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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % E/ P( j' b6 M6 u7 `8 w
  1. [code]EDMA sample test application. s* p; a3 Q1 \- P( p' o! B' I
  2. /*0 z3 L1 a. d( ~% ^+ X
  3. * edma_test.c
    $ a. q6 `4 R& R+ L0 f
  4. *' a( n6 A2 Y4 u9 ^. e9 O2 ~& ^- H* W
  5. * brief  EDMA3 Test Application2 q8 C  |% Z9 V6 `1 j+ ^5 u
  6. *
    ; C+ }7 D. m2 a7 b% W! \5 E
  7. *   This file contains EDMA3 Test code.  T1 h1 `$ h2 ]! _: p7 _7 g
  8. *
    ( K4 {0 Z% Z. i( r+ K- j
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
      x' I, v# i$ T/ K* ^
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 i' T! E# G* K
  11. *         TO CHANGE.1 E! f' d* \7 T4 c- O
  12. *
    , l! h) F6 o0 q& [: j7 B2 B
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    0 F5 a4 b; X3 f) t& b6 [
  14. *
    - b. M  a# R/ q( R
  15. * This program is free software; you can redistribute it and/or
    * n, R: |  }; {$ t8 q4 _
  16. * modify it under the terms of the GNU General Public License as
    / h- ^. s( k% J: a$ X1 I( L
  17. * published by the Free Software Foundation version 2.
    : a7 \8 h- x8 p' G
  18. *
    ' H( q, k+ @7 s! F* G7 X
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    1 O/ B/ I2 Y/ _  S) f
  20. * kind, whether express or implied; without even the implied warranty
    1 z7 D  {4 F) `6 J$ o
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    * a2 B5 n5 r2 h& @8 y$ K2 {2 W
  22. * GNU General Public License for more details.2 k/ S4 [0 H9 k. ~! m: `4 X# j  u* ?
  23. */. T7 d, L& z0 M% l7 f1 J0 `0 \& A
  24.   C! {/ g1 a$ Y0 U
  25. #include <linux/module.h>
    * V3 I; u, u3 _( P5 P+ N% N( C
  26. #include <linux/init.h>" O6 Y( |3 t: G9 |2 t' M
  27. #include <linux/errno.h>
    , j2 X- O. u( u2 I- r) e
  28. #include <linux/types.h>
    5 @- b" u6 h& i% Z* m/ ^2 x
  29. #include <linux/interrupt.h>
    6 |; ?+ m3 W- M* M% O$ D
  30. #include <asm/io.h>
    7 [) U- \4 x. r+ W& l" ~) ?& ^
  31. #include <linux/moduleparam.h>
    / y' S4 a# g6 O0 z5 j! h; V3 [6 l, ?
  32. #include <linux/sysctl.h>. {3 W6 W; j+ S! D
  33. #include <linux/mm.h>
    : b4 h) ?" D7 G. P
  34. #include <linux/dma-mapping.h>4 ]$ ?3 j0 m2 Z1 `7 m, \
  35. . p8 W* W0 T# F! p9 M5 U: B) J
  36. #include <mach/memory.h>
    * A) t4 }! f+ c$ |; H" A
  37. #include <mach/hardware.h>
      |5 u- ^9 b2 N+ x) [
  38. #include <mach/irqs.h>
    & p7 S$ A. F3 p" c1 ~  S1 ^" ?- ~
  39. #include <asm/hardware/edma.h>2 n. ?( q5 a: A( O! X9 B
  40. & F) }4 h. J, G  c& s
  41. #undef EDMA3_DEBUG; }. n2 Q" ^9 U0 D( F9 t4 ^
  42. /*#define EDMA3_DEBUG*/
    1 A, O; S" _$ u4 g' q
  43. $ s" Y* T7 m3 A
  44. #ifdef EDMA3_DEBUG
    ) r5 F. u. @' ~1 @& L* W
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- z2 q# w9 V4 F: ^" }  o
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    6 Z7 u9 C' y9 ~7 U
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    - Z9 f( s- e+ o5 J8 n1 T$ O
  48. #else3 Q* _1 N7 `$ F+ p5 W1 b7 @
  49. #define DMA_PRINTK( x... )
    / v( ^3 \2 g& e
  50. #define DMA_FN_IN) z1 W/ n# A( c; D) N/ E
  51. #define DMA_FN_OUT
    ( ?) K' x9 @# `
  52. #endif2 x. z. l0 J9 W5 C2 ?1 r2 E( K
  53. ; _: s2 ]3 t% c. j
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)2 d" G" c& O% E# M9 |; W* m
  55. #define STATIC_SHIFT                3$ V) C% j3 b* J" q3 p* w) m
  56. #define TCINTEN_SHIFT               204 g/ d) U3 J. @4 Z* T/ t1 H% x
  57. #define ITCINTEN_SHIFT              216 o3 ?, V% n' h" s( _9 v! X
  58. #define TCCHEN_SHIFT                22  J0 ?- j& Y# m5 B# b
  59. #define ITCCHEN_SHIFT               23
    + E7 `" E3 n0 A, T7 z

  60. 2 Q3 D$ S) F, l6 x! D6 t$ m4 H: ?
  61. static volatile int irqraised1 = 0;. W1 N$ d1 ?7 P: X! F3 F6 [
  62. static volatile int irqraised2 = 0;
    + b. O% y4 e# K! u7 S8 e. u

  63. 9 H2 a% k7 ?) c  N/ {6 j( C1 K
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; W- [+ @) I4 ^, N
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % G; i: S# _' m1 u
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : ?1 m6 p- W& G- S& W
  67. ! e+ c) O7 f2 a* L
  68. dma_addr_t dmaphyssrc1 = 0;# k5 W2 o: v( f
  69. dma_addr_t dmaphyssrc2 = 0;
    " R# B( j7 b9 A* s- A
  70. dma_addr_t dmaphysdest1 = 0;9 a/ D' c& T* ]
  71. dma_addr_t dmaphysdest2 = 0;1 l/ ~6 }( B" z' `6 n

  72. % [6 J% J5 ?# s, l/ a5 P
  73. char *dmabufsrc1 = NULL;3 c3 X9 g/ y6 ]% r/ B
  74. char *dmabufsrc2 = NULL;
    & B' X2 d" R; a8 B+ H, _
  75. char *dmabufdest1 = NULL;0 I4 }% q- `6 I
  76. char *dmabufdest2 = NULL;$ A4 v) e8 R; a, g4 j

  77. 2 W5 K4 Z" w- O: f, U- I/ N. f
  78. static int acnt = 512;$ g* g3 v# e4 T
  79. static int bcnt = 8;  b# B; `' {* V3 X5 u* y
  80. static int ccnt = 8;
    , n5 @1 _0 g( N0 F2 r: ?
  81. + F2 \% U" n4 N6 U
  82. module_param(acnt, int, S_IRUGO);
    % C. d$ F# [" T9 c! j
  83. module_param(bcnt, int, S_IRUGO);. c8 k  y# R2 b$ E- [. C, }; w
  84. module_param(ccnt, int, S_IRUGO);
复制代码
' M9 j7 y. {9 H' |6 K# ^) o( |: e

7 e; O2 r" J9 [) d      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 u! V9 u5 l  W2 h& e/ @- I4 A
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 J/ p+ t" L6 [. q9 Q0 R. Y     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& E, q4 ]$ g2 {& \5 K- W
& v& h1 o5 [* X% `  ~, ?
/ Y) D" ]1 A( X
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-13 16:58 , Processed in 0.050344 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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