|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# q$ E ?2 f% i1 ~+ ]- [code]EDMA sample test application
3 F% T; A, l( y0 W1 ]* z5 j& r+ c+ v8 O8 k - /*
j! \. \9 `: W& c* t% V - * edma_test.c
. J: Q! l' E) T$ Y$ p - *
* m" X! G6 d" {7 h - * brief EDMA3 Test Application: |1 X3 D" C a9 ^) `& Y
- *
& V) f; I: r$ A* N - * This file contains EDMA3 Test code.& \8 g5 P2 a' Y& V; J/ U
- *
2 Z- J$ e7 A2 c& Z - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, q" x% F4 h( i$ U
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
+ O# A1 e; S4 Y5 J& U. X - * TO CHANGE.
1 L* u) w2 S, v: n4 L$ G/ G- q - *
D7 E; w* R8 }+ W4 J& E - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
$ k: u/ l7 i& g) u% n1 Z - *0 l( a' u* o! R% j+ ?! M8 ~) ~; r2 q
- * This program is free software; you can redistribute it and/or: g; _* t- h. T5 I6 T8 h' G
- * modify it under the terms of the GNU General Public License as9 ~; B& G/ h/ Z) I
- * published by the Free Software Foundation version 2.
- v2 r- ^) m' ]8 a - *
( O7 |) j( b* }) W) t" g - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
) T7 r; d; b7 y4 c u: w+ {6 U9 ] - * kind, whether express or implied; without even the implied warranty
/ x, z8 D# o9 m6 e9 s- Q) z - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
: c2 a; O5 P- i7 B) { - * GNU General Public License for more details.8 G, O5 z3 D: D2 L: r! Q: | |( l1 ~
- */
7 Z9 L/ }) L) k - 2 T5 [; I& z6 j- R) C
- #include <linux/module.h>
2 O" h9 Y1 m& g4 h- q - #include <linux/init.h>
7 e( l s% K* t, K& S- P ?9 y - #include <linux/errno.h>0 ]7 z B& ]; V ^
- #include <linux/types.h>
) Y& T& x" \! C ?& E* B9 O9 f - #include <linux/interrupt.h>% \% r9 Q( e/ W/ K5 q8 j3 J
- #include <asm/io.h>
# g+ ] v6 `: K2 L7 ], @ - #include <linux/moduleparam.h>
' f+ R! E9 d% Y* I - #include <linux/sysctl.h>5 k: ?0 Z( Y3 u
- #include <linux/mm.h>+ d0 V1 _# @) M a
- #include <linux/dma-mapping.h>( e1 Q* ^- t3 w0 G
' {, Z& n, |/ g6 O- #include <mach/memory.h>7 _" p: H$ b: V) p8 Z3 L! {
- #include <mach/hardware.h>
4 k6 \; w8 V: {* Q - #include <mach/irqs.h>
$ Z' b+ N, \3 t# U- s - #include <asm/hardware/edma.h>& f7 [" B, d8 G5 F n
' O7 _' G0 K- r2 V- #undef EDMA3_DEBUG) _. F% V/ k3 y! T8 @8 G H
- /*#define EDMA3_DEBUG*/5 [" |7 p) ^! T+ y @
- 0 B# c, f& D' n. d
- #ifdef EDMA3_DEBUG
7 \( m, h7 S7 ?) r! C - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 {0 _7 _3 E# G2 r9 l) p
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
+ D# @0 e: a' F; M+ u! [9 U, Q - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" b% P" k$ q1 q+ ?+ b& L/ ^
- #else' Z% B+ `+ T0 ]. L
- #define DMA_PRINTK( x... )6 A0 j( x6 M) C6 I7 `$ ]4 q
- #define DMA_FN_IN9 X4 W4 c$ v. w [
- #define DMA_FN_OUT
, |( k! W; X# l( I, Z - #endif0 J' {9 Z0 E5 d. G- q& z
# v# O& U( N1 r- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
2 R" a) y% f: [2 A k - #define STATIC_SHIFT 3; Z8 D9 O5 }6 i5 D2 e B' H% B/ F
- #define TCINTEN_SHIFT 20+ X" E( C+ W3 A% R+ \) K
- #define ITCINTEN_SHIFT 21
( _& H1 V4 K) m* { - #define TCCHEN_SHIFT 22
+ T! y- Z( g7 f; P+ D3 h - #define ITCCHEN_SHIFT 23
$ s2 r% m- j2 F) k1 ]1 H - , B4 D( M5 x/ A9 ]
- static volatile int irqraised1 = 0;7 r |: c( w0 p1 Z: {# g
- static volatile int irqraised2 = 0;
. h1 y! b6 `5 e2 x% `4 | - 2 N6 s* N$ B* D1 H
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 @5 |, o% ^7 f& M
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" G: V' n1 F) [; a3 ~5 l$ V - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ E4 s, Q/ m# t1 S - 3 T; |! _+ ?- S+ f, j8 E
- dma_addr_t dmaphyssrc1 = 0;
; p- f+ t4 _& q6 {7 p* T) V - dma_addr_t dmaphyssrc2 = 0;
' s5 f4 Y. ~( E+ C1 e- B - dma_addr_t dmaphysdest1 = 0;+ u8 b1 v/ I* S# j/ G' j- E9 W3 R
- dma_addr_t dmaphysdest2 = 0;5 V) \; \6 e u
- 6 s& m+ z$ a" s% `9 A' K; n
- char *dmabufsrc1 = NULL;
1 N( }% Y( W$ L9 W - char *dmabufsrc2 = NULL;9 y3 r9 N1 n6 [$ p$ o
- char *dmabufdest1 = NULL;/ e0 T- @+ R4 y; g( Z* w
- char *dmabufdest2 = NULL;
: P4 r0 e* c2 f( N# i6 \; _- u; n - # U! H7 o2 D. T7 H+ d, r5 N/ l- Y
- static int acnt = 512;
% T# g$ d& R2 }2 e - static int bcnt = 8;' c$ ^/ R9 Q% o
- static int ccnt = 8;
& o! i1 F" Q! T, p# ~2 o0 {! j. d% l - ; Q1 E0 O* c, }( }
- module_param(acnt, int, S_IRUGO); ?* i. g& e% G! A! D5 w
- module_param(bcnt, int, S_IRUGO);2 Y6 V' ?# q3 C; b) E0 R
- module_param(ccnt, int, S_IRUGO);
复制代码
. O+ q$ u5 i' v
! Q% m& [1 o3 i& V+ ^! O 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 U! i2 c8 Q! Z0 m1 D, X
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# R' K+ F3 P5 |1 U4 R; q
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 U$ X+ N8 _& ?) h( V% ~' J( ]3 j+ w- g# [
" M& a' [$ b" V3 [' A, c& e! C1 [5 S7 f
|
|