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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ e2 h! n0 s' ^- }
  1. [code]EDMA sample test application1 \0 V  l" R* C" o8 B( B' N- Z- v
  2. /*
    7 v6 k7 P7 d) ?. ~+ n# m1 }+ ~9 W  _3 L
  3. * edma_test.c
    . `5 g6 K/ u- I' r% y: [
  4. *
    % u+ g7 p! O# m: O% u- t, E+ y# o5 K
  5. * brief  EDMA3 Test Application. z9 x1 f( i; k7 u! ^% u
  6. *7 ~, C+ c+ r; P: \; `. y
  7. *   This file contains EDMA3 Test code.
    / ?0 w' s* d8 H" Z# m2 H( f9 N/ M
  8. *
    3 d' K/ i; B# i8 q2 B
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, T0 q# n! \" G; V
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    6 f" R; u, K0 x% o- t7 y
  11. *         TO CHANGE.! A! X- g& K+ O
  12. *; g; n$ U- m4 J$ M. {) t8 x% I
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 k' c) O1 ~9 P" [3 {! O$ v
  14. *: F% u' g* |0 p& J
  15. * This program is free software; you can redistribute it and/or
    / M: v  l% F$ c2 x4 Y4 b
  16. * modify it under the terms of the GNU General Public License as
    # H  ~7 C# f1 h# E
  17. * published by the Free Software Foundation version 2.% x+ X$ I& R! r+ L
  18. *9 n9 B* i# }, u8 \- i  {# |7 }
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ [0 b& i1 p8 c( x
  20. * kind, whether express or implied; without even the implied warranty2 b) i3 `. j2 f; p6 q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the+ r; g! ~3 D. ]0 D9 M6 t; X; G
  22. * GNU General Public License for more details.
    $ x+ c. F" {7 i) B
  23. */
    8 a8 A" V" Q$ z

  24. 9 h) N: I" i0 _" `2 f6 K9 |
  25. #include <linux/module.h>
    3 I' Y( B* t  p3 `. P/ ]3 y. Z* h
  26. #include <linux/init.h>1 x5 y& T* Z+ V5 g, j
  27. #include <linux/errno.h>
    4 [! y# |' c+ J, u1 H
  28. #include <linux/types.h>4 E8 k* h! `2 J" Y) [1 U
  29. #include <linux/interrupt.h>
    7 j2 O8 p. A+ s; L0 W) U4 l1 X- }
  30. #include <asm/io.h>
    & h# [% e5 `: q/ N
  31. #include <linux/moduleparam.h>( ^+ i( f' u. q( n
  32. #include <linux/sysctl.h>- G+ W+ w6 C9 F# z7 W. W% T/ G
  33. #include <linux/mm.h>$ K5 {1 t+ x( Q! @, n5 S
  34. #include <linux/dma-mapping.h>
    2 l. S$ x; N+ s8 J0 [0 j
  35. : K& ?% X1 J: B. H8 }
  36. #include <mach/memory.h>! @" i' u" e$ T
  37. #include <mach/hardware.h>
    8 @) B, g# |) z6 R3 c
  38. #include <mach/irqs.h>* m+ ?+ f3 @" G7 ]- g
  39. #include <asm/hardware/edma.h>1 E; a+ R& i4 y7 ~5 g
  40. 4 M7 p+ w+ v5 s7 l' O: }# G
  41. #undef EDMA3_DEBUG$ r7 x1 h* P# L& {7 U" X
  42. /*#define EDMA3_DEBUG*/( R/ f4 W( n/ p7 Z8 J2 }: O- [
  43. " M0 p/ |$ Y1 E& M! o+ x8 d% F
  44. #ifdef EDMA3_DEBUG
    & X% |$ F( Z/ J+ z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    8 ?7 \2 h' [) c) f- r7 E# t
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- z! _; J1 O, z) i
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    4 N- Z; {& Y' f6 ]9 _* E
  48. #else5 a  S' `$ n! q, w8 p
  49. #define DMA_PRINTK( x... )
    . V3 d4 ~. X/ v: Y8 r
  50. #define DMA_FN_IN, g2 M! P1 ^& U+ ?- Q& m
  51. #define DMA_FN_OUT+ b% o5 U& y2 {8 H- i4 m
  52. #endif3 A' O! Z% a5 m1 a8 f9 ]  i
  53. ' m7 R, z1 Q" x( j" o7 D
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    1 ^' [/ m" |: {* ]
  55. #define STATIC_SHIFT                35 z( M) m6 z5 s' p; N5 E6 G0 g
  56. #define TCINTEN_SHIFT               20# ?5 O& S( }2 O* Y6 u5 T
  57. #define ITCINTEN_SHIFT              21
    : r3 K3 d( n& j- M& p2 ^+ _5 o
  58. #define TCCHEN_SHIFT                22
    ! n/ G8 J+ O; a( y) `# b
  59. #define ITCCHEN_SHIFT               23
    % @6 ~0 g, D& D8 S( k$ w
  60. 1 ~* I9 L& d& j6 a, |" h
  61. static volatile int irqraised1 = 0;0 T$ \' ?& z  [. i
  62. static volatile int irqraised2 = 0;0 Y. V9 y6 \" i

  63. : J7 F" w+ b+ Y! ^+ ~, L" v
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. x! @0 ~+ Z2 m! c5 @+ I0 ?
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" q- }3 c( O' s3 V/ ?6 a
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ E2 p( }. Q# R" d2 m  [

  67. * ?5 u! C; `1 A+ w7 {2 O
  68. dma_addr_t dmaphyssrc1 = 0;' W# H- s( a3 ?2 P" `
  69. dma_addr_t dmaphyssrc2 = 0;6 F4 T- U3 r9 h) Y' g. o5 q
  70. dma_addr_t dmaphysdest1 = 0;
    ( ?6 N( i3 n% |1 L
  71. dma_addr_t dmaphysdest2 = 0;
    3 O( j+ Z5 J9 ?. J

  72. ) ^0 g( W! \" u( r" Q8 M
  73. char *dmabufsrc1 = NULL;4 V' {. Y3 ^6 ~% t6 Y
  74. char *dmabufsrc2 = NULL;
    1 T' x' r# x" }* g5 Z
  75. char *dmabufdest1 = NULL;( t: N7 R7 P5 E! K7 {! M! B
  76. char *dmabufdest2 = NULL;) N! H2 g0 S$ ?9 B
  77. % v. y  ^6 J* h7 t
  78. static int acnt = 512;
    2 k/ a( T) g5 m2 H2 P% r
  79. static int bcnt = 8;. u0 D3 }7 A0 V/ _' L1 r
  80. static int ccnt = 8;" h' p  Y/ W6 X. D
  81. ) H  G9 t7 x  g# e. ^
  82. module_param(acnt, int, S_IRUGO);9 k$ s( q: r9 D4 j( I4 _1 i9 z3 j$ N
  83. module_param(bcnt, int, S_IRUGO);# ^* M7 J$ j2 `3 j+ V0 ?5 W. _
  84. module_param(ccnt, int, S_IRUGO);
复制代码
1 m) d- D% _! C2 s' ]; G
3 I" C! P1 B: v. A9 [
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
  x8 ]/ f) y  X3 Marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& b2 }; W( D4 d; h- R
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: u" q8 D6 v; H' ^
& b. M; g; J& f1 ~0 W: A, i

2 c& x* ?4 C* O1 p  z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-11-4 21:49 , Processed in 0.041598 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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