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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 x* e$ Z( C; {2 c: [. g# J
  1. [code]EDMA sample test application3 U, J1 g% M/ w
  2. /*! ]9 d0 M3 D; |9 ~" K
  3. * edma_test.c
    1 y, ?8 T! T+ y& ~6 L0 Y
  4. *9 [' I& r/ Z) r; e
  5. * brief  EDMA3 Test Application* i3 c! U  h' y/ t- `8 C- V
  6. *
    3 Y4 [" B3 }7 i. I7 P& L  T7 c
  7. *   This file contains EDMA3 Test code.
    5 t# T2 S# V; P) B. }' Z' m
  8. *
    - Q& J  M, U8 p/ i+ J5 C0 u% u
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    6 a8 z3 Y" B5 V1 c/ ]! P
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    # D* u! l" N8 f  ^2 S
  11. *         TO CHANGE.+ Y4 \& i9 `& u+ M8 B$ f; s6 I! H
  12. *
    0 K* \- c& f9 N' y# ^+ L) ]
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    4 z% t) `/ @' h$ X5 F
  14. *$ ]* m" o+ E2 O+ I$ o% k& A- ^" b7 f
  15. * This program is free software; you can redistribute it and/or
    - e: B' N  h7 P! b' @7 s
  16. * modify it under the terms of the GNU General Public License as
    2 E4 \7 C9 ~, P9 w% }/ l( y; g" C* M
  17. * published by the Free Software Foundation version 2.
    % s/ f% ^+ ]& L  L6 e8 `$ I, r
  18. *; }+ }2 @2 S( d, R: {4 z: Z3 C6 ~
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
      _7 I& B) G" N
  20. * kind, whether express or implied; without even the implied warranty- r/ E* z- f# P0 u) g' _
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    5 m0 B& f7 e2 N3 C# i: F+ [& y
  22. * GNU General Public License for more details.. ^& y; R# q9 D/ _
  23. *// j* j8 U( A# e$ ]

  24. 6 h8 Q! a# ]% l; ^# Q9 \
  25. #include <linux/module.h>- ]& j: p) u# @+ g) v9 l  H
  26. #include <linux/init.h>
    * i- e0 _! r4 M4 l5 ~' c: j1 C6 u
  27. #include <linux/errno.h>
    % N. w  L) Z, _6 m- J
  28. #include <linux/types.h>
      v% D5 j" x3 L  U0 l
  29. #include <linux/interrupt.h>
    5 A! i' F6 S. l. {1 @8 Y& ~* y
  30. #include <asm/io.h>: \, a; e* j5 N- R! ~2 {# H1 |
  31. #include <linux/moduleparam.h>& r' J$ z, @4 Z7 _
  32. #include <linux/sysctl.h>
    9 Z7 v5 P/ k3 X; ]! t$ [
  33. #include <linux/mm.h>- W2 d/ Y% f5 i
  34. #include <linux/dma-mapping.h>! U3 O, m7 \* j2 C; u

  35. ! N" i& g0 l4 x/ Y, r
  36. #include <mach/memory.h>
    . @, z' e1 Q& L$ u/ J( c
  37. #include <mach/hardware.h>
    5 _* i- f% w6 f0 d7 E
  38. #include <mach/irqs.h>
    ' B2 i+ g4 T% f3 q! x; d- L
  39. #include <asm/hardware/edma.h>
    ) d! g; _+ \) G7 M6 a

  40. * P2 n8 n8 T% ^) }. s5 e
  41. #undef EDMA3_DEBUG& x8 ~3 V+ q8 x# D: v
  42. /*#define EDMA3_DEBUG*/7 [! j% C4 I+ h! F, [7 S2 h
  43. * ?% w5 u! I% ]; R* j
  44. #ifdef EDMA3_DEBUG
    ; M7 y. A% K& Y( m9 B# P8 G7 k# G* l9 w
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    + j% l% a5 ^$ n: c
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 Q, y! H5 h3 r
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    0 {& J5 }0 g* {& n; Z) @
  48. #else
    / G0 i" E/ K  l/ s" o# F! ^
  49. #define DMA_PRINTK( x... )
    . ^3 j2 x0 j) O1 X* P
  50. #define DMA_FN_IN
    % w. \1 M! b) v2 |7 [
  51. #define DMA_FN_OUT0 D) a, Y4 c& @6 ]
  52. #endif
    8 f& Q( K0 O7 Q& x

  53. ' f7 g' u$ D6 O/ `0 K0 |; V4 E
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    : u: a  u/ C7 I% F* P
  55. #define STATIC_SHIFT                3. R1 I! o7 l: ]) i5 @$ u4 O
  56. #define TCINTEN_SHIFT               20
    ' \+ ]% m. N& P7 b2 ]
  57. #define ITCINTEN_SHIFT              21
    2 f' d& r/ O$ E, t0 o! G2 I4 o
  58. #define TCCHEN_SHIFT                22
    2 s5 g0 a$ Q, X( W- k1 w0 @
  59. #define ITCCHEN_SHIFT               23/ J9 F% z, O' _: k" G! r3 k

  60. ! s6 J7 C+ K" R
  61. static volatile int irqraised1 = 0;
    * f$ e; J* I9 F0 ?7 [. X& t/ g
  62. static volatile int irqraised2 = 0;+ X2 u  m  Q6 B/ l- u: ^

  63. 5 V" q% [& }: V' }5 Q1 p! y6 Y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 N* p" N, l  [% P3 T" x
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & {( C, C" p5 }! @
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) R& [8 R) j' r" w3 A& d6 m

  67. ) X) I- w! l2 N/ R7 S
  68. dma_addr_t dmaphyssrc1 = 0;
    7 {; I8 w+ B, `( t! t1 B
  69. dma_addr_t dmaphyssrc2 = 0;
    8 n! a; C  v) [2 K
  70. dma_addr_t dmaphysdest1 = 0;" a  R7 q! ~) T& A
  71. dma_addr_t dmaphysdest2 = 0;1 j+ ~$ N: K5 n+ Q

  72. 0 ^6 \& X6 b  t7 x5 P& u
  73. char *dmabufsrc1 = NULL;: H- m1 n! `2 Y0 U, j
  74. char *dmabufsrc2 = NULL;  @$ U( Q, p) v; P# q/ v
  75. char *dmabufdest1 = NULL;- H0 I% L. O4 g" x4 v- I" Z
  76. char *dmabufdest2 = NULL;$ \& o: R* v0 U) i& k. o# i# |

  77. 7 X6 {" d. c5 t- }% ?0 C- u. v
  78. static int acnt = 512;
    4 z- p. B. ~, b* C( T
  79. static int bcnt = 8;
    0 P! r0 p$ l$ D3 U
  80. static int ccnt = 8;$ v. i4 e/ o% K# b3 D) X! ^/ Z

  81. 1 T% |: R# }# Z- B- x, b, ]( h
  82. module_param(acnt, int, S_IRUGO);
    " V. E. w, m# m+ t+ u7 a: Z
  83. module_param(bcnt, int, S_IRUGO);0 i1 n. X$ H: V6 F3 T5 \8 l6 j
  84. module_param(ccnt, int, S_IRUGO);
复制代码
$ b. \7 l$ N4 {3 S0 X( H0 U, g1 ]$ x

$ u) Y( {1 ]! M' E) f      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' H& j( }) M0 B4 i- p
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ F+ C( [- E. y( D! V6 S( h
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* @/ G: ^- H( @+ ?
5 s4 V7 Z( R5 E$ m) m6 E+ G6 d( h$ K5 m" e* u+ |& J
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-11 11:37 , Processed in 0.039769 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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