|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ z# c2 \% b4 Y- [code]EDMA sample test application
1 B5 P0 s" \% c. ] - /*& X4 \5 Y+ Y: ?7 |8 A3 u& @
- * edma_test.c* U6 Y. I/ p9 c' O1 V# q) v
- *
K; R: A: g! A& x2 U- z - * brief EDMA3 Test Application* H% u7 N' D* F( n @5 |7 C! j( Q
- *
( i/ H: u- `2 P0 B3 i, v - * This file contains EDMA3 Test code.
/ V6 H* Q E6 h2 @# Z4 H P" ~" ` - *
, E. Z1 J0 @5 C( \4 r7 r - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 c% u, b+ e- M- f F2 }8 X+ H U) S
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
+ J* Y" e* y7 s+ U0 |& m - * TO CHANGE.
0 ?6 O# d! a, c+ u4 @ - *" r6 w% F/ q$ L1 S1 K3 W0 j' b( M
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 k6 s$ p9 _) H$ ?4 t- Y
- *
1 h- z `6 S# h0 q1 J1 u - * This program is free software; you can redistribute it and/or5 _1 l" D1 q# W1 l5 J
- * modify it under the terms of the GNU General Public License as n g; e2 j1 ^6 D3 n
- * published by the Free Software Foundation version 2.8 G [- i& q9 d, V2 a4 [- ~1 `
- *4 ~/ m% i0 B4 t* Q
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any" B6 O, F$ A, Y( I0 i& Y
- * kind, whether express or implied; without even the implied warranty3 t$ j E/ d. [5 }+ }3 {# j7 i1 p
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
: `; W" P- L8 N2 D3 x' l* ^ - * GNU General Public License for more details.) Z3 l; T9 _$ J# a
- */
1 s. M& p0 x+ H - 3 f$ B& c O( H" r+ p6 I
- #include <linux/module.h>
2 Q8 N' {9 ^3 t" o, M - #include <linux/init.h>) G" U- I% G+ y- F
- #include <linux/errno.h>
( c9 F* Z5 C* z' e5 A+ k - #include <linux/types.h>
, @# w3 w) l" o9 Y - #include <linux/interrupt.h> e9 s( n3 D3 ^/ ]" O1 f4 P; z# u
- #include <asm/io.h>
' n, Y! t0 I- W: T9 c+ @ - #include <linux/moduleparam.h>% D/ Y! D! r9 d8 E1 P1 }
- #include <linux/sysctl.h>
! }1 h8 `8 E" s8 T V - #include <linux/mm.h>
4 Y* C) G3 d. n; s( x# r9 Y; ~ - #include <linux/dma-mapping.h>% Z( h+ r/ O' D6 j: i" k/ g
- ( a* O, _! _6 g9 j) w
- #include <mach/memory.h>- F( S1 M7 Q, Z: ~/ e, w
- #include <mach/hardware.h>
& o9 _! ?( V ]0 v, y - #include <mach/irqs.h>
( r0 |8 L! l& H. u6 A8 j - #include <asm/hardware/edma.h>7 n# O$ t% R" u1 A
- ' b, j9 P P6 u Z4 {7 r ?$ P; c! V
- #undef EDMA3_DEBUG
3 S" J# D# h! c+ o - /*#define EDMA3_DEBUG*/0 \/ U# w0 ^% [6 E( ?/ Y
- 1 R, c+ ~' T6 |3 [3 H8 x$ ]% Z
- #ifdef EDMA3_DEBUG1 R% ?) X; v* f4 t% u% _( r
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
* V6 S; U5 D" s7 k - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& Q9 q Z v; Y3 ?' H6 _; ?
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 i* F* A8 K9 g6 P3 J
- #else$ w: m- F7 y4 D
- #define DMA_PRINTK( x... )
3 K5 [4 b# {& ~' R6 p - #define DMA_FN_IN. Q9 A, |* C' A* U
- #define DMA_FN_OUT0 q! o) t8 b4 [' b1 h; ` i3 H! k; @
- #endif# v7 S* z! Z, r5 ]% N
" O8 f1 F/ K! M! _% Z& p5 S' p- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
2 P: s0 g; S' `' Q - #define STATIC_SHIFT 3
0 ~2 H* X& k& \9 z) V0 f7 h( T - #define TCINTEN_SHIFT 20* D# Q& s; i1 i/ R. g6 B s2 u
- #define ITCINTEN_SHIFT 21
) K" |1 b. q& a# ^+ o7 @ - #define TCCHEN_SHIFT 22
0 Q6 K& d( T9 w$ K1 [2 [ - #define ITCCHEN_SHIFT 23
+ A" I8 r. j, v( Y- i
3 A1 s7 D3 |/ R. W- static volatile int irqraised1 = 0;
) C& u+ I/ o! L - static volatile int irqraised2 = 0;
& {5 H+ @7 E2 l% I: @, t J6 y - / j+ c1 t8 Y( C) }: h
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, v8 ~! z+ V$ t& o+ \% f - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) i( m+ z$ U' q0 R& P$ P - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 h7 u$ B1 F% {$ Y& E5 { m6 u
% T, \* j* r* f. E# w, X% ~- dma_addr_t dmaphyssrc1 = 0;
+ g6 I& T2 @3 R u4 n2 { - dma_addr_t dmaphyssrc2 = 0;- j4 j1 Y3 X5 i! i2 O# t+ K1 `: Q
- dma_addr_t dmaphysdest1 = 0;9 [" U1 Q* |5 e4 @2 R
- dma_addr_t dmaphysdest2 = 0;% `! W- V2 i! @/ U/ [/ q0 T. b
' _- P8 f9 z- ~0 o4 ~; J- char *dmabufsrc1 = NULL;
" E v4 N) C7 h. ?0 c- y - char *dmabufsrc2 = NULL;) P. K0 c. c! R0 l' F, H, L' I5 U
- char *dmabufdest1 = NULL;+ H6 B3 ]- T( A* |. M
- char *dmabufdest2 = NULL;# G% u4 S; U2 I" H/ @ c( V: [
( t$ a9 [8 @; I- static int acnt = 512;* q& W9 [4 {. P3 R0 b
- static int bcnt = 8;
' e: q" t1 X- |6 M* v - static int ccnt = 8;: C' Y" r! ]5 d0 B1 e# ^4 v# X
- . i9 r3 M6 D8 d' x8 V
- module_param(acnt, int, S_IRUGO);
! c! [" }# f) l8 N: r( V" l: C# Z$ I - module_param(bcnt, int, S_IRUGO);' Z \- v" q4 r) I' G( l$ T( U3 V
- module_param(ccnt, int, S_IRUGO);
复制代码 $ p2 F3 }: T* a5 R; o% R0 P9 L
% s8 `: B* A |/ Y7 f6 y' O; k$ O/ Q% j 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% V' q& x# t, D: h( L# F
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: o. F/ Z, ]6 K M4 b 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 C/ [( ^6 H H# p$ |
: {2 a O1 x0 P a
3 u! n; }9 ?; o; ` |
|