|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 K) ~$ U, T9 ?/ l/ b' O9 _) V/ ]- [code]EDMA sample test application
2 Z# Z5 T+ K8 c/ t2 S3 ~. I - /*
9 n% l5 f E' J5 f - * edma_test.c
6 F8 g. @) [! I# ~ - *
4 p( \& o |) v# o - * brief EDMA3 Test Application4 j/ n) ~1 |: E. I' _8 s Y/ O
- *
- r: V" m3 G& w& v8 X. u0 | - * This file contains EDMA3 Test code.& \' k- w7 L) J* x) J/ Z" ^- T
- *# n8 M$ f2 V; P" T8 B. c
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
- v* v3 m1 d2 |3 b) m - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! M! W! [1 X) Y( [0 w
- * TO CHANGE.0 H; W; {0 q, d1 \( J
- *6 w d: y- n4 X3 e1 J
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 r* m1 R; ^6 L. M# y. s# M, E$ Y
- *2 ~9 F, G# I" K; Y5 G' E
- * This program is free software; you can redistribute it and/or v; A5 i8 G, [9 b! _5 I( ?
- * modify it under the terms of the GNU General Public License as2 |& n0 a3 ]6 c1 j+ D) t8 a5 ~4 r
- * published by the Free Software Foundation version 2.
& D* H# `6 X6 o. ~+ ^5 ~# ]5 l - *' s \2 N4 Y" N
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
2 ~! M8 S/ x5 M - * kind, whether express or implied; without even the implied warranty- K# t4 `3 L, p* I9 C+ ]
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2 ~; @8 P+ _* x, ^2 E6 G! S - * GNU General Public License for more details.
0 B: v2 L5 e% `3 d4 i - */
; k1 J* [0 Q. p8 {1 M% o
" r. q* ~, G4 m! ]( T- #include <linux/module.h>
, q ]- ]3 T3 a( O - #include <linux/init.h>
( F: c: m& b# L - #include <linux/errno.h> Y! l# B3 ~; }1 k8 Y, V) X
- #include <linux/types.h>
" }. n$ S' P M$ \$ I$ ~ - #include <linux/interrupt.h>- z; o; j# _2 u% M' I
- #include <asm/io.h>7 {8 d/ x% \' ^
- #include <linux/moduleparam.h>" u# j# J% [! d- O1 i/ f9 p* {' W
- #include <linux/sysctl.h>3 j: Z2 t* E8 a5 z" a
- #include <linux/mm.h>$ J# B7 d" u- a2 \
- #include <linux/dma-mapping.h>
5 B4 s( E. m, r7 ?! e: ~9 W3 k/ k
7 W4 \. Q3 H* a3 W- #include <mach/memory.h>0 \! }+ V* t0 b8 r0 j6 s$ I b
- #include <mach/hardware.h>
: D/ ?% X; F9 ?+ W - #include <mach/irqs.h>3 T; V" Z8 z7 m
- #include <asm/hardware/edma.h>3 T7 A. u; @5 W$ v# J) z: e
- 6 m* e6 W$ [3 K
- #undef EDMA3_DEBUG) o, b# X5 x3 e, M0 W" j
- /*#define EDMA3_DEBUG*/
4 Q; h$ I% \3 |0 p
9 P& A4 B4 H% s0 i- #ifdef EDMA3_DEBUG8 |1 s1 p. Y1 D; F) B& v
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 H& M9 l' M) X' `8 V1 u- A
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
; q' k6 h" ~9 G% |" ~ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) m2 q8 Y9 D0 K3 w, k
- #else
E0 i8 K# L% M, t% X4 p5 U - #define DMA_PRINTK( x... )2 L# u% x7 t# M& i
- #define DMA_FN_IN
7 K; X" K0 ~* ~: g& X' v5 q7 z/ T - #define DMA_FN_OUT
. N" T: Q8 Q. Z% A, o - #endif, @& b& e j: K1 V' k: [$ z! Q
- & z+ _' i' M# E+ s! T. g
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)4 y( k* E' R: q& G
- #define STATIC_SHIFT 3$ z, R4 @6 e ^- E* S: d
- #define TCINTEN_SHIFT 209 a' g7 T! o- O& n8 ]
- #define ITCINTEN_SHIFT 21
# Z- M( v# k3 `7 S" C - #define TCCHEN_SHIFT 22
$ g w4 V4 }9 k1 }; | - #define ITCCHEN_SHIFT 239 P; X8 p1 H/ o+ A6 I, u- ?
( c0 U4 n. l3 {- t+ y3 A' {- static volatile int irqraised1 = 0;5 B8 Z! Q8 c5 ~0 m% ?
- static volatile int irqraised2 = 0;. a0 H" f3 N: Z' K6 \4 @
- 1 j! I& @+ _0 {" J: L
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 R/ F# X' i3 y% Z) }
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ z w1 F( q* C3 y1 P o8 N - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ F, Y1 o- n# o; ^
- i' q" Y b- \# n- dma_addr_t dmaphyssrc1 = 0;
9 e+ Q) U" d% [9 `9 w: D' t+ k - dma_addr_t dmaphyssrc2 = 0;
% H$ C3 ^2 v& M( x - dma_addr_t dmaphysdest1 = 0;
: K b5 T8 L m3 R' c+ {6 Q - dma_addr_t dmaphysdest2 = 0;. q/ I1 Q: `+ R, Y& O) t
, ^( [1 g4 V% E% g' `- char *dmabufsrc1 = NULL;
1 o5 S0 L$ c( y9 ~ - char *dmabufsrc2 = NULL;
+ C* M- ?1 |8 p - char *dmabufdest1 = NULL;
( S7 h+ H' W U/ }# k; k6 k - char *dmabufdest2 = NULL;/ V7 F9 v& ^, t6 V+ L5 i
8 d6 h0 \* b" Q, i4 @; x- static int acnt = 512;, h" L' A: t+ t- ~# ]
- static int bcnt = 8;! m; e5 v- a1 @3 l U- @8 C
- static int ccnt = 8;
1 g9 ?% a7 z( ~ - . ]# ~& b2 }6 ^: c
- module_param(acnt, int, S_IRUGO);
4 r) w3 o! `: Q9 b/ u - module_param(bcnt, int, S_IRUGO);: f' q W$ s, Y! _. I+ S$ E
- module_param(ccnt, int, S_IRUGO);
复制代码 * c& ~. S6 I: k4 n g
+ v$ s* p1 H9 T; D8 h C/ w( E
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ n. |5 X7 F/ y- d* sarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, \! a, c- k# L! @" q# h5 R
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ ?' f# \; ]$ ^2 O: W+ y
: Z+ K9 }3 `( ~0 K- A' p' s4 {- p* B6 ]& N- {9 ~8 J9 _- f- r
|
|