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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + I3 M  x8 D! t- Q$ q' Z7 W) b. o
  1. [code]EDMA sample test application
    / a1 P6 G( u& @2 W  h5 o
  2. /*
    + k" Z9 @$ z1 C$ p: x
  3. * edma_test.c
    + H; b. i" l. t
  4. *
    ) f' i3 ]! B" m, y+ |" i4 b
  5. * brief  EDMA3 Test Application
    3 Y( E& g$ I, v, B+ s+ v1 t' ]& v
  6. *
    . t2 Y) {6 Q9 Z4 r) F
  7. *   This file contains EDMA3 Test code.; t$ b9 ^; |( x# u* ]
  8. *6 k; |1 M* ~. Y& L/ `
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, E" s" o7 `3 ^& _
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 t% B, b. E0 E- L2 c
  11. *         TO CHANGE.4 x- d" `7 J# c' x, k! r
  12. *! A4 x9 s" x# X4 _! P
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    4 p! K4 a0 [3 g; E
  14. *  H' I: E; K6 P. |6 j. _$ T' g
  15. * This program is free software; you can redistribute it and/or
    , B& Z9 N/ ?6 M  {
  16. * modify it under the terms of the GNU General Public License as3 z3 P- s  F: s* R( m
  17. * published by the Free Software Foundation version 2." J+ x3 p& h4 T2 Q  d0 a/ i
  18. *
    ' ?; j. m5 Y3 l
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any. @! F1 A1 ]  n3 E$ p/ O
  20. * kind, whether express or implied; without even the implied warranty  X' x4 U1 `  l1 A
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    & c/ ?7 T3 X1 z1 K) u/ W! R; Z* @% m, s: F, [
  22. * GNU General Public License for more details.
    * D' K; L8 `7 L& y
  23. */
    ) `8 j; {+ A$ _' |8 Z& ~3 \2 I" c

  24. / Q; x4 u& G) I+ ~7 w: n# p
  25. #include <linux/module.h>
    3 U% y3 q: H4 m4 `3 d% E; B' R3 F
  26. #include <linux/init.h>( e2 ?, R0 v4 P& Z2 P
  27. #include <linux/errno.h>
    ( M5 v' U( f$ l5 {/ `8 R
  28. #include <linux/types.h>, S2 E: y8 m. [2 n
  29. #include <linux/interrupt.h>
    2 }/ b. T- s2 c( F4 E7 x
  30. #include <asm/io.h>7 W- t; S& I9 B; {+ k: v( M5 u
  31. #include <linux/moduleparam.h>! |. j  _. n7 l1 _& S% K
  32. #include <linux/sysctl.h>
    1 r  l/ V. |" \" I5 W! x: [
  33. #include <linux/mm.h>
    8 K9 p! S0 }1 M% O' i& g, H
  34. #include <linux/dma-mapping.h>
      d* q1 q0 P' Q( B) [
  35. / Y* R! M$ j. ^5 Y9 e) I
  36. #include <mach/memory.h>
    / J# y  a$ Z1 b: L
  37. #include <mach/hardware.h>
    ( p$ Z6 z: X. f* Y
  38. #include <mach/irqs.h>
    / R8 H& g0 q. Y/ e2 G
  39. #include <asm/hardware/edma.h>
    # o* A+ S4 q, f  I% a* F
  40. ) K1 e/ |; l& X& K" A- r
  41. #undef EDMA3_DEBUG
    $ T  ~+ K1 W$ d, C+ t5 Q2 ]
  42. /*#define EDMA3_DEBUG*/
    ; \* t  q1 H* `

  43. & A! o4 B! w8 i: R
  44. #ifdef EDMA3_DEBUG3 Y% w4 r  T% d9 C  Z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), [8 @8 [0 D1 C: q# t9 U) N5 x
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
      ?; I9 q2 o- P0 u2 h" m  e
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    . P$ z* Q! Q: l6 V$ W
  48. #else2 N7 b4 w! r9 U! D7 e  a
  49. #define DMA_PRINTK( x... ); Q0 U6 V0 }9 L$ F, ]* k4 u( V
  50. #define DMA_FN_IN
    ; s3 r! v/ Y$ R" b: O2 X* q8 R
  51. #define DMA_FN_OUT
    1 H/ x& y+ h4 ]; w) K
  52. #endif
    * m2 j. S8 n) G9 P; {8 K  K* y( G
  53. % m4 ?0 \) j" m& H/ q7 a
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)$ y& W+ ^; b  o4 |* s* j
  55. #define STATIC_SHIFT                3& K$ y- H5 J" m' i" D! x  n. J+ L
  56. #define TCINTEN_SHIFT               20- L1 M: H7 o" I: n, B, S; H
  57. #define ITCINTEN_SHIFT              21
    - o. m7 l( s* t! d: [3 U# e
  58. #define TCCHEN_SHIFT                22
    9 M/ V, X3 d/ S% ]2 L
  59. #define ITCCHEN_SHIFT               23
    : O7 {/ e% g% j: R5 m$ J8 N0 \

  60. # B: _% m) r" b% q  v( W) R
  61. static volatile int irqraised1 = 0;4 K4 }+ J* b* e
  62. static volatile int irqraised2 = 0;
    # _/ L7 O2 G7 O/ Q& x) j

  63. ( ?5 r* _, Z: F2 }& ]0 j) l
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 f: q; c( w" W. _. O1 ]# y6 `9 g' e
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* x! J) B* r  I7 _* H& f. O/ N
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( _  W5 j3 H) @/ v, V  Z% v

  67. . o+ Q6 \/ U$ [) Z  X
  68. dma_addr_t dmaphyssrc1 = 0;
    4 L% a! m2 s+ t; F# v1 ^
  69. dma_addr_t dmaphyssrc2 = 0;1 K9 m) K+ e) i5 ^1 K; D
  70. dma_addr_t dmaphysdest1 = 0;# H8 ]) ~2 |/ O. p) s3 r
  71. dma_addr_t dmaphysdest2 = 0;$ |) u  {$ I. x- M6 m. {  w
  72. ' O1 w. I3 Y0 T( t6 p
  73. char *dmabufsrc1 = NULL;
    1 f8 N. z; C2 E8 a  D1 J) Q
  74. char *dmabufsrc2 = NULL;1 U2 B+ d  z! \$ N5 a: ?+ i, H
  75. char *dmabufdest1 = NULL;
    ; V( F& V. j. z4 o& t
  76. char *dmabufdest2 = NULL;
    $ b7 N5 O3 D9 q; N; \, d, h

  77. $ _, R6 D, C" Q2 L% C2 q
  78. static int acnt = 512;: M* G+ y+ M  f
  79. static int bcnt = 8;
    9 q/ k$ c: ]" H* M8 R/ G
  80. static int ccnt = 8;- M7 j4 y* H) h+ o* f9 u

  81. 3 s; d) N4 ~8 a+ n. q+ w
  82. module_param(acnt, int, S_IRUGO);* C: W5 A/ J' n
  83. module_param(bcnt, int, S_IRUGO);# v. F& D3 l( b' H
  84. module_param(ccnt, int, S_IRUGO);
复制代码
; ]# s  ?( l# i4 l+ i/ I
5 |$ x, }% n9 f5 k0 x0 ]6 J: X' Z& \3 s
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" w# g9 w  K, g, E
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ N( P* n: N; Z9 I5 E     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ q2 D; l+ ?# a- j' v* J. J
/ u2 A" o% E: w
+ O8 q% Y' E. ?$ L' x7 }4 i* {, A
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-10-8 23:01 , Processed in 0.043675 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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