|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , Z' t/ ~9 x. w! y# }( x( \! B
- [code]EDMA sample test application9 k# \( h0 ^" h8 b
- /*/ p& D( L H; V* x
- * edma_test.c
/ ]6 l5 r4 W' y& q" [3 K - *0 n1 Y& b# ], B# k
- * brief EDMA3 Test Application
; ]( u3 U. |# E. ~! q - *$ B$ ]4 y8 q) ]) d7 t" a* A
- * This file contains EDMA3 Test code.
3 S; Z& W6 D' [ - * U; r( K' \7 [; m3 v: k
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 Y) s. N ~; x
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 s' s' h% q7 \$ D# F5 G4 L
- * TO CHANGE.2 y0 \# g4 [3 U4 H m
- *. h! t- b: v' k' }
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 L t" ?8 V- ]; M: p) d
- *
- G8 O8 ]7 f+ q6 e4 R' p' y$ T' X - * This program is free software; you can redistribute it and/or
* s: v; j+ q6 w6 f0 T - * modify it under the terms of the GNU General Public License as: k/ |4 l6 o2 Z! ~; L/ A/ w
- * published by the Free Software Foundation version 2.
: J# c; E( h" e; b* j" m - *8 l- i) X" P O! p* t E
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any- W' T2 J% F, X" G
- * kind, whether express or implied; without even the implied warranty
, u6 L& z, p7 C' N6 C - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
& t3 S0 g3 t Y0 c0 s - * GNU General Public License for more details.' I9 D% s/ f9 T, k3 q' W
- */! ~, d' G- I5 i, W+ F! ^& H
' c: j6 l8 G A4 F6 |, W! b5 S5 g2 [- #include <linux/module.h>
' W6 {. |3 {0 \1 g" M - #include <linux/init.h>' K7 F; X1 j* `& E0 ?3 W4 h& H
- #include <linux/errno.h>3 h7 C7 ^2 N+ m ]) e
- #include <linux/types.h>1 E/ [7 _6 M' H; R9 k$ u9 ^
- #include <linux/interrupt.h>
+ _& b) @& p; w0 W8 t - #include <asm/io.h>
) {7 B/ o7 I) b1 d, A S z' J - #include <linux/moduleparam.h>
d) D8 U& W' v& w: m. f - #include <linux/sysctl.h>
) l7 {4 w! H) E+ F& }4 V& W) n - #include <linux/mm.h>
% n. d5 Z! c' t+ p9 A7 O$ e - #include <linux/dma-mapping.h>
f+ q- A5 e7 d! m5 I6 a- r - ; ?0 Q$ d n' C9 {- b% l
- #include <mach/memory.h>
2 V% w. y, B0 h6 ` - #include <mach/hardware.h>8 { E9 E) l8 J, `, }' `+ G
- #include <mach/irqs.h>5 U2 C8 c' T9 U8 T$ L3 M
- #include <asm/hardware/edma.h>; L* l/ V. d3 v0 G9 e9 H1 ^
, U6 T: p: T$ p- #undef EDMA3_DEBUG
2 _- [3 e* z y9 | - /*#define EDMA3_DEBUG*/) e* F- Q, q; _# L3 M( W5 t
/ {. {4 T- G, `- #ifdef EDMA3_DEBUG
) s% A# n& _9 y4 L/ ~6 b7 w2 z - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
N6 t/ M( Q5 y5 ` - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 {5 L; Z4 E" a& [) Z c
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
; R9 S2 l( b) z# w Z4 j - #else
' f$ O- P8 x2 V/ ~% [1 [! g H# | - #define DMA_PRINTK( x... )
$ [5 t) ?$ z: ?7 d0 U3 ?6 i - #define DMA_FN_IN
3 Q7 ?. ?$ w8 r - #define DMA_FN_OUT
5 P' g8 j# D/ h3 k' }: ^ - #endif* y5 Z3 a3 @. }$ p! `. x
" z9 K3 m( W$ ^$ q- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
4 A) O- f7 K" J) \* ^& Z - #define STATIC_SHIFT 30 c" x/ R$ V. s2 ]
- #define TCINTEN_SHIFT 20
& n1 J7 ? ]6 V, K3 ?9 C' o/ o - #define ITCINTEN_SHIFT 212 f0 v1 x3 ?1 {! x
- #define TCCHEN_SHIFT 22( E( ^" G$ C6 j. z3 B6 {6 B
- #define ITCCHEN_SHIFT 234 S$ C! T9 e' D- q& T1 i) e% ~& M7 {
- , j8 J; z; u6 h6 [
- static volatile int irqraised1 = 0;
0 E( r# n" `7 w - static volatile int irqraised2 = 0;* @. `% K5 {, F1 V& [' ]( h' r
- ) }; B: I& D) R* Q5 g
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) I/ M1 s# c/ t! d: E - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# y% c6 Y# m* w" J8 C* x; I/ g, X - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
?( I- b `7 ]1 h
7 R2 R+ ~, U F i% m1 P- dma_addr_t dmaphyssrc1 = 0;1 I6 J/ v4 k$ ~) J N, w& I
- dma_addr_t dmaphyssrc2 = 0;; s% S! G. p) {4 V; _0 h
- dma_addr_t dmaphysdest1 = 0;
; t+ @0 s6 _$ k! M3 a) I - dma_addr_t dmaphysdest2 = 0;
. ~ q n* i" ]9 u
# c. R5 b# m8 O8 ]4 u- char *dmabufsrc1 = NULL;& ~6 G1 k7 P1 \1 F+ Z" l
- char *dmabufsrc2 = NULL;
1 y1 a) Q, J; w, x: C1 ? - char *dmabufdest1 = NULL;
" I: E. L+ l0 y4 {$ W H+ _ - char *dmabufdest2 = NULL;
; |. T# C# H7 i* A! V; x
3 {! I( D, C2 F- static int acnt = 512;
# ~' E4 @: {1 p1 E - static int bcnt = 8;$ S% u1 Z t7 t2 ^1 S3 t7 ]( w& M
- static int ccnt = 8;
2 s3 F q) ^- M W: N
4 N# T, [7 o0 u+ E; ~1 z3 |% z- module_param(acnt, int, S_IRUGO);
* g' p. `7 N% J: ^ - module_param(bcnt, int, S_IRUGO);
$ D0 }3 V/ j1 ~/ ?) z( s& p; p - module_param(ccnt, int, S_IRUGO);
复制代码 ! U# |6 `: [1 x6 f, a1 U7 [
?. s2 ?1 I% { 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 T, g/ P6 o7 m8 K1 ` _3 d7 farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 e# ~4 ?% v2 c! c
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" Y( t0 b' \4 S' j
6 v" X0 S% }! w) ]! y: D1 z. T; T; {, K: H/ I( I. ^
|
|