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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . w  O* d6 r, ?6 X: Z$ r  N& `
  1. [code]EDMA sample test application
    ( Y8 {. z5 |+ X" A( x
  2. /*
    0 \+ q% W& x) T8 d8 _
  3. * edma_test.c: Q7 a! \& }+ V6 i  K( A
  4. *
    4 L# j+ E3 m+ o; O' T, `9 i
  5. * brief  EDMA3 Test Application
    ) `/ o$ [* C) N( q3 l1 W* z
  6. *
    4 {. j- i1 q5 [1 P9 L
  7. *   This file contains EDMA3 Test code.
    % {7 `5 d) _" w" v. O# H
  8. *
    7 ~& F8 X# a3 I. S* `& \
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    6 M' S  |- q4 d  x, S# Q- T
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ' `1 y+ n4 U- O* q
  11. *         TO CHANGE.: C8 m. u  K) U7 W' ]  F* n
  12. *- m" {& E" H2 c7 y) R/ _
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* Y4 n/ \: ^. p- s! {  o
  14. *7 f) @$ f# s4 P7 O7 x: {4 {5 `8 e
  15. * This program is free software; you can redistribute it and/or0 y$ s, v9 `" T# B+ c
  16. * modify it under the terms of the GNU General Public License as
    / a: }/ m: Z0 B% `3 _
  17. * published by the Free Software Foundation version 2.+ v1 v# W7 c6 }
  18. *" V& A( K7 |# H
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any: H: w" P0 X9 B, l. T- h2 W" I' L
  20. * kind, whether express or implied; without even the implied warranty
    2 H( j+ i4 A$ X' {
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    : b. y/ F5 U! p9 ]$ i1 f
  22. * GNU General Public License for more details.
    ) C, s/ Q: T/ o& \, V1 T& E  u
  23. */' k+ q4 S6 B/ s0 `7 o2 ~
  24. + H3 t/ |, T+ G* K0 H+ o% _9 M/ c
  25. #include <linux/module.h>, }; s: o9 X) p' t' r* b, K( R) @
  26. #include <linux/init.h>
    # c1 |) [1 t( N' G3 W& v8 g& ?3 d3 V1 x
  27. #include <linux/errno.h>
    / [" q$ L- o1 C- C0 Y
  28. #include <linux/types.h>& p" V; F5 k' ~/ l7 X
  29. #include <linux/interrupt.h>
    , T' j3 j# Q& y) T- J* e) |
  30. #include <asm/io.h>2 o1 y. z- ^7 n! i$ l1 Q
  31. #include <linux/moduleparam.h>: U; D% X5 E6 e6 v+ t
  32. #include <linux/sysctl.h>
    - K& G" C9 @$ P- f5 O
  33. #include <linux/mm.h>
    / E/ B0 k1 w1 S/ ?4 U1 q/ s
  34. #include <linux/dma-mapping.h>/ t$ S' R* z' F# F
  35. ( b4 p  s" c! P2 q8 j/ p- i7 i# ^
  36. #include <mach/memory.h>
    # j: p' S' m* @# Q% q! {
  37. #include <mach/hardware.h>
    , I0 K8 a* I5 y
  38. #include <mach/irqs.h>
    9 q$ \1 h) J) V& G0 B( m$ l/ K; F- m3 T
  39. #include <asm/hardware/edma.h>
    7 t! e4 f' z" t4 }7 h
  40. 8 y* h* |. Y! k6 x) }+ m- o& x
  41. #undef EDMA3_DEBUG; f4 c1 b, h+ v+ P3 S
  42. /*#define EDMA3_DEBUG*/
    1 W8 s$ v2 W$ u/ U

  43. 1 ~  m6 B$ K5 i9 q. M) n) Z
  44. #ifdef EDMA3_DEBUG
    $ h) Y' ]* I1 I0 p+ U2 w% y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    / k. e2 n5 K( m( o, j" d7 f
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    7 r& ]) P4 [: F1 ?+ w7 ^
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    8 d  u' W3 s5 J  j4 E  X; j% _6 B
  48. #else% T/ D& K4 o* G' t# s
  49. #define DMA_PRINTK( x... )+ K& T2 u: Z/ X. ]& h; l% }% ~
  50. #define DMA_FN_IN% b5 R) |) Q! C$ D1 G* b9 t
  51. #define DMA_FN_OUT
    2 t5 u  t, a4 S! k0 M
  52. #endif& Q* @7 Z3 Y. z! Q2 A6 N
  53. 3 n9 ?) f1 s2 b5 k* B- r7 n
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)3 k; R2 m1 E7 J) T: ?; p! l8 o" _
  55. #define STATIC_SHIFT                35 b) r1 J1 P3 q' h6 n- z2 ~
  56. #define TCINTEN_SHIFT               202 g- V8 ?7 Q' @
  57. #define ITCINTEN_SHIFT              21
    8 z0 i( U) t1 y
  58. #define TCCHEN_SHIFT                22
    8 t5 @9 U. \% N- i
  59. #define ITCCHEN_SHIFT               23
    ( t) ^' x: C, z: W

  60. - C" ?$ Y5 f5 A  W  p
  61. static volatile int irqraised1 = 0;
    # @9 D; X7 L+ M  B9 {! C  {- ~
  62. static volatile int irqraised2 = 0;' V5 j4 |$ S; |- y3 X2 x5 \

  63. 5 c" _9 [' ~( I. U
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & w8 e) ?, |: d- u. ^- j
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 t. I5 m2 V! C5 k+ ]2 X( T
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! C0 n& J5 }& l- y$ c: v8 l, |
  67. + _7 _* c4 ?# r; x( ?
  68. dma_addr_t dmaphyssrc1 = 0;
    7 K" e- L  e% f$ A
  69. dma_addr_t dmaphyssrc2 = 0;: T# D  w- p, `
  70. dma_addr_t dmaphysdest1 = 0;
    4 U0 I8 e. L: J: ~- v- @4 P
  71. dma_addr_t dmaphysdest2 = 0;
    - C% [2 w; w* G) q- L' ~; \/ @/ P

  72. ! }1 D- [* \  X3 v0 v" z; k
  73. char *dmabufsrc1 = NULL;
    ( D9 _4 O, q$ P6 u3 r) f
  74. char *dmabufsrc2 = NULL;
    1 m( C; j" i8 Q% ]" {0 d# @
  75. char *dmabufdest1 = NULL;
    , v, ^  A) j" {& r/ n
  76. char *dmabufdest2 = NULL;7 O3 u& F! C* G- t- t$ ~& ~

  77. 7 e# }! S( t  ?- r" R
  78. static int acnt = 512;) M" N; g2 j$ Q  c8 b
  79. static int bcnt = 8;0 w$ c* ?8 x5 J- Y/ A
  80. static int ccnt = 8;- R& @7 u6 f9 s, V8 a# Z+ i: R

  81. ; X6 y  r9 g' Q4 m4 I6 M0 V2 p* f- o
  82. module_param(acnt, int, S_IRUGO);4 X! ~2 j) F- l2 L' Q
  83. module_param(bcnt, int, S_IRUGO);
    & l9 T2 J% |, F
  84. module_param(ccnt, int, S_IRUGO);
复制代码

1 W$ f( m! l7 l3 L; _4 ^0 e2 e# X2 r$ v
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 M8 @7 t+ E8 D. `- Larm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 w) \1 k6 e+ Q! d2 M! C4 P     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, R( p- M' t7 z! I/ u! I

  [. G, C% K% S1 e: j& P4 J1 r7 q3 r
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-10-27 19:47 , Processed in 0.041566 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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