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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ w  d2 q! q, M, l2 M0 b" S& X0 [
  1. [code]EDMA sample test application! x6 x. l* l% E) o
  2. /*
    * {0 m3 O% c- G3 Z; ]  v
  3. * edma_test.c8 r6 i* O/ E  j' n. f5 `5 ?8 f0 y
  4. *
    0 ]0 I- \1 V0 k
  5. * brief  EDMA3 Test Application  r* ^* K  u5 D0 l/ |5 @
  6. ** l) `! z% Y- M- y' Z1 W' f
  7. *   This file contains EDMA3 Test code.. h5 |+ }7 u' o) z
  8. *
    4 ]% G) }2 L3 N5 g
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& p  ^& c6 R. ]2 ]1 N: H- H1 h
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    7 c9 Z. x/ n4 u2 g
  11. *         TO CHANGE., c" p* F; M8 H5 l: R
  12. *
    . D; P: Y/ G- ]. K+ s$ d
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    8 W8 y6 m! U* E8 E- f5 M8 _. X
  14. *  p$ |& K; ?% j" E* r" g3 B  B7 r3 ^2 l
  15. * This program is free software; you can redistribute it and/or
    0 y( ]* F; l  k- ~, m" T
  16. * modify it under the terms of the GNU General Public License as
    5 G! l/ h) N; `" I
  17. * published by the Free Software Foundation version 2.
    / F- h) N  q  H& ?  i# B
  18. *
    + v0 H& j% A! D# t+ A
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 y; d7 f5 e* a# q( S
  20. * kind, whether express or implied; without even the implied warranty: J( s* B, z% N4 q3 t" i4 d
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the; E3 U2 C6 `  O7 I; g2 P6 P4 ]
  22. * GNU General Public License for more details.1 g0 N' {& b; ?9 f
  23. */4 F' i  A5 J" C+ @+ I
  24. ! r2 e' ?% Q' z  m
  25. #include <linux/module.h>! H* A& ~' g7 T. p, q
  26. #include <linux/init.h>$ Z; i( S& X" N% Q" d! y
  27. #include <linux/errno.h>
    & }: G8 V2 ?; @
  28. #include <linux/types.h>
    5 f( ]  e0 e$ U0 t
  29. #include <linux/interrupt.h>
    , }, p+ W4 k, i0 C3 }+ W. z' j
  30. #include <asm/io.h>
    0 H0 p: m% M( Z
  31. #include <linux/moduleparam.h>
    5 {2 q: A  d" N1 \
  32. #include <linux/sysctl.h>
    5 ?0 k0 V, j) ]
  33. #include <linux/mm.h>
    # ?4 |* o2 \) T! F
  34. #include <linux/dma-mapping.h>" v2 I' d" v$ B) ^+ B: i
  35. % l* D3 d( U+ w# Y  C% ?" V
  36. #include <mach/memory.h>4 \7 t) ]. C1 q+ M- Z+ f( s5 U
  37. #include <mach/hardware.h>
    ) E: u3 M( R: y/ V
  38. #include <mach/irqs.h>8 B3 M4 ?, h+ h/ p8 }7 W
  39. #include <asm/hardware/edma.h>2 T/ m* W. j1 ]$ Q+ V- H5 v5 K5 N
  40. / y0 C( U# z. f3 z( c# A' d7 a7 \
  41. #undef EDMA3_DEBUG
    ; w/ c' d; K/ @
  42. /*#define EDMA3_DEBUG*/% r8 R8 ?) Y- f& X( Q
  43. , v' c9 v) \5 a9 [3 W5 d. a
  44. #ifdef EDMA3_DEBUG
    5 n/ j( x3 ^; O2 g; z6 H
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' W/ ^" [, x- H$ |1 \/ g; k
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ W, S6 W! K, b. q. \* z0 L9 U6 N3 ^
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' ?, J7 s3 |; @) {, A
  48. #else
    ) t1 W5 V3 l: }+ B/ P/ q
  49. #define DMA_PRINTK( x... )
    , N/ v+ `. c: }  ?( J: W
  50. #define DMA_FN_IN& f8 ?/ t0 C- R. J7 K
  51. #define DMA_FN_OUT/ p2 l% y  }( R6 z+ _( o
  52. #endif
    - O1 x' T) g# |
  53. 3 Y8 N& e; e0 r" x
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ! u% ?5 F3 B: e
  55. #define STATIC_SHIFT                3
    ; @3 R9 S9 v+ t
  56. #define TCINTEN_SHIFT               20
    0 Z6 y- m: |& p4 ?
  57. #define ITCINTEN_SHIFT              21$ G7 p  R' ?  n
  58. #define TCCHEN_SHIFT                22
    4 e2 w$ G* q/ x( Z% T& i
  59. #define ITCCHEN_SHIFT               23; F; o" O* [8 R7 Y- w
  60. $ Q% O* C9 P; B- S
  61. static volatile int irqraised1 = 0;
    ! E, B9 j5 K( E* K) W3 S
  62. static volatile int irqraised2 = 0;  M+ N' B4 M' e( _

  63. 6 C: e0 H2 O9 o7 ]+ o# ?' q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 E( A; D0 Y4 p; ~
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 G3 @1 C: b' h
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 P+ @) y9 T5 F! [: ^. e. r
  67. 8 s; O% _6 s( q8 @
  68. dma_addr_t dmaphyssrc1 = 0;/ p/ k. m" v3 Q* I0 D3 P8 m2 L6 N
  69. dma_addr_t dmaphyssrc2 = 0;
    $ O3 Q# K9 R* W: B) b
  70. dma_addr_t dmaphysdest1 = 0;
    # a5 w3 \) c0 x) Q) W
  71. dma_addr_t dmaphysdest2 = 0;
    - f1 P7 @# v" M4 C; Y. Y$ A
  72. : j7 N; o5 c# @* h5 D* E# I$ I
  73. char *dmabufsrc1 = NULL;% R% ^  [# H0 t* h) B
  74. char *dmabufsrc2 = NULL;& k4 C# H0 t- s/ ?
  75. char *dmabufdest1 = NULL;% }0 Z; Y6 t' _. _( ]* ]
  76. char *dmabufdest2 = NULL;
    + n* T, e% L' T1 }3 p  V
  77. & H7 T$ a5 M, ~/ D
  78. static int acnt = 512;
    0 f3 N; c% \- k) _9 {
  79. static int bcnt = 8;5 p4 A7 B8 u* o
  80. static int ccnt = 8;2 w( G0 y9 L7 [8 `8 w# I
  81. $ L  W/ C2 Q, E/ O5 u
  82. module_param(acnt, int, S_IRUGO);  Q+ u- y. g$ y; }; r+ b# K; U" X
  83. module_param(bcnt, int, S_IRUGO);
    $ _5 y& T* D- Q' C$ ?
  84. module_param(ccnt, int, S_IRUGO);
复制代码

/ j* R3 g. R# J* j9 u0 z& h6 Z- h" S
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" g6 ?, G$ p. D+ Parm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ c9 z  W. i" i7 F1 m; d* I* H, \     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 @% k# [3 n7 @7 P" P: J
# r5 U8 S: M+ f6 V" ]8 F8 \0 @  Z: Q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-4 14:22 , Processed in 0.039347 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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