|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% O+ l5 J0 Y' T1 @7 E0 o# f$ N- [code]EDMA sample test application- Q/ f: N3 ^( Y: f7 {8 Y
- /*( {, F# B0 n o! F5 b# Q3 m
- * edma_test.c
9 w% D. A% W7 r5 O, X - *. Y( z; p9 p: E4 y! Q; i: k2 u
- * brief EDMA3 Test Application
, ]( L+ a2 R* ]9 O3 B, @ - *; ?; k6 @8 I) t3 T
- * This file contains EDMA3 Test code.! l' g( s7 | t0 }( d% Z% W
- *
$ ?" U' \9 E- E9 R; M4 k! S - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% P* d9 J+ H% K# k4 U2 [2 V& c
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
( l! H$ T3 O% E% ]3 n2 N2 ~- c" k - * TO CHANGE.( F6 ^: ~6 `+ Q
- *2 d1 O9 }/ @ i9 k6 m- F
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) R6 a- f8 l. y x$ f4 q- g
- *5 s2 H' M& S4 B+ s, D
- * This program is free software; you can redistribute it and/or) h6 Y K2 Y/ |. r, u
- * modify it under the terms of the GNU General Public License as
) W& W" {) d% `* W - * published by the Free Software Foundation version 2.! e& Y+ L% { @8 ~6 L
- *
7 l. F& e$ S- B+ F8 o - * This program is distributed "as is" WITHOUT ANY WARRANTY of any- I h+ ]2 K* z! {5 A
- * kind, whether express or implied; without even the implied warranty
) \# {+ Q3 ~, G7 I - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5 H4 j/ P S$ v5 p; Y - * GNU General Public License for more details.
* _5 c# e9 L" O- F j - */
2 ~+ Q/ c6 O3 F$ s! G* U0 j+ j
7 W* t; i, z. c* N- #include <linux/module.h>/ D' i ?7 L: L3 {6 K: ^4 Z
- #include <linux/init.h>/ \4 T9 b: I, W& I
- #include <linux/errno.h>
/ N& ~$ [. O* h( n. q4 s% Q7 v - #include <linux/types.h>
8 p! {3 T! T$ Y5 U - #include <linux/interrupt.h>7 `' k# O( E$ [0 k- Z
- #include <asm/io.h>4 [& y8 f$ G# h; k( t
- #include <linux/moduleparam.h>+ y; ]9 c/ o( j0 n
- #include <linux/sysctl.h>8 b- ?$ H/ {$ N6 F( G7 W/ a
- #include <linux/mm.h>0 p! v9 ]2 h' h. a# z2 B- H# ]2 y
- #include <linux/dma-mapping.h>
' W$ b) @- e/ X - 3 }* N# q' w, _& Z) Z/ G
- #include <mach/memory.h>
# P3 v" b- @# b - #include <mach/hardware.h>
- f3 l& q1 J3 a. R" b5 Q - #include <mach/irqs.h>1 Q. `. M, @) [2 B9 _
- #include <asm/hardware/edma.h>0 l9 K3 _. \7 J
- . S; g8 p" @+ N; d9 l+ z
- #undef EDMA3_DEBUG
, _+ L. `; @) t7 E - /*#define EDMA3_DEBUG*/
# t" C* a9 ]9 N) {
4 I7 T" R' X5 _" d, J- #ifdef EDMA3_DEBUG2 @/ E+ S) a+ F
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
& x0 L$ {7 P2 M# U5 p: w - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
9 G5 n* F1 g0 s - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 n* R/ s( r8 ]0 d- c, k$ `, }
- #else
1 k* m E- _8 j: v# u) I0 G2 W - #define DMA_PRINTK( x... )
- w& s' ]/ ?8 d& Q M$ A+ b2 F* I - #define DMA_FN_IN
6 s9 c, T% E+ u$ f0 c( k0 [ - #define DMA_FN_OUT
# F( b2 Y4 i6 ] - #endif. l- ^0 m$ k+ C2 {
) R# w" W% V- j* l" g6 e( [- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
0 R' m; A6 \. M' V; e! ]4 | - #define STATIC_SHIFT 3
' k" X8 u/ q, @4 e" y8 P& ] - #define TCINTEN_SHIFT 20- \3 t8 Y- y$ E# T: y) T
- #define ITCINTEN_SHIFT 21. ^# _; C! N- c7 h
- #define TCCHEN_SHIFT 22% N9 c; R. D3 \" t3 h8 q
- #define ITCCHEN_SHIFT 23: K; I1 C+ @' L. ^) }" S# E
- * x3 P4 E' g0 j
- static volatile int irqraised1 = 0;2 D1 V* U q! v6 R* O
- static volatile int irqraised2 = 0;
. h. T/ N: h# H( \9 q2 S) ], a; @, Q - 3 u/ ^. _$ J* e/ [5 G2 }' h
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); i: ^; M8 \# f d
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& @, C9 d: n6 A' ]2 B% v - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 u0 P! x! l6 C
- 0 y+ x; h6 o/ f( z
- dma_addr_t dmaphyssrc1 = 0;! n" o2 g/ n$ F1 M$ N( |
- dma_addr_t dmaphyssrc2 = 0;
$ _' M$ K2 f, y& B - dma_addr_t dmaphysdest1 = 0;
1 F2 y4 ]( c2 H. v' K! ~8 l* Z& M5 n - dma_addr_t dmaphysdest2 = 0;
1 Q) v8 W$ F, m6 Y" f
( Y% O5 k# s5 A1 g. w5 u# |- char *dmabufsrc1 = NULL;
# V! }& t2 P2 O7 ~1 P. v: i1 y# F - char *dmabufsrc2 = NULL;
5 i, c( q/ p8 O$ ^1 K+ N - char *dmabufdest1 = NULL;
9 I# }& `, i' T; c9 T - char *dmabufdest2 = NULL;
& r9 Y F+ c2 A- D" D - ?9 V. T+ `, Z4 J- H
- static int acnt = 512;! r! Z4 z* X1 s$ ] w% n
- static int bcnt = 8;
. E0 i' c; V; o* T) L( s- d - static int ccnt = 8;" f5 X+ A& z+ E
- 5 K9 d8 j: l) J+ r
- module_param(acnt, int, S_IRUGO);
" w& C# k; h7 g! q& U - module_param(bcnt, int, S_IRUGO);5 H6 S& {; d' @ n7 H' F; Y% q8 p! K
- module_param(ccnt, int, S_IRUGO);
复制代码 8 j- s9 z$ p: y! w' G* U# K1 p
G. O3 N! S9 v& ^
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& w P+ y1 E! T& u* g0 C+ ^
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ @- @, Z0 [7 z6 k
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ h9 T! }& E' ~* R$ H1 T3 {. \ ^ ]( c! ~+ n2 n
2 S! ^ D: s1 ]% C5 h
|
|