|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ w2 h2 m! y/ ?$ `. I* w; q- [code]EDMA sample test application( h" |- [1 W. J* ]' U' w
- /*
* R9 X) z* x( e: \3 u - * edma_test.c
0 ~6 t* N$ c* M5 u; t - *! {7 S/ O/ P6 l! r# K6 c5 Z$ `
- * brief EDMA3 Test Application+ y, [- L2 x( g0 X' }
- *8 o; a: ^3 s, s% I( r% q4 B
- * This file contains EDMA3 Test code.6 n5 D) A3 q/ } u
- *
* N: @0 }: \! Y0 R1 d# j - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# h5 Z4 Z- j B- E0 I0 C
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
+ h1 _/ }' o z8 d* u1 u - * TO CHANGE." K, g( |' v) D9 [7 b D
- *
& t. E0 w; }0 Y2 A9 _ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 P, e0 G' _5 z
- *
) W0 ^5 |( Q. G1 I8 F - * This program is free software; you can redistribute it and/or# I9 C- S" e/ i' ]3 w
- * modify it under the terms of the GNU General Public License as% q6 y# o& }) u& u5 n. M7 B
- * published by the Free Software Foundation version 2.
4 L9 o! C& e: S, j6 n - *
3 `" t4 O q) }+ L0 n) ]; b - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
v2 {7 E7 N+ O2 ]7 t) W( \- n - * kind, whether express or implied; without even the implied warranty1 m9 `6 N9 R) J5 ^( A
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6 z/ B1 Z0 k4 x7 ?: [/ g - * GNU General Public License for more details.
4 w" {5 U: I3 X! A. D! x - */1 Y3 q2 p ?; w8 Y
- ( i+ B, h; i" T4 h9 x1 i
- #include <linux/module.h># d0 D' A2 s D3 d
- #include <linux/init.h>
1 ? N( R- U) T3 U$ u+ Q- |/ G - #include <linux/errno.h>
0 M/ f1 h3 [* k$ r) g5 i5 J - #include <linux/types.h>
o8 O' O: H2 {0 @3 t* A - #include <linux/interrupt.h>
" Q; e# _1 Y4 k! F# I# e6 _) q - #include <asm/io.h>4 M' u. ?1 ~. t* J& Z, q
- #include <linux/moduleparam.h>
$ V( }8 q; y4 [- a/ `7 Q - #include <linux/sysctl.h>4 V9 e6 W, T1 g5 E+ I$ Y% B9 X9 n% [
- #include <linux/mm.h>5 `6 q( l9 c; ]1 Q6 B+ [% R1 _ t I( }
- #include <linux/dma-mapping.h>
+ L3 k& k' z+ {3 E2 _ - ) U! [& k6 e6 F0 O3 ^
- #include <mach/memory.h>
; \4 a# g. o5 ^# ^' f6 o) T- X- w+ X - #include <mach/hardware.h>$ x( m( T! f. U c0 x
- #include <mach/irqs.h>5 }5 P3 g; Y( i5 g, p$ ~
- #include <asm/hardware/edma.h>& B( H4 X: D! e) B; o8 i
- N1 A. ^+ O3 r% [. u* G! K/ s4 o- #undef EDMA3_DEBUG y" C/ `7 s( l; L2 n% D1 k
- /*#define EDMA3_DEBUG*/6 B0 H9 D7 [2 _% j4 P2 D
- 0 @& j/ a# |3 {: @8 B
- #ifdef EDMA3_DEBUG% O/ _* U* k8 _% m7 v
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& a* I6 E5 ? e1 c
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
0 p- B# E" a' r - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# y) f0 p3 q8 @! ^
- #else* C$ w' h3 W, J: S+ [7 I8 {4 K" n
- #define DMA_PRINTK( x... )
$ A8 f# ^; j7 W3 |- A { - #define DMA_FN_IN
2 _/ S9 G4 N( k! D - #define DMA_FN_OUT$ B( s* F# ?3 U/ Q/ x
- #endif% z# E& D5 Q2 n0 V2 \: f
- . D# ?$ D* S" j1 J+ S
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
' N6 ^! h) A6 N. J - #define STATIC_SHIFT 3 K3 y s7 i% P+ H. \; h
- #define TCINTEN_SHIFT 20' M4 d" y2 i; ^% e+ Z
- #define ITCINTEN_SHIFT 21
, Y# i# L) y2 r/ g5 b8 B - #define TCCHEN_SHIFT 22
0 O- z! S0 u, P9 c- O, ] - #define ITCCHEN_SHIFT 23
" G4 ?7 B* [, ^( [ j& f1 x
. r# g2 y) w/ T3 Q/ \1 [- static volatile int irqraised1 = 0;( x n: s- H' E# X+ I1 x6 O
- static volatile int irqraised2 = 0;, i+ @/ ^# I/ {! _
9 @3 l. q* E' s: C3 ]3 `- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
x' J5 N3 R6 u' J9 E - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# R2 R# E) J: Q. j5 \6 a7 F
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 }" ]) e; h+ g& x. @6 d
- ! H- Q7 Q* K' Q4 j: K
- dma_addr_t dmaphyssrc1 = 0;
' A3 [5 A# B* \5 j& [ N - dma_addr_t dmaphyssrc2 = 0;
/ Z' c9 ]' P) d# }0 N - dma_addr_t dmaphysdest1 = 0;% v9 R; y' N& e" s% ~* C% z
- dma_addr_t dmaphysdest2 = 0;( I5 @/ K) `) ?
+ y% `1 l x8 [9 b$ q% Z" Z- char *dmabufsrc1 = NULL;
. V% v- B( T3 e' u& m/ b - char *dmabufsrc2 = NULL;2 B" H& a1 I8 L! ]9 A
- char *dmabufdest1 = NULL;
: w9 X6 j8 C6 m* d+ H4 z$ }! P( D - char *dmabufdest2 = NULL;: o' F- D' }% m/ g6 \2 T6 w! [
- w& ^, R, l$ m2 R" p- static int acnt = 512;( m- f: q/ A( k6 V# U; |4 ^# _
- static int bcnt = 8;
( B0 k& S9 w+ H; [# F- g1 s: y9 ^* I - static int ccnt = 8;+ J* A7 x6 h+ u+ x0 \
- * S8 p; E7 _5 A/ ^& x4 K" l
- module_param(acnt, int, S_IRUGO);
4 X W$ l; r; |3 D" V - module_param(bcnt, int, S_IRUGO);
{6 v6 t. z0 { - module_param(ccnt, int, S_IRUGO);
复制代码
4 s* ?* E) h V! V: A1 j+ n
" O) U) j; f# l7 ` 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" i8 h! S9 H" 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 e; i) x1 L5 h2 |. @* o 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 }& y/ X( J6 s% {
9 X6 J3 P, {! n# u% [4 O4 z# I5 x* j
* m* R* ~5 K8 k ?4 m |
|