|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; u# j9 ]2 _' `, l2 |$ {5 u# y- [code]EDMA sample test application
4 \' s; ^! @* i8 U; l - /*3 E! f- g- k' b2 r
- * edma_test.c
6 w) y3 p3 u5 F' x - *2 l8 Z, V; {0 E1 x3 |1 F, }% w
- * brief EDMA3 Test Application
5 v7 h; S8 l( X& z- D" }9 L - *9 z: m8 X$ X& H" {
- * This file contains EDMA3 Test code.
' z! A( [: W0 V. [4 k$ Y - *- Q0 {+ i0 m$ p8 g
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
2 M7 |& s u: X O- m9 s - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
+ E2 ~* y- V- _: B0 o' }$ E - * TO CHANGE.
+ r- C2 s& k# i. ]! m - *
! i$ {$ ` e. @ V4 a - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
- N* z+ O+ k w* t5 O8 K - *3 P: }/ Q9 N* I
- * This program is free software; you can redistribute it and/or
/ w/ Q& v; K7 ?. q/ s - * modify it under the terms of the GNU General Public License as% G( j! }! }0 d x: F
- * published by the Free Software Foundation version 2./ q) L; X C0 H
- *
( @* s8 X6 y0 \& v. Z0 m) l* w" V - * This program is distributed "as is" WITHOUT ANY WARRANTY of any( e1 I; R; N3 l
- * kind, whether express or implied; without even the implied warranty/ F) y/ B# }7 p2 }
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1 `4 X- T2 _5 T7 S4 S( [+ P
- * GNU General Public License for more details. R, A/ j* O8 U' B
- */* q/ o8 R9 C6 k7 ]
- 8 r) x' H- w/ m9 _) R! I \
- #include <linux/module.h>- X& e4 G- O$ ?, @/ m% v& ~
- #include <linux/init.h>
/ y, E7 m3 t8 {. T: u - #include <linux/errno.h>
+ }* Y8 V* G# z( e. K4 y" \' z - #include <linux/types.h>
$ J) N+ D4 }* C A+ Q- R; ~- a) o; ` - #include <linux/interrupt.h>& N8 B+ {8 l) I$ M
- #include <asm/io.h>" m6 @5 _4 s- |- D
- #include <linux/moduleparam.h>
# Q q4 b; [# B$ o# R6 O4 V - #include <linux/sysctl.h> {* R% N: z/ A2 {: ?
- #include <linux/mm.h>
, \$ h/ q) ?2 g+ a - #include <linux/dma-mapping.h>0 d- N$ Z! ^; [3 `
- 7 f' m& v2 o1 `6 t4 v
- #include <mach/memory.h>: l9 c2 ], c4 s8 q& u
- #include <mach/hardware.h>
7 S$ c. m9 Z3 I% P% z9 h7 g - #include <mach/irqs.h>
% M2 A6 z X4 Z" ] - #include <asm/hardware/edma.h>2 ^# x. v8 q* u8 F' K4 ~; s% b
- ) R d3 o) S8 H; D9 \3 l" ]" B
- #undef EDMA3_DEBUG; @* \% Q) X! q+ Q! [
- /*#define EDMA3_DEBUG*/) T) d6 q4 l M) Q. _
' D4 @" l! l$ X+ e& s% d' v) C- #ifdef EDMA3_DEBUG
9 J" T4 [% N, Z R7 w( T - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ ?. T" j: s& {" R1 s
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
3 V( p6 f+ Q5 q5 y B3 }5 q+ ~ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
9 B4 v. `- Q m. [2 ~& u) @ - #else
6 v: h9 e' u9 n9 Z0 w9 i% q - #define DMA_PRINTK( x... )' ]. j" d- z5 ^% r4 Y1 \
- #define DMA_FN_IN# M. K y) \* c; u0 o0 L# c6 R
- #define DMA_FN_OUT
9 Z. {7 k0 f6 O9 G I6 G2 s- I! n. M6 U - #endif; h2 H& r7 F. p. Q$ q+ U
- 6 I$ S* r2 M6 L b9 ?
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)) k) l, n) W; i9 s. Z) R, y/ u
- #define STATIC_SHIFT 31 G8 E. z- s% `" @. Y
- #define TCINTEN_SHIFT 20
. _ B9 x5 d$ T' u; h1 T - #define ITCINTEN_SHIFT 21) v3 E+ R+ O+ V; j! V7 _
- #define TCCHEN_SHIFT 22
' r' U6 U: d8 H) e l; v5 D; J+ |- H - #define ITCCHEN_SHIFT 23
& C/ D6 V4 E( u- G/ N - : U7 {1 f6 P- g0 G- ?/ L1 U
- static volatile int irqraised1 = 0;
+ G3 E% k* b$ f* n% Z - static volatile int irqraised2 = 0;5 W3 t! n9 ]% G0 @2 O) @
- - m% {( }- L$ M( u# q& J
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! h' m% v; B7 x$ v" W) L8 K6 D0 { - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 K0 ?0 x$ L, m) ~ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 v2 n2 v, d C; D% n3 B5 p) R! B2 x T& U - ! u% _4 H+ K/ P" d! w5 R: l) e0 @
- dma_addr_t dmaphyssrc1 = 0;2 g6 e7 y0 t# K) B6 C$ [
- dma_addr_t dmaphyssrc2 = 0;
/ u0 f3 O8 _' L) w - dma_addr_t dmaphysdest1 = 0;& X, o" J/ C3 `, i$ d3 X7 a
- dma_addr_t dmaphysdest2 = 0;4 R, |- y" X8 M* I- n' B8 v
( V! S0 V5 v1 P- char *dmabufsrc1 = NULL;
! a& c+ F' b" F5 t, J0 c8 y0 y - char *dmabufsrc2 = NULL;
0 W+ y% d. W$ f! b" a6 d f0 p - char *dmabufdest1 = NULL;6 g: }: F0 P- K) \3 M+ b4 N
- char *dmabufdest2 = NULL;. Y( d; F. C% v, t* Q) S
- o1 m3 t4 j6 @: J* b, a h1 m- static int acnt = 512;. @6 b+ {, }& {5 M7 S4 Z6 N
- static int bcnt = 8;$ F- o4 }+ @+ H* t6 r `! O9 ^
- static int ccnt = 8;+ z7 v7 D" O* x- P3 T; s" T0 o
- % I/ k/ j a, z: v. t1 l0 Q" J* V+ w
- module_param(acnt, int, S_IRUGO);
* M& M6 H% T. O5 { - module_param(bcnt, int, S_IRUGO);2 a2 f5 u! Y' ^' x$ ]
- module_param(ccnt, int, S_IRUGO);
复制代码
" Q4 P/ A4 w R3 }- Z
( S+ y5 _+ U" L, n 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ ~# S Z! s' h2 c4 Z8 ^6 Q0 Warm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; B: \# R5 w2 }' C' E: Y, a
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" c* E/ P. b: S0 B3 r! M( j1 h) O- @+ C* f1 W7 b
# [/ i! B+ n+ T5 \* G1 k- `
|
|