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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 g/ @7 k1 B7 _+ I# q2 @
  1. [code]EDMA sample test application2 M3 x4 b8 V8 A" q
  2. /*4 `$ r9 D. [8 W* w# w6 a, M6 t
  3. * edma_test.c
    % K. ~# l/ K/ n% V4 F
  4. *( n! d3 p' {) l& f! g
  5. * brief  EDMA3 Test Application- m& Z- R; v0 F9 X
  6. *! ]9 A! \2 [  {: y/ ~6 }# [
  7. *   This file contains EDMA3 Test code.
      ~6 I# X9 N6 l: y
  8. *
      _# R$ Z8 }- u' ?
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 {( k9 H; Y# t. ~) u
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 r) ?9 E; O: J9 l6 E3 ?7 E8 b
  11. *         TO CHANGE.
    : _( h" j* I+ ]( t/ `7 P
  12. *4 j7 {1 p; b7 e, G9 W% l, P( B
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; U2 Q1 h& S( U" ?. [: U
  14. *! i, A; J" c- D$ j5 j7 ^% ]
  15. * This program is free software; you can redistribute it and/or
    0 Z9 y* W! a  R' K2 n# e( ?* y
  16. * modify it under the terms of the GNU General Public License as$ j& U( s7 e8 f" _
  17. * published by the Free Software Foundation version 2." c8 }% k* _( b$ [& F9 P* p
  18. *
    0 h# N9 h* a6 f  F/ f
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any; a" w2 @. L, v4 \+ Y4 ]# v% J
  20. * kind, whether express or implied; without even the implied warranty
    ' q0 `& ]7 }9 H& l( E2 G3 Z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    - s( N& L' u* w4 F7 z: ?
  22. * GNU General Public License for more details.
    . E- _5 [1 w$ c" z
  23. */* C/ G( T' L$ D9 M4 l
  24. , Z) F4 q6 k) j; D
  25. #include <linux/module.h>
    9 |% m3 O7 V6 M9 C. @* _
  26. #include <linux/init.h>
    3 [6 Y! X! T& P( q
  27. #include <linux/errno.h>
    * f* j# T- C& s4 x8 w: n/ d( D7 I
  28. #include <linux/types.h>$ G4 p0 \: b) s2 W7 H6 }2 v
  29. #include <linux/interrupt.h>
    $ f: y) a. I8 ]* f" L' s
  30. #include <asm/io.h>
    4 J2 X; m' Q' t
  31. #include <linux/moduleparam.h>
    + Y6 {* q2 B3 G
  32. #include <linux/sysctl.h>7 X3 n! k# d7 Z
  33. #include <linux/mm.h>" m, N- @; \" i  k, L
  34. #include <linux/dma-mapping.h>" K% D0 G! ~& R+ [
  35. $ Y( u! {3 p: ?8 Q: ]6 g
  36. #include <mach/memory.h>! T- q2 T1 M3 {1 R" m
  37. #include <mach/hardware.h>) U4 f9 d8 ]; ^9 C4 s9 }3 U
  38. #include <mach/irqs.h>
    ; O% _1 l" ]* Q! {4 p
  39. #include <asm/hardware/edma.h>
    + b# q- q% M: ^0 a+ X1 V/ |4 m; ^% a
  40. % h" F% z1 M% T- c4 I% h$ m
  41. #undef EDMA3_DEBUG5 \9 T. S0 [( A9 Q
  42. /*#define EDMA3_DEBUG*/
    + _8 V4 D  m1 x( r0 ]2 w" @+ n) a

  43. - S, d5 p! `1 F2 {2 y
  44. #ifdef EDMA3_DEBUG( C: z: f; d- H
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
      B, F; d3 U1 {7 h- I
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 @2 }# i  w6 g/ L4 ]2 J
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    6 {* l, g; o! N* n
  48. #else) }3 f, T' @# Z
  49. #define DMA_PRINTK( x... )
    ! Y1 d  j& t6 _% D& j& H
  50. #define DMA_FN_IN- k& H1 S+ Z0 a6 ~$ W/ c" v$ c
  51. #define DMA_FN_OUT
    5 X# R# j: ?8 p3 B$ T+ H7 E
  52. #endif
      i" [1 W; S5 @5 Q) G
  53. , `1 A  f  l7 v3 C# _7 P
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768). Z8 f0 D9 ^/ N8 q& A$ E- \
  55. #define STATIC_SHIFT                3
    3 E" f& a' F/ x% }
  56. #define TCINTEN_SHIFT               20" t& f% l: ^# I5 f& o7 q
  57. #define ITCINTEN_SHIFT              216 D; [/ q# s3 M: Y
  58. #define TCCHEN_SHIFT                226 d3 U# n( X. {$ @7 f! r7 w) y! J
  59. #define ITCCHEN_SHIFT               23# W$ F* z/ k3 O7 e+ o. P) X
  60. ) }/ h5 E. E; V1 g
  61. static volatile int irqraised1 = 0;
    3 p+ [; i3 s2 y6 V4 f
  62. static volatile int irqraised2 = 0;; A- e# l( K: u' V; b6 T5 c
  63. 6 N) r7 X: W2 f% C0 B7 J0 u; ?
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ S& W) l- _3 Q! O
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 C) ]5 T" D& z" W
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 c2 R' d+ N. s  Y
  67. 4 q. l5 f5 V4 d1 {
  68. dma_addr_t dmaphyssrc1 = 0;
    ; R& J# C( C4 S+ F" |. d
  69. dma_addr_t dmaphyssrc2 = 0;# C9 J( o; J6 e6 I" X: \
  70. dma_addr_t dmaphysdest1 = 0;
    + W# p6 _5 o& f2 |5 W4 p
  71. dma_addr_t dmaphysdest2 = 0;
    7 b# @: {) \1 \( f
  72. 4 [( ]. D4 x  @
  73. char *dmabufsrc1 = NULL;
    " o) r! D! p9 @
  74. char *dmabufsrc2 = NULL;( O+ i: J) o$ v- r5 _8 N
  75. char *dmabufdest1 = NULL;
    % t8 Z8 w8 u) d4 l9 s
  76. char *dmabufdest2 = NULL;6 S- M9 N4 d; {9 q' ?3 P

  77. * X! }# ^5 ~1 X( K
  78. static int acnt = 512;
    2 V2 F/ `4 u- Y9 c$ G
  79. static int bcnt = 8;9 q! u1 o3 j8 K7 Y2 W
  80. static int ccnt = 8;
    $ j: z% Z! p, J! H% y6 X

  81. 4 o7 Y/ Y, H2 S$ l2 t
  82. module_param(acnt, int, S_IRUGO);
    5 K8 S  W2 `0 h8 j' l
  83. module_param(bcnt, int, S_IRUGO);2 |& g% Q# Z0 Q6 t
  84. module_param(ccnt, int, S_IRUGO);
复制代码
& J, D; P2 }; w  P7 F; t
' ^# x9 r; |: Q" ~2 J/ p! H6 ~6 J2 z
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 ^( B" c" g) R$ b9 [3 marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) l3 M4 X- s& S9 x- Y4 F
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; y5 Y  B) M6 X0 u" `/ p, s% v
, l; }- g5 k" ^! y
( u9 w3 c2 A4 q+ b( ~$ P) j8 p, ^8 W
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-4 20:20 , Processed in 0.039851 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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