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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) G) \7 ]5 d+ W
  1. [code]EDMA sample test application
    ) O) s- _0 q8 [% \+ M, a! h
  2. /*4 i* s7 M: V  h  o8 |3 A
  3. * edma_test.c
    / F" q5 T8 @1 G/ h+ o: @
  4. *1 K  U% ]/ j; b1 X' h# t% c1 ]
  5. * brief  EDMA3 Test Application& I' m1 p+ j" Y: w, t6 d
  6. *
    * S* \. J1 f! T( a( _
  7. *   This file contains EDMA3 Test code.
    6 {7 g  O- T% m* y1 ]) C
  8. *. M) s* F6 {9 r; y4 m' y
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 v' m& A5 N  ~
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    " g' B4 }! X9 u3 d" o
  11. *         TO CHANGE.3 s9 A* U& Y4 Q. Y- d
  12. *
    9 [3 G* g. o0 O9 N) i( j: M
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 J7 G, W% o+ _9 h  ?, G" r: ~
  14. *- c( z) d4 Q4 ?5 h: r
  15. * This program is free software; you can redistribute it and/or
    3 s3 N4 i" X( A% I0 Q
  16. * modify it under the terms of the GNU General Public License as% |* R" [5 g  m, d2 w
  17. * published by the Free Software Foundation version 2.$ z6 A% b* x, W, F
  18. *: Z! e( W- N. _
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    . X8 R+ L4 i5 O1 Q4 J0 l9 c5 j
  20. * kind, whether express or implied; without even the implied warranty
    % Q3 x9 c3 n! _) W6 H
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the# v) x- M# _, s4 w4 u2 ^8 E- m6 Q
  22. * GNU General Public License for more details.
    4 [+ C3 }8 h) ^
  23. *// H( d: z" F* }3 L: t

  24. / |  i" n4 ^, n5 k
  25. #include <linux/module.h>
    % W5 r- X/ ^" x
  26. #include <linux/init.h>
    ! J6 A& I: P0 |/ J3 v
  27. #include <linux/errno.h>- e, u! ^; o1 O9 s- X% T, s
  28. #include <linux/types.h>6 A. q. [0 C, ?, m+ r
  29. #include <linux/interrupt.h>
    ' d6 a, T/ d; P( g, o! R
  30. #include <asm/io.h>2 i; J: t8 J$ M) f& f
  31. #include <linux/moduleparam.h>
    . S5 x  J, y- e/ @& C
  32. #include <linux/sysctl.h>
    ) y, y% F2 ^) Y7 A" U) B
  33. #include <linux/mm.h>0 q5 S5 I/ `' ?1 V6 u# Y
  34. #include <linux/dma-mapping.h>2 ~# |$ Z+ F/ V! D6 y: K
  35. " h, }9 f6 m% I4 ]6 V0 Y& d* U
  36. #include <mach/memory.h>
    9 ]- G0 W; G1 @/ Q0 m5 n
  37. #include <mach/hardware.h>
    ) f$ p4 t0 w8 X* A- |& V
  38. #include <mach/irqs.h>6 L9 x2 ^3 q2 ?* Y8 {! s
  39. #include <asm/hardware/edma.h>
    - I: |* ?0 `9 f- v9 u

  40. + N2 v& C4 K& z' g8 r/ K2 ^& B
  41. #undef EDMA3_DEBUG5 y  E6 Z/ J! m. T- ^
  42. /*#define EDMA3_DEBUG*/" g( n7 X$ m/ V6 y  L, |

  43. ) X! I# {' m1 q& Q. X+ Z7 y
  44. #ifdef EDMA3_DEBUG: U' ~  S+ m- i  |. ^- `
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). k8 D) [$ L& c
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ p0 y; Z" O1 G) ^0 O$ v6 p
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& l$ @# R- U4 q& t* R1 x7 _8 i
  48. #else
    - z  f7 C1 _7 t6 G9 y
  49. #define DMA_PRINTK( x... )
    1 x3 k: N0 O1 v. u+ M% a( c/ J( Q
  50. #define DMA_FN_IN* c0 D; j, _7 ~
  51. #define DMA_FN_OUT0 K0 |- u- F. a9 h
  52. #endif: O9 P' z, Q3 e1 U% ~( Z/ g7 K
  53. ! K# m% e. o" U+ H
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    4 e. C% w% q; p+ ]( j: @% F% u
  55. #define STATIC_SHIFT                3
    " N5 W! D+ r" x7 ]& @+ a$ z4 E
  56. #define TCINTEN_SHIFT               20! Q) P. k6 V& ]7 h5 P
  57. #define ITCINTEN_SHIFT              21
    ' y+ t; K: M0 m4 @9 w3 ?
  58. #define TCCHEN_SHIFT                22' r8 w1 A! ~# E/ M+ y
  59. #define ITCCHEN_SHIFT               23) w5 S) J! E# F' e( ]! |0 f7 n& c8 p
  60. : q& Z1 _% Z; W. t% M
  61. static volatile int irqraised1 = 0;
    2 a/ P3 L( s, R9 a8 B% t! |, s" T
  62. static volatile int irqraised2 = 0;
    7 c3 M/ s8 f" T: C8 X4 Y- m
  63. - g: ?1 @' i8 f7 B: _
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 r; e! ^; {* J! e. V) P) w4 e4 u
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 x/ \/ n$ r" _- Y) v3 P' E
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 Y" d2 W: A$ L/ F  t. J6 n

  67. * d% |7 T: Z2 L+ X  Y
  68. dma_addr_t dmaphyssrc1 = 0;7 n' |3 t5 s  A  c6 \
  69. dma_addr_t dmaphyssrc2 = 0;
    " [+ w/ a/ @/ H8 ]9 r% l
  70. dma_addr_t dmaphysdest1 = 0;
    5 t* |0 e* B( V' h( l3 `
  71. dma_addr_t dmaphysdest2 = 0;
    " s! v9 x) Z. s: {1 J4 i: K) Q
  72. ; W: x1 D1 N. q' `" f1 f& ?- V
  73. char *dmabufsrc1 = NULL;( f3 `' \# R9 h4 t
  74. char *dmabufsrc2 = NULL;( z! U( x1 A4 l" ~  ?! _( w
  75. char *dmabufdest1 = NULL;- c- G& D+ o! X0 g6 L: x
  76. char *dmabufdest2 = NULL;
    " W3 [8 a$ z" P
  77. 8 S2 |$ z- r. X5 i
  78. static int acnt = 512;
    3 O0 }, R/ y- \7 f& U
  79. static int bcnt = 8;
    ) @" F# c! l- L- n, x% n% Z  j
  80. static int ccnt = 8;- D0 w4 u7 ~/ v

  81. * ?! c8 X' P& e6 X
  82. module_param(acnt, int, S_IRUGO);, ]+ j! A5 l; ]) S' H
  83. module_param(bcnt, int, S_IRUGO);5 s. l! J  R% m8 d. i2 t8 m6 v
  84. module_param(ccnt, int, S_IRUGO);
复制代码
& a# l$ o7 @9 @/ x
& G( Q  U% \9 c: b* f
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 W& k8 o3 D( E: V2 g3 ~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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- B; }* I, y1 a5 C7 O' n3 R! U     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' i( E  D+ B9 Y7 {, }8 I9 |

. `. O# \( U( b4 s( f
4 u4 H+ `- |: ^5 [
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-5-5 18:17 , Processed in 0.040606 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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