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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 b+ a9 |- F" s% l/ a
  1. [code]EDMA sample test application8 E+ I# x7 \3 }8 T8 A- h5 s+ o
  2. /*
    * d9 T9 p1 r+ ?7 U) ?( `
  3. * edma_test.c7 W3 \- M: I# S$ w( d6 s
  4. *
    / j5 o- C7 u: A6 E) y0 i5 N9 k# V
  5. * brief  EDMA3 Test Application) a0 R: ?8 z2 v& g% P
  6. *
    8 ]9 M0 O9 Z( b- u' O
  7. *   This file contains EDMA3 Test code.
    ! A! `, p' V1 R/ e
  8. *, w9 r( L6 r0 @2 Y! u0 g
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' w" [  H- ^6 o7 r! d
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% o! i3 ?/ B- G7 h' U7 `
  11. *         TO CHANGE.6 i1 S$ W8 i: W  _
  12. *
    ' [4 H) r& t, {/ g" M' y/ l; q* }. G
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    7 J2 y" x9 a% |% r. a
  14. *
    ) p( t" L5 F; \# ~! y) a! d# C
  15. * This program is free software; you can redistribute it and/or
    + c* V) C. K1 w( w5 F, ]
  16. * modify it under the terms of the GNU General Public License as
    2 [* D/ r" }2 P+ X5 e5 \! s9 C
  17. * published by the Free Software Foundation version 2.( p2 I9 L5 h; t
  18. *; E2 w: e  N7 A0 k- M2 K
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any; k* R; o1 D7 m! _
  20. * kind, whether express or implied; without even the implied warranty6 s# }6 Z4 m6 r7 M/ B/ f6 F3 g
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the6 b: E9 a9 t& l8 p& ?
  22. * GNU General Public License for more details.7 ~5 x" M: q8 ]; k3 x
  23. */9 G% B5 ]( ?$ O1 g

  24. ; h9 {- \6 V. O% ^: |
  25. #include <linux/module.h>5 J8 H2 K0 F( D9 U
  26. #include <linux/init.h>
    $ u8 [+ E; l2 D7 v- d2 d
  27. #include <linux/errno.h>
    $ O  N/ H. J- y9 L. T
  28. #include <linux/types.h>
    6 U, F. u5 k- J, ]; }. [: \
  29. #include <linux/interrupt.h>
    + R) ?# R0 c' a' N& q* o3 m: `
  30. #include <asm/io.h>- I% h  t+ O2 c8 ?' [; r  Z% r
  31. #include <linux/moduleparam.h>" H4 ^$ k2 L" z' ~+ I! m1 Y  J
  32. #include <linux/sysctl.h>" g! ?3 n+ @+ s% n' W
  33. #include <linux/mm.h>2 A, n7 i+ a1 T* h% a6 ~9 Y, Y/ x
  34. #include <linux/dma-mapping.h>, P; F8 @. I  M5 F8 P( Z$ n

  35. 0 G3 s- f" K/ s
  36. #include <mach/memory.h>
    - ~0 E1 A# q* K* [
  37. #include <mach/hardware.h>  y( ?  i- n$ @( S. L" h
  38. #include <mach/irqs.h>1 F; N% Y! \+ C7 A' j
  39. #include <asm/hardware/edma.h>. V, d) q/ ]* I  v% v) J

  40. 5 r, G4 [4 ^  G
  41. #undef EDMA3_DEBUG
    , q" F. S# [4 E$ z+ e8 Y8 P" w4 {
  42. /*#define EDMA3_DEBUG*/* e& ?! x1 ]! ~6 C9 W

  43. . c) A8 B+ @7 M  B% w
  44. #ifdef EDMA3_DEBUG
    - v* u% U& A. V0 S( y& c* ~# N; d! G
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ V9 ^4 y/ y1 V7 T) o8 B$ R
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% _" Z' N) B: a2 e' U+ A
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    + Z& w' G. y) k9 ~! y* s
  48. #else8 E  c: G; J3 o8 V. v4 a. W! r+ d
  49. #define DMA_PRINTK( x... )  W; E0 Y0 E  |  a  z
  50. #define DMA_FN_IN
    . `- J& @3 U6 o3 z: x3 p; W$ W
  51. #define DMA_FN_OUT, ^; c& A; J" W9 {2 w
  52. #endif  e' Q& f( e& Y. Y& S
  53. # y" P# B4 Q% `: K
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)8 E2 J7 u2 \3 S) {, _' x+ r5 v/ R
  55. #define STATIC_SHIFT                3
    " [* ?& C/ q# m* X
  56. #define TCINTEN_SHIFT               20: t" ?8 I& I$ z- W0 @/ O
  57. #define ITCINTEN_SHIFT              21: P( U6 f- J$ R/ x+ h, ?$ Y/ q- s
  58. #define TCCHEN_SHIFT                22- e9 K0 p% }1 `: l
  59. #define ITCCHEN_SHIFT               23
    / B, }* i( D. h% t: v  U$ n2 U
  60. " N: L$ P% x$ z) q4 i4 _
  61. static volatile int irqraised1 = 0;
    4 X  z% W( o6 ?; ]- _2 L
  62. static volatile int irqraised2 = 0;& m. u: b3 k2 C: }$ N# W, M* {
  63. / c+ J- s$ l$ e# B7 B
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& o8 N6 `" e; ]: s
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 P4 ^+ N0 ~* z0 _6 o2 O& V& |' P
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 I6 o3 k3 V3 |. ]* c

  67. / {- \) r) a4 ~1 G2 j, }
  68. dma_addr_t dmaphyssrc1 = 0;: i) `! M9 D% a
  69. dma_addr_t dmaphyssrc2 = 0;
    ( G  t  N& |& M& W1 P
  70. dma_addr_t dmaphysdest1 = 0;
    0 @+ g" {. c1 d* @
  71. dma_addr_t dmaphysdest2 = 0;9 H, V" `6 Y" j- J

  72. - ^' e; O: x: }8 V
  73. char *dmabufsrc1 = NULL;  j( f+ w0 y! _, L! [
  74. char *dmabufsrc2 = NULL;0 U, O! \" O/ @2 G1 _! K: \% |, r* a) g
  75. char *dmabufdest1 = NULL;6 B6 ?2 i/ t5 J& E
  76. char *dmabufdest2 = NULL;
    4 \9 e1 {& c. v, |2 W3 b$ p
  77. - a6 k; E( N+ @9 R; E! J  [
  78. static int acnt = 512;
    7 f  A/ T; E, H1 j: J
  79. static int bcnt = 8;
    $ U, Z# [8 p/ M  ^! F! d1 h" ^
  80. static int ccnt = 8;( w0 M# ^) K1 U- F( J

  81. + Z* Z, B1 \' \  }6 G9 O/ ^
  82. module_param(acnt, int, S_IRUGO);
    0 @! P! w7 ~: Z* C% g( Z
  83. module_param(bcnt, int, S_IRUGO);
    3 @  L$ M8 q7 H  m0 \+ I
  84. module_param(ccnt, int, S_IRUGO);
复制代码

, P7 H3 a& t! S0 p) u
' _5 d4 k2 a; d) {: [      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& _! b# b) g& E% u; t9 c+ o- L7 t
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; _: T6 `3 Q% L; j     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
  o) D! f; ?+ U; ]1 G* s7 ?0 n
1 p0 [+ a# h1 l9 f! m9 Z" I3 ]
- `: m' a2 h8 i4 y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-10-23 18:40 , Processed in 0.050828 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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