|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 c2 S2 W& x- M' y/ U- [code]EDMA sample test application5 {' T) q! i2 z3 q
- /*' j1 j1 d# T" ^
- * edma_test.c N( q7 R& ]1 H$ p
- *4 d# ~+ z, c* B* ^+ C$ n
- * brief EDMA3 Test Application6 \- M, f. H# G( f s
- *( N% u1 _ o* T8 J' U$ n- l2 n# z
- * This file contains EDMA3 Test code.. m( ^5 E1 V1 F' T* F
- *
0 F- [+ E, ^4 K9 C/ r$ W - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' ~' G+ w7 H! b4 V- T! _" k& v% `
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
" a: _* Q8 Q4 {0 t3 E, B - * TO CHANGE.4 T5 i" I0 B7 `+ ^3 ^. h: t
- *
8 _2 o# t* u3 C3 N7 u( f+ y- V4 I/ W - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! r4 Y2 u1 I" ^' f# o5 [! @
- *6 h# J7 ~( d' I) S: _
- * This program is free software; you can redistribute it and/or5 ?8 a* ]; E& j9 ^1 `' p3 W3 Y' Z
- * modify it under the terms of the GNU General Public License as& i" ]( D2 J5 N l! }" q1 H& u
- * published by the Free Software Foundation version 2.; ]' ^ X* J9 ]
- *+ U v* B' ^$ E6 s$ a" Y( z4 A+ |
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ y W; E9 N. p6 Y ?8 X v w. g, a
- * kind, whether express or implied; without even the implied warranty
7 f9 J1 {5 \. L2 R+ V - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0 k' d3 w: l+ N/ i' C* K7 ^ - * GNU General Public License for more details.
5 c1 _: N0 e2 p6 D: t - */! @( j5 Z6 _! }" }) P
6 Z) ]* t' X( m+ m$ t- #include <linux/module.h>
" E5 ^9 x5 ^, l) B - #include <linux/init.h>0 {/ J: V; d8 D; M) o0 \$ R6 R
- #include <linux/errno.h>
7 j9 f( o$ C+ v, V' Z5 n - #include <linux/types.h>
4 u( C, y) F7 q7 ` - #include <linux/interrupt.h>
& }5 G, y2 ~, n/ [+ ?- N8 H - #include <asm/io.h>
4 C$ r, e) f2 w2 b - #include <linux/moduleparam.h>
$ N" {& o- N, T2 w$ T - #include <linux/sysctl.h>
$ S: ?6 O3 X: ^8 k+ I+ k" r/ p - #include <linux/mm.h>
2 N ] b. y4 B - #include <linux/dma-mapping.h>: d5 x' s' _+ g6 |0 Y+ {
- & o: |8 `: Y( S% k! A7 i: S. x0 q/ T
- #include <mach/memory.h>. V# V% N) p6 T, V, R3 a, ?$ T
- #include <mach/hardware.h>
7 W% y7 T% r3 O; R6 H0 t6 e - #include <mach/irqs.h>
( K9 [0 `9 K; ^3 i - #include <asm/hardware/edma.h>
4 w* a4 Z' G( q6 p2 X - # w! b9 X1 E9 I
- #undef EDMA3_DEBUG9 c9 @& P r6 G# I- F& k
- /*#define EDMA3_DEBUG*/5 A& l# E4 S# ^
- $ S$ ~5 |: D7 w
- #ifdef EDMA3_DEBUG7 {( \+ W* ~5 R y1 f1 c. k
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
( g0 k3 g0 d. e2 i - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ r2 k+ i3 v2 u: J6 G9 f2 H
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
6 z% s& X( h8 [6 P) g4 j) I - #else6 D# p8 Z( k" H+ J: w' \" L) d
- #define DMA_PRINTK( x... )7 L1 d& _ N: {) C2 ~. e0 J
- #define DMA_FN_IN
% }' w1 \5 l& G - #define DMA_FN_OUT
2 q% n% `! L7 @8 U) z. g - #endif$ W5 w/ {5 X+ [: s# I
4 H+ c1 K5 b* O$ @+ k- #define MAX_DMA_TRANSFER_IN_BYTES (32768): V1 `; ^, B( ]7 `# @
- #define STATIC_SHIFT 36 G4 D8 i z6 [ H/ C& }
- #define TCINTEN_SHIFT 20
7 x/ U0 k% p# G5 x# U& K8 I' j5 R - #define ITCINTEN_SHIFT 21$ q6 C8 o% P1 C5 p+ v& W
- #define TCCHEN_SHIFT 22
* \- r9 r, u/ f% U7 H* ]0 a - #define ITCCHEN_SHIFT 23
3 X" T+ `% @0 s2 }* ?
) R/ @5 N) c) u* d- static volatile int irqraised1 = 0;
8 Z; A3 s+ A* G' q2 o4 G* C - static volatile int irqraised2 = 0; [2 F8 l& w8 ^
0 h8 n; y; r5 F- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* l$ k+ m! T2 C+ z: | - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ U8 O- O; i& x, U' ?
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- i7 b+ d) m: a5 g1 U* Q
: y, S, j5 j! u- dma_addr_t dmaphyssrc1 = 0;$ R' @ x1 B# W+ ^ U5 F
- dma_addr_t dmaphyssrc2 = 0;/ B( ~) y, z! x+ u2 U: r }& d, }
- dma_addr_t dmaphysdest1 = 0;
4 L% Z# m9 \/ f) a - dma_addr_t dmaphysdest2 = 0;% R( C. D2 t! h0 M7 n7 K" @2 |
- ) Q K* u% C! d3 @& K
- char *dmabufsrc1 = NULL;
& y, f( D2 o5 R) ]8 k3 ^3 y; e - char *dmabufsrc2 = NULL;$ E g1 j5 ^3 ~
- char *dmabufdest1 = NULL;
3 z' {! X" b" X - char *dmabufdest2 = NULL;
* C% O" _& O* ]' z& e - . o+ ]5 l$ q/ P% [
- static int acnt = 512;
8 g$ ^4 w+ L! t7 ]; r1 N& d - static int bcnt = 8;
, c: t7 J% v- [! J* U$ B - static int ccnt = 8;- ^8 k. l0 G) \1 r9 m6 T7 a
- & a, @( {2 k% b- g5 s4 m- O
- module_param(acnt, int, S_IRUGO);
* r- X9 F# E( \; g4 `+ { - module_param(bcnt, int, S_IRUGO);
+ u" V' j4 |% T2 t# Z+ @+ j - module_param(ccnt, int, S_IRUGO);
复制代码
$ ~' ?9 m, _" I. q9 t w
: w* Y1 \4 R( [* q- c+ h( W 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( r1 _5 x$ O% t* l# @( \
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- x0 T) I6 m! A 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 Z) ], \8 _+ v0 v3 u
" p4 w# S) I: J) r0 w
$ X5 {+ n( F6 s. @# ^
|
|