|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 z0 ^$ f4 {; D _4 g9 |- [code]EDMA sample test application( w. K* \$ m. x% K4 K( B+ X
- /*
( ^$ ?% ^6 f3 g( ~" j6 L4 m - * edma_test.c& |! n' w3 {. d1 L4 J7 p: V
- *
2 J5 R& _$ }8 a5 j+ _% a - * brief EDMA3 Test Application
K2 @' }/ o" j% d) @ - *6 h; Q; U6 Z5 L- s5 s
- * This file contains EDMA3 Test code.1 n7 O. ~3 j: D3 H) F$ f" ?3 ~* ?& O/ `
- *
4 @" y! }9 x: n2 d' Q - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ _! m6 q9 G& w0 G- ~
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
0 w; X6 w: ^3 E: d; a; l9 {) P - * TO CHANGE.# ^- d% o0 ^9 I h ?
- *
/ x( S9 s2 g1 M( p - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
% k) M# S* P" _ - *' H) O2 v* z1 G6 G
- * This program is free software; you can redistribute it and/or
4 ^7 i, t4 z1 _6 a - * modify it under the terms of the GNU General Public License as# z0 j- E9 h0 c
- * published by the Free Software Foundation version 2.; W+ L8 ?( Z/ }8 n' g/ o: p
- *
T6 _, i+ S+ v }" @+ S - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
& _6 s9 W1 o% T6 y - * kind, whether express or implied; without even the implied warranty" B" t, b7 s; H8 z0 c
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the; H. G k D/ P$ ~1 E, x
- * GNU General Public License for more details.7 N0 `* s0 n1 l
- */1 C& y$ a0 }9 n
- ' N0 g, O; Q$ O: Z1 |7 Y S) K' \
- #include <linux/module.h>
$ {+ p' d" z+ P/ }/ E - #include <linux/init.h>* Y, h3 ]0 w5 W; Y$ V# k
- #include <linux/errno.h>
' M) M3 B- j, [ U - #include <linux/types.h>8 r! P9 L6 Z& [, G9 n# L
- #include <linux/interrupt.h>
: z6 @/ J. j# F* Z& O& v - #include <asm/io.h>- _2 J0 V$ g+ t0 z$ }+ i g6 u, M2 m k
- #include <linux/moduleparam.h>
M( E: b7 o# t: M, w& n - #include <linux/sysctl.h>
$ u, S6 R+ D6 M( @7 p$ ~2 P - #include <linux/mm.h>
+ {2 w4 B# m# A& U - #include <linux/dma-mapping.h>! O: k2 d1 l* I& Z, m# o* Z$ i7 X
' s- I0 {, e% x, U2 v- #include <mach/memory.h>) u8 D+ X3 {) ~
- #include <mach/hardware.h>6 P( P% Z* b9 s! L
- #include <mach/irqs.h>
5 S9 X1 s: x' C* F$ ]0 A - #include <asm/hardware/edma.h>0 n6 P/ ]2 t! i, Q+ @
- : B7 z5 G& N8 k+ T9 G. j
- #undef EDMA3_DEBUG
9 G# v( ~! `6 Q - /*#define EDMA3_DEBUG*/
2 Q A: c( t6 s; e' \ - * M8 y: E" B( Q Z/ W: }
- #ifdef EDMA3_DEBUG+ R* V, j6 @' b3 B! \
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
' V- a, z. s+ [: P: d& L - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
5 o6 x, D2 g \6 t/ Q( N - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
% z, c# t& \ @, `! D - #else! O% T# v1 O! T! i# U5 V
- #define DMA_PRINTK( x... )
; Y" i( W8 F$ e! h }) ]' Q( i2 _ - #define DMA_FN_IN& h3 W; R" k) B. U8 w" j
- #define DMA_FN_OUT
" O2 W; k/ i6 |( p ` w8 [7 y - #endif6 a: i& U! `. \1 E w. J6 n
- ; |9 x3 S& t& J: D* ~" ?! z
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
$ z N& h1 y9 ~( R3 H4 S( m$ W0 E4 B - #define STATIC_SHIFT 3. y- c) k, U( X. t# u
- #define TCINTEN_SHIFT 20! t h" m/ Z# f, K2 B. A! k; C) z
- #define ITCINTEN_SHIFT 21. p& M/ _- d7 k+ n& ]
- #define TCCHEN_SHIFT 22
" w5 X4 k, ]( d$ j7 }9 q - #define ITCCHEN_SHIFT 23+ ^5 o* ?0 i' B" d8 d& H
- ( t* d4 y! q* b9 T4 j; L( b
- static volatile int irqraised1 = 0;+ e% u! [( H! ]2 X% [$ X
- static volatile int irqraised2 = 0;, n; _% y& e7 B8 u
- ! w# z) @3 E3 g8 B; c! ~ v9 F: X
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ Y. J9 g9 y2 w3 Y2 }
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& Z2 X7 m+ i# E5 A' m A - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 `) e' W' b2 e
; k! W; K" m" V! Z- dma_addr_t dmaphyssrc1 = 0;) R. r L, p S! N3 ?9 ?+ E5 M
- dma_addr_t dmaphyssrc2 = 0;# ]: O1 @5 x( a! M9 | \) d6 w
- dma_addr_t dmaphysdest1 = 0;
1 i3 O0 p* x# b: E4 {, t+ @$ \; W - dma_addr_t dmaphysdest2 = 0;
$ @' r) O/ W: s# q8 D: o
' {7 U! _/ u( _- char *dmabufsrc1 = NULL;" |4 h6 w- q2 f# k
- char *dmabufsrc2 = NULL;1 k6 n- t7 M1 M H' [) I
- char *dmabufdest1 = NULL;
4 n6 X3 l5 f9 Q: J+ c( D9 j- g W - char *dmabufdest2 = NULL;
* m5 L: v* L: q - 0 ^% g9 r M7 h
- static int acnt = 512;0 \3 I0 Y! Y/ K* p' @
- static int bcnt = 8;
h ? u1 A1 N; z1 n+ f6 w - static int ccnt = 8; [& |* q# {# W) g z5 R) N
" T; g4 K! ^( } z* X0 O9 {2 I- module_param(acnt, int, S_IRUGO);
' I8 p f! U1 P9 ^; u0 E" ]1 b - module_param(bcnt, int, S_IRUGO);' W6 y }/ d1 M0 x* r5 K. q- \
- module_param(ccnt, int, S_IRUGO);
复制代码 $ Z1 `5 I2 z; K1 m9 z* Z2 a, I. g
$ z; {1 [ e) Z0 n" c$ w/ L
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- X, k5 }. x6 q* R' yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) [% i- A# a+ L) P8 l
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( D4 _! T H# \
/ o2 R4 Y) E5 Y; ^4 Z
6 i9 h% n6 Y! U/ S
|
|