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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' w4 E5 P7 G8 q
  1. [code]EDMA sample test application" ]# n1 s( u7 w7 ^5 ?
  2. /*
    + y6 q, Y4 [9 f
  3. * edma_test.c( }! y$ Z$ K+ {( N& B2 _
  4. *3 |& A, H, F# ?. J& U/ ?
  5. * brief  EDMA3 Test Application3 @+ f( Q$ t$ G
  6. *
    , J; o: v2 H2 y) L4 `
  7. *   This file contains EDMA3 Test code.5 W4 r1 \5 Q6 e( @; s( D
  8. *
    ! f- n$ l1 Q. e5 s
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    * x; m- J) @9 a0 T+ o8 V# {( a: z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ a$ D; w. Y$ u
  11. *         TO CHANGE.
    4 k8 W# }) O& A5 K
  12. *
    2 N* y! B4 M" j, v
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    8 g. _$ b6 K1 n6 v5 l! V& N: k( i) f. U
  14. *, W# M; ]' `) u3 F
  15. * This program is free software; you can redistribute it and/or* }/ {0 l2 P* ~8 a# R, u$ [& b
  16. * modify it under the terms of the GNU General Public License as& |# F  s* m1 x% q; \! y2 v
  17. * published by the Free Software Foundation version 2.
    - E! [4 B! k0 a
  18. *
    7 n3 B+ T9 ~5 ]
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 h' [8 g8 m4 f# `
  20. * kind, whether express or implied; without even the implied warranty
      p. W+ ]  V5 V4 N
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the8 s% i/ R  F! ^5 O7 s
  22. * GNU General Public License for more details.* W. C2 K7 ?& A+ N/ {
  23. */9 s" `$ U/ |& M/ T
  24. 1 J5 U' y/ m- J: Q( L7 c
  25. #include <linux/module.h>
    & C# Y! L" L2 Z0 ?  I4 g3 m
  26. #include <linux/init.h>$ S: k/ R2 u# t! Y
  27. #include <linux/errno.h>* B/ `; }% C( K
  28. #include <linux/types.h>
    3 X% m6 x7 _5 _4 A1 C
  29. #include <linux/interrupt.h>7 T7 S, u3 E$ \
  30. #include <asm/io.h>+ [( `+ a  v; P% C) ?
  31. #include <linux/moduleparam.h>; {4 J/ Q9 n* z/ {0 Y% _
  32. #include <linux/sysctl.h>. w& x. }! A) \# k$ N( H) z
  33. #include <linux/mm.h>0 w; T1 C4 W) N
  34. #include <linux/dma-mapping.h>+ C' c+ O. Q$ X; w; L% T& I3 b
  35. 1 ^1 G5 {7 ?, U7 `
  36. #include <mach/memory.h>
    ( y; O" C$ u2 K2 b5 _  ]* Q7 A' F
  37. #include <mach/hardware.h>. m1 f+ ~7 I: u2 Q
  38. #include <mach/irqs.h>- D/ N6 c3 t2 L! M) H( O
  39. #include <asm/hardware/edma.h>/ Q3 F) x1 S; g

  40. 3 R) ^5 m6 u% N
  41. #undef EDMA3_DEBUG
    ' R9 c) T( R* }" M. Y# s/ y9 J5 d
  42. /*#define EDMA3_DEBUG*/
    3 z0 q! h, {( o$ d- A& b
  43. 7 _. b9 v7 d2 ?& w4 c7 H
  44. #ifdef EDMA3_DEBUG
    $ U1 q9 M6 ?* @3 g# l
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): x. z0 g! O1 Q; H( l
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 @5 x: E. m# h  Z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    0 ]% b7 F9 d2 K4 e" E
  48. #else
    % }# F0 x- G0 m; a$ R6 S. F' G( v
  49. #define DMA_PRINTK( x... )
    ( V+ a( x) U! u/ l. L
  50. #define DMA_FN_IN3 t, i* |" p; X, I! d
  51. #define DMA_FN_OUT8 g. M, T5 }* @/ {
  52. #endif0 T0 P" D. c9 k! u& l2 s# c% ~! `3 `

  53. ! I9 y4 R$ z; E+ H: U# H: n5 Z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    . n# O0 k% A! d; G! X, d1 K9 |
  55. #define STATIC_SHIFT                32 Y' Q; w. b6 ^% l8 l0 Q6 F
  56. #define TCINTEN_SHIFT               20
    - y$ D* L! k8 g5 n) n- B- T
  57. #define ITCINTEN_SHIFT              21
    % e9 A+ N" ?: B. P
  58. #define TCCHEN_SHIFT                22
    ! v1 c2 W( |6 ^
  59. #define ITCCHEN_SHIFT               238 t4 v& o" Z! A% `
  60. ' m0 a- \! H5 a* A' G
  61. static volatile int irqraised1 = 0;& z& P8 S* ^. E2 ^( ]
  62. static volatile int irqraised2 = 0;+ _) Q3 c  [% j( r$ P- c( H
  63. 5 P, ^/ b8 O( g
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + y0 t2 _0 Y; }' M2 g/ }/ [# l
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, a  P- P) b/ L, g; `( V; l
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' \8 B0 Y. A$ y* b

  67. : q4 {: E9 ?) S8 L. b- g9 |  L
  68. dma_addr_t dmaphyssrc1 = 0;
    ! l% Y  g' q/ c8 H
  69. dma_addr_t dmaphyssrc2 = 0;/ O  k% X( q& d# W* h& S
  70. dma_addr_t dmaphysdest1 = 0;& D. ]9 ~5 Q0 i4 ~, m$ P8 u
  71. dma_addr_t dmaphysdest2 = 0;9 x6 V" y, {: z/ X# T- T

  72. 9 N# v; i: V- c" w
  73. char *dmabufsrc1 = NULL;8 U. P# S' Z6 g! A! z: G
  74. char *dmabufsrc2 = NULL;2 f( G* I8 E9 ]! L8 i. A
  75. char *dmabufdest1 = NULL;6 `" K, G1 f4 D7 v
  76. char *dmabufdest2 = NULL;
      Z2 K. [' Z, w9 X$ x

  77. 3 O8 S* R( I- x% u
  78. static int acnt = 512;
    . i% I$ H  F" E  }1 D/ e) |$ M: D: ?3 [
  79. static int bcnt = 8;$ U: a& c8 n  M- X& T
  80. static int ccnt = 8;
    " s, E/ x9 q1 x4 ~: V8 k0 p
  81. # \! ~* `( h/ {1 p, w
  82. module_param(acnt, int, S_IRUGO);
    ; L7 p' u6 u- i7 X% H$ H# P+ L
  83. module_param(bcnt, int, S_IRUGO);
    ; Z6 b/ \2 I9 d* y6 a9 x
  84. module_param(ccnt, int, S_IRUGO);
复制代码
5 c, }  Q" ]% \* F7 U. t
9 b7 o4 |. @7 u$ l5 i3 ~
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, l9 `: C* o; ~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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* Q. l! d9 {/ f* I1 b# E     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) w9 H2 Z: r! q6 \

6 z# U" N. `% j% g: A$ v/ m8 v/ }' `3 p0 Q0 e6 x
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-11-7 12:52 , Processed in 0.041245 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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