OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& g' N$ j8 a, {6 R1 ]7 y; N8 h
  1. [code]EDMA sample test application. e. m1 O+ d( D* S
  2. /*0 T4 M: _  I0 T& L2 f# @
  3. * edma_test.c
    # d7 \( j1 q4 V1 M" g9 m5 D. U. X
  4. *: T$ a( m$ w! s# `5 n% ~
  5. * brief  EDMA3 Test Application
    * J' G( b' S8 o/ X" d
  6. *5 V8 S  U/ H% k* l# J0 w
  7. *   This file contains EDMA3 Test code.
    & ]8 P) ^8 p& k6 F: I3 W
  8. *3 C0 q& t  t9 A
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    . u$ @' |: j; c# y+ g  \$ F6 ?
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    * B! m0 S& D* h9 O! X
  11. *         TO CHANGE.
    ! f( o5 Y( C1 U. g
  12. *( n+ _' U. p& [/ X8 K& o6 Q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    3 a6 h* [5 J6 |; ~. c; ^1 }$ Y3 ^
  14. *4 @# K6 K+ e0 r* f+ `; Q
  15. * This program is free software; you can redistribute it and/or
    3 r3 X" }: E6 `0 M  \1 v7 n
  16. * modify it under the terms of the GNU General Public License as+ V7 |- W' a0 }4 x- g# ^1 I
  17. * published by the Free Software Foundation version 2.0 O8 \: o. P8 q8 `# i+ d* O% @. q
  18. */ t2 y5 \- [& j1 i' K9 b* m
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ) v' p! \8 x* d
  20. * kind, whether express or implied; without even the implied warranty8 }. Y, P- {( i, w4 y1 G5 Y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the' }4 ~' M( y; t3 X# b4 D! y
  22. * GNU General Public License for more details.
    ) R% [; g4 z  D- c$ \
  23. */
    , O1 C$ X  g. T& F6 k9 }7 I8 b
  24. 1 M$ l+ d$ ^4 ^4 H! C$ C& Y
  25. #include <linux/module.h>
    0 T) Z. M* Y# o) ]# y, Q! T
  26. #include <linux/init.h>
    + ?& ~) a* Z; w  u, H* n5 r
  27. #include <linux/errno.h>* Y* x& @8 }/ z) I) L8 `4 P
  28. #include <linux/types.h>4 O3 \8 x/ R: z4 \' f' r
  29. #include <linux/interrupt.h>2 Z* v2 ^) s8 l* u
  30. #include <asm/io.h>
    3 {+ u( U* j2 R7 j: ~; l
  31. #include <linux/moduleparam.h>) a$ B9 m  {; N& J6 [# x8 u3 T3 E
  32. #include <linux/sysctl.h>+ V5 G+ O6 x$ P3 ?6 y) R+ O
  33. #include <linux/mm.h>
    " V& W0 y( Z) I' M  o; G$ ]9 y2 T
  34. #include <linux/dma-mapping.h>) ?* d3 f3 D9 K' ]  t* F

  35. 9 C4 a, i( y8 [/ C7 D( y% y
  36. #include <mach/memory.h>
    2 c3 g2 P9 f3 q4 _8 J8 M
  37. #include <mach/hardware.h>3 e# K7 Z( d8 B2 R) }( K# V* m& Z9 z
  38. #include <mach/irqs.h>6 e4 {8 O, q% |' E) O  _7 \4 J
  39. #include <asm/hardware/edma.h>
    6 j+ f/ G4 j$ G& L

  40. 7 l! Y- e! Q; z, [9 h8 a, \
  41. #undef EDMA3_DEBUG, [8 J/ h6 E1 G$ W  {1 A, o
  42. /*#define EDMA3_DEBUG*/
    8 q/ n( w/ u  r3 G# D5 l6 \
  43. 2 B# T" ^: B$ H& r. R% w- N' ]- g
  44. #ifdef EDMA3_DEBUG/ W5 r1 \) m: f2 l$ ^5 j! k
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! N) G" M7 {3 E8 |: p0 M  W% l
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 d3 S6 G1 q- W, M, Y  n. B' m9 C
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 q9 e9 \: m* F. p
  48. #else
    . {- Q* @' z- @4 @1 y
  49. #define DMA_PRINTK( x... )
    : M3 s/ p) c1 Z' Z' ?; {
  50. #define DMA_FN_IN
    + z) D$ P' \. U
  51. #define DMA_FN_OUT
    2 r* j% j/ T1 @
  52. #endif5 m9 M( q! c1 J7 K6 p: z8 }8 E
  53. & g/ P' ^8 {" {
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    7 d+ j8 m! `7 c, i4 r3 E3 K" E# t
  55. #define STATIC_SHIFT                30 H2 W  w. V1 l) y6 a& [4 M
  56. #define TCINTEN_SHIFT               20* a0 k2 Q, S8 U! X
  57. #define ITCINTEN_SHIFT              21' w- f5 [2 P7 w) c" J/ i
  58. #define TCCHEN_SHIFT                22# i3 R8 O# b# T
  59. #define ITCCHEN_SHIFT               23. R) F; ~3 p6 c0 m/ B/ [2 t5 o
  60. 8 A- G2 h3 M# y) h+ v* X
  61. static volatile int irqraised1 = 0;1 O* d3 w* m2 i) s8 [
  62. static volatile int irqraised2 = 0;
    7 a9 Q* h: y. i9 z/ {
  63. " ~& {* V7 p) C! k; \& f7 t
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 N+ y: {" x7 f% g3 c. J
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * F! i  h, w# j! T4 _0 H
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  w- l" r+ q4 ^6 f" _) w& J2 V' B* o9 C
  67. & d! g: k6 r/ v0 ]1 ~7 ^- A* W6 |0 r0 s
  68. dma_addr_t dmaphyssrc1 = 0;
    - Q8 E- ^, n" E& N% ]* k1 E
  69. dma_addr_t dmaphyssrc2 = 0;" o. b: [9 |. f1 _
  70. dma_addr_t dmaphysdest1 = 0;
    : H5 d: C  Y! ~4 |+ |/ A/ e) c
  71. dma_addr_t dmaphysdest2 = 0;
    ! l2 E- Y! @" }: U4 j5 [" `0 t

  72. 9 u( @) {: l) f3 l' [5 y
  73. char *dmabufsrc1 = NULL;6 A% p( R2 R0 v3 f8 I7 T
  74. char *dmabufsrc2 = NULL;  I* I$ B3 {4 I) d
  75. char *dmabufdest1 = NULL;
    ; w) B! H2 O7 R( L( R+ m  Z$ P. q
  76. char *dmabufdest2 = NULL;
    , V% p7 M3 g- u& m* \/ O
  77. 6 R( m9 Z6 }* H: W; B7 K8 @7 h$ \/ \
  78. static int acnt = 512;) F8 u9 E5 C, `/ P& G
  79. static int bcnt = 8;( h( {! u2 j9 o6 N1 E3 a, p
  80. static int ccnt = 8;
    4 {/ H. C$ l6 \" |7 L

  81. + D$ G6 x$ i' F9 ?$ w  W
  82. module_param(acnt, int, S_IRUGO);
    $ L; r/ E3 ~# r1 O) R
  83. module_param(bcnt, int, S_IRUGO);
    ( L0 O* e1 z1 w/ g. F
  84. module_param(ccnt, int, S_IRUGO);
复制代码

, K; B1 P4 b0 O* g. Y$ B5 f5 n8 e; J( A' |
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 i5 n* S6 o( p3 f4 I2 p6 D
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& K% D/ t' l* |: H, ~
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, m6 o& m& `8 a5 T) D! R# e5 O; N' g2 }) N

: M' c, M! r7 ?, q8 |; Y$ a
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-27 01:57 , Processed in 0.039245 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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