OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站
点击跳转“创龙科技服务通”

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 14186|回复: 0
打印 上一主题 下一主题

[未解决] OMAPL138如何在Linux下使用EDMA3驱动

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * X# e% t  R% e5 y
  1. [code]EDMA sample test application
    6 S, E& r' B4 y4 ^( z
  2. /*- P! U$ C8 m6 \) h' W5 S
  3. * edma_test.c! f! H$ V; K# y5 w% y5 }
  4. *  ?: S. W8 t3 P
  5. * brief  EDMA3 Test Application
    ; R( v2 P' K3 t5 n
  6. *; W: y6 ?. M7 H$ E+ g: @
  7. *   This file contains EDMA3 Test code.- m3 I. V$ x7 I& T3 h
  8. *) X3 P0 a3 w7 x: n" E5 R8 y
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 |# f/ M" Z4 \0 w; Q7 R6 ^. U  V
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    * R% T2 c8 E6 l  `& N
  11. *         TO CHANGE.) t7 L  O' W- t0 F2 h/ v9 \) m3 h& d
  12. *
    4 x( Y! e1 `4 q5 `1 P, r  U% K* b
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 [1 v$ W' t6 \
  14. *
    & v8 y% Q3 \+ ~
  15. * This program is free software; you can redistribute it and/or( F  n! a$ v+ f* J( ~' `4 q  |
  16. * modify it under the terms of the GNU General Public License as
    4 \( h* P2 d0 V, R. Y
  17. * published by the Free Software Foundation version 2.
    1 l/ A5 w% R  u5 |1 C7 X
  18. *$ ^9 L& V& |* ]) u0 n; z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    4 R& ~( ~# e/ R5 m2 O! w- z+ W  z
  20. * kind, whether express or implied; without even the implied warranty
    & o; u1 [# v8 R, `2 Z; M' T. V1 z0 |
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the8 q+ R& s. N4 d5 y9 U' Y' R4 H
  22. * GNU General Public License for more details.. Y3 R+ L% I) d4 y. B+ T  L
  23. */% `4 g" o# J1 w  B/ j9 W4 ~

  24. ' r3 a' S1 o* S: I) H
  25. #include <linux/module.h>
    6 Z+ w, B9 ]+ S
  26. #include <linux/init.h>
    & O6 b+ N3 K' p1 f4 A0 W
  27. #include <linux/errno.h>' w3 w5 d5 p4 o0 h4 k4 K
  28. #include <linux/types.h>& C- g, p8 R: a2 K
  29. #include <linux/interrupt.h>
    ! H( f1 R( g) q! Y/ a- d( v. w2 A
  30. #include <asm/io.h>
    ' ^  h* [5 q% V- J2 d4 u* N
  31. #include <linux/moduleparam.h>$ n$ O1 v; D4 Q6 R
  32. #include <linux/sysctl.h>' [# j+ \- M! V* H$ I1 ~" S( W
  33. #include <linux/mm.h>4 \% o8 O% q/ u" j
  34. #include <linux/dma-mapping.h>
    9 l$ ]% r+ g, p6 Z( B/ \7 Z5 Q) W

  35. # M+ g% g- k) ~5 @- o
  36. #include <mach/memory.h>
    3 V: L  N7 H: ^1 v' R- w' O8 w
  37. #include <mach/hardware.h>
    ! o+ U3 O  x( x  q* H5 ?8 X
  38. #include <mach/irqs.h>
    1 S8 T1 b, B  o& V0 ^' p
  39. #include <asm/hardware/edma.h>6 s+ _' [. @0 t9 C

  40. 8 D% @* k& x& K/ u4 E& y- `
  41. #undef EDMA3_DEBUG3 b" P& q/ v9 X+ Q% Q: D
  42. /*#define EDMA3_DEBUG*/* j2 T5 n4 I3 E7 w. Z
  43. ) w8 @  G; j- `( F# X( ^7 k' S
  44. #ifdef EDMA3_DEBUG& J& H1 t1 M1 `0 z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- h2 e8 u3 @! Z7 ^5 A& L
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 C" L- G5 H/ m8 \, X
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    5 Q. U& a- l* u- {" `; v7 U
  48. #else; h2 E% p* J2 x
  49. #define DMA_PRINTK( x... )
    ; _9 O  V& d2 A8 ?, C" ^6 j( j
  50. #define DMA_FN_IN
    0 k4 y. o+ j7 R0 d; b' B. r0 t! x3 k
  51. #define DMA_FN_OUT
    # J  a7 s4 x+ C2 Q6 K
  52. #endif
    , ^0 l$ K2 m4 ]' r- Q1 ]9 R

  53. 4 i& I. _2 t; }; y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    , z! d$ D; w7 U3 H( o
  55. #define STATIC_SHIFT                3! v' z+ [6 U5 l8 W
  56. #define TCINTEN_SHIFT               20, K" b5 R  _+ f1 R# e+ z
  57. #define ITCINTEN_SHIFT              21
    6 E  [- r* a0 J  |2 C
  58. #define TCCHEN_SHIFT                226 T$ q& g" M2 R; J; O( n: I
  59. #define ITCCHEN_SHIFT               232 R! z- D  W, ^9 m+ e

  60. : u+ c0 h, \+ m. ?0 {+ m7 D
  61. static volatile int irqraised1 = 0;
    ; {- R+ l2 N1 N5 U5 c* X2 a2 i/ P0 R
  62. static volatile int irqraised2 = 0;
      \' m$ a* b+ Z5 h* ]' z4 n

  63. # [& a7 G. p, B* c; g; |, M
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 m) V  F& G+ r" }/ L
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / n8 d3 f2 _, x# c- y. q3 I
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 `& x$ y* _- m) q$ y3 B

  67. , g1 V# k* f) c  ^. q0 V; p
  68. dma_addr_t dmaphyssrc1 = 0;
    0 b7 D' M. j2 s. K% p$ p5 [7 J; x+ @
  69. dma_addr_t dmaphyssrc2 = 0;
    ( L$ j3 z" a$ o0 k; b
  70. dma_addr_t dmaphysdest1 = 0;; g7 ^# ]8 R$ }* n
  71. dma_addr_t dmaphysdest2 = 0;/ i! C4 t+ }$ _8 W

  72. ; S. O. f1 p& c* |
  73. char *dmabufsrc1 = NULL;* p! o( O  a& T3 r1 U
  74. char *dmabufsrc2 = NULL;
    ' |! w$ n  n9 [) N3 K! b
  75. char *dmabufdest1 = NULL;: R7 y# K# D9 [& z/ u: [7 t
  76. char *dmabufdest2 = NULL;$ R$ h4 S5 A& e: l

  77. 7 h2 ]  O/ R$ Y
  78. static int acnt = 512;
    5 T4 w" V8 F' f$ B' [2 I% ?' j
  79. static int bcnt = 8;6 k" `' m* X9 v
  80. static int ccnt = 8;
    0 ^. E" M: T' V9 T- @* E$ T! S

  81. + I7 D" a7 t2 S! d& n/ T) I1 h! l
  82. module_param(acnt, int, S_IRUGO);
    # ^0 a# x9 t: O7 G- K4 \
  83. module_param(bcnt, int, S_IRUGO);
    * i) [/ Z; d+ J: T4 C
  84. module_param(ccnt, int, S_IRUGO);
复制代码

: `0 U0 x, p  W# W  F
7 O( n: _! O5 V      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) N$ t, ?" F4 S- `$ _3 V
arm-none-linux-gnueabi-gcc  -I /home/tl/omapl138/linux-3.3/arch/arm/include -I /home/tl/omapl138/linux-3.3/include  EDMA3test.cpp -o EDMA3这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. v9 s9 R4 I. q6 x; C  `5 [
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 E' J: M  z; j6 t5 }6 z

, L8 W, W' A2 X- k
- \4 q6 h4 T* p9 K0 T- g
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

点击跳转“创龙科技服务通”

QQ|手机版|小黑屋|嵌入式开发者社区 ( 粤ICP备15055271号 ) 

GMT+8, 2026-10-7 16:44 , Processed in 0.044754 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

快速回复 返回顶部 返回列表