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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑   s9 h+ [+ x6 f9 q) L4 V
  1. [code]EDMA sample test application
      M" n( L2 W/ D$ `
  2. /*0 E( z* q/ g0 [- r$ G4 z
  3. * edma_test.c  ^0 h3 f' L* D# [8 j) c
  4. *% x1 N8 E1 {- w0 Z3 h( E
  5. * brief  EDMA3 Test Application) B3 W9 a- K5 H+ P1 l
  6. *- O7 m* B% c7 V. i2 \6 [
  7. *   This file contains EDMA3 Test code.
    " B. S. ?# u: \
  8. *# o0 D8 D: `, v: ~, K: O
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& g0 v  o) v. D- f
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) S0 V7 |! b0 ?4 b/ @+ W3 b
  11. *         TO CHANGE.
      n) n- a3 r6 K. I1 ]0 ]- U
  12. *! q, d! B8 |$ i. Y  I
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    . [' C% F& M  b/ Y
  14. *
    1 C% W7 V- r% o! A: U5 t: u
  15. * This program is free software; you can redistribute it and/or
    " `1 l( |) X! c1 U/ ~, c
  16. * modify it under the terms of the GNU General Public License as
    0 Q$ g8 c( M" z- C8 K7 F# B
  17. * published by the Free Software Foundation version 2.
    9 ?! V- u6 h1 j. k& G
  18. *' x: o0 R* }* P; [0 B7 {
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    : L; S1 \  t  ?- J4 E9 E1 @+ _
  20. * kind, whether express or implied; without even the implied warranty0 |6 M( g& G9 c, i
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the; Z) t7 v6 v( R+ h, Q, g* F, m
  22. * GNU General Public License for more details.8 c" r; U7 Y7 S0 q' B
  23. */, j, z6 c/ z0 T
  24. 0 B# S$ a" A% V! }2 o2 b
  25. #include <linux/module.h>
    : V; y! G  p+ m( Z- ?4 \5 `/ u
  26. #include <linux/init.h>* |/ M1 I) t7 }- `! [$ U$ W
  27. #include <linux/errno.h>
    1 y% H1 `2 Z' Z6 c
  28. #include <linux/types.h>
    8 x# e  T1 y" h! g
  29. #include <linux/interrupt.h>
    ( V2 x* a" o. K9 n4 I$ q
  30. #include <asm/io.h>
    : P- U4 F# j& h0 O/ O1 S
  31. #include <linux/moduleparam.h>; O, c/ D+ X% I& L) G& \- D
  32. #include <linux/sysctl.h>
    - W5 n$ V! O. I, Y  u
  33. #include <linux/mm.h>
    3 ?8 U5 U4 X# d1 j0 e$ U. J$ p
  34. #include <linux/dma-mapping.h>8 a6 d6 w# C! D2 l, P+ c1 b/ v0 k

  35. 2 _, @9 O& `- M" _1 |/ x
  36. #include <mach/memory.h>
    * R9 q8 d& P$ `. v# k' \
  37. #include <mach/hardware.h>
    + \+ ^' X8 U9 @
  38. #include <mach/irqs.h>7 z; c9 Y/ L6 `
  39. #include <asm/hardware/edma.h>
    , h& p! t/ g$ P' a

  40. 4 U8 U: e4 K& ?3 V; U: ?: v4 Q
  41. #undef EDMA3_DEBUG
    + Z2 Z$ x" O9 m( v8 w7 D
  42. /*#define EDMA3_DEBUG*/
    1 E( t$ u$ ]1 F

  43. 5 \; u# Y9 j  G
  44. #ifdef EDMA3_DEBUG7 I, g- a3 ?. C6 D' k
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
      v; ]" i$ d: W  |8 l. ~
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 j- }: y5 m/ N% p! M
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
      Y. d" B! x  a+ G3 G9 K
  48. #else. `) ~' M. e4 f9 j+ P8 }
  49. #define DMA_PRINTK( x... )
    . U, c3 C3 Q% p5 J$ E* o3 `! w
  50. #define DMA_FN_IN/ t1 Q& }9 m' q7 O* P! Q
  51. #define DMA_FN_OUT
    ; y, j9 i1 I/ e2 |2 X  b/ x
  52. #endif
    + y& Y9 \; }4 j2 v. j4 B

  53. , l2 b$ G5 f" ]: T
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    . z3 _' m3 t* w$ e# A+ D% J: X- D
  55. #define STATIC_SHIFT                3
    % J8 O* b2 _$ K: P
  56. #define TCINTEN_SHIFT               20
    7 R4 W% B7 @. B3 j, u5 N
  57. #define ITCINTEN_SHIFT              21
    9 k$ W8 n1 D: c9 l3 Y' d' [9 S
  58. #define TCCHEN_SHIFT                22+ E" \' _2 A& X% F0 E
  59. #define ITCCHEN_SHIFT               233 U1 K2 x$ P8 N7 U+ x, [/ F; W
  60.   X- Q$ |/ }/ B1 k8 b" d0 X: \
  61. static volatile int irqraised1 = 0;  J3 @0 l% Q5 J# i
  62. static volatile int irqraised2 = 0;. H+ Q$ h8 ]# G5 @2 n
  63.   H" g* h, o0 l& H" n' P9 o1 y% y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 i3 v/ K  q% ^
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 ^8 H* r: m$ i0 z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 b. Z' E9 U. R" z5 l1 `

  67. 9 Q- ~+ s: a) `) _) ^( K- y* n
  68. dma_addr_t dmaphyssrc1 = 0;+ @' P8 u# K0 a/ g0 [5 w$ _+ c
  69. dma_addr_t dmaphyssrc2 = 0;( M" m$ f9 @4 n7 a6 [' e3 T" J$ M, T
  70. dma_addr_t dmaphysdest1 = 0;
    - {% [" V' ^( j" ~  d3 ?" x# C
  71. dma_addr_t dmaphysdest2 = 0;5 D8 J) \, q0 [$ V. v* O1 q! O
  72.   H  v; C5 I( _8 E: P$ d4 f
  73. char *dmabufsrc1 = NULL;
    - \& s- i" [/ O2 ]3 m5 V
  74. char *dmabufsrc2 = NULL;) f  ~  l/ P) K& n
  75. char *dmabufdest1 = NULL;
    - S! t' B9 j/ ~; r6 }; _
  76. char *dmabufdest2 = NULL;* R9 W' p! y4 {$ u$ o- `

  77. * `: b1 j: I# ?% z, L
  78. static int acnt = 512;
    , a6 ^' ~5 ]* b2 [& L6 ?
  79. static int bcnt = 8;
    $ K3 B' I4 b  Q: b4 f' g, k
  80. static int ccnt = 8;! a8 C: y  a) {

  81. * P# J6 l' s7 f( q* ^- j  e, P
  82. module_param(acnt, int, S_IRUGO);
    * I% K0 \0 b, G) F! W3 r9 R. \
  83. module_param(bcnt, int, S_IRUGO);- h2 k% V: G! U/ C6 l8 z: a& ^
  84. module_param(ccnt, int, S_IRUGO);
复制代码

% B& p, j% }5 I6 I1 `" X3 \2 W
$ U+ L+ y# m3 P      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 A0 _5 ]5 o* {( R! p* c6 C
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 S2 d6 @8 t2 V2 @
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; }* g/ D2 B5 a: @/ ]% W
2 S( j2 ^" U* ~: |+ i
, X! k+ D% q6 i: s( p3 u
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-3 02:15 , Processed in 0.040788 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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