|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 i7 _ G0 C; J! u) x
- [code]EDMA sample test application
. j* ^6 |+ d; Y( w7 @ - /*
% I8 r g1 R$ D+ R3 i: n - * edma_test.c
' ]' Z0 l4 N% h - *; @, I/ n, H/ q$ ~
- * brief EDMA3 Test Application; l( X5 a( |; o* M7 A
- *
& u" S( @% V* V* b1 R E, F - * This file contains EDMA3 Test code.
9 Y6 p' u+ c" p% ]' s* Z - *% u+ z1 w0 u2 r! }% v; b' u6 f8 g
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
( A" I& t: U# n5 f - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
1 q: Y6 Y/ J6 I) \( L( i/ s. C( l! ] - * TO CHANGE.+ i7 g; j7 d! g
- *0 d, G; S, J& r# U# A! t
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
% W) t% M2 `/ j7 d$ {* x- W4 s - *
; L! T$ w: W: x3 N5 ~ - * This program is free software; you can redistribute it and/or
, E3 r) a2 }, q7 q0 u# e0 z - * modify it under the terms of the GNU General Public License as! ]3 c; |' f5 p! I2 v
- * published by the Free Software Foundation version 2.* [5 l- O( l5 Z3 v0 Z, G" Q
- *$ A4 e7 ~5 U" ^. R3 l
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ j4 `. K* A6 A. D t+ n, o
- * kind, whether express or implied; without even the implied warranty
. r* p, w' `6 n! A. D8 w - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2 }; b3 x9 O$ _" G1 G; C - * GNU General Public License for more details.
W- R) ^0 u+ T8 K1 h - */
`! Y9 d- P7 ]/ V/ S - ?" I- L5 k+ l# r" a6 J9 x7 U( G' r
- #include <linux/module.h>4 p! O2 ] c* h7 {' _6 x
- #include <linux/init.h>. k) M, R) q) |; U
- #include <linux/errno.h>- H0 U7 o9 Y6 S# \
- #include <linux/types.h>
/ ^% v1 y& X7 L - #include <linux/interrupt.h>
. @1 j! m0 X* M, T - #include <asm/io.h>
( I% C' u0 ], v - #include <linux/moduleparam.h>3 W: c, Z- w/ ]6 ?% P& I
- #include <linux/sysctl.h>
+ t+ R% A, {- I" C7 b - #include <linux/mm.h>3 x4 h% R$ b6 |. H8 m! s3 k
- #include <linux/dma-mapping.h>$ Q" [ F- {, Q# l4 L
- ) ?6 Q+ n9 G# b5 \
- #include <mach/memory.h>
, p" r; j& r' y' I4 U3 _ ?5 C - #include <mach/hardware.h>
, W- ?- o$ S/ u) t - #include <mach/irqs.h>
4 Y# v$ c) U2 k! D - #include <asm/hardware/edma.h>; z8 K' {6 E+ E8 ]
- . @/ U* I( Y8 U" Z
- #undef EDMA3_DEBUG
+ ] {+ o7 s9 g. k1 r; t9 O - /*#define EDMA3_DEBUG*/
8 W+ A8 t6 F K; l+ l - & ^+ A% u/ h8 B# C U1 s: A/ I$ ~
- #ifdef EDMA3_DEBUG
/ N/ y/ f" R* g+ B8 Z - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
7 V1 W/ S7 ?/ Y2 G, { - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! E" @2 v8 L1 L. r; b
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 N$ }- S4 t: B& l) ?6 w
- #else$ G, u, i8 K1 M; H( m6 ?* Y8 v
- #define DMA_PRINTK( x... ), w! t9 j7 e, W1 a& J0 H' |" A
- #define DMA_FN_IN
" O3 G. w3 s! C' k - #define DMA_FN_OUT% l( u6 V0 Q4 v$ Z. Z
- #endif
5 S% O! x) d F" w, G9 K
2 E4 B) ?, E" O: w% O( ^/ f) ^. R- #define MAX_DMA_TRANSFER_IN_BYTES (32768)0 G. j5 z! {' o/ j' j& ?4 F4 |" K" \' V
- #define STATIC_SHIFT 3
' K3 @* b& _, f, N& v" j - #define TCINTEN_SHIFT 20
, u2 K' c8 |8 u: O - #define ITCINTEN_SHIFT 218 e% u& n9 @' W8 q, } ?8 y
- #define TCCHEN_SHIFT 22
% z7 r5 K, O0 \- b# q - #define ITCCHEN_SHIFT 23
2 {) |0 j$ S4 r; ~% M - 3 Z6 ^: M- q* h( Z6 i- v8 W# |( z
- static volatile int irqraised1 = 0;2 l' q. H7 l8 W2 @! Y/ X* _, h
- static volatile int irqraised2 = 0;
& j8 D2 l8 o/ P/ E: O
$ E! d% B- _$ C! K$ r3 Q& j- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% h- W+ R3 T. o1 [. }7 P - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, _0 R. a* d# I% \
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 X _! g; K# S9 X- H- l7 s8 n4 [
5 Z- F; b$ b7 y) g- dma_addr_t dmaphyssrc1 = 0;8 }+ ~+ `+ j) R8 |; j! d
- dma_addr_t dmaphyssrc2 = 0;" F5 S Z: e. e$ v8 V
- dma_addr_t dmaphysdest1 = 0;
j' n$ m4 `! [- z - dma_addr_t dmaphysdest2 = 0;) a' F9 [- g$ I5 |* L* \3 }9 l
' g' j% G$ Z, s# Z- char *dmabufsrc1 = NULL;
; F! t: q$ J! k4 J - char *dmabufsrc2 = NULL; y* B2 ]" N$ N3 l7 q! ?
- char *dmabufdest1 = NULL;
; s* T7 S% P, t - char *dmabufdest2 = NULL;
- P* R& p. p3 m5 Q: j# s/ T) A5 H* ^
6 R) a& W' C3 i; y T- j1 P( ?- static int acnt = 512;" \4 z1 q1 r1 s- p! S6 J! M c' [
- static int bcnt = 8;
A S; w- d4 b# G$ k) V; s - static int ccnt = 8;
1 P- D8 `+ a% _( A - / {6 M* D8 o; a+ ]0 i. h- p6 g- v
- module_param(acnt, int, S_IRUGO);5 m D# j" }' _& Y: d$ ^( @
- module_param(bcnt, int, S_IRUGO);
/ r7 C1 P. x7 c3 [& p' K - module_param(ccnt, int, S_IRUGO);
复制代码
5 w6 |6 f+ w: u: ^5 C! M5 g( q8 w( h, E% G/ D5 P) M
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( _" z& D3 B' O5 r q
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 V* {/ [: d, I5 C
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( c4 }4 I! N3 U1 o" s _* L5 f; {0 W v
3 G* U( v$ X6 V# W6 j |
|