|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ Z+ Q" o9 o+ O4 P4 @
- [code]EDMA sample test application
D' D& S! W' m4 p& G8 b/ Q/ p - /*
: Q8 {2 q% k1 o) n2 Z - * edma_test.c! M3 o4 }' S7 Z, n6 q* k& ^5 `
- *
; T2 Z @- H8 O+ |- I - * brief EDMA3 Test Application
; }! a8 \& Y" {) { - *' K( i' e c! A( R/ H7 q
- * This file contains EDMA3 Test code.
: B3 q& Q1 q$ i0 `) u' q2 U2 o - *$ u5 ^, P2 ~- `6 M
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) d+ H8 j) d8 j$ L7 r) G0 Y( E5 N
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 k1 t4 c5 r. B+ Y9 o L
- * TO CHANGE.9 I# M, F: d3 \- ~* Z
- *% u4 S# S) ?% B+ d# S, \
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 G. T& }- X5 A& ~! @. T# n2 R6 \
- *( [& y( ^% u* ?
- * This program is free software; you can redistribute it and/or
& D+ B0 |3 m' q( p) i* v& t - * modify it under the terms of the GNU General Public License as/ H: d7 ~& V6 |' u
- * published by the Free Software Foundation version 2.
, \+ r- n6 @9 d - *
9 g0 U2 m D# s* g - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
1 T4 {4 B& C6 b8 d. R3 X9 r0 l; H - * kind, whether express or implied; without even the implied warranty
! e5 i* K7 Y3 Q- N9 ` - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ w& }+ j" M" K - * GNU General Public License for more details. U" _7 q' F ~ c- T- t) A" H& e& Q
- */
, q# T4 J8 l) r3 O1 J - : G8 W1 D; g9 P0 d J9 D3 T% D5 i
- #include <linux/module.h>
. q% z( x. N9 c: v$ a( H% G - #include <linux/init.h>. g$ X) c0 e+ C3 @3 U5 X% n
- #include <linux/errno.h>! z1 l p7 S/ g3 J0 E1 C) D2 S" R$ D
- #include <linux/types.h>
- r C$ P ]0 ` - #include <linux/interrupt.h>
) N- S( F% U% `- L9 t Q# c& Y - #include <asm/io.h>
6 J+ o* E( X+ k- h: u - #include <linux/moduleparam.h>0 H) _7 R- _/ _" d% a+ o
- #include <linux/sysctl.h>5 u5 u: i9 c8 U) K! a: V" U
- #include <linux/mm.h>
. e. S b3 p% ^$ K- N - #include <linux/dma-mapping.h>
, n- c2 r3 H' A) {2 ^( S - 1 G0 f! o' {* U8 O+ ^- U
- #include <mach/memory.h>
, ^" ~) N( [+ t* \: E! H - #include <mach/hardware.h># ~( X0 M" g6 K- k/ N
- #include <mach/irqs.h>
$ |& s0 ]" f g0 B; i* O$ P - #include <asm/hardware/edma.h>
( e. ?; o1 z u9 }3 Z
2 I- [0 C& y! K& K, U- #undef EDMA3_DEBUG- @8 g0 X7 T& \5 S( f5 H. P
- /*#define EDMA3_DEBUG*/
; i/ A; d0 _4 s2 r: Y% B
, I% V. w" t) \, j+ _7 [/ O- #ifdef EDMA3_DEBUG* `! N9 J# L3 P+ r" w0 e% c7 q* [ D
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
. b* g$ W1 n" d& Q2 A7 H - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* o7 n8 w9 o, @" F6 b+ ?9 S" I
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 p) l; Z8 B" H9 L
- #else3 w2 h3 s, t8 ^ b
- #define DMA_PRINTK( x... )
- W+ [* o& ]2 p: O+ v - #define DMA_FN_IN" `- O# d: }$ K9 b0 ^
- #define DMA_FN_OUT8 Q* j2 b) ^4 G! @
- #endif+ E5 {7 m7 N' w7 G0 D6 m; n
- 9 K$ A. s8 b; j4 `% s# T ]
- #define MAX_DMA_TRANSFER_IN_BYTES (32768) t' D l5 B: i7 v6 J0 g
- #define STATIC_SHIFT 3
+ P9 @$ Q! X6 g# X( w2 G: ]! k - #define TCINTEN_SHIFT 20
m+ f( T# l7 G% \4 S - #define ITCINTEN_SHIFT 21
$ c, Q3 y0 s/ ^/ a6 m2 d - #define TCCHEN_SHIFT 22
/ S0 ?" z- y+ ?! a/ i. f/ T - #define ITCCHEN_SHIFT 23, d1 J; p) ~# J0 ^5 s! k
- ! _, O/ W) n- ]' J n% K
- static volatile int irqraised1 = 0;0 A9 @: y0 y4 F- L Q
- static volatile int irqraised2 = 0;
. P0 x q# ~1 l1 j - + w5 ~" M, Y1 n- ~$ g0 ?# L
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: A' ]. J8 W' q$ ? Z" d - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 k' a( I* r" q9 X$ q6 r - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. n5 a* S! R1 j/ m G
) I# Z) B+ ?9 C/ N; C- a6 {: V$ P- dma_addr_t dmaphyssrc1 = 0;
- H, b' a9 h, i' B - dma_addr_t dmaphyssrc2 = 0;9 D/ G" x1 \" u% n$ W2 d
- dma_addr_t dmaphysdest1 = 0;5 A+ B! R' A9 L* n+ t
- dma_addr_t dmaphysdest2 = 0;0 E. U% F' r$ ?0 a; @$ R5 |
- ) B7 q. V. a1 H/ P7 [) E1 ?# f) m. L3 t
- char *dmabufsrc1 = NULL;
9 |, l% q+ b5 ]) C8 L% e - char *dmabufsrc2 = NULL;
6 L/ ^7 _( b! e - char *dmabufdest1 = NULL;
, o6 u* d! p2 ]! X9 T2 E$ @ - char *dmabufdest2 = NULL;2 [$ _+ u n, ^/ S0 L% t
- 0 Y4 d& A- C5 @7 g" r: c
- static int acnt = 512;( g8 |# y3 G9 d6 y/ g% A
- static int bcnt = 8;" G( P: C+ M$ n% C4 Z
- static int ccnt = 8;
$ E2 H' ?& o. g+ m - 1 q1 G1 {3 H9 \1 F
- module_param(acnt, int, S_IRUGO);
' r; Z5 \5 N9 i& h. N( c - module_param(bcnt, int, S_IRUGO);
( |6 Z; U) n: _( m - module_param(ccnt, int, S_IRUGO);
复制代码
( o3 R% {2 c. d0 q6 p8 ^9 S
# k# B) y; g: K$ f" L- R8 ` 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* E; H0 L0 i$ 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 X* }. Q6 W$ M0 z
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 l) P$ L3 G) \7 V+ V/ ] m" N0 O' }
. [& ]# ^( S8 I# ^+ Y |
|