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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& X! j- E* T( P" }& _# E% Z
  1. [code]EDMA sample test application6 T, O# Z" @; t: R; x" d
  2. /*' v  F" J* [) o$ T6 n$ b; ?
  3. * edma_test.c
    4 Q, x1 P% a/ R: o  D
  4. *
    9 S- N/ {* a: N4 {
  5. * brief  EDMA3 Test Application
    " a9 `6 p( X. y3 l  e' [- d
  6. *6 l7 a6 _; d* v, u( N! J
  7. *   This file contains EDMA3 Test code.
    - f$ l1 U* \. ]5 \5 ^% l# u" P* r
  8. *
    ' C. U# Z, M( k1 w& O' i
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    - L8 y) u* d) r5 P( c' v
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ! D2 [% O) s# n6 h' f, y
  11. *         TO CHANGE.5 V4 V  k$ I- z7 C- I+ [3 L
  12. *; D6 Z- a: ~9 e8 h6 B3 z$ F' |
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    / B/ G( M# O% ?  q$ `' }
  14. *# T( v: X+ o5 B$ w/ P) C
  15. * This program is free software; you can redistribute it and/or
    ) p4 z8 T6 m' q6 h) f
  16. * modify it under the terms of the GNU General Public License as: S' n2 N  V( u  D
  17. * published by the Free Software Foundation version 2.& D6 M8 j5 J% q4 D. P; u. A
  18. *
    6 ]& w" k8 P0 N1 k8 z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 P- `- o, i; k  p: [8 o
  20. * kind, whether express or implied; without even the implied warranty
    6 N0 I$ P; q& ^2 i/ f  a4 `
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the+ t+ F# M' g8 p) `- [6 c! }6 L
  22. * GNU General Public License for more details.- E( N! c) P% m! T" o/ R
  23. */
    0 V4 i) Z  E' X9 n; y7 `% X

  24. , g  o' H3 t+ o2 r& |) t5 W
  25. #include <linux/module.h>1 [$ T# f; c- m; o4 ]4 T3 X; K2 F
  26. #include <linux/init.h>, X6 [0 m5 i! @0 C  r) l
  27. #include <linux/errno.h>
    5 k; X! s1 F8 T7 u
  28. #include <linux/types.h>: ^) G8 i* r# h, f+ k
  29. #include <linux/interrupt.h>, P" \: |) z! m: E& u
  30. #include <asm/io.h>5 a0 P3 n: X; }
  31. #include <linux/moduleparam.h>
    - ^- E- ~# U& H  A+ I! `6 C
  32. #include <linux/sysctl.h>  e0 G5 c/ R1 T* \+ k; \% v
  33. #include <linux/mm.h>
    0 \: r. C8 z5 P5 a1 q! v
  34. #include <linux/dma-mapping.h>8 e' f( W) I: A5 V5 ]0 c0 W$ d

  35. 9 z1 M9 s  Z% m1 X( G- @
  36. #include <mach/memory.h>2 G4 {! ], a+ m; f, }8 J
  37. #include <mach/hardware.h>2 r: F- L' d. T+ P, I
  38. #include <mach/irqs.h>1 i1 a# |3 _* q9 a
  39. #include <asm/hardware/edma.h>0 ~1 x$ m$ E* t/ U
  40. ; F: j/ p! ~0 W+ z$ F6 e
  41. #undef EDMA3_DEBUG+ m: ]: u) w, m! D. v
  42. /*#define EDMA3_DEBUG*/
    & T0 x2 C: F( X, q5 \2 U0 I
  43. 1 w. g* ]8 _# F1 @
  44. #ifdef EDMA3_DEBUG
    - N( s. Q: q5 R* {$ w6 E' j" ]0 r
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    # g# o" J( g+ u6 i# Z0 P
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    & g2 m9 a+ u' H1 f9 P! ?
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' j7 O# D. ?/ C( r+ {0 M# @. q
  48. #else
    ! S; Q* C) O+ M1 X% W5 t2 h
  49. #define DMA_PRINTK( x... )' c0 \2 Y; Q) V" @9 d
  50. #define DMA_FN_IN
    ' ~0 \! c0 }1 o
  51. #define DMA_FN_OUT
    8 A+ t0 d( E7 i/ c4 X
  52. #endif" n4 P! x0 @5 l, x, C3 Z) I( C
  53. + [9 a: N0 Q/ Q4 I' i$ T* G
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)* i1 K  @! M' g7 {" j; c; d
  55. #define STATIC_SHIFT                3: q& G! L+ Q& n6 V: r7 V% K' l' i
  56. #define TCINTEN_SHIFT               20$ [- w1 ?( E$ \8 p2 X  ?2 Y( K
  57. #define ITCINTEN_SHIFT              21
    ) ~) D3 b' j* V& e- z# M
  58. #define TCCHEN_SHIFT                22
    # j  h3 G5 G( i1 g
  59. #define ITCCHEN_SHIFT               23
    " [  i( r  u8 t$ M& g( j5 s+ |+ F

  60. $ B* @3 S% z; L- W) s% w% M
  61. static volatile int irqraised1 = 0;
    0 a( s& n2 M% R+ |1 Z- x0 T
  62. static volatile int irqraised2 = 0;4 ]  D. j1 U( P4 S0 L
  63. " L; Q7 @  j0 I( i* Q5 C. u1 c( C
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / x8 z, ^9 m, N* N; F1 U
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, K; x+ o: A9 a8 T  e5 W! Z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* ~5 \# o: i( H8 O

  67. , x% z- h0 d8 G# J
  68. dma_addr_t dmaphyssrc1 = 0;
    - V" F6 P% F  l; p; F4 i* q
  69. dma_addr_t dmaphyssrc2 = 0;& H" O# O( y% |8 H% u
  70. dma_addr_t dmaphysdest1 = 0;: S% X% ?! H2 p" O% S( X9 h$ n! P
  71. dma_addr_t dmaphysdest2 = 0;
    + T5 H3 ~# U, C4 N4 V, \
  72. 8 z9 n! B# s- C! _' W" l
  73. char *dmabufsrc1 = NULL;
    ; {: P. k5 L# H% z2 m3 X7 Q4 t
  74. char *dmabufsrc2 = NULL;. @5 K0 `; N$ I$ t+ b, W
  75. char *dmabufdest1 = NULL;7 {) T  t* k: m2 L
  76. char *dmabufdest2 = NULL;3 ?: ?5 W( x, l

  77. 3 q# k% ^1 G. u2 C; o6 I
  78. static int acnt = 512;  w) y" p4 j2 h' s2 h  M: {
  79. static int bcnt = 8;4 I- a! U' g8 `4 E+ [3 o* k$ b- ?
  80. static int ccnt = 8;7 D5 l- t" L2 c4 v

  81.   }# R, P7 T  f% ?: c) g& s% L
  82. module_param(acnt, int, S_IRUGO);& |) D- ^' O+ R" j5 [
  83. module_param(bcnt, int, S_IRUGO);
    ) b! f0 M  C% L0 j7 H$ b, m% M
  84. module_param(ccnt, int, S_IRUGO);
复制代码
& h  N/ j; f* q
4 b2 J9 a1 D1 t/ `
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 }( w. f* ^! e# F1 @% l, v* a' y# ?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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( X  T3 r0 a2 Z2 b. l0 V     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 T# U. ]% N2 z2 {( j7 A" P9 Y
, \+ O+ r9 l# w; ^
, Q: a# m9 d, Z6 ~1 x
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-5-14 09:02 , Processed in 0.039701 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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