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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 O) J0 G4 H) k- K$ a: {
  1. [code]EDMA sample test application
    0 B+ `# Q# J* L: i* Q  J& j
  2. /*
    * @9 r0 F$ Q, n4 J8 W! k
  3. * edma_test.c
    8 T! T( b% V: |6 u, B! h% U
  4. *
    , q- J4 b- p% }# }; c: w
  5. * brief  EDMA3 Test Application$ z5 S% g7 n  \. t1 x& N7 C
  6. *( Z2 E6 p8 N* [
  7. *   This file contains EDMA3 Test code.( ~- U6 f+ T* k4 j; P& m; Y
  8. *
    ; S- M, C* q8 E" l+ g8 p0 f% Q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    . D- o5 b" e2 F5 F# s9 m
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- }$ R8 K" H4 ^8 ?! r  S4 v
  11. *         TO CHANGE.+ `4 J* y: _/ F1 v
  12. *
      E7 H/ u, P- |+ M1 M. k8 T6 P
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' m( v" N# ^* Q: A# P7 I: T
  14. *) F7 b+ z* o. H* C( O5 C
  15. * This program is free software; you can redistribute it and/or
    ( S3 w4 o# s; e, ?+ }7 N! `$ u
  16. * modify it under the terms of the GNU General Public License as
    " E7 ^. A6 N8 |& q
  17. * published by the Free Software Foundation version 2.+ y% f- O& Y; T" Z' I9 X0 g9 {. o
  18. *
    # o3 x/ @/ W6 g6 B7 s
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    2 n5 A, D. R. ?' L3 P5 Y+ [
  20. * kind, whether express or implied; without even the implied warranty2 i! e' ?4 y" b" |' ^1 P
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ) L. h8 d* B  y; E& X5 y+ Y8 x
  22. * GNU General Public License for more details.
    " E; c6 F, k* f2 t1 f# p+ N
  23. */0 ], T4 o' Z& ^, J

  24. 3 l9 d& {: ?( U9 x; ^9 ]
  25. #include <linux/module.h>* O- V$ B! q' F9 G2 S; V- Y
  26. #include <linux/init.h>
    / o, u, _4 J4 {% S1 ]5 c4 `/ X- g$ ~
  27. #include <linux/errno.h>, Y! H7 ^$ \# n
  28. #include <linux/types.h>
    5 y( S, I' P5 S2 }4 B1 e7 F
  29. #include <linux/interrupt.h>1 U/ c6 w7 ^( y$ {
  30. #include <asm/io.h>/ m/ V0 C# w( V" M' i
  31. #include <linux/moduleparam.h>" g0 F" Y. Y; @4 v) ?5 ?# S) T
  32. #include <linux/sysctl.h>
    , r+ S/ m6 Q. F/ F+ c! `
  33. #include <linux/mm.h>. K" b( q( Z( [  x$ J% t2 T
  34. #include <linux/dma-mapping.h>' N( D+ J! R: P

  35. 8 E3 B% s! V- a6 i( L
  36. #include <mach/memory.h>
    % n+ G  L! [9 Y
  37. #include <mach/hardware.h>
    ' o, P$ N. y' K) _, `
  38. #include <mach/irqs.h>
    6 Y3 K( Z' v% c8 m5 v8 T5 o# [
  39. #include <asm/hardware/edma.h>0 s: d+ a+ j) T5 }: Z* m+ B8 B- Y
  40. 0 K- Y2 H0 E" T- u$ ]& b
  41. #undef EDMA3_DEBUG) o  B  R/ ?% r
  42. /*#define EDMA3_DEBUG*/
      z, p  m) X9 o: |

  43. 0 A5 w& Q& a" l4 {: ]( Z0 x
  44. #ifdef EDMA3_DEBUG
    , e' X$ E# b) P
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' O! ~. }( `% f. O" W; H
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    & }, r) s+ h  l6 a1 ]5 m# B
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    9 W9 p, R! N; X5 R6 O. c, c9 [- e
  48. #else# v7 F" j% _" G/ W/ A+ h2 O* ?$ ^7 A
  49. #define DMA_PRINTK( x... )
    ( v0 e3 Z  n. ]
  50. #define DMA_FN_IN
    # T9 @6 D- _5 _3 A& Z
  51. #define DMA_FN_OUT
    8 f3 ~' {$ v# ], s3 I
  52. #endif7 t% t1 z7 S' W" n; y  L
  53. 7 }, T# [2 A. t3 r& `
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    2 K1 U/ O/ S' w  i/ X+ Y
  55. #define STATIC_SHIFT                3+ m/ C! x) r8 O4 B$ H2 D
  56. #define TCINTEN_SHIFT               20
    & [, @# y' I5 \7 t8 P6 U
  57. #define ITCINTEN_SHIFT              214 x6 u, ]5 r% p( {; n
  58. #define TCCHEN_SHIFT                22
      L+ E6 b% M$ C; x, O* x
  59. #define ITCCHEN_SHIFT               23
    ' Z9 z2 a4 Z1 [( x( r( f

  60. % y# n9 x; {  \8 x8 x+ r% a8 u
  61. static volatile int irqraised1 = 0;) h2 K+ c& d" B  L8 d
  62. static volatile int irqraised2 = 0;
    ' z; v& |( e0 r9 L0 `

  63. 7 k+ q4 \1 M( U- L5 E* I- q0 N
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- U4 q0 v; d/ P) h9 M5 i
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 a( {! |2 R$ L9 o
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + b- A3 \# c/ G

  67. 5 o' R. ?  b( v* g1 `* \
  68. dma_addr_t dmaphyssrc1 = 0;
    8 S* |; m# F0 L; K* N" q. z
  69. dma_addr_t dmaphyssrc2 = 0;
    # ^2 X9 m. \: ?' x' a/ C9 h4 J
  70. dma_addr_t dmaphysdest1 = 0;# p3 ?) w% O0 c7 ?4 K
  71. dma_addr_t dmaphysdest2 = 0;. o& y( O; ~" A8 T; T( ~) Y/ @2 }

  72. " L1 i0 ~$ [9 s$ {
  73. char *dmabufsrc1 = NULL;
    " |/ l( Y/ o7 Z" [& g' K7 l8 P
  74. char *dmabufsrc2 = NULL;
    : D" Q4 V4 P, k
  75. char *dmabufdest1 = NULL;
    3 U5 R3 i: _( V5 c& f8 z7 K
  76. char *dmabufdest2 = NULL;. c, l- w6 O& \3 h( ?# N! Q
  77. * e- L' q# u/ O# X  n8 I6 r) f
  78. static int acnt = 512;. [, v0 }. y3 t. }* I* [7 ^
  79. static int bcnt = 8;9 }9 i6 `8 Z2 ~3 L* b
  80. static int ccnt = 8;
    , u8 e$ J# n: q- W+ {

  81. , N; B- t6 F* ]0 F+ k" i! o) I
  82. module_param(acnt, int, S_IRUGO);/ _) Q& U* i) m( ?( K7 n0 W6 {
  83. module_param(bcnt, int, S_IRUGO);
    ( ?! X3 X7 X6 @0 j% `
  84. module_param(ccnt, int, S_IRUGO);
复制代码
7 Z9 y/ X7 v4 B! F9 M) q$ B

* @& I4 E, M2 Y! ~/ O/ n3 k      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ H: q, p7 N5 P# n) W% Uarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ z+ R/ H$ f* E2 o+ \7 H% Z; J     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 v- a: s! B9 S2 B6 z8 Q! \

' P* c! w- D; ^$ w1 R9 U6 n) w! s- }: ^
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-8 17:57 , Processed in 0.038525 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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