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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 `( f3 W# ?" J/ G
  1. [code]EDMA sample test application
    ! Y5 [6 r+ Z, ?5 O! F3 X2 v' t
  2. /*
    - Z4 C$ }- v$ _8 o' e2 F
  3. * edma_test.c
    ( `. u2 g) A% T: l7 R& Z
  4. *  f4 s. T! x8 C* ?: k
  5. * brief  EDMA3 Test Application
    # C8 D) q" E$ r! U8 W
  6. *" x* L9 u4 ]- V  h: @/ Q
  7. *   This file contains EDMA3 Test code.3 d+ G" z2 |/ E& F6 b2 P' o
  8. *
    ( k6 {2 |$ X/ K2 g0 F& i
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ) U% m) q! ?) l9 T& R+ B
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    5 g$ Q# ]+ t  @9 T% J6 ^
  11. *         TO CHANGE.( s' _3 H# \. z& o4 c# E
  12. *5 |- D: M/ A3 Q5 N
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 q5 J$ Y# h  ?1 ?) _* ~8 d' I! y1 W
  14. *& c; ]" X3 g5 u( @3 N
  15. * This program is free software; you can redistribute it and/or. w( ^1 i, f7 Q3 c
  16. * modify it under the terms of the GNU General Public License as9 n$ e7 g2 F0 R* \* g
  17. * published by the Free Software Foundation version 2.
    3 g% i: }* a) {4 d
  18. *
    5 E+ V# ]/ M" Q  f
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any- ?4 j4 O6 S' O/ t
  20. * kind, whether express or implied; without even the implied warranty; g1 l9 i/ ]7 i$ }, P- I
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the+ ~: S) U& {, k! k3 G+ g1 j
  22. * GNU General Public License for more details.
      Z# @& @# d) y' U, w
  23. */
    ! S: G* C% R) Z0 ^  C

  24. 5 ?& Y9 _- E9 w% t/ C
  25. #include <linux/module.h>. ?" P& l) C9 p7 S3 S" G- R7 v  G
  26. #include <linux/init.h>
    ! K9 E& _3 n+ {3 N9 s
  27. #include <linux/errno.h>: T7 O. t, M) I2 v- T) M
  28. #include <linux/types.h>' b; G3 y; R) T. n0 c5 ~* N5 D6 W
  29. #include <linux/interrupt.h>0 P7 `( }) k; O' E
  30. #include <asm/io.h>2 s7 i8 J% `5 @/ Z$ e3 j3 q
  31. #include <linux/moduleparam.h>
    . y% B* w  ]& Y( c
  32. #include <linux/sysctl.h>
    & n6 @4 y& A- }8 F6 S$ e( j
  33. #include <linux/mm.h>' x1 `5 y, ?' @4 r) s
  34. #include <linux/dma-mapping.h>. O& _) G# Q1 g/ x4 h% l  z

  35.   X  J* K4 l; G
  36. #include <mach/memory.h>3 P! w& P# {! s2 H
  37. #include <mach/hardware.h>
    ; g9 h8 |% u4 y; m. n. E3 h
  38. #include <mach/irqs.h>
    / V; |+ q7 e: m. F0 j$ `
  39. #include <asm/hardware/edma.h>9 d2 n+ E1 g  w
  40. - h) R. M! y3 @! K; A; c
  41. #undef EDMA3_DEBUG/ w7 t/ Z. B1 Z. ~5 p
  42. /*#define EDMA3_DEBUG*/
    - ]5 n, ?4 B9 D' Q! O
  43. 4 D6 V9 _0 e" p  D2 {4 X' V' f* C: F
  44. #ifdef EDMA3_DEBUG( `+ j/ e8 L8 X, `
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    + b* Q0 G1 I0 C( j: U- A& ?- Z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    3 b! A7 D/ ]  ~- H1 `7 s
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ v# p3 `% k" v" v# v
  48. #else
    0 `( ^- x4 _: g# s. ]/ j
  49. #define DMA_PRINTK( x... )
    + @5 l; \( T( d9 L
  50. #define DMA_FN_IN6 @: Q( O. q3 ]5 L$ j% _
  51. #define DMA_FN_OUT4 M5 O/ G2 s, t/ c3 G; ]+ h; Y
  52. #endif
    0 ~& J1 e) V3 r* X
  53. , b7 ?& T) w7 F, v1 L+ ~$ G
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    / ]) a/ O5 b; V. n6 q6 p' \8 t+ ^
  55. #define STATIC_SHIFT                3- T+ m5 r' ]4 g9 ]1 b6 ?! c7 M
  56. #define TCINTEN_SHIFT               20
    : o, T6 D9 v, E+ m: i4 T7 _
  57. #define ITCINTEN_SHIFT              21
    , r8 U4 u0 _# D+ w
  58. #define TCCHEN_SHIFT                22
    * F6 ~" y5 f: k8 Y  G% m' q$ ?
  59. #define ITCCHEN_SHIFT               237 s4 o8 L, ^& C0 D0 l, G! z
  60. 1 J- g% N* z' B  Z) u3 Z" p
  61. static volatile int irqraised1 = 0;
    8 p4 ~& `  C  J, y5 ?1 z
  62. static volatile int irqraised2 = 0;
    5 e% o" f4 H' Z3 z
  63. ; g; _* l7 x, e: c5 d
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 A2 F8 j" p0 z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- k$ r5 j( e( k
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . W/ D3 W* h4 C) R4 v) D; \% M

  67. $ ~9 t( Z; _: w% V% Z7 `
  68. dma_addr_t dmaphyssrc1 = 0;
    . p# p7 t5 v1 H. A
  69. dma_addr_t dmaphyssrc2 = 0;
    ' O' V1 f5 \% v6 p0 \0 J* `2 }1 `
  70. dma_addr_t dmaphysdest1 = 0;8 N% n9 ?7 ?4 F: C( t
  71. dma_addr_t dmaphysdest2 = 0;7 o% R! j( a$ n! T
  72. , |$ i- X: Z# m" Q7 U$ e
  73. char *dmabufsrc1 = NULL;1 O) L* j7 V- Y
  74. char *dmabufsrc2 = NULL;
    2 C) r3 e5 b8 w" o4 t9 m
  75. char *dmabufdest1 = NULL;- b6 J, m# q+ m) s
  76. char *dmabufdest2 = NULL;
    * f+ q+ [; h: s) w5 k

  77.   m- T! M; r5 L; r
  78. static int acnt = 512;4 Y: R" ?# d; p2 c- }
  79. static int bcnt = 8;
    5 K: K4 P2 ?& S. `( |7 B6 J
  80. static int ccnt = 8;
    6 ]8 k* r9 ?( i* ?0 @& u& v- g
  81. 5 L& \3 ~# i0 D, \0 G! c& V
  82. module_param(acnt, int, S_IRUGO);
    4 c" p+ Z1 c! H/ T; |
  83. module_param(bcnt, int, S_IRUGO);
    $ D1 I5 b4 A1 I9 J' o
  84. module_param(ccnt, int, S_IRUGO);
复制代码
& E8 c; K9 ^' I8 c/ f
- p  d5 l9 w4 q! [$ m$ @  i: o% O) @
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# p$ I) `: A& D8 Z$ S2 |5 C
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. O( i0 v& J7 V# s5 n) i6 g1 r3 ^     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ v( V6 n+ {( V
, a" T2 g# s4 E* z2 g
5 f4 h- Q3 i" Y* b  ?
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-1 13:31 , Processed in 0.039712 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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