|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " I+ M" ?$ t4 I: E& w& h0 F9 U
- [code]EDMA sample test application; ]! a6 t& N. U" l
- /*! y; m5 S( X6 n; Q& \% J6 G
- * edma_test.c4 x$ e$ P! {7 m3 P; P8 S4 `) v
- *
+ z9 O2 Y7 l1 |8 |! Q - * brief EDMA3 Test Application! s1 H9 b7 U& _( ?( k% k9 U
- *7 ]5 x& a& i+ ]4 y, c3 k% d% b
- * This file contains EDMA3 Test code.- W" q# ]& |% ?1 X; I# ~! V
- *8 X0 x" y6 D% n; d2 X1 E! W- i
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% _; z, s4 w. t% r5 @
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
/ F' _8 `" o3 y; I) X( q Y8 T - * TO CHANGE.
* w9 X. K3 b J0 Q% q - *( T: r, j M( O! Z \$ B
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
2 y! @; u- ~ ]5 |# P9 e) H- y' y j - *
/ M! k6 }$ J6 g- N' w8 q m$ D5 o. ~! I - * This program is free software; you can redistribute it and/or
* f( k9 J ]$ m& k9 e9 B1 t - * modify it under the terms of the GNU General Public License as
, n0 ~2 X' T# H5 z3 o. O9 L* f7 q$ f - * published by the Free Software Foundation version 2.: ]. e" X* o4 ]" Y& d8 _3 T* C4 R
- *
/ c3 I% v( i b0 H6 D+ W - * This program is distributed "as is" WITHOUT ANY WARRANTY of any; J. ?/ _3 C a1 o( ]
- * kind, whether express or implied; without even the implied warranty2 _: e9 u, l- I! _$ j
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the4 I& x! ]6 @$ e# n9 R
- * GNU General Public License for more details.
& J$ G7 U/ c4 _* R' K1 q& n. S - */
& F, @! h Y" g! R - " l6 t3 e7 h- m; T' B$ N6 A
- #include <linux/module.h>
6 o4 G6 z6 [$ `- h6 S - #include <linux/init.h># s _, |/ q3 s
- #include <linux/errno.h>
+ I( f" |, z/ H: V" n3 P - #include <linux/types.h>
- r, h0 t& [+ I5 f9 M( N- [& Y' D - #include <linux/interrupt.h>
' D3 P; z3 T7 p - #include <asm/io.h>
4 a! r5 @% X5 u) \ - #include <linux/moduleparam.h>: w3 c, M2 }- y5 e7 R
- #include <linux/sysctl.h>9 ^) i8 ]/ `$ ?, k3 `3 R# |0 T
- #include <linux/mm.h>
' s- D* z& ^& j5 g1 D! z1 s5 l" Q - #include <linux/dma-mapping.h>2 A: w! h$ V5 Q' R2 m! L; }2 J, q
' ^* |1 A* e% E: r( @- #include <mach/memory.h>
6 ]3 E# A& ~& v. R% A: w- Q4 P& w" J - #include <mach/hardware.h>
. L/ c1 N8 X! f. f& f# H) Z n - #include <mach/irqs.h>
A2 R" }8 @ V$ @2 |5 }. f, e: B+ ~ - #include <asm/hardware/edma.h>
* z8 C* P, M6 h$ {+ z* D3 { - ( Z5 W& p2 _( _: l$ Y* o" \
- #undef EDMA3_DEBUG
+ \, j/ g( M3 O7 M3 Q2 {6 a - /*#define EDMA3_DEBUG*/
9 M$ u4 B) T/ _) Z
9 L+ p& C0 m; v- #ifdef EDMA3_DEBUG: I- E) s/ o/ D
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): k& S4 b2 B) O' O( b
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# h5 ^4 V Z/ C- i' D' R
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 b/ q: o' H$ Y0 h( ]
- #else
% h+ x5 L" H. ^ - #define DMA_PRINTK( x... )* X" j( N7 ^+ g3 o' h
- #define DMA_FN_IN6 p# P8 d# i8 A. Z+ Y$ C- C6 z: p
- #define DMA_FN_OUT, U7 X3 ?; t0 J# ^( G# }
- #endif
; `) R) K8 ^: o( E+ w1 J - 8 O+ `0 ^3 n8 J: F. q# w+ b( U
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
3 V9 _! w" O" q8 J( v2 r - #define STATIC_SHIFT 3
4 R w2 r3 i1 | - #define TCINTEN_SHIFT 20
* G' D- |/ q' S0 i3 t1 H) F - #define ITCINTEN_SHIFT 21: ^& F" F4 q/ @* w J7 V0 h% u C
- #define TCCHEN_SHIFT 22* _: b! g5 r4 v& o7 C; K2 l
- #define ITCCHEN_SHIFT 23
! K$ s l9 E, o# r `
6 ~: v2 O6 v) F7 }; y- static volatile int irqraised1 = 0;
6 e, d) F1 g" L. h+ U+ f: b8 Y - static volatile int irqraised2 = 0;
- G5 @1 E( \( k; ^6 O, S- l+ ?7 ]$ e
# K/ k4 g1 S5 c- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 }+ k5 W# e: B4 ^ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 ^& O1 u ?/ n4 D+ u0 r" Z - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ y1 s! u, M, ?6 C - . ]" C' K2 l. [4 a* w
- dma_addr_t dmaphyssrc1 = 0;
k) U( H4 J- y( ^4 s2 Y - dma_addr_t dmaphyssrc2 = 0;
- M# D2 \( H9 O& b# O - dma_addr_t dmaphysdest1 = 0; `+ }9 @. ]) R2 ^4 M2 e
- dma_addr_t dmaphysdest2 = 0;
$ @ e. V% |, i) |) K - - Q% e+ n# Q' T9 u- |
- char *dmabufsrc1 = NULL;) n7 B h7 D6 E% P3 d4 Y
- char *dmabufsrc2 = NULL;8 R. c s. ~- g2 I
- char *dmabufdest1 = NULL;
5 @+ _$ K; s6 i3 w7 E - char *dmabufdest2 = NULL;& d4 R5 E! q1 G R: g
- 6 j2 T. b: j* a; ~% l
- static int acnt = 512;
9 N* _8 L6 T0 ]$ _' i - static int bcnt = 8;0 h6 k. o& I1 f- m) \2 |
- static int ccnt = 8;: d2 L5 E/ U0 d) h
- 7 e$ Z. E( g5 Z7 w/ z, X( u
- module_param(acnt, int, S_IRUGO);6 c& u7 O6 w& {: h
- module_param(bcnt, int, S_IRUGO);
5 ?# K0 \- ]7 P% r7 L - module_param(ccnt, int, S_IRUGO);
复制代码
5 H+ J4 t# }( i" b: R V
2 i1 z0 h. k; ~1 V% X 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% R" Z4 u% N, W- ]6 m' A) Yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' [8 J6 _' u' d6 I7 @" b G0 t
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. _1 }# d. s6 J. G8 c: V
6 f" g) |5 F! l. m' w
) `- N4 q$ W$ x |
|