|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 H& g0 N: ^! m4 j0 l! K* {- [code]EDMA sample test application7 M! B u& r0 I1 f9 @0 U
- /*4 N* C! z/ a1 M: p
- * edma_test.c( h/ y: V5 N. Q& r3 v
- *: b' T% c9 i! c: u: D$ f+ O6 }
- * brief EDMA3 Test Application& F/ j- Q3 {( u: C$ y
- *
. R7 H" M" I5 I1 E/ }* x - * This file contains EDMA3 Test code.
. o4 p* r" m, x7 E# g# E - *
# R1 G# |+ b6 f* R: \3 s8 o* h5 C - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! W, I" N/ G a/ W+ A
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ { P) N; u) z( p) L' }
- * TO CHANGE.
9 v* J7 J$ d: A - *
8 n- x8 I- F7 c- r g, l - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
0 r$ Y0 |1 I: a+ f) w+ t - *
. @, ]1 U9 C/ O3 H9 h3 H& [ - * This program is free software; you can redistribute it and/or
* `5 Z( l0 H2 N( o6 ^2 M - * modify it under the terms of the GNU General Public License as
/ m' a" f& |" U& }5 Q - * published by the Free Software Foundation version 2.
8 Z% Z5 R* k( x" b+ f - *8 c# v) U5 p7 s: s% `
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any% o4 E" w' t9 n! q7 }) r: X4 @0 g0 `
- * kind, whether express or implied; without even the implied warranty4 p' K" @. h/ _7 W6 M+ A" @/ N
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0 [3 Q8 C. n% f" Y0 [$ I - * GNU General Public License for more details.
6 f: h' B! \# Z+ x - */
: x: ?; Y& f+ C: A2 C1 E0 Z# z - 4 D$ U/ E5 F4 @$ A) t) ?" ~
- #include <linux/module.h>
" n7 N$ d, J# t P - #include <linux/init.h>
6 a3 |, n2 u" {+ Q4 E- q6 W - #include <linux/errno.h>& e5 f- V9 ?+ X6 A
- #include <linux/types.h>
) |, t2 M7 Q( f0 S$ ^ - #include <linux/interrupt.h>
# Q' Y5 f' ]( T7 W0 Z; V( P - #include <asm/io.h>
y! A% q: U6 a/ ?% ]: M2 R6 h - #include <linux/moduleparam.h>: t! z+ N k+ l$ t1 y! |1 m
- #include <linux/sysctl.h>
: z" r3 @% ?$ k- O( f - #include <linux/mm.h># s0 D: Z$ o# y( n
- #include <linux/dma-mapping.h>
7 ^8 p% h) z( A' U' N# m% X
! ?# u( r- Y& J }* c- #include <mach/memory.h>
, e+ B; ?1 X) ~- \ - #include <mach/hardware.h>
3 Y6 r2 ?4 h1 Q: h+ | - #include <mach/irqs.h>1 W Q* ?4 m2 i. l
- #include <asm/hardware/edma.h>/ x' \3 E& U* Y; v
- . g! X+ O4 k! w9 h7 g* T& V
- #undef EDMA3_DEBUG6 U* e/ d6 f9 C& q+ b
- /*#define EDMA3_DEBUG*/
3 {/ T% H4 [& ?: M) a
4 }% n& m5 w3 j; ^& }# ^( _7 T- #ifdef EDMA3_DEBUG/ [. K @5 K3 k$ P$ E$ c$ \8 `
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 V8 P1 z& y$ P8 x! g* ?
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
/ h5 k. u u( X# V; h3 _# T) o - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
2 H; ~; S' _% A$ N - #else% f1 Y1 ~/ w" c" t- U- I; H
- #define DMA_PRINTK( x... )
$ @( p1 |& [3 }+ h& ]+ Z$ s - #define DMA_FN_IN
5 X: h0 I$ ]9 b7 |" g8 p - #define DMA_FN_OUT
w2 E2 V% y: e" L. F$ ? - #endif
% F$ {& t0 b( R' V+ p7 k
: C. Z& p; L7 t+ X1 Y/ o Q% B- #define MAX_DMA_TRANSFER_IN_BYTES (32768)8 {9 l, B( S5 o" ~2 y# h+ C
- #define STATIC_SHIFT 3* V% }, H3 Z0 i( z
- #define TCINTEN_SHIFT 20$ [+ ?" u; X7 S
- #define ITCINTEN_SHIFT 21
5 X: V' M" P2 O; b0 U) F - #define TCCHEN_SHIFT 227 L# N& L8 e% ^: g! r3 S1 _
- #define ITCCHEN_SHIFT 23! P6 J+ t" k7 @9 w) ^ y+ N% y& k
3 M" H; ]7 i5 J7 B, g/ x, i T8 h) W- static volatile int irqraised1 = 0;& m$ a+ T! a& V4 C, r F
- static volatile int irqraised2 = 0;+ n a% V# ]+ I5 _( X) x
( _9 R( K* X6 G- u o6 k0 J- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 e3 p0 @% t9 t# C7 }$ U/ F# u
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; F) ?" l$ G+ S; g1 |
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& E/ |& i8 D7 G% \* C
: J4 X+ ~. f# w% y0 W, T/ U9 c- O5 [- dma_addr_t dmaphyssrc1 = 0;
3 f$ b2 B& d) _ - dma_addr_t dmaphyssrc2 = 0;1 K9 b2 |9 M' F1 G
- dma_addr_t dmaphysdest1 = 0;, g' a% b# _1 ^: X
- dma_addr_t dmaphysdest2 = 0;, I/ r9 j3 v0 [8 B/ P6 D- `# e5 |
- # u1 o& v, z: o1 f- B/ j
- char *dmabufsrc1 = NULL;
/ A/ b# }8 { J- o, H - char *dmabufsrc2 = NULL;
# U1 s3 ~8 N( X* O - char *dmabufdest1 = NULL;, z, y) E8 F2 P/ H- f
- char *dmabufdest2 = NULL;
' V" T" I7 x; [% E9 F/ z - 4 Y" B2 E o5 K7 {4 p3 T# T) u% F
- static int acnt = 512;
) l1 |5 y$ j: z, O/ u9 G, q+ R - static int bcnt = 8;
( j7 y' Q' m9 ^ - static int ccnt = 8;
2 p" U' D% s1 Z% t! s
8 _2 B q" A8 p( P# w6 ?" m3 q- module_param(acnt, int, S_IRUGO);
4 K; N( W; f9 K - module_param(bcnt, int, S_IRUGO); b/ N; x4 D8 h) e- A( x
- module_param(ccnt, int, S_IRUGO);
复制代码 " d( C& z3 T* K I0 ?9 Y1 O* P& X
$ B' f, C f2 J+ Y4 b0 ^' o; V# @ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ i* b/ x4 s8 p- D( k
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 Y+ ]+ F* S2 d; i$ ~. g: _' E
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 E0 s) t [( F3 {. v R5 D' u
! t/ f% S' R& i: P# _/ U. `0 f: r9 B5 ?. q; X3 U) p1 K+ P
|
|