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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( y4 @3 u$ `! Z6 Y6 ^* d9 q
  1. [code]EDMA sample test application
    2 N# ~+ j! o$ G" I! F- e% {
  2. /*$ m1 ?3 F; A( B, `& s
  3. * edma_test.c
    & Z5 s7 ^& V% K* h  x
  4. *
    0 U' v7 Z3 w2 j7 i
  5. * brief  EDMA3 Test Application
    $ x2 v7 w2 O$ d- n- Q( ~+ ?
  6. *
    0 n6 t! o! J( Q& G6 p4 }7 ]' s
  7. *   This file contains EDMA3 Test code.
    : D" i4 s* U6 s( w
  8. *( U$ m3 e! J& K4 m4 @' L* B
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 d6 D# J% P8 s' z7 j. `! r
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    7 h+ i0 J& M+ [( ]9 k  V
  11. *         TO CHANGE.
    . x3 a; S3 S( t5 |, P8 [. M
  12. *7 ^! [# w9 S1 P  `# O5 v0 b
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" e* ^$ q) I6 B: ~9 q( K" Z/ l
  14. *$ a' R: a5 ~' Y8 F5 l
  15. * This program is free software; you can redistribute it and/or
    ! V: e* g) {6 |# S- T4 `
  16. * modify it under the terms of the GNU General Public License as
    5 A* N* z3 \1 h5 A- h, _
  17. * published by the Free Software Foundation version 2.) h& T5 F* d$ r6 ]7 u5 r! Z
  18. *! [7 P1 O8 s& B- Z& ]
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any* o4 X) K/ i8 Q3 ]6 \+ @+ n
  20. * kind, whether express or implied; without even the implied warranty8 \0 A- P; P) W6 k% B4 M: Z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    $ F# G& r9 @( J% E' n3 g
  22. * GNU General Public License for more details.
    % [5 ^9 G' M: [
  23. */! N$ N: A+ ~: ?3 X% k! U

  24. 6 n' |6 P! ?' X$ A/ [8 ~
  25. #include <linux/module.h>0 q8 [# X7 }% D! K2 H1 m  A
  26. #include <linux/init.h>
    " |0 M& z  ]1 A3 \% y
  27. #include <linux/errno.h>/ j1 [% k& U5 D5 z& q( Z
  28. #include <linux/types.h>; q4 d/ z, q+ s5 ~% f* {
  29. #include <linux/interrupt.h>
    5 r/ ^, }" P6 h$ {
  30. #include <asm/io.h>
    " R1 }: f: J+ j% p0 w, }
  31. #include <linux/moduleparam.h>$ q& o5 d" P4 e7 m: [, M) g" Y( l* _' d
  32. #include <linux/sysctl.h>
    8 q5 W4 G( R9 h; f* ~3 r' q+ z
  33. #include <linux/mm.h>, ?- |( Z  g& f( F% t
  34. #include <linux/dma-mapping.h>) c7 j6 {+ C; ?' _) h

  35. ) s; n; e5 N3 x' E
  36. #include <mach/memory.h>
    " M7 q1 V- T3 g
  37. #include <mach/hardware.h>
    6 o# |9 N) G& q! Y+ y( f" p6 F
  38. #include <mach/irqs.h>) ~8 j: w# ^8 ~- s7 c, u; X, |+ E" y
  39. #include <asm/hardware/edma.h>
    ( j# a7 F5 y. I  {! @% D

  40. 2 z8 O0 L  c- M9 S+ [' H0 y
  41. #undef EDMA3_DEBUG* \* z: C1 x6 ^9 c; }4 G- b! U
  42. /*#define EDMA3_DEBUG*/
    $ {# s# w1 B+ o6 d1 |
  43. 8 G+ j# f( q! `+ Q. g
  44. #ifdef EDMA3_DEBUG
    ! A; Z; r0 o1 c" ]$ b
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
      [: I% x+ |$ ^: j
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 k8 a; s, \3 }
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ( P( x9 f: B+ |
  48. #else
    $ h( J$ ]9 r2 m3 F7 m3 K
  49. #define DMA_PRINTK( x... )8 E. M4 _) ?- K6 G2 h9 U( f3 `; D3 X4 x
  50. #define DMA_FN_IN
    ; x" V  ~1 a: X% V) u
  51. #define DMA_FN_OUT  M# o& _  _5 J1 f3 q1 Z; `( O
  52. #endif5 g/ M2 B8 e- B$ C

  53. 5 \0 w) L8 u& A: a6 C# U3 p) z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)  U) q2 o: D) P3 |% X  `, r
  55. #define STATIC_SHIFT                3
      e/ v4 y' T7 N+ L5 ]
  56. #define TCINTEN_SHIFT               20
    0 T- o0 }) Y# ]% G. M$ h5 y" Y
  57. #define ITCINTEN_SHIFT              217 G4 }5 @& F% P& S0 r" d, W
  58. #define TCCHEN_SHIFT                22+ k9 S" b( C6 N) c! J8 Y5 N
  59. #define ITCCHEN_SHIFT               23
    ( I3 P7 C4 y/ R( C: x$ G/ n! ^
  60. 4 E5 ]2 r' `9 m2 V# d$ @
  61. static volatile int irqraised1 = 0;
    : j/ z- e+ B. z( }' F9 j! j) i
  62. static volatile int irqraised2 = 0;
    ) i- i+ i* i' N: o

  63. , k( g4 ~2 P( a: t) ~/ n3 d* Z! f
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 t% w5 b0 w7 _
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' u. P. E) J* t' D! {4 K
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " T, u! L- Q) E) V% z
  67. 1 O3 ]+ O2 }# h4 o
  68. dma_addr_t dmaphyssrc1 = 0;
    % g( @/ Y' g$ W9 K1 C+ ]. x
  69. dma_addr_t dmaphyssrc2 = 0;+ y1 D) A0 H7 B6 j. E; _" L/ v
  70. dma_addr_t dmaphysdest1 = 0;
    9 J# g! T# u( T4 v! y) q
  71. dma_addr_t dmaphysdest2 = 0;" D; N- g4 j/ e9 I# p# X" C5 M& x

  72. ' M2 V: v! J/ {0 |, O  [% ^
  73. char *dmabufsrc1 = NULL;* E, i3 R0 a* [
  74. char *dmabufsrc2 = NULL;
    5 z2 ]$ |. K' f' ?' F% D
  75. char *dmabufdest1 = NULL;
    - m% V4 a5 w% {9 @$ b- E
  76. char *dmabufdest2 = NULL;
    1 k: P- b& ^+ P2 h5 f) S

  77. & u* J. l3 d; l" j! h1 y- z
  78. static int acnt = 512;
    ( S. `0 ?& b4 I* m$ u5 J8 B
  79. static int bcnt = 8;" Y1 c8 Q" e: m$ _
  80. static int ccnt = 8;
    ( X4 }8 M+ @- X2 r; j9 v
  81. 4 \3 @2 c0 o3 o+ C# j
  82. module_param(acnt, int, S_IRUGO);2 ~7 O. |0 {% S% l: q1 k; _  t
  83. module_param(bcnt, int, S_IRUGO);, k6 J3 y* b$ X5 F" ~% p* |2 R" P
  84. module_param(ccnt, int, S_IRUGO);
复制代码

( W8 Z" r2 H$ B# j2 [, Y& x
/ d9 t. o, X. T$ |      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 v) S% D0 v) y0 J' M8 w
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; T& Q/ x: d( ^. }/ O) o& }$ R0 w
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。  y# N: _0 R. G7 Q
1 V3 x) r5 o9 k: @: k* o0 g* f

' \* Y5 q4 t) q. C3 k4 _
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-5-20 07:55 , Processed in 0.040540 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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