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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + Z1 _, Y4 ]+ |" f" Q9 ?7 Y
  1. [code]EDMA sample test application
    6 Z" j* M& c7 i* q+ X
  2. /*
    - k; u1 L' {8 n6 M
  3. * edma_test.c4 S8 f6 N4 m/ s1 R% y
  4. *+ O+ \7 }/ x: L+ W9 M
  5. * brief  EDMA3 Test Application
    # i7 K' [; P! Y& s/ l+ u6 `$ r
  6. *" i  Y9 P6 c1 y5 O$ h; L; h0 D# ?
  7. *   This file contains EDMA3 Test code.
    $ u% F( x7 a& {" z
  8. *8 Q! A+ _1 P' m, j5 P. m6 H) o
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    8 X" u2 S3 g* a% K6 f
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 r# h: N4 Z- ~: a5 v% M
  11. *         TO CHANGE.' F: w* E  F' E; X8 X
  12. *( C: p+ q/ n& ]3 K" u+ n7 V" E
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" h9 s* M' p* Y# \
  14. *# R2 J& @) n# f/ s
  15. * This program is free software; you can redistribute it and/or
    7 O6 x  ]+ s3 v3 \- D! g
  16. * modify it under the terms of the GNU General Public License as
    $ o3 i5 _! \) a( C" t7 s5 B
  17. * published by the Free Software Foundation version 2.# ]8 v0 C, }8 p
  18. *7 J8 P. o9 `' w9 c) o0 k
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    9 Q7 }- i  i% E7 z3 y. {5 `
  20. * kind, whether express or implied; without even the implied warranty
    * u$ e  M# d/ C% }/ a6 y  g
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the# |) g' F1 K  U
  22. * GNU General Public License for more details.* A% h( F+ X  E
  23. */$ _& ~, M5 s! A0 E. K
  24. 5 t! S% e  X! x# m  k
  25. #include <linux/module.h>
    . \4 g+ R6 C& Y* L, H3 q* `  d2 d. S$ w
  26. #include <linux/init.h>: _7 w* S; }; b) @
  27. #include <linux/errno.h>0 M2 y. B5 B3 U7 G7 l( F* D' U
  28. #include <linux/types.h>
    2 \" k0 k/ {  U& a3 Z: V' N
  29. #include <linux/interrupt.h>( c! e) j$ d7 D0 `
  30. #include <asm/io.h>
    - T, l7 n6 B) O8 b3 y' Q
  31. #include <linux/moduleparam.h>0 S' K. g' ]; z
  32. #include <linux/sysctl.h>
      Y8 C* F/ h  p% ]
  33. #include <linux/mm.h>8 ~; g4 B& l2 [9 Y& {$ K( D
  34. #include <linux/dma-mapping.h>
    8 \  Y1 j3 W  y0 f, S8 \

  35. 8 L) f; H3 r8 o# W& q
  36. #include <mach/memory.h>* }5 _; @  c& }2 Y. T
  37. #include <mach/hardware.h>
    . }0 {9 w% C, W% e$ x# d
  38. #include <mach/irqs.h>
    & W( M/ S5 \* d( ]0 q
  39. #include <asm/hardware/edma.h>) z/ E5 E( W- k3 S* j
  40. 7 G7 A& I# S* G# q* v% z3 l
  41. #undef EDMA3_DEBUG
    2 H5 }2 g  o- v- {* j. d
  42. /*#define EDMA3_DEBUG*/
    4 M; d3 Q: X' I1 S

  43. , h' j/ I; g( Y- q
  44. #ifdef EDMA3_DEBUG& a8 M0 Q) m( C. g1 r4 i
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 o; @4 u" H1 H2 `4 z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    2 d. C% m* p3 D. h
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ e0 x6 n% }8 W  U
  48. #else' [, q6 S; f3 N0 X( B4 F+ m6 K+ d7 P. ]
  49. #define DMA_PRINTK( x... )0 y, R/ x  }- t4 }1 n$ D' |
  50. #define DMA_FN_IN
    - J# C% z/ C0 H. m& ~& N2 m; e6 t5 x
  51. #define DMA_FN_OUT
    $ D6 ~% T' t' z9 ?0 F# ?# ]
  52. #endif, c. c! ^/ M2 Q

  53. 7 M2 {+ N, Z4 Y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)9 F; \% {: G; G8 O
  55. #define STATIC_SHIFT                3$ C" \5 O/ f" j1 o! j
  56. #define TCINTEN_SHIFT               20
    2 i, _6 Y! w% W  a+ V
  57. #define ITCINTEN_SHIFT              21
    8 I4 o- t2 r& N
  58. #define TCCHEN_SHIFT                22
    9 b" T- ~7 t2 m) x$ l
  59. #define ITCCHEN_SHIFT               23; V) S3 N: X: |

  60. ' m9 S8 H: Q  @, h: t% y
  61. static volatile int irqraised1 = 0;8 T# v- a2 \/ Y0 U+ r* i
  62. static volatile int irqraised2 = 0;
    $ A3 N/ G6 \/ G+ ?) [0 Z/ J% a

  63.   a8 M* ~: _3 P* U  z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 J; j: [! l! J. d4 J+ R
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 }- g' b" S% R; e8 Y( ~+ ^/ E
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # |& g) w9 ?# A& S1 a
  67. - K1 p# }! i; t% P3 Q5 i
  68. dma_addr_t dmaphyssrc1 = 0;% P: o( j  x- V4 D
  69. dma_addr_t dmaphyssrc2 = 0;3 ~: I+ i+ R9 r1 i8 _
  70. dma_addr_t dmaphysdest1 = 0;& T- `. l" R2 V2 z8 d
  71. dma_addr_t dmaphysdest2 = 0;" ]4 ?. C' T! A

  72. 2 x# w+ m: N; A0 W3 x
  73. char *dmabufsrc1 = NULL;
    ) H5 Z$ u$ P8 ?  Y" A! i
  74. char *dmabufsrc2 = NULL;
    % P" e* Z/ M- h/ Y3 h9 y% t
  75. char *dmabufdest1 = NULL;" |8 a+ r7 v. E
  76. char *dmabufdest2 = NULL;
    / \3 g5 h" E) U4 M" y0 T

  77. ! ~) a# D! u1 _
  78. static int acnt = 512;
    * G( u; ]4 w/ l: I' {1 W8 n
  79. static int bcnt = 8;
    # a& T1 s3 c3 y6 H1 t& C
  80. static int ccnt = 8;
    ( j1 G1 w* d: d
  81. ! `" t2 G2 n2 K: n' q0 R, n- R
  82. module_param(acnt, int, S_IRUGO);
    0 x5 e: \$ i+ T3 z1 [& r" `6 l
  83. module_param(bcnt, int, S_IRUGO);
    5 q& v  L+ `! Z; Y( {+ K
  84. module_param(ccnt, int, S_IRUGO);
复制代码
1 d$ N) K2 Q3 H6 a9 X
$ R3 r. V( }$ f: c
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& c5 s' K' L$ R7 o, S/ ~8 P# q) a
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 y5 X+ q' R. \. V
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
  B* J6 N; |* ^; J+ y! }5 l: W
. G* P4 }1 j7 N* I1 V9 \1 g0 Z% W" t5 k: v' i
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-30 11:24 , Processed in 0.526905 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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