|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( d% s! E0 o; \" y9 j h
- [code]EDMA sample test application8 U* @" h; I" ~
- /*
, k! F) d/ U$ h! u7 S) \' L& M - * edma_test.c- I' w1 `1 x" F# o
- */ j8 p: Q9 a9 ?' \! ?
- * brief EDMA3 Test Application
3 n5 r" T# h, L0 q - *+ `4 j& o/ B$ X2 @" A
- * This file contains EDMA3 Test code." r" V5 P% L# ?5 g& p
- *
0 \" x% `3 j4 ]) w$ p; J- C - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" @8 [# w1 B* U( ]% i
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
d. j' V& o+ Y* e7 s% ? - * TO CHANGE.
- n$ t0 d9 r- ~, \4 D/ k# y0 v - *) w _ F/ V4 m/ I$ Q) R2 H
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
* z: ?4 p0 F% f - *- I- Z/ Z5 N% r0 L8 {" Z
- * This program is free software; you can redistribute it and/or
0 x& n, I. `( A4 a - * modify it under the terms of the GNU General Public License as4 ^" v) o# b. e, [% P8 `
- * published by the Free Software Foundation version 2.* `: N- }- U' S! M! C
- *. V$ N: T( ?* A, i) E
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
3 y' J0 r. x9 \* o% q. P - * kind, whether express or implied; without even the implied warranty7 J/ p" b/ [4 V( ^3 [
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the. [" H) \5 b7 b1 s, W
- * GNU General Public License for more details.( {% b- y3 F+ x: h. F
- */
( G, t0 y+ Z: T2 b7 X- c
) H% f% }- L$ m1 e' x# R. H- #include <linux/module.h>
$ f3 e! w4 a7 @3 Q3 n1 v - #include <linux/init.h> ~4 d2 c+ D- j7 b2 ^$ E0 N3 V
- #include <linux/errno.h>
$ r. R. o6 {9 }& ?. X. ] - #include <linux/types.h>
3 g/ i5 q6 F2 C% D" U7 ]$ k - #include <linux/interrupt.h>+ d9 P3 a( a ^' O
- #include <asm/io.h>
" g" j0 j$ E' I8 o" f* H. ~1 e$ Y3 m - #include <linux/moduleparam.h>9 `/ O. H9 X) m1 G* ?- s. U
- #include <linux/sysctl.h>
7 s& d0 C) I$ ~# ~" R - #include <linux/mm.h>
2 ?5 u5 T' v7 ]3 w+ [ - #include <linux/dma-mapping.h>
1 G' e y& S8 ?1 I/ m7 }4 p( w3 ? - * y+ P5 m) j/ K" i1 N( R' C
- #include <mach/memory.h>
8 h0 N4 G1 H+ v1 W2 Q - #include <mach/hardware.h>
8 g: {6 Z6 e+ H - #include <mach/irqs.h>
: ]3 J C( t" V - #include <asm/hardware/edma.h>" B% o) l1 n9 r' e$ }+ X7 `7 o
0 U9 `7 `+ v# k9 f2 G g+ y6 I& [! R6 n2 }- #undef EDMA3_DEBUG
( W& c( f; k' ^: \- r% F0 A - /*#define EDMA3_DEBUG*/
0 k* v/ l( B) v# _' ]
7 p8 a5 d2 h' K) e. O! `- #ifdef EDMA3_DEBUG
7 T5 ?. H/ a: Q' o2 S6 d - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 \% }7 s4 m+ j T
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
6 V6 R8 i; z d - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# y/ I5 P; n0 }/ H# [* \! M( W
- #else: W# F* @) ]) q
- #define DMA_PRINTK( x... ); w1 e0 c9 @& Z9 b' s: q
- #define DMA_FN_IN
. u9 K' r% ?8 w. G1 s% h6 K - #define DMA_FN_OUT5 f- u, q) ~: ] M
- #endif$ n4 e1 k! C/ T, y5 [
- 6 p+ r2 ~( i% X: S% V
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
/ R% n% r9 E: O% X - #define STATIC_SHIFT 3
8 h# @& D, s2 G9 f4 O* A' L - #define TCINTEN_SHIFT 20
3 M/ p4 p, V" C7 K' N% U5 S& \! Q - #define ITCINTEN_SHIFT 21
e, l: |5 h2 ?0 t - #define TCCHEN_SHIFT 22: ^! N9 i& ^ v- u
- #define ITCCHEN_SHIFT 23
% e) S+ n7 I9 q. E - 6 j9 N- I; p' s" Y5 S" u, x1 X6 ^
- static volatile int irqraised1 = 0;( z# q& W) Q9 i
- static volatile int irqraised2 = 0;
6 j1 j' j/ L/ U9 r1 } - - P- v7 h q! f* W% X
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. ]$ ]9 N$ j0 m
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 ^$ l* K' w; _6 U: R2 V; r
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; C O5 D/ E7 o5 L) p: q$ k
; H$ ~) R* f, F$ ~- dma_addr_t dmaphyssrc1 = 0;/ O, H; {$ J1 B7 `4 Q1 {
- dma_addr_t dmaphyssrc2 = 0;0 p3 ]7 Q9 `4 S5 Z
- dma_addr_t dmaphysdest1 = 0;
1 X7 b, ]7 t& l. m - dma_addr_t dmaphysdest2 = 0;
/ l" J/ R8 M) S# n9 ?/ {2 M
1 `# h9 M" k6 i1 X3 Y! J- char *dmabufsrc1 = NULL;
5 W8 q1 A0 }; G. _" a$ h* A - char *dmabufsrc2 = NULL;, B) D1 S5 i7 p8 i( B/ `8 j
- char *dmabufdest1 = NULL;
- A4 n( H( v; a- q: t2 z - char *dmabufdest2 = NULL;( d* v- O6 g! z
- ) C( L4 N6 P) j
- static int acnt = 512;
* l& F. Z w5 K! g# c: `1 r - static int bcnt = 8;% g! C3 }/ s M. Q# e, W
- static int ccnt = 8;
2 T5 J5 ~2 h S2 k - & J: j/ i6 w5 \: s
- module_param(acnt, int, S_IRUGO);9 \- H1 j8 |2 A3 w5 P
- module_param(bcnt, int, S_IRUGO);) I' {4 T6 s0 z p7 x
- module_param(ccnt, int, S_IRUGO);
复制代码
/ \$ ?' \1 t/ H: F- v" n* Z0 E9 X
' } I) J/ M' b1 a 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 t* e0 }2 l; E& y/ D0 U0 b% barm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 I! d1 E4 Y. N- I0 w$ i8 [( a
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; S7 r! b8 G. T z6 _% s% H
! |* U3 h0 A! F" r7 j( Y) {6 s- \! d% m; a
|
|