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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 X+ f$ W* E3 a( L6 D' B1 A6 r
  1. [code]EDMA sample test application9 J) l7 `, b. [
  2. /*( `2 ?! G3 I& Y, M9 E
  3. * edma_test.c
    7 K" d) L* e" i
  4. *
    # B$ G# O/ A6 _! P1 z
  5. * brief  EDMA3 Test Application
    1 _0 a$ H, j$ r6 y$ t# H/ c$ p; c
  6. *; n. a5 h& C1 y  q( W( ?
  7. *   This file contains EDMA3 Test code.
    3 g5 G0 Y* r! ^8 I# S
  8. *
    1 l1 c1 B  f3 U! y" A3 _
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    : f  l5 Y; y! }4 J
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    1 ?" L, S! K# {: [
  11. *         TO CHANGE." [7 N( c! r1 q' P! ]4 [: {
  12. *
    ( P+ f7 B8 e, x# k
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    4 c6 l, g6 ?. }
  14. *
    ! j7 M+ Y7 q! X) c# _& p
  15. * This program is free software; you can redistribute it and/or
    8 [' a5 b# Q5 N5 z
  16. * modify it under the terms of the GNU General Public License as
    - m8 y& T) D; A- P6 G# Q% q
  17. * published by the Free Software Foundation version 2.& A$ X- G# Z  P$ T& J% K
  18. *5 _/ L# f( _3 r8 ^/ Q& y
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any- B! t/ g# k$ O; T- m6 |
  20. * kind, whether express or implied; without even the implied warranty
    4 K% b+ _$ F2 Q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    0 u- L; T, H  M6 `$ w& m% N
  22. * GNU General Public License for more details.) e( @& A9 @9 G0 O
  23. */; _. h" D- {9 O: i% e' a
  24. 9 \% z' p+ |0 r- S
  25. #include <linux/module.h>- M! p; K+ U; i+ \2 l! v
  26. #include <linux/init.h>$ P$ A: x) L5 J$ Y. J
  27. #include <linux/errno.h>
    & M% k' X% Y: P2 k
  28. #include <linux/types.h>, q: X0 a  X' s" j" W& }# s: ]( n* E
  29. #include <linux/interrupt.h>
    ' T3 i/ l, }: T
  30. #include <asm/io.h>* ]: H' a) ?  b$ e" D
  31. #include <linux/moduleparam.h>
    1 }4 i; d' f0 s; x4 `  i$ w
  32. #include <linux/sysctl.h>
    , K' {( Z; F1 S/ e% @
  33. #include <linux/mm.h>
    - @% R/ g) c' C2 _' s+ e4 P& I
  34. #include <linux/dma-mapping.h>
    1 w+ ^' f& e/ _! J( W. ?

  35. - j( D9 S9 C' V/ z' A
  36. #include <mach/memory.h>
    $ |" o: s7 X1 I5 J) o) Y3 Z
  37. #include <mach/hardware.h>6 f7 y# I1 ^7 U# g6 ?' p- S
  38. #include <mach/irqs.h>0 b0 Y" W" c" \1 h( f& \
  39. #include <asm/hardware/edma.h>- i' `8 X+ ~3 K% b% `

  40. 1 |2 u+ v( f" a8 Y
  41. #undef EDMA3_DEBUG- u. K  J$ [( }/ y+ }/ s
  42. /*#define EDMA3_DEBUG*/' Z6 F: e" p, G
  43. / I* y4 t+ b+ T
  44. #ifdef EDMA3_DEBUG0 ~9 G7 m/ f) p: z; m- I5 f: x
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ! `0 U' t1 o# x1 ]1 }3 J) `
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 O1 h. v0 k1 u& x# M( k
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), C+ W7 v/ ?: J2 v8 f/ L/ m
  48. #else
    ; ], Z$ M9 @1 W/ M% E+ U* V; p
  49. #define DMA_PRINTK( x... )
    7 d! D& t& L& a1 O. {: D
  50. #define DMA_FN_IN
    : q, L/ u- o5 Q
  51. #define DMA_FN_OUT
    3 H8 d# V; S: {  ?. C2 g) V, i
  52. #endif
    # F& N* E. B6 M* J( \) W& o
  53. 2 @9 p$ e# i+ Q5 [& N  I
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    $ {! ^* w4 d0 ^: w+ i( R" k
  55. #define STATIC_SHIFT                3
    4 ?' S5 M# }, C
  56. #define TCINTEN_SHIFT               201 p) t, ~! ]/ T: T2 q3 J
  57. #define ITCINTEN_SHIFT              21
    5 s" T: \- k9 @7 l  ?* V
  58. #define TCCHEN_SHIFT                22# i# j; j, f, W: S- b( F
  59. #define ITCCHEN_SHIFT               23
    7 O2 f9 K+ ]6 N; B9 `+ A

  60. $ y4 w4 F, K& D! q/ F  \
  61. static volatile int irqraised1 = 0;
    ( i# S; a) c3 ?- b8 K/ C/ {, Q/ O
  62. static volatile int irqraised2 = 0;
    - o0 H9 c. L% g, u3 J" D
  63. & k4 z  r/ w; Y+ W2 A$ z( F
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( n$ o3 x" d" O0 ]7 `+ Z! M/ _2 L
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 @) o6 G" C; e4 @  \. r6 m, ?
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 F* I$ b! b* h8 n0 [3 N
  67. # N% N" v5 \8 l  i5 J9 z1 \
  68. dma_addr_t dmaphyssrc1 = 0;
    - Y9 k9 u# d) g# I' I; E
  69. dma_addr_t dmaphyssrc2 = 0;
    * K6 [/ ?* f3 X6 S6 T
  70. dma_addr_t dmaphysdest1 = 0;
    + X% |5 ~! q* C! I0 i% D# J  P
  71. dma_addr_t dmaphysdest2 = 0;
    + Y' z  t" C7 r, u
  72. $ h1 H( @( A3 I" L. l1 j- U. J
  73. char *dmabufsrc1 = NULL;
    ' K! {" @, l% w( M+ x% {$ W
  74. char *dmabufsrc2 = NULL;) ], s% Z  z! u8 M
  75. char *dmabufdest1 = NULL;( }3 H. b4 ?; `5 `
  76. char *dmabufdest2 = NULL;
    + L. c3 \2 l# e+ M5 }

  77.   L4 l7 [6 @, p# N: |+ X: \
  78. static int acnt = 512;
    ; o! h( n5 w' u3 }
  79. static int bcnt = 8;% V" r7 I0 s$ g$ P
  80. static int ccnt = 8;" B( u* a+ ~2 j* R

  81.   C1 h* [# T1 G9 o+ c
  82. module_param(acnt, int, S_IRUGO);
    . U6 [2 Y$ H  y) V/ U! P% `3 L2 w
  83. module_param(bcnt, int, S_IRUGO);
    # ~, J" e; X: w
  84. module_param(ccnt, int, S_IRUGO);
复制代码
, U4 \* [1 }) s! B
% Y8 f2 d7 S( w5 e3 i) n
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- s! ~% n. E4 {( ~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 U7 D& @  j7 c$ I     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
  w2 @( r. q7 H/ R! l  J! j' h# I" w/ n5 F% }

; Q$ o1 v. A' d
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-30 10:01 , Processed in 0.040190 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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