|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% ~, G+ `! B" a# s, ]- [code]EDMA sample test application f- [7 V5 k' h
- /*
" S' K5 j7 ^6 o8 O. n1 N2 v; U$ w - * edma_test.c
, a [2 f9 ?1 R3 l - * B- s' y6 U/ r( n7 | V! p5 _
- * brief EDMA3 Test Application+ g r: F1 J% b1 E. P% C+ U+ N/ C& _4 ~
- *: r% o8 V5 Q5 F, W( H0 e6 y
- * This file contains EDMA3 Test code.0 I; g: e! h B0 q
- *# P1 u, G6 s& Q* d0 t3 D
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
7 ~) z9 p) R% K+ m/ T! X - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 f6 U- I) _5 p+ }
- * TO CHANGE.
6 c: d* A5 i, X G4 A+ K - *$ z. R; B q2 ?$ a- \ D5 l+ a: I
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
, k: S3 B( M, d1 l; w, a - *. ~* C6 M) t5 r( m* d' W
- * This program is free software; you can redistribute it and/or& n2 V$ i6 c) `& ~+ }- g
- * modify it under the terms of the GNU General Public License as8 `) \, o% v' |
- * published by the Free Software Foundation version 2.
! y/ r& {2 s) E5 l0 O- S% Z0 G - *5 N4 _! ^" F! c; z% l+ v6 A
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any% ]5 c& b# i5 N7 l: a
- * kind, whether express or implied; without even the implied warranty% J) `" m/ W4 J5 ?2 T
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the0 F8 h* g9 s; D/ G
- * GNU General Public License for more details.
( f0 l% C0 @( e6 E8 B% e7 G - */
# `5 F( d6 c5 M - 5 s3 E/ w y' u, K5 A$ c
- #include <linux/module.h>) m- V, t. O5 G; @4 t) F
- #include <linux/init.h>
+ l- D9 w: Q2 l, x - #include <linux/errno.h>
2 I7 W$ e9 Q( }! L6 V- E, [ - #include <linux/types.h>$ t3 i7 Q; }! d7 u7 K( I U
- #include <linux/interrupt.h>
0 B1 z% G' P! C' y( C - #include <asm/io.h>
# D6 P# S9 ?3 _0 [5 P0 k, G - #include <linux/moduleparam.h>
9 |% @& m& h: R2 X# x - #include <linux/sysctl.h> }% z3 c% ]) [
- #include <linux/mm.h>3 W9 {/ u9 r% v2 [3 ?- h
- #include <linux/dma-mapping.h>
C: ~# v1 s2 D6 b F. ?7 e - 0 y- q3 H- \( g- N# v4 D3 J
- #include <mach/memory.h>
3 a9 L! a7 X" n - #include <mach/hardware.h>
" Q/ U: z: A- A, j, T* c: S - #include <mach/irqs.h>, o _2 f9 h O) |* Y
- #include <asm/hardware/edma.h>5 D5 i, y, i% ^$ d9 k
- % i3 Z" G5 j m% }; d6 V7 h* g
- #undef EDMA3_DEBUG9 n. [: X1 N m( q
- /*#define EDMA3_DEBUG*/8 U) ]& L( G6 l$ |$ H
- 0 k6 D' K# X; C
- #ifdef EDMA3_DEBUG) `: I$ m. g% ?
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 F# D: i9 i( _1 A; v( {( Z& L4 u1 I7 q
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
, y9 T _( {1 j9 Q( \ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
( n/ T) n, Z% U/ D - #else
) U5 x: ?) N# x7 f; [2 D7 i; ` - #define DMA_PRINTK( x... )
& _ N: K- l6 @4 A! z+ C2 f: j - #define DMA_FN_IN
+ k/ \; Y6 ~" r& S - #define DMA_FN_OUT& x4 ?8 {8 R$ I9 @
- #endif
, {7 Q: @6 F8 L
6 h9 ~; b& m- U, W- #define MAX_DMA_TRANSFER_IN_BYTES (32768)+ W% V1 T0 S* ^& F5 h
- #define STATIC_SHIFT 3
( E& M" W3 T- _) [# n2 U - #define TCINTEN_SHIFT 20
2 {) w/ N2 O7 E# M - #define ITCINTEN_SHIFT 21
. Q n. `5 j* y/ T - #define TCCHEN_SHIFT 224 k% w4 _4 }8 P6 x; H; ?
- #define ITCCHEN_SHIFT 23
1 T, E7 Z+ A: R7 u6 v$ G9 f4 ^
! ^9 @" |$ i ]: x4 ~- static volatile int irqraised1 = 0;
$ {3 ]2 e& D7 M2 Y- F2 Y4 ^7 E$ V- a - static volatile int irqraised2 = 0;
$ n9 \8 \3 [6 {- r
- F, M! S* h' N. o* I5 \7 E9 J8 A- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 H/ }3 J5 M; r: R+ a* b% i6 A# f
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% G9 C+ p& h% p1 s5 c- ^* |% K - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 N( f9 s0 z" g( h; d
- * W( v \! m6 {6 N, z/ {
- dma_addr_t dmaphyssrc1 = 0;
9 b) S7 A3 X: H# J - dma_addr_t dmaphyssrc2 = 0;
6 A& Z; t. i4 H2 n0 f: R - dma_addr_t dmaphysdest1 = 0;
$ A6 ~* K6 p$ S9 k, k. y R) K' E - dma_addr_t dmaphysdest2 = 0; ?$ @ E3 E4 }) E& }! ?6 D5 Z
- # H+ x7 l/ J* d/ d7 \8 j
- char *dmabufsrc1 = NULL;
) t( ^6 t4 `2 A; n# U. s) m% H, i - char *dmabufsrc2 = NULL;& Z q" q# g, @1 m$ n
- char *dmabufdest1 = NULL;1 p C9 ~6 k9 s# g' D
- char *dmabufdest2 = NULL;
|' B. `* O/ P# a - 2 h* d7 {7 i4 k: C6 d
- static int acnt = 512;$ |% q, t+ I( t+ d7 ]3 S
- static int bcnt = 8;
$ }: z$ ?! W4 V' j, l - static int ccnt = 8;
z- P" h$ L& e8 m& D7 T6 y - ; @- ?& |% l' D! A5 O$ Y$ Z) c; `6 k
- module_param(acnt, int, S_IRUGO);
6 d, X% R+ G0 a7 ~# y! x - module_param(bcnt, int, S_IRUGO);
h, w! ]+ {* i3 H$ w | - module_param(ccnt, int, S_IRUGO);
复制代码
0 x- z$ N1 b% P) c9 r' I# i1 Q
1 R. D2 D/ U ]0 h 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
D7 S+ u, ^6 Q9 c2 u; e4 U. K" 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" a" v5 O% _8 M y 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! U7 W3 E6 W% `$ P3 N
; ^6 }+ ^: U* P/ i% y$ W
! I9 |6 n" G5 K! E5 g0 |* B |
|