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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 d6 Q; @, [9 n+ }/ Z
  1. [code]EDMA sample test application! L7 F6 s" T7 I& R
  2. /*1 c+ G+ s; X' Y% ?4 f
  3. * edma_test.c
    / S! c2 G# ~9 v: c) f# \2 E) Q
  4. *
    + V$ _7 |+ v, U* S  t
  5. * brief  EDMA3 Test Application
    $ A' f& K# n3 _. V
  6. *' {* Z( `8 h7 J6 u; p
  7. *   This file contains EDMA3 Test code./ {2 Q  x8 g  ~2 u" O
  8. *
    $ F" f4 v6 I# x7 u* ?
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, X9 T! k( D( P, u4 x
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    9 v7 i# e: R2 ^$ h$ b; w
  11. *         TO CHANGE.
    & R* N8 B8 q! v2 G- p( S/ b
  12. *$ z+ }: b5 r1 Z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 K% q" Y7 C' ]9 D+ u
  14. *
    + l0 k! h% }( i  E4 `
  15. * This program is free software; you can redistribute it and/or- t. l7 `+ v& ?9 M
  16. * modify it under the terms of the GNU General Public License as
    . ^, d3 L, R- _0 s
  17. * published by the Free Software Foundation version 2.( j- B1 P9 O, V: F6 Q: ^  Z
  18. *
    2 y4 f  K6 L" F) f
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ' }! w9 ?! {( _1 |
  20. * kind, whether express or implied; without even the implied warranty8 g' A& b+ O  s7 w9 t
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the) `. R8 b+ r4 x! j/ B
  22. * GNU General Public License for more details.' `; X, [* l; o( w! o
  23. */: w0 H. i! A% k( {& M# K5 L

  24. 6 y% Y2 O7 y* C: |
  25. #include <linux/module.h>
    ! O. A# \+ o& p+ E- J
  26. #include <linux/init.h>" H  v8 d; ?9 H, T; S) }1 E
  27. #include <linux/errno.h>% p4 W2 K' l/ ^
  28. #include <linux/types.h>
    2 o% Z& W0 m6 B) F& F6 s
  29. #include <linux/interrupt.h>
    % g2 F6 }6 f2 g5 p: ~  K
  30. #include <asm/io.h>3 I  ?1 v# b6 B
  31. #include <linux/moduleparam.h>) v; y. c4 [: a
  32. #include <linux/sysctl.h>; b0 S' L0 c7 u
  33. #include <linux/mm.h>
    % V  n( X7 {# t
  34. #include <linux/dma-mapping.h>& l) \2 n7 d  {( F& W, B% t. a
  35. + t1 W( H1 q/ K  L" `
  36. #include <mach/memory.h>- g% C# s  J& _6 E/ N
  37. #include <mach/hardware.h>
    ( V8 [# h# h6 F7 z) ]0 g
  38. #include <mach/irqs.h>/ g6 Q  {$ Q. T9 c1 P" _
  39. #include <asm/hardware/edma.h>) d9 `$ K& G6 P6 o8 P+ F7 I
  40. ' X1 x, {$ q2 d* f
  41. #undef EDMA3_DEBUG8 H$ H3 U! ]1 I4 l: R
  42. /*#define EDMA3_DEBUG*/
    8 Q4 W$ K7 ^9 p, a
  43. - O9 s+ }9 q. V. a7 n+ K: e! A) p+ R
  44. #ifdef EDMA3_DEBUG& v, p/ B  n) u$ n7 C/ {
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 Y9 w+ t6 s7 ?$ {4 m/ i2 k& R
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    4 W$ Z/ I; \1 Y  }" F; f5 F
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ! L6 t# ~+ b, @; C! k% R
  48. #else1 a1 c  |: Y3 w2 Y( R  \
  49. #define DMA_PRINTK( x... )
    8 W; [, [; A& e
  50. #define DMA_FN_IN
    ) o6 }4 e$ R% ~: _* E1 O: a- s- N
  51. #define DMA_FN_OUT  U- I. A1 \- ~8 }$ H; k* w( e
  52. #endif6 s7 J1 C2 x! l% z: e. m( r; _

  53. 7 t# N% r1 a. @, N0 d  m8 d
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    - {4 Z5 l2 t$ T5 H
  55. #define STATIC_SHIFT                3
    5 K/ ?/ ?- @5 X1 L5 B
  56. #define TCINTEN_SHIFT               20
    ) M  I9 y6 ^' q( \6 z
  57. #define ITCINTEN_SHIFT              21' c4 B$ V2 N7 H! \# \# H' i: R1 Q
  58. #define TCCHEN_SHIFT                22
    9 I( c2 N, c9 x( v8 Q% ]
  59. #define ITCCHEN_SHIFT               23& x# v- [7 N( h* Y! [1 H/ O
  60. 6 N& N) v' s- D& G5 D7 q7 s9 O
  61. static volatile int irqraised1 = 0;
    . L# }& S0 Y1 r. `5 k
  62. static volatile int irqraised2 = 0;* ~0 X6 |" }4 |4 {* j; _% O( {. w

  63. , d# s& I  O3 Q1 l; V, v
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 {; c! u4 T$ ]( D
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 t5 M! k, {6 C) q, ~: p# v
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 J' r! F7 Y% F1 d6 D3 P
  67. # D3 ?. H4 X$ a5 t
  68. dma_addr_t dmaphyssrc1 = 0;
    + Z2 Z5 w% j; o  e" w
  69. dma_addr_t dmaphyssrc2 = 0;
    3 r' e- b' P( k7 N
  70. dma_addr_t dmaphysdest1 = 0;
    " n$ X& Q6 U) S7 B2 r! L& w- C* y* j' [
  71. dma_addr_t dmaphysdest2 = 0;  m! y+ w; ?0 c
  72. * I9 k1 n9 m) u! C/ `& q/ o
  73. char *dmabufsrc1 = NULL;0 h' D7 E+ W0 [( Z+ N, h9 W& e
  74. char *dmabufsrc2 = NULL;' \1 a# N2 ]+ N8 t( d' [' t) `
  75. char *dmabufdest1 = NULL;
    % {! t" T9 ?7 m2 g# D+ D- `3 R
  76. char *dmabufdest2 = NULL;! O! ^2 |% o: J

  77. 9 n' l0 N% a5 |
  78. static int acnt = 512;9 e' h  K0 r" |# Q0 ]1 H  ?) [: J
  79. static int bcnt = 8;
    ' E3 y" [( ^. Y" d2 {- Z+ W. C2 P
  80. static int ccnt = 8;
    , j7 M5 ]6 L) @" w2 i

  81. * a  W9 U+ `3 h4 ~
  82. module_param(acnt, int, S_IRUGO);7 W: n1 @1 Q5 {% P0 N* U# h( C" {
  83. module_param(bcnt, int, S_IRUGO);
    7 }9 d1 o4 Y) t6 L7 f
  84. module_param(ccnt, int, S_IRUGO);
复制代码
! ]; p' T; J  B7 y( _8 c% r% j
8 v. F* i! j) y0 D4 y5 p
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用  e  x% L8 H; ?7 A7 X
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。  S% Y% ]: G4 A# X/ `" P" Y
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: M4 m& _( p6 @+ M5 j8 N4 ~- s# d
6 B" C8 ~) Z( d& _
3 W" H* z$ N1 e: j
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-6 16:30 , Processed in 0.043001 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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