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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 X& l+ |, w) g. ^
  1. [code]EDMA sample test application
    ! M! p* d+ a2 _  T9 Y
  2. /*, b" B8 p5 e+ ?( P+ J
  3. * edma_test.c5 h$ t$ b1 q. m( @6 A! f
  4. *3 M7 \0 w) n" i7 o
  5. * brief  EDMA3 Test Application
    9 x0 U2 m0 |' l# x' W& B$ {
  6. *
    . \! t2 {4 i0 o/ I' _, m# i
  7. *   This file contains EDMA3 Test code.
    9 [9 u: r& g' Z
  8. *+ t  H. u% a; y, N
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. L5 ~4 Z# T- G1 N
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! [  N. }2 v4 ~
  11. *         TO CHANGE.. l; `6 j- J9 }+ H+ H
  12. *0 a8 Z5 ]6 P: _8 W! U9 E7 }7 G
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% c4 p/ u* [+ t
  14. *, N4 f+ b. ?# n8 i" a* ]" G. E9 |
  15. * This program is free software; you can redistribute it and/or
    * ]: ]' b* B$ J9 `
  16. * modify it under the terms of the GNU General Public License as
    5 @! }6 G- M+ R- d/ R
  17. * published by the Free Software Foundation version 2.6 a1 O8 `+ Y' }; Y
  18. *
    " S# r9 K9 H; S5 W7 q8 C, R
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    1 d6 k2 r/ q8 z
  20. * kind, whether express or implied; without even the implied warranty6 w2 q( s1 h' [1 f& g- Z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    / h% i( m( ~3 p4 o! n
  22. * GNU General Public License for more details.. A( N7 B/ g1 C7 Q+ f- o9 @7 D
  23. */
    ; F# X' S: w! h# ?

  24. % W! m6 _6 E0 }8 m3 r
  25. #include <linux/module.h>- }- n; }+ o3 G& v
  26. #include <linux/init.h>
    * w$ P3 c; z7 p( q( b
  27. #include <linux/errno.h>8 C8 ], O' `7 h$ c& [' Q; S# x
  28. #include <linux/types.h>
    * i" u7 g! ~; t
  29. #include <linux/interrupt.h>
    ) {8 t) b/ i5 }8 @0 x3 z1 e' u
  30. #include <asm/io.h>) A+ k: |( e. ?, g5 s; y
  31. #include <linux/moduleparam.h>1 H0 p6 f3 ~" x
  32. #include <linux/sysctl.h>
    7 G; _) M5 W# y& O) {2 n
  33. #include <linux/mm.h>
    0 K3 r- F/ ^. {: k9 y1 }6 Z% h
  34. #include <linux/dma-mapping.h>
      B* o: Y3 G8 S7 |, e# z6 s3 c
  35. 0 Z6 O1 [( B7 M) u; j- X& P. z; P
  36. #include <mach/memory.h>
    " ^: E, C+ F$ E1 U0 [7 u
  37. #include <mach/hardware.h>* R+ Q! t* k! Q3 M7 m! `
  38. #include <mach/irqs.h>
    7 ^6 ~  l1 y2 }) t. A- R
  39. #include <asm/hardware/edma.h>
      S8 P  i' R* h
  40. " f4 E$ o  z" K7 N7 i2 h
  41. #undef EDMA3_DEBUG! I% L1 o5 m% p; ]# e
  42. /*#define EDMA3_DEBUG*/
    * I: p! W  |8 w3 [/ M" ^

  43. # b# ~4 }/ \' t/ o7 m
  44. #ifdef EDMA3_DEBUG
    & F; \7 }& Y; u7 ^* s! Z5 A/ E
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 J) S4 f  W0 J+ g
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    % Y1 d, D) d6 p$ K$ l: G
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    7 Y. ^& f" ^+ Y$ j5 w" ^
  48. #else
    0 o5 `! N. @2 @6 ~/ i9 L
  49. #define DMA_PRINTK( x... )
    - T& T7 s: H. Q: A+ e7 B
  50. #define DMA_FN_IN
    : D  E7 [; z3 p$ M: B) Q4 g
  51. #define DMA_FN_OUT
    7 g3 J8 q8 m+ {7 s) X
  52. #endif
    + M1 P. t9 b; q$ Y+ e- Z* p

  53. & Q3 n5 n7 J( g6 N$ ^5 {
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    5 \. a! W0 x. r$ h2 c) m3 H
  55. #define STATIC_SHIFT                3+ o5 j/ x( O' d  }' s
  56. #define TCINTEN_SHIFT               20
    # ]& |0 m% T/ f
  57. #define ITCINTEN_SHIFT              21. ]. I$ J: V" z2 \7 ^/ ~5 {6 P
  58. #define TCCHEN_SHIFT                22" u; s1 U! m! i: y! ?( v
  59. #define ITCCHEN_SHIFT               23
    6 x* L2 n+ ~, m' X! U% ?: s2 d

  60. 8 l: A# }0 @$ P8 u5 Z/ y
  61. static volatile int irqraised1 = 0;
    ( h- I# d+ R4 |: G( e
  62. static volatile int irqraised2 = 0;
    : p8 [6 T, z8 i( Z8 r

  63. ! K3 d7 y6 e$ C# a0 c
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / |3 [# }0 C. Z: N5 }) u
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) W7 q6 I- l" \; Z' j0 ~6 O0 u
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ |( q+ _, h8 A1 n

  67. 4 |' f+ }5 i. o, y3 ?+ `/ n) h
  68. dma_addr_t dmaphyssrc1 = 0;
    3 C8 j+ @6 r: [' l. Y0 r2 m1 k
  69. dma_addr_t dmaphyssrc2 = 0;
    2 o/ l( d# L3 k* U0 b
  70. dma_addr_t dmaphysdest1 = 0;/ F7 j' w$ l9 F% G
  71. dma_addr_t dmaphysdest2 = 0;
    : C. g! {- M5 j% q2 N( o

  72. 8 A9 h* u& _5 v# @) `
  73. char *dmabufsrc1 = NULL;  \* _/ i' m9 Z( ~! u- c3 z- ^
  74. char *dmabufsrc2 = NULL;. C& _  Q9 Z( j6 D! U' X) b" `- S
  75. char *dmabufdest1 = NULL;
    6 J6 T7 K6 ]+ G2 `- A0 M$ H/ g+ `  s
  76. char *dmabufdest2 = NULL;
    - b5 ^9 L9 h! `! L# T. [

  77. 2 _5 K2 t2 ^  H0 y3 Y# x
  78. static int acnt = 512;
    ! s9 [3 t9 S7 W  H$ x0 f$ |+ _
  79. static int bcnt = 8;
    : o: V/ L* H7 H4 |' v: W
  80. static int ccnt = 8;
    ( C0 S, ^. _3 n+ }& `1 Z) k* q
  81. " Z" M, F" L+ H" }
  82. module_param(acnt, int, S_IRUGO);
    3 L; h. Z* g6 I) G0 n+ O  `
  83. module_param(bcnt, int, S_IRUGO);/ T* g; q5 C+ z2 D6 Y  J
  84. module_param(ccnt, int, S_IRUGO);
复制代码
( g7 W$ J2 s! j
0 L) ^( W) a- F$ H" b- q
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& }" K* t/ v) V3 Qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ |) d: O7 e+ e: G% C
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" Y3 |2 X' I: H1 y; G

2 J: U& t4 e% h, S4 d# e- j/ S
1 P: ^/ y0 n1 M5 F) v: i/ @
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-1 00:11 , Processed in 0.039764 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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