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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ c# [+ h) M7 Z) r
  1. [code]EDMA sample test application, H$ r, ?: |" x# g! f
  2. /*6 Z: [% Z" ]6 o, y1 p- R, b
  3. * edma_test.c
    7 n* T9 k$ t4 k5 D/ g  q
  4. *3 C4 ~1 r1 D! l% S) j( l1 \3 L: f
  5. * brief  EDMA3 Test Application
    7 T: Y0 b+ I1 @: X5 G5 n" S
  6. *
    4 F0 E  L  _) E
  7. *   This file contains EDMA3 Test code.
    ' Q9 v& h! v1 l! V# |6 E' y: O* _
  8. *- j$ v5 }: `  e1 V; J2 \1 s$ D4 p
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, |* C% Q* w- u5 _  `& K2 Z* N# L
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ T, V7 X6 x: V  v+ c8 N* Q
  11. *         TO CHANGE.
    7 W. I# d( G5 p1 \
  12. *
    7 v* V# J0 W  K# u3 h$ l) m( c/ o8 t
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% A$ I4 j+ w, Y* a% Z; r1 a9 s# u
  14. *
    & {4 @! C7 L4 V7 z
  15. * This program is free software; you can redistribute it and/or
    4 p- X2 A3 R; h' J- `5 @
  16. * modify it under the terms of the GNU General Public License as
    : {9 d- j6 m" R5 A" S
  17. * published by the Free Software Foundation version 2.
    " g+ q/ ~! a0 d$ D; G
  18. *4 {7 v" ?- W* W% m# k" G
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any  Y- D6 \' h  h8 p* m
  20. * kind, whether express or implied; without even the implied warranty
    / Z2 B% `3 s# W' z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    3 u8 q8 a5 W; N! f0 X
  22. * GNU General Public License for more details.
    9 u. c) g& [7 i! g
  23. */
    1 d9 r% M; Y. P# G6 G( _
  24. $ g( a, [* ^$ m  b7 e
  25. #include <linux/module.h>4 p2 ?# e9 R% \6 U' E0 u6 r- i
  26. #include <linux/init.h>$ a9 P/ c! r) x' j% o
  27. #include <linux/errno.h>
    9 ^9 P; f% W0 m/ y. J$ G
  28. #include <linux/types.h>
    / ]& ]% d& ]$ p, [
  29. #include <linux/interrupt.h>
    0 U0 G: _  d9 q5 H
  30. #include <asm/io.h>/ l: V; h0 K1 ~% t
  31. #include <linux/moduleparam.h>8 d4 x) t6 N( b" B2 f8 o& b3 N+ `
  32. #include <linux/sysctl.h>) h3 i& W; {/ h0 t5 z( C
  33. #include <linux/mm.h>5 b2 S7 M$ L/ M/ `  d! \- i
  34. #include <linux/dma-mapping.h>: h3 s/ D" P/ O9 C
  35. ( V& V3 {! Q) Y8 c( x2 W
  36. #include <mach/memory.h>7 N, \7 Q/ A( Q* z* i
  37. #include <mach/hardware.h>. _; S' [- s- y5 [
  38. #include <mach/irqs.h>
    : p4 R& g; [. B6 B, u: ^& d# y) ~
  39. #include <asm/hardware/edma.h>
    9 m& W. D4 n& S. ?

  40. % u: x6 i; I* l0 Q+ R4 Q3 f2 z
  41. #undef EDMA3_DEBUG. ?8 a9 I# [. h4 L- C0 Q1 Z& o
  42. /*#define EDMA3_DEBUG*/; P. |* ]; R% I! }! z, F3 Q$ b
  43. 2 u; t4 s2 o; a  b6 {/ Y9 V, H
  44. #ifdef EDMA3_DEBUG2 z4 q5 N3 W, Q7 Y, B
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 K+ Z+ W; ~) e2 z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
      R5 [" ]( x  c- K6 j
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    9 N1 L" ^/ F. a% X0 e
  48. #else
    4 b$ _/ J/ s$ ]' R% e
  49. #define DMA_PRINTK( x... )4 W0 w2 o& u* l5 w! H3 @
  50. #define DMA_FN_IN
    2 y9 _; a  m. g' A
  51. #define DMA_FN_OUT
    ) {, u3 P: T7 H
  52. #endif5 c3 J/ \9 a/ t; e4 Q( Q

  53. 2 {) E; {1 ]# K( c- U
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)* n+ A& O) A+ l1 x1 }. i5 z( n  K
  55. #define STATIC_SHIFT                3
    3 u/ J5 O" S5 d; [2 u* z+ c: i
  56. #define TCINTEN_SHIFT               209 `' J5 b8 z2 Q& ?
  57. #define ITCINTEN_SHIFT              21
    9 e% w; y6 L$ I2 P( [
  58. #define TCCHEN_SHIFT                22
    0 t  M( \' M. _% @. C' ^; C4 [
  59. #define ITCCHEN_SHIFT               23
    9 [/ g) _7 H& l; R0 ?, w% B7 s

  60. : V: }: ^. Q' G) D# I( r$ [7 c- L
  61. static volatile int irqraised1 = 0;/ m% j0 `5 U% j6 O# |7 b7 r
  62. static volatile int irqraised2 = 0;& |6 |2 O4 \8 r; B# B; O! {
  63. 5 H# G, q8 B- X! B% i% d0 N
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 ]( E) |" y, Y. P' e8 i' I$ P
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( S# m. n1 G1 Q2 q, l2 G
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' b% @! i+ n" L& P8 d

  67. * n7 t* e4 C& ?- y# c
  68. dma_addr_t dmaphyssrc1 = 0;# k- C4 R2 o+ w
  69. dma_addr_t dmaphyssrc2 = 0;! ^7 O6 o& Z1 y+ J
  70. dma_addr_t dmaphysdest1 = 0;
    : V# C0 ^7 \. m/ f5 T
  71. dma_addr_t dmaphysdest2 = 0;; Q3 M* a" h) @6 @- i% u2 t

  72. $ H6 j' z6 z: t$ i4 F+ E7 t0 U
  73. char *dmabufsrc1 = NULL;
    9 ]' m  M4 l9 z" U4 M# _
  74. char *dmabufsrc2 = NULL;% O6 f( t# W6 i+ Q7 L0 ^
  75. char *dmabufdest1 = NULL;: ~! b9 y1 m9 A7 P! T
  76. char *dmabufdest2 = NULL;
    8 y/ E2 u, d, r& G4 |
  77. . k. |( e7 K$ _4 S
  78. static int acnt = 512;5 u+ p; T+ O6 s2 F8 q$ f$ d
  79. static int bcnt = 8;
    * G1 L3 u. o7 L5 e
  80. static int ccnt = 8;
    2 \5 _. A3 x* R% K2 {) |
  81. ; X" a0 ]. v( K/ m2 l+ }3 z
  82. module_param(acnt, int, S_IRUGO);; e$ J2 R* G* U) R9 i
  83. module_param(bcnt, int, S_IRUGO);
    ' ]! z/ @  t8 u. c" B
  84. module_param(ccnt, int, S_IRUGO);
复制代码

" I' g! }0 Y1 H
9 Z( a8 w. Z) `- H      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) ~) z. t3 d: l0 n7 z+ \
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ G7 H! p7 U( a# C& `; T     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 u6 T+ m# w9 K# b, j+ u6 A. e* o! O" u- J* K
# E5 P) q7 c$ a/ r$ R8 f+ H  l$ R
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-8-29 15:00 , Processed in 0.043211 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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