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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ T" ^( u+ @; Q) ]& h" N2 G, k  ^
  1. [code]EDMA sample test application
    ' `5 I  {3 C% w- H
  2. /*
    , Q& @/ b' U- n
  3. * edma_test.c5 i+ J' v' G* O+ n! Q0 W
  4. *
    5 }4 r; X7 O* n8 ^! V
  5. * brief  EDMA3 Test Application
    ( A( }4 [2 H' `* Z$ W
  6. *
    9 U) ~) B% z! ?, U, W
  7. *   This file contains EDMA3 Test code.1 l2 M" f6 Q( H' I: W: g2 c0 A2 Y
  8. *8 [0 b/ D% Z0 H; [$ j9 w. x
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    " |, `  I/ Y6 \5 I2 `
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    , Z6 y+ E2 f+ m/ Z* l
  11. *         TO CHANGE.
    $ ~" U3 k3 [' w4 K- B+ c# C! x% }( [" E
  12. *$ M0 E6 H2 P* Q* m2 `4 T7 ]' m  v# W$ d
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# }' X8 n/ F: V% t: C
  14. ** h  L+ J9 q% ]8 \* r
  15. * This program is free software; you can redistribute it and/or
    % [/ N6 ]! |$ ^6 B+ w5 a6 ^- z
  16. * modify it under the terms of the GNU General Public License as
    - q3 }' E& N8 m  V! o' Z
  17. * published by the Free Software Foundation version 2.  s4 ~  X1 V6 L
  18. *
    . S5 _% g/ I2 N; C1 x7 x
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    0 h0 Z0 D' H) U" H4 u0 {
  20. * kind, whether express or implied; without even the implied warranty
    $ C# q. Y2 i. [/ F% }6 T
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    9 b% r# r& q* B# B2 f/ f
  22. * GNU General Public License for more details.5 ?' _: ]5 b2 a# t( z+ {/ r
  23. */" A+ G$ p; p: Z5 L/ s
  24. * P' ]. C5 E, p( a1 ~+ ^) O
  25. #include <linux/module.h>" f0 y1 r# \3 y
  26. #include <linux/init.h>
    & e& Y( e5 m9 l. N$ t( Q6 D
  27. #include <linux/errno.h>
    3 l0 F% D- J/ m/ O; t/ w* [
  28. #include <linux/types.h>
    1 @- [0 s4 P: g0 V6 T. Z
  29. #include <linux/interrupt.h>
    , u" `7 g5 a: X) V* @
  30. #include <asm/io.h>7 n/ k  y3 f' c' Z9 b2 A
  31. #include <linux/moduleparam.h>
    ! N5 n* {- I9 P  ~* q% U5 M6 A
  32. #include <linux/sysctl.h>+ A* z8 o$ [* R! f. n6 H% u3 `
  33. #include <linux/mm.h>: Z0 E2 ^+ x! x' ^5 c7 ]' s2 a
  34. #include <linux/dma-mapping.h>
    : t5 R$ \% s+ ?+ {4 v0 W- m9 B

  35. . M0 r; U/ J: C' ]
  36. #include <mach/memory.h>+ u8 C+ f( o2 _# e3 Y/ G3 L& k9 p. K
  37. #include <mach/hardware.h>' X& L0 A0 V! {2 L9 L) s
  38. #include <mach/irqs.h>2 t- e6 O. q8 @+ L0 j% `
  39. #include <asm/hardware/edma.h>
    & G; {2 L+ t- j7 v" S5 ^

  40. 4 s" `) K, O, `, v+ I' V8 o
  41. #undef EDMA3_DEBUG9 k+ R* }+ n$ l* f1 J) k
  42. /*#define EDMA3_DEBUG*/
    $ ^- N* `& [; E+ t+ `

  43. ' g" j7 c9 V  N; K2 U) {" q
  44. #ifdef EDMA3_DEBUG
    / t& P3 J0 ?5 O8 r# W! f2 H9 r
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 `" ?# a4 o( ~6 E* D0 Y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 k  X5 J# Z  F! ]0 F( n
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). w# [4 E/ H6 W! l/ b6 o, x" q2 X8 }
  48. #else( Z" d7 v* z( L1 B
  49. #define DMA_PRINTK( x... )
    ( W. `, |  z3 Y% h1 S, Y
  50. #define DMA_FN_IN
    ! u2 F2 V$ J4 G
  51. #define DMA_FN_OUT
    ! o7 m1 q# A* W6 i
  52. #endif
    3 N* u' c( s. R1 y8 ?# h8 [
  53. $ \* |! W3 ^* I+ R5 t& _8 P1 R
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)% j5 {- ?5 X# c# s. I
  55. #define STATIC_SHIFT                3$ Z, u. b4 j6 o
  56. #define TCINTEN_SHIFT               20; c, O- Z' c( @) R, c3 A
  57. #define ITCINTEN_SHIFT              21
    ! ]" Z9 ^# s5 e7 q9 Y
  58. #define TCCHEN_SHIFT                227 P/ e+ P! Q8 T% L
  59. #define ITCCHEN_SHIFT               23( J' R: h  M4 B' H

  60. ; j) m6 d, d! r# ^$ s' s
  61. static volatile int irqraised1 = 0;
    & ^% ^& M( w/ y/ m; X& l/ f& N
  62. static volatile int irqraised2 = 0;
    & \+ p( ?, |. T) Z: }% R

  63. - H' V8 Y+ `$ g% a8 n& d5 R: u9 h/ r
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 g, H; ]3 k3 `1 F: I8 J
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( \4 ^% O4 j) z" A. J: D6 m( [2 |/ R  X
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      f; A! S* g0 R0 r8 v+ n: Y
  67. , \+ I! R# F/ v, i6 I+ p: B, T
  68. dma_addr_t dmaphyssrc1 = 0;1 n& D+ F1 b- j% U
  69. dma_addr_t dmaphyssrc2 = 0;  ^# p* C$ X3 V$ l0 g$ J
  70. dma_addr_t dmaphysdest1 = 0;
    % b, g3 Z- @3 S: o' V, G: _
  71. dma_addr_t dmaphysdest2 = 0;% m4 q% i$ J; ?

  72. " }! }  ~3 b7 w1 S# q+ }  s9 A& `
  73. char *dmabufsrc1 = NULL;
    * w3 Z7 ]7 K3 m
  74. char *dmabufsrc2 = NULL;
    5 h# K) z# j# [9 ?( ]% Y) ^  P# x; g& O
  75. char *dmabufdest1 = NULL;
    : l: a+ Y' P/ X
  76. char *dmabufdest2 = NULL;# ^2 e3 E4 W2 T. s  ]+ z, V. P

  77. & b7 D3 ?$ E- T9 y2 s- h: J/ A
  78. static int acnt = 512;  [+ D  V( Y! c* W3 G. u" h
  79. static int bcnt = 8;# W4 }# u0 B2 a5 H- r
  80. static int ccnt = 8;4 Q( f  I$ {0 o/ W& ]
  81. - g" b/ `# i6 t/ M& X
  82. module_param(acnt, int, S_IRUGO);
    9 ?( w  |- I8 C# \; d
  83. module_param(bcnt, int, S_IRUGO);
    $ N. Q" }  o# i9 L
  84. module_param(ccnt, int, S_IRUGO);
复制代码

2 n' ~/ y. x' x( R
/ q# R6 `& q4 p0 X2 U! `% a) t      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ `7 F. C  p! o3 {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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" K2 b3 u0 N9 K& O7 r$ _2 V1 Z0 a     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& O5 u# m2 Y$ d# l  Q, s9 C' W

; d9 i& v. v5 a
6 E2 D: o! L+ E* p1 ^2 x: J
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-10 13:56 , Processed in 0.036177 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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