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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ k% V& W7 H/ \
  1. [code]EDMA sample test application, G  U) C: F9 q! I% Y3 i
  2. /*  Q# K, f' Q5 ~: ?6 h
  3. * edma_test.c
    9 u$ ]% N' T  i& x7 I
  4. *
    ) S4 D  W) U1 ]5 ~8 C
  5. * brief  EDMA3 Test Application" {3 X% u" y9 y9 G, v$ G
  6. *
    - f: `; p9 y! C' E
  7. *   This file contains EDMA3 Test code.
    - T0 W+ g* a2 G. v1 ^
  8. *
    % \4 }$ n+ `- h* {' y$ R3 y* g
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ) S5 n. {  E) w; E
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ) J* `7 K2 A" Z. C# f0 g# b
  11. *         TO CHANGE.
    4 p1 R% F5 b" x, o- ~
  12. *( }6 O9 X, t& W+ ^! r: l! k8 p9 Q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    % `# z# Y5 M" c1 @! `7 r
  14. *
    5 G, z/ }& \& \! @7 G+ @4 W
  15. * This program is free software; you can redistribute it and/or
      ~  h' \; u$ J' O; b- _7 |5 H
  16. * modify it under the terms of the GNU General Public License as
    " P2 h) W$ X9 D* I7 E+ c( S$ _
  17. * published by the Free Software Foundation version 2.
    7 p7 h0 B! }& A3 {4 f1 W
  18. *
    2 Z0 y- ?+ \# n/ n
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ q% n2 ]% K2 D0 }% L
  20. * kind, whether express or implied; without even the implied warranty
    2 f( v( ]3 w5 \" B5 Z' U
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the# X2 M+ `2 L) g  b
  22. * GNU General Public License for more details.
    4 \, s' y1 v# ?$ P- r' V
  23. */; h9 o5 f2 s# X% s; `
  24. " l% j0 [+ N5 I! G% J9 L  p+ t# M! k
  25. #include <linux/module.h>
    + _3 A6 P6 M2 A" C! D
  26. #include <linux/init.h>
    % I4 d1 y3 y0 g0 W! N  n
  27. #include <linux/errno.h>
    ! E+ q. t& l" p$ ~: T, D! n" a
  28. #include <linux/types.h>
    ) [$ u; R# K  u  y4 y
  29. #include <linux/interrupt.h>
    ! o3 W9 B! e0 V: ?/ ]
  30. #include <asm/io.h>2 J6 G/ P* k8 c& s7 ]
  31. #include <linux/moduleparam.h>- |9 e' _0 c  \7 {# B0 O
  32. #include <linux/sysctl.h>
    ) N5 i  U, D, e, i- D
  33. #include <linux/mm.h>; d) o# G, i4 R, _
  34. #include <linux/dma-mapping.h>
    + O  k3 P8 z: b

  35. . ^5 S7 `1 G* f
  36. #include <mach/memory.h>& l, J  j; `4 V& Z% ]7 f7 Y/ I
  37. #include <mach/hardware.h>" v, E$ j0 V( x
  38. #include <mach/irqs.h>
    ' r. n- }+ g& J
  39. #include <asm/hardware/edma.h>$ a7 Z# q# I" k4 b- Z' w
  40. ( h7 P4 \: L8 q
  41. #undef EDMA3_DEBUG8 d2 f5 ^* G, y: K+ N
  42. /*#define EDMA3_DEBUG*/8 ?1 J! y; D9 c1 n
  43. , p- `: a; K# }, E- x: Y5 V3 ~) l) F
  44. #ifdef EDMA3_DEBUG
    ; V. [; v- e, n' {- N
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    8 z- n1 R$ B9 f' C4 S
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" b' o" @: \7 V$ J/ b3 t
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    * p2 e9 H* f( k$ G8 |
  48. #else
    4 F* H) E% j7 v9 G2 [* I
  49. #define DMA_PRINTK( x... )
    5 M# T6 ^. P9 s: {' l: r4 Q7 r# X$ F
  50. #define DMA_FN_IN$ C  E3 J' l; p- ~
  51. #define DMA_FN_OUT- h( T5 h; f, f7 R
  52. #endif
    2 y) E( l% f' F: z/ o/ g( t1 x

  53. # H3 M9 s7 A7 n8 k& X  r$ p
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    3 K# @+ B5 C& ]* H# b) q
  55. #define STATIC_SHIFT                3
    , v+ h! I( P7 [3 C* H2 s
  56. #define TCINTEN_SHIFT               20; c6 f( J. V2 N& f
  57. #define ITCINTEN_SHIFT              213 ^  h/ S; K/ C
  58. #define TCCHEN_SHIFT                22
    " ~- c1 }4 j$ I1 F2 S# B2 t
  59. #define ITCCHEN_SHIFT               23
      T9 Q9 i( S; d8 o; ?8 \; W

  60. ; m! {! b8 g2 w; h: c
  61. static volatile int irqraised1 = 0;
    ) q' }% M, D( t+ H3 ^6 G+ Y; s3 S; @
  62. static volatile int irqraised2 = 0;' \1 n8 T, v1 k, e/ p2 a9 m

  63. 8 K) N( r, I$ c* `
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' @( L) _' }- m' h7 i
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # T9 \: Y* Z" H  x# A. j
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ |& |6 H& b1 E+ r
  67. 2 n' A* B, U3 I+ I: p4 [. u. h' D
  68. dma_addr_t dmaphyssrc1 = 0;. s$ I/ j1 e4 t1 \! ~
  69. dma_addr_t dmaphyssrc2 = 0;
    + [3 i+ m; ?- t, x
  70. dma_addr_t dmaphysdest1 = 0;
      H' @1 ~9 q' e2 N, H: w
  71. dma_addr_t dmaphysdest2 = 0;
    * l3 L9 R' f2 f6 F8 D
  72. / h- y) D8 |8 [3 v1 H2 z* E5 Z4 K! v
  73. char *dmabufsrc1 = NULL;1 x4 u" f( C2 }! G7 b8 |& Q
  74. char *dmabufsrc2 = NULL;# F+ L* D5 C$ b+ O- Y8 `  i& O
  75. char *dmabufdest1 = NULL;, o7 R6 j3 [% t. ]* W
  76. char *dmabufdest2 = NULL;8 n+ Y8 B9 r( i  p6 W' ~
  77. & }1 @. u' a" Q: U/ ~
  78. static int acnt = 512;
    9 O9 m" q3 a  r( [% e. I8 Q
  79. static int bcnt = 8;8 G, {3 L! Q& j: \
  80. static int ccnt = 8;
    ; S8 s8 |7 W7 ]  ?' O8 R

  81. # y% \$ J, P; k1 e
  82. module_param(acnt, int, S_IRUGO);
    8 r, d' G3 q( O4 l/ t
  83. module_param(bcnt, int, S_IRUGO);3 `" l$ S4 Q9 i4 H  c- ?
  84. module_param(ccnt, int, S_IRUGO);
复制代码

+ n, H7 o5 {# H2 F, c' S5 Y' v2 `2 [7 W
8 A% {6 n; \* }: j0 O      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ G! m( O- Q5 I: Garm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( j+ J$ r/ @" ~% T0 l9 S; ^3 E     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 e4 A0 V5 d6 y0 m6 ?- q
$ r0 `5 q/ C5 i8 v

% Y' e7 M8 P/ @- u. ^/ T/ W
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-5-6 00:15 , Processed in 0.040829 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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