|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 i/ ?1 @$ V, Y/ d _+ O' ~1 S. O2 V- [code]EDMA sample test application4 Y# x# l+ U: a- q- O! B5 M
- /*
! b& _: }! g) j7 u6 E3 R - * edma_test.c M5 Y+ ^$ _. O8 Q8 a+ v
- *6 S" B( G P# X# [4 f" \2 K
- * brief EDMA3 Test Application
" S4 r0 l) l5 R& s& d+ U - *: F( }6 V1 T* ?& q- S
- * This file contains EDMA3 Test code.
: k+ f" p' L3 o2 e& C - *
1 N, R$ p* V% O* z0 ^( W - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, q2 L4 d7 ?! E7 n$ g
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
6 p3 B5 r5 E9 ~5 _: B% q) O - * TO CHANGE.
; v0 G2 r# ~ Z; N) \ - *; k2 R4 x' E/ J8 \4 F% S
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
5 L1 B* D X9 k. E0 m( `) M! w1 n0 I/ t - *7 h: Q5 |/ T3 ], E0 H
- * This program is free software; you can redistribute it and/or
$ h5 W! r* t# ?0 r3 V - * modify it under the terms of the GNU General Public License as8 i' ?: D% ]& z3 e
- * published by the Free Software Foundation version 2.1 X, ~) C# I6 l/ [1 y
- *
: d w8 E: E6 T! _# V/ m - * This program is distributed "as is" WITHOUT ANY WARRANTY of any( P4 \" r. R! s, J2 q
- * kind, whether express or implied; without even the implied warranty
1 \3 c# A( M% f/ {" v; x - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- D) B. [& |2 Y& D; C
- * GNU General Public License for more details.
- ] g# n# F; U) t* e - */
5 V# L6 f& A& r2 T( V& }6 s - 8 ]7 S+ i K/ [" u! Y2 ]1 f! d5 f: _
- #include <linux/module.h>4 I1 A. {7 ~) l! B& O( h
- #include <linux/init.h>
$ {' {, ] _; E. e7 u - #include <linux/errno.h>
- L$ V# e6 ]/ g: c - #include <linux/types.h> p* k9 m/ z9 A. Q* R
- #include <linux/interrupt.h>
0 \, W- L+ F* b+ T$ S - #include <asm/io.h> r+ d7 \4 w4 C8 K) n+ x
- #include <linux/moduleparam.h>
2 F* `7 w: @$ s2 K) H: D. ~4 U( ] - #include <linux/sysctl.h>0 p; U- g m* g! q5 H8 ?1 J
- #include <linux/mm.h> O" ~* N0 I/ n) x/ U3 Q
- #include <linux/dma-mapping.h>
$ w+ ~ X2 L, q& ` - ! ~: d/ g1 E/ x0 Y4 S7 F$ s$ v* V, d
- #include <mach/memory.h>! ~- L1 u8 ~4 K
- #include <mach/hardware.h>
9 l% @$ i+ z) H5 H2 @4 h% D - #include <mach/irqs.h>4 }& U% m+ ]5 A" n, P
- #include <asm/hardware/edma.h>7 N% q _. H" K. O r4 \
; x% M0 J, n9 Y* Y& e/ [; d- #undef EDMA3_DEBUG
5 V: D4 j% {9 s6 J% N - /*#define EDMA3_DEBUG*/* p. K. d% D# }5 d+ V
/ A0 ]" D- q8 @- y( g" a# M- #ifdef EDMA3_DEBUG u) @* q5 S5 P& t, u4 I1 |$ H4 d
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 N5 x& b# b& ^. U8 W- o8 C
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
$ L( j" _) q+ a/ A - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
+ [/ k) I, ?$ `( r# a) r1 w - #else
3 c, Q% a* n" @ - #define DMA_PRINTK( x... )$ g$ o0 G8 @1 W1 A# _$ l* i
- #define DMA_FN_IN
% b6 f3 a5 |( n! ~ N - #define DMA_FN_OUT
: F$ f, f+ j: f - #endif1 ]) l, X; \. r$ @5 B- u
- 2 Q* w" y- S9 A" _
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)& W! }, O1 ~1 D4 w/ d. T
- #define STATIC_SHIFT 3
- w7 L! g1 K8 P& a8 G - #define TCINTEN_SHIFT 20
$ H( _- G1 Q3 @$ y - #define ITCINTEN_SHIFT 21
# \, s: B- }. u( k7 F+ { - #define TCCHEN_SHIFT 22
+ k/ b7 `8 J) o5 C) f - #define ITCCHEN_SHIFT 238 ?, K% a5 e7 j
* d( o( }/ U" o; X( [1 H- static volatile int irqraised1 = 0;/ r+ U2 D) A' {' z0 w
- static volatile int irqraised2 = 0;/ f' ?) G- T Z8 T! n0 e- K5 ]- w
; E3 B6 l; {5 W& r- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: O- o! W4 w8 V" H, s
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& j& `! M* G; H1 `4 i* L* |
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% U, R% {) o6 \6 w6 r; C
* G& l9 y9 d) g5 p- dma_addr_t dmaphyssrc1 = 0;* k E8 H" q/ S" y
- dma_addr_t dmaphyssrc2 = 0;
: h: N0 Q" l2 g: C1 v - dma_addr_t dmaphysdest1 = 0;6 N8 r8 b( |/ _
- dma_addr_t dmaphysdest2 = 0;
/ s" V9 ?+ [6 [0 U- ~, F7 e/ ~3 S- a
4 z8 i. o' P* r- char *dmabufsrc1 = NULL;
8 |2 V. w% W8 ^# \; G& Y - char *dmabufsrc2 = NULL;) z, e* d3 T+ z2 Z) a& {
- char *dmabufdest1 = NULL;
8 X9 e5 h% J3 k7 i6 { - char *dmabufdest2 = NULL;
# Z/ @! S: P: B0 q1 {8 p+ E
$ w1 p& e) i8 ^# |2 r- static int acnt = 512;: m# k* n9 H: @2 _
- static int bcnt = 8;; S# X3 b6 s4 V$ w L! k
- static int ccnt = 8;
: A4 X; n5 {1 }6 d, S u& [3 X! s - 9 Q5 e0 g5 ?% _& l/ ]& X& w
- module_param(acnt, int, S_IRUGO);
5 T; d6 H+ x' L! A! E - module_param(bcnt, int, S_IRUGO);
% ]5 |2 f4 G$ I% y( J* x - module_param(ccnt, int, S_IRUGO);
复制代码 5 E& y3 A! ]1 S' d) V# I
- S$ N; B5 @1 W! j 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 T4 m- E/ l5 P, l* 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# c/ w9 C% _- _* @
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) H) B" H& f, J! x4 ?" E( H8 n+ X
6 |6 y2 T! E0 s3 _4 S0 {' W% g- L, S, }+ T0 n: M
|
|