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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . }( h* F( c3 y- S, E
  1. [code]EDMA sample test application
    3 R' G  B/ G! J$ x  W
  2. /*
    # W& k2 G) W" a3 z0 s$ ]6 s- W. i
  3. * edma_test.c6 W8 l+ h1 r) T( X& ]1 {) L' ?) M% P
  4. *. a1 O! z& v, q
  5. * brief  EDMA3 Test Application
    4 D- l- r- \% V+ A( D0 k. K
  6. *& x5 N9 c, n! @7 f5 i# h
  7. *   This file contains EDMA3 Test code.
    7 `* [1 e- B7 R; q; M. ?2 n7 ]
  8. *
    ; o( h# w) `- r/ Z
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 l7 A5 A+ Y, }. g9 T
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ ~9 I, ?5 q4 N+ l5 b6 E' E) v
  11. *         TO CHANGE.: t7 H% ?0 }& z4 i% Y. [
  12. ** c# H9 W' F% Q8 \" v( ^- V
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    , X; s1 u+ l# \# q. A/ {
  14. *
    " n0 M) d9 l# ^4 n
  15. * This program is free software; you can redistribute it and/or, `3 k5 v* V+ `$ b2 k/ z
  16. * modify it under the terms of the GNU General Public License as4 {- ]% P; \1 F" P" ]0 U
  17. * published by the Free Software Foundation version 2.
    ) p, i, ?+ d. E5 N8 T
  18. *8 m9 u6 l' D. j) z; q- Y
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any* m" W5 Y( @( [" g
  20. * kind, whether express or implied; without even the implied warranty+ E+ ]+ w" i0 R1 H: O
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the0 y( z; ]6 t! u& a: E& r
  22. * GNU General Public License for more details.7 _  Y$ Z7 T% \8 S$ Y0 H7 B
  23. */& g( v$ p% x; A; D2 `5 ?% k

  24. 3 G% o9 u" K3 n; b  M
  25. #include <linux/module.h>
    8 U& B1 ~2 m& C3 f8 X/ k! {
  26. #include <linux/init.h>
    1 l% h5 n! b, w/ X1 d
  27. #include <linux/errno.h>! g  @/ U' j0 `) s; r" V3 E
  28. #include <linux/types.h>
    % s4 v8 V6 u4 J! ~; ~" d. j$ O5 H
  29. #include <linux/interrupt.h>7 f! |* v. ?- F" a0 ^$ B1 o3 _
  30. #include <asm/io.h>9 |9 o/ S7 V& k* Y7 R
  31. #include <linux/moduleparam.h>& p8 q- p2 [% a2 s& h) p+ I
  32. #include <linux/sysctl.h>
    8 }' p. S+ f  x+ c( e7 \7 [
  33. #include <linux/mm.h>
    . x7 H9 d' e' \8 D+ E
  34. #include <linux/dma-mapping.h>( f: j/ G4 p, g$ D$ A, U; ^  Y* H- J
  35. 1 {% r9 H* r1 S1 R' R
  36. #include <mach/memory.h>
    . b$ O& @% `/ _
  37. #include <mach/hardware.h>6 l6 w: b9 h+ K: g* Z
  38. #include <mach/irqs.h>
    : C$ j2 n% D+ o' `6 O
  39. #include <asm/hardware/edma.h>
    5 |* ?( `, I2 [: J! O

  40. , Q; _6 N! G6 c' K8 H: l
  41. #undef EDMA3_DEBUG
    ' c9 ^* z8 w# e% B9 r
  42. /*#define EDMA3_DEBUG*/6 ?9 w6 S3 j# f9 x; ~
  43. ( [/ x  F1 j7 u+ x) m  A
  44. #ifdef EDMA3_DEBUG
    % Z  K1 |8 R8 M- y: E4 W
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    1 V2 o( b1 B9 I/ r# ]- R
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    * o- n" f. f$ `' v
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 c7 Y+ ~) g  \, v1 ^  y
  48. #else
      E1 l7 _& \% j+ C8 ]
  49. #define DMA_PRINTK( x... )
    ) F: ~" [. F2 J- U
  50. #define DMA_FN_IN
    7 q3 Z; `4 [) v6 ?# k/ a& d
  51. #define DMA_FN_OUT- f  o1 C3 T# I" [3 a
  52. #endif
    9 a) E) G* |1 z5 d: x+ s
  53. + A" o4 F  p6 a
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    : P+ R8 u) z: ~0 |
  55. #define STATIC_SHIFT                35 ]( Q% y* C) u
  56. #define TCINTEN_SHIFT               20
    7 V( h! @( `0 H, T$ v. n% Z
  57. #define ITCINTEN_SHIFT              21& O- P8 V+ ~/ Y# g. M5 q
  58. #define TCCHEN_SHIFT                22
    / C7 P. _: b5 d- B$ }7 m
  59. #define ITCCHEN_SHIFT               23. D" J' }1 _+ h' h

  60. - z/ C) N) J& s2 U7 ]. S) d7 s% y
  61. static volatile int irqraised1 = 0;8 X3 ]$ M; x9 W5 D, @& G
  62. static volatile int irqraised2 = 0;
    . u9 m# F, c) k. D) L: M& V/ y3 L7 a

  63. ( C4 F. v+ B$ b1 P1 a+ J' Q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# Y+ o: y% D0 ]+ f0 ]
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; q' D6 ~2 v5 J' A
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( K* x# [5 q1 x; Z
  67. ' f3 V2 L7 E! m+ _  B: j
  68. dma_addr_t dmaphyssrc1 = 0;: w( a# B4 g) g0 T# [$ h0 V
  69. dma_addr_t dmaphyssrc2 = 0;" M5 T, o3 T& r. x
  70. dma_addr_t dmaphysdest1 = 0;7 b6 R9 L; x% O2 H- Y
  71. dma_addr_t dmaphysdest2 = 0;- L& K+ N4 T( q: ]4 U$ A. O0 @% ?! T! s
  72. . ]& u5 e- u+ n" [/ T+ h: `, g
  73. char *dmabufsrc1 = NULL;
    * k$ l0 r- r, F( q0 L' S
  74. char *dmabufsrc2 = NULL;1 m, A" Q0 M( E$ H/ z; E4 O
  75. char *dmabufdest1 = NULL;
    & \8 Y. |' C& Q; T  L# A  d# p/ F
  76. char *dmabufdest2 = NULL;- P3 J8 @/ K% M! I& k9 b! z

  77. 3 X& x' Y* G9 v" \& t6 _) @) h
  78. static int acnt = 512;
    2 R, G& \. j/ e: C
  79. static int bcnt = 8;# P0 J' v+ N' o  m0 E; B* N
  80. static int ccnt = 8;
    : }; e% o( L9 j2 z9 x% d

  81. / J4 T, c7 ]4 _: N
  82. module_param(acnt, int, S_IRUGO);+ V- P* o; u& G$ x% z6 L: \
  83. module_param(bcnt, int, S_IRUGO);! B  |; u4 A# J2 B
  84. module_param(ccnt, int, S_IRUGO);
复制代码
, C9 x' n2 [/ @+ Z, U" @
4 l) M, D! v! [! ?& S& i
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 m' u! C- l# r7 e% Warm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: I; |% T: h3 _& |% d
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- j$ A$ }3 a5 y" d7 v. p) I! s
8 |2 f9 j7 |  P, @' ^) p2 B5 N

' U7 d' u+ T/ b. K' I* Z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-10 10:08 , Processed in 0.054179 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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