|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 k @. D8 `, K/ S5 N6 y
- [code]EDMA sample test application
. y0 J+ y9 G/ i x. Z7 n: T - /*3 Q. o Y, k8 }: F
- * edma_test.c
- a; E' Q& @8 g; v4 n9 m, C - *
6 I+ ~$ {! [. X' F - * brief EDMA3 Test Application
' _6 X& L2 q7 z$ A9 I$ I* K( O - *
3 f( @7 f1 j) v/ W$ U0 P9 F - * This file contains EDMA3 Test code.
0 Z. }7 q$ b% _2 B$ V8 T) w - *7 \( F; [& K$ r5 l$ ~% |
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
7 |$ Z' ?! N) N2 P - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( r1 @) X0 u. r1 t) R$ F* S
- * TO CHANGE.. K9 u+ S$ G. d# w u) t
- *. m" Q* n$ @7 n! A: O/ E
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// w5 ^8 Y' C x
- *6 H/ j/ ?6 m8 r5 h) \* E
- * This program is free software; you can redistribute it and/or
5 |9 M Y9 H8 u6 E - * modify it under the terms of the GNU General Public License as0 C+ Z) J/ @, ]- R! k: @& }
- * published by the Free Software Foundation version 2.* H' L3 I* v3 ?- y" i3 D" p
- *; R5 I3 c4 q ^8 j7 ]8 J# q- T
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
: d) _9 r1 v' }: _4 {4 V - * kind, whether express or implied; without even the implied warranty
) n; ]+ j' F. ~7 } - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
$ d- F! e* N( A# q - * GNU General Public License for more details.5 b! t- ]: h& T$ u t7 U: k
- */0 C% t" s w) M, t; g
" N3 K y, Y5 D$ S. I; ~* f# V- #include <linux/module.h>
1 a: H0 _- l! a+ h- ^ - #include <linux/init.h>
3 m) H8 i2 m4 G' F. g; r4 { - #include <linux/errno.h>
7 \: _+ e4 F5 T. u7 j" U - #include <linux/types.h>6 `, L: B8 A8 j; c9 [
- #include <linux/interrupt.h>/ o4 u' q5 `. ^$ a
- #include <asm/io.h>
" }' W9 w$ e) s5 K0 t9 r - #include <linux/moduleparam.h>" R `( s- p6 y) R, l, j- [2 L
- #include <linux/sysctl.h>1 m$ Z! {2 x& C$ ?2 s+ O
- #include <linux/mm.h>
$ K$ Z0 z! ?' ?- e! j& s+ n - #include <linux/dma-mapping.h>
) K' K7 ]7 g% \ Z) |
" C% F, Z- k2 X% a" l3 o5 E- #include <mach/memory.h>
, W% d8 n+ X7 v - #include <mach/hardware.h>
- G1 o' l% E: z9 I# ^ - #include <mach/irqs.h>8 O( c6 ~- O: U+ k& {4 s0 M$ r; S! X$ \
- #include <asm/hardware/edma.h>5 A7 r H5 `7 a% v) @0 }5 Y* X- a
6 r1 s4 E" D3 Z! Q- #undef EDMA3_DEBUG5 t" K* b8 ~/ }0 Q! Q' G
- /*#define EDMA3_DEBUG*/
Z- v0 u+ B. Q$ J6 L C/ V) {! K
$ I+ }3 Z- V/ m7 Y: m- T1 `- #ifdef EDMA3_DEBUG
( `+ _9 x; R5 H9 F. ] - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 T# X2 W. ^, T; N/ \, R( v
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
! b6 N2 L+ ~5 W" i, g - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). S6 g- X# X( u
- #else
! F% q+ {' H* N! b0 w - #define DMA_PRINTK( x... )
* C& n# X( V e8 I2 ]! ~, S! J - #define DMA_FN_IN% L7 y; B& `" D( Z' U; A
- #define DMA_FN_OUT: E6 y( b9 { i2 e/ q' g
- #endif4 h. ~' X, Z2 z. [* ]/ l
5 P, a( k6 v% I5 [* D& u- #define MAX_DMA_TRANSFER_IN_BYTES (32768)' B& Y! Z4 {8 {/ `1 ?, s& v- O# o
- #define STATIC_SHIFT 36 {7 B8 | V& U m
- #define TCINTEN_SHIFT 208 R+ q* X7 C/ X" k6 C; W
- #define ITCINTEN_SHIFT 21" x, @. e+ v/ Q _
- #define TCCHEN_SHIFT 225 c0 e: t2 ?- x
- #define ITCCHEN_SHIFT 233 z4 N) q/ b8 g9 ? K5 ]5 k. H
- 4 W4 [, b1 S" k, b/ S# F
- static volatile int irqraised1 = 0;% j3 K9 s3 [8 H
- static volatile int irqraised2 = 0;2 P5 k6 f# j L
- V8 N1 C! \* \4 F) A
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 j% D. Q' B. g; X - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& {! q" H: U Y. ?0 |3 f) d, l& j - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 O2 j" `/ m9 q; X" W
- 5 h E3 @- O8 O
- dma_addr_t dmaphyssrc1 = 0;
& R' E* I6 o' N" M! ?7 o% J - dma_addr_t dmaphyssrc2 = 0;- C- X6 y2 V9 O3 a3 h
- dma_addr_t dmaphysdest1 = 0;! d. m' g l4 n5 d. N
- dma_addr_t dmaphysdest2 = 0;" L/ h8 l2 R: [. ]. w: z
7 u! Y9 k) G% K4 l- char *dmabufsrc1 = NULL;
) z2 h7 f& Y& M$ V& [, F2 X - char *dmabufsrc2 = NULL;
' R! W) S! V, e/ y I* X - char *dmabufdest1 = NULL;
) Y6 P1 ^6 `# e1 y5 ~ - char *dmabufdest2 = NULL;. z; Q4 L$ t; h( c2 g
5 N. ]. F0 Y5 J6 v$ ~- static int acnt = 512;
9 Z' d( r( i( W2 \# S - static int bcnt = 8;" }+ e& h- q: F6 d2 b
- static int ccnt = 8;2 d" C0 \; \+ U! ^0 A
$ B, J5 c" L4 w }9 J( i3 O/ P- module_param(acnt, int, S_IRUGO);1 w6 q- b# Z, j# W2 O( {
- module_param(bcnt, int, S_IRUGO);
. i9 j; B5 w, [ - module_param(ccnt, int, S_IRUGO);
复制代码
' N8 N% X- X( o5 m0 V2 Z( y) p# E& S: v$ i
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ }1 K- t' y* ^) D7 Rarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" z8 z' C. h2 R* g3 ^# Y
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! b1 i! f5 B4 c, ]; D
+ z6 E6 s4 e- _: e* E' f7 q
2 c8 u& g7 N0 h3 S6 y/ V1 d |
|