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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 `" m3 [  d- R1 e
  1. [code]EDMA sample test application" j6 P% y- F* z0 S; p+ r
  2. /** a+ t; h" R8 ]) k' j' }
  3. * edma_test.c/ X( o- G' D6 h5 V: T. Z/ ]. c
  4. *
    9 g/ y5 P0 E. g4 z: Y
  5. * brief  EDMA3 Test Application
    $ z* ^1 _$ p$ s
  6. *. O+ W; w# ]# h8 g. x# G, u
  7. *   This file contains EDMA3 Test code.
    * C& d& l4 i: w( m. L
  8. *$ w3 t2 r, Q3 e3 Z; t9 A
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, g. ^2 g$ _/ _; G3 T  \
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    $ t1 T& {4 e1 [, F
  11. *         TO CHANGE.
    * N% i/ `+ K( ^* }6 C; f
  12. *' I9 @4 i  X: y/ F/ T4 z5 R) D
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    % j+ K$ e/ p- @) L; L
  14. *- P8 G. H; Q* W! s
  15. * This program is free software; you can redistribute it and/or
    * f# Q" m; K1 b: B0 M7 q
  16. * modify it under the terms of the GNU General Public License as$ p+ X8 t: Y1 J) s
  17. * published by the Free Software Foundation version 2.
      m8 H! a/ A* Z5 R. n
  18. *
    2 \: t8 P) {* ^% Y" v! D
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any% a4 X; e- D0 c
  20. * kind, whether express or implied; without even the implied warranty
      Y' G( G  R5 R% w
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    6 l  C3 n4 O; y0 z  D) h
  22. * GNU General Public License for more details.+ B6 b1 p% }' W! u2 T) l
  23. */
      P  Y; I! H3 h+ _/ h
  24. 5 k+ c/ ?3 \# T" K8 H3 D
  25. #include <linux/module.h>3 G: f5 M1 C3 ~, i3 w; Y
  26. #include <linux/init.h>$ A+ P# M& U1 G3 u+ k
  27. #include <linux/errno.h>
    / `% A) L% p  ]! X& I' I
  28. #include <linux/types.h>0 m9 |8 D5 J, q- t- Q
  29. #include <linux/interrupt.h>
    ) K/ R. }. J- K( A1 w
  30. #include <asm/io.h>
    # M/ w! A  n5 c; \$ x3 ~! e6 p8 J
  31. #include <linux/moduleparam.h>: [# f3 u5 E* L
  32. #include <linux/sysctl.h>0 z+ k8 q- A' h' K/ B1 _
  33. #include <linux/mm.h>! N- g3 w* w, t
  34. #include <linux/dma-mapping.h>
    ; ~3 n- ?( V' Y' Q) O
  35. 9 d2 d+ Z8 M7 b  x9 ^/ U1 ?
  36. #include <mach/memory.h>
    $ X' H7 o# H7 a9 j
  37. #include <mach/hardware.h>% H# d4 s1 u- H& h& @1 a
  38. #include <mach/irqs.h>
    7 B  e6 h% E( B4 R+ Y, B$ z
  39. #include <asm/hardware/edma.h>
    3 X3 T" M9 H+ a! e
  40. 0 `. u% ^" K. {
  41. #undef EDMA3_DEBUG* I; Z& d4 p3 X8 g/ O5 Z5 A
  42. /*#define EDMA3_DEBUG*/
    , O2 ]; B" @4 J! r6 p9 ]
  43. 0 u& M  O: P. ^! d( Q3 r
  44. #ifdef EDMA3_DEBUG
    9 X/ |! Y8 L! ~8 E# n3 {0 }
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 _) B4 I5 E# a0 `
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    8 G8 c. L2 p$ n) t9 R9 R$ r% ~
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    8 H; D3 A4 C2 w, y5 R
  48. #else+ N6 K; T- f7 t+ _8 P  u& V
  49. #define DMA_PRINTK( x... )
    & d9 p# l6 j- ?, `  _  m$ N0 H2 y
  50. #define DMA_FN_IN
    . E4 {, v" l+ V
  51. #define DMA_FN_OUT
    + ^7 W9 [( ?5 R5 S- a( ~
  52. #endif5 x7 ?; k0 g' _

  53. - T+ Z# ~1 e5 l8 j5 _: e7 \
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)! k: s* T1 Y0 A+ V8 v% K1 ^/ l
  55. #define STATIC_SHIFT                3  f( _+ S  l3 s- ^
  56. #define TCINTEN_SHIFT               20
    9 N( T# K# ?/ w- f
  57. #define ITCINTEN_SHIFT              21
    - j  |* I: C. V, [5 d
  58. #define TCCHEN_SHIFT                22
    : f7 B# h( c3 F' [( Z
  59. #define ITCCHEN_SHIFT               23( J5 c' i: A7 P  g7 `

  60. # G& G8 x& [7 |
  61. static volatile int irqraised1 = 0;
    ( k9 T0 K9 m; Q
  62. static volatile int irqraised2 = 0;2 D# O0 h& I* Y; _

  63. 9 [/ N! y% O' ~
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, u( k; R$ D7 y' ^1 \: L
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* b8 S, c! o% p0 G+ M# e
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : F2 F0 g, Y4 Z) n6 @+ b- \

  67. ( h9 I6 W9 E3 }5 I
  68. dma_addr_t dmaphyssrc1 = 0;
    ' l3 I- p9 f  W" s  }5 a$ S8 V
  69. dma_addr_t dmaphyssrc2 = 0;! H$ @0 m& O: G$ I2 ~
  70. dma_addr_t dmaphysdest1 = 0;
    & p$ W& `1 _# l: p# [! K/ X! ~
  71. dma_addr_t dmaphysdest2 = 0;% y# |* |0 ~3 l! k3 @2 B0 p$ B

  72.   a8 b" e' x$ N, S* X6 W. ^
  73. char *dmabufsrc1 = NULL;9 P* m: }8 ]9 u" M" Z* x5 x0 z5 G
  74. char *dmabufsrc2 = NULL;5 V& @. K" l4 D+ J* I9 b
  75. char *dmabufdest1 = NULL;
    5 ~. K- h; M  J
  76. char *dmabufdest2 = NULL;1 @/ t  c) r" X
  77. 5 o( T) @- O+ c# h1 ?7 n. G% n
  78. static int acnt = 512;
    : H$ F( v$ _7 p' K$ H6 K3 s7 t
  79. static int bcnt = 8;- W6 k- j8 J: y% W7 y
  80. static int ccnt = 8;/ m- T9 _, _0 R+ X) I/ I
  81. * R. t' R7 t2 j; L% y4 e$ _
  82. module_param(acnt, int, S_IRUGO);2 c1 y6 X2 |& o% t; \8 c$ t
  83. module_param(bcnt, int, S_IRUGO);2 l& b3 }4 B6 n) E( Z- w4 e3 a
  84. module_param(ccnt, int, S_IRUGO);
复制代码

5 }" b0 s1 e) ]! P: I7 O7 ^' _. I
# U% r3 g# D1 o* y4 ?# @      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" d( P8 m. b0 |1 [( n
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- ~/ r: a) z7 v1 q     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 b9 i. {, z5 j
# V$ B1 A+ M: s) u) J) g% [: m% O

$ F0 P8 B, N/ o  U4 E! K) u
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-29 16:23 , Processed in 0.048892 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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