|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
t8 [# V2 d- v* [- [code]EDMA sample test application
- U1 t& w4 u5 U. a O, \0 c8 u - /*5 G1 H) z: o' P3 i) \
- * edma_test.c% M3 m( u, T S( h% N/ H' Z
- *
8 S; P1 u% r# Z3 O; m: H/ g - * brief EDMA3 Test Application) G7 ^+ G; Y) G1 L1 [0 Q
- *
5 m! |4 g* @1 z) {/ t# E9 M P, L - * This file contains EDMA3 Test code.) a+ m( A, G: z% J' B8 w
- *$ z& I) H4 p2 ^& f2 A
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
# ]: _2 W/ D: X) J/ Z - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
2 D1 n4 E: e9 F0 Y - * TO CHANGE.' w% i6 D2 c: r8 R1 @1 _5 @
- *4 J. t$ D6 ?3 Y* v
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
$ `$ R- m5 I" H, O s - *, J4 `0 h( g( _+ P5 c, Z
- * This program is free software; you can redistribute it and/or
; X/ |5 G6 I- d - * modify it under the terms of the GNU General Public License as4 F. X4 e& }# r6 g L% p6 j' f
- * published by the Free Software Foundation version 2. h% z" g8 g" m" h
- *. b- H7 x( c% Y+ {4 g. z
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any, X g8 h8 k2 K' f0 G$ O+ `
- * kind, whether express or implied; without even the implied warranty
' ^ d" \. m& U7 d4 i" r - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- h& X# [: e; R0 L: Q - * GNU General Public License for more details." O% Q& f5 Z! B/ ?& v2 `" o
- */
6 y- f) P) c/ L. B - ( K! ?& A# ^" j6 s
- #include <linux/module.h>! q4 V8 N% G& z* N, l- D
- #include <linux/init.h>9 B: X, X5 y9 a7 c8 n) {
- #include <linux/errno.h>
( D7 _4 @: G8 a0 K7 V - #include <linux/types.h>4 |' ]7 Q5 G( \4 V r
- #include <linux/interrupt.h>- }; j. y- p/ P; \ G1 A. L
- #include <asm/io.h>
1 W c' r }7 j5 A7 R - #include <linux/moduleparam.h>! V' T0 y* R/ E+ A
- #include <linux/sysctl.h>% C; x& a: \* D( Y+ o
- #include <linux/mm.h>
9 _3 {, A$ Q' _' n- f/ e - #include <linux/dma-mapping.h>
8 j" V7 o& \% D" A7 g
" f! Y" m; ~- ?% ?7 F8 \- #include <mach/memory.h>
) _0 U+ i. g) b+ g/ [1 V2 J& W, W - #include <mach/hardware.h>7 \1 `, M" T; @
- #include <mach/irqs.h>% M [7 {) G) t! {, D8 B
- #include <asm/hardware/edma.h>2 i7 D/ ~- A. x p$ U
- 9 g6 ^9 {) x. F, e( v- q% U) I( K
- #undef EDMA3_DEBUG8 @/ x2 @. R. k9 ]* f1 ~
- /*#define EDMA3_DEBUG*/
6 P R7 O) w- x- Z+ `" |5 U - , S" I: l; @9 p% \
- #ifdef EDMA3_DEBUG5 T+ n3 }- p( j( s, ]0 t/ n6 \6 C
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
$ h$ r0 d. U/ Q: |/ O9 w - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% a% E- Z+ C0 {" x
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
" n$ S x) v$ R - #else+ D4 E$ Q% b6 h. o0 `
- #define DMA_PRINTK( x... )
! J5 k* f! h3 I - #define DMA_FN_IN
) j9 S% @+ B: |& f' B. X - #define DMA_FN_OUT
% @3 x1 o$ `3 D. {. b1 s9 l' e: s - #endif
' U5 X; ~5 O/ P
3 _# a' r% r5 y+ u9 ^ d3 H3 m5 S- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
0 N+ X2 F( G$ F: u - #define STATIC_SHIFT 3
; m9 ?/ c1 M; a7 Q, F - #define TCINTEN_SHIFT 20
- Z( R [# n8 o) J2 p/ u: o$ u+ j( | - #define ITCINTEN_SHIFT 21
v. [* N& B5 l4 F$ Y - #define TCCHEN_SHIFT 22$ R5 ^) [! ]) m& d0 B. r% z
- #define ITCCHEN_SHIFT 237 j4 D6 U+ m8 c$ \9 M) M2 G, Y& n" V
- - R: m" k& @+ G
- static volatile int irqraised1 = 0;
% L: }) j& U1 T - static volatile int irqraised2 = 0;
2 v2 k1 k/ r4 \1 S7 t - ( r2 Q- E O0 a0 w0 h" N' f
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ d& u$ {' J0 O5 ]
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 v% n2 e i x1 m7 F! W
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' z* Z, M( C% Z8 u9 [9 ^ - & A' ~4 v2 P& q
- dma_addr_t dmaphyssrc1 = 0;
% g9 ^9 F; }2 `1 O2 E) a2 N7 P/ y - dma_addr_t dmaphyssrc2 = 0;
7 p' Q x0 n h2 x* L7 Y7 T - dma_addr_t dmaphysdest1 = 0; `1 |6 c3 e: i! L& d: L+ o
- dma_addr_t dmaphysdest2 = 0;1 N* R- V. v6 t$ m) G4 ^+ t& f- f2 H
- / v& J8 V9 d! G) M s. v
- char *dmabufsrc1 = NULL;" V+ H: e& n# {. c
- char *dmabufsrc2 = NULL;6 P% n2 W) s. }* d& V
- char *dmabufdest1 = NULL;0 t \% F2 [ x. l5 a1 e
- char *dmabufdest2 = NULL;
5 e a: r3 Q! D# ]
& q% M+ P2 H1 |( y1 _' g; l- static int acnt = 512;
8 i6 b: u4 V# G( ^ - static int bcnt = 8;
. i* F1 [ w0 c$ a - static int ccnt = 8;4 M2 t9 c+ _5 B( o( \
# o; L g8 S+ c; }5 V: v- module_param(acnt, int, S_IRUGO);
0 U' c' v7 }9 x$ m1 n! ^ - module_param(bcnt, int, S_IRUGO);
& r6 |! N9 t# g: a q - module_param(ccnt, int, S_IRUGO);
复制代码
2 [- S4 j. w Q$ |+ o V# S4 }. V: V* _8 v4 ?8 P) ^ w9 q
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: D$ Y8 @9 ?3 @# B! w" q
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 O, z. {) ]7 \* n* g& c 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。 x! h- \7 |- u! ^/ a" k
1 q( T0 {! g0 ^: Q9 c6 O9 a$ \
$ [4 q/ n9 L; W/ w4 R& M( q& Y- d& C |
|