|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , N) X; a" U2 r& f) `# w
- [code]EDMA sample test application; q9 ~6 \8 }$ z: {6 X
- /*
5 p/ q2 ?8 V" h/ S - * edma_test.c" q; j8 \5 W! }' k% i+ x
- *
1 \" Z# T( S; H+ z4 ]7 }% j) G - * brief EDMA3 Test Application
$ J7 w8 @& Y) Q7 S' I+ K; w' ?8 K - *
+ W5 P9 y3 }6 S z6 g - * This file contains EDMA3 Test code.+ w8 t! u9 F# ]* c2 X; b8 ~- k- \- c' A
- *
& n* f% R) U; j. B) g' }1 H: U - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
# ]% s, h+ c# Y6 w/ q! Y @ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! Z7 \0 f: k; \- O$ b: I5 c
- * TO CHANGE.* ]+ Q; Z7 S' w9 B u6 r" Q8 O
- *9 {3 O% P8 Y7 x- C( V7 |$ m
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
S2 A0 G% j, g - *0 p5 b ^: f; d U, \( S) I
- * This program is free software; you can redistribute it and/or* o9 `. o5 x; n! O) S% d9 I
- * modify it under the terms of the GNU General Public License as% Z1 \) C/ H/ i, D$ W1 E0 b% Z
- * published by the Free Software Foundation version 2.
" H6 R& r; g- B* n+ I" d& P0 { - *
Y1 Q& O2 h4 C( |3 t1 O - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
# k, L& ^7 Q k) c _7 K - * kind, whether express or implied; without even the implied warranty
! V# H+ n( R2 H f! G! H - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! z2 W5 b) d# i8 Z& \; W - * GNU General Public License for more details.' [0 Y$ s( ?* Q/ _$ Z
- */
0 _& s7 a( Q: }! B3 Q; B$ R" Y6 n - , ]3 P, o! @4 ~+ i
- #include <linux/module.h>
/ x9 h {! q4 E - #include <linux/init.h>" R+ c3 L3 z. D1 g$ ? [
- #include <linux/errno.h>7 @ | D# E$ p
- #include <linux/types.h>
9 y6 w. @) w2 e- \( ?' d1 L1 U - #include <linux/interrupt.h>
, l8 L/ k( K4 a% } - #include <asm/io.h>" O) x+ x2 [/ q0 }: s, K
- #include <linux/moduleparam.h>
7 e- f' b' u1 F" W3 g# F- [6 `& h' R - #include <linux/sysctl.h>% P9 U7 N% t5 A" t- C
- #include <linux/mm.h>
+ t7 l1 P1 V5 j: R; l" e - #include <linux/dma-mapping.h>4 J: Q o A# o- z* u# v+ U' e
1 I: O" n. E" P- #include <mach/memory.h>9 ?8 p1 a% X4 G1 b5 P" e( C
- #include <mach/hardware.h>
$ A' ^# J1 }. _( g" w - #include <mach/irqs.h>4 S. ?3 t# c- F% j3 A0 b: f4 U4 @
- #include <asm/hardware/edma.h>
6 {5 K5 c# [$ s# X - / h, e4 O' [5 `- X2 F1 b2 ]% f& a
- #undef EDMA3_DEBUG
# ^! P4 R2 b. p7 Q/ B9 e% t% {+ w - /*#define EDMA3_DEBUG*/7 `# {; {* }/ W* J3 G
- " G: B$ w0 m z! n: Q
- #ifdef EDMA3_DEBUG
- q- [: q' l7 [9 m - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
) k5 L5 D& ]' V( k1 V9 F8 B - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
+ X, |; s& n3 r0 w( C' h: i+ u - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
4 `+ R3 G/ j% ?5 r5 m6 U - #else3 R0 [# |, k- A2 T8 N o0 V
- #define DMA_PRINTK( x... ) ^4 a9 ?9 h3 B, T2 c/ z0 C
- #define DMA_FN_IN
; B ]/ l( M5 ^4 o' q/ ]4 L - #define DMA_FN_OUT
. H) m7 R3 Q* M/ `6 | - #endif9 g* c- m2 z6 C# v9 N3 G
- 3 r: H$ }2 `; @
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
, m7 }& ]* m* l4 p& u - #define STATIC_SHIFT 3
+ |# c; L% y0 K; x9 C0 ~ - #define TCINTEN_SHIFT 20
' i1 G% B. u+ ~+ E - #define ITCINTEN_SHIFT 213 u: u u6 j: {3 j# q! L: ?
- #define TCCHEN_SHIFT 22 K/ m+ Z) d6 \: o# `6 M
- #define ITCCHEN_SHIFT 23" {# D/ _5 [& Z$ U/ m, [ F! S
- 0 h) H3 V$ `2 V8 w6 X& H8 q
- static volatile int irqraised1 = 0;* ]; Q' x( v: e' b
- static volatile int irqraised2 = 0;
% c; H& t/ O2 T. }$ s$ j - 0 R R6 |3 s5 z% f/ S7 q0 Y4 Q
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* N1 _, {9 o, Y9 N! \ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ A4 Z/ c1 W0 i3 R# ~8 V" K* {6 T - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 p. [# E4 l0 ?9 P
- " h. | L6 g0 t( W& c& F
- dma_addr_t dmaphyssrc1 = 0;+ a) c- o6 n: U6 X! p
- dma_addr_t dmaphyssrc2 = 0;
1 u/ V- S2 S1 H4 E4 J - dma_addr_t dmaphysdest1 = 0;4 I* G5 E( O9 J# }- `/ J5 c# h$ y8 a- o
- dma_addr_t dmaphysdest2 = 0;
# o# c$ Q' p9 A7 m7 r
3 W/ l x: M \/ C' z- char *dmabufsrc1 = NULL;
' a: F( d5 j( d+ e* q - char *dmabufsrc2 = NULL;
( I9 s) l- e$ L/ e; C+ C - char *dmabufdest1 = NULL;
2 N% x$ _" S ^+ q+ G% L9 c - char *dmabufdest2 = NULL;( O3 Y8 p% m0 J) J, G6 w
- 6 v6 ^+ Q w+ S& s- ?
- static int acnt = 512;3 V( A# A* x! {4 V6 G
- static int bcnt = 8;3 \4 @2 Y1 a4 n2 Y/ c- p. K
- static int ccnt = 8;9 [" h% D% s. l0 ?* e5 c2 S
: T! k O5 D* _- n2 }+ N' I- module_param(acnt, int, S_IRUGO);' F9 F7 C+ U$ e- o* F
- module_param(bcnt, int, S_IRUGO);
% i5 w7 _* J- p2 v* U - module_param(ccnt, int, S_IRUGO);
复制代码
7 g1 E$ W( j! \: U: j1 V7 J# L" ^
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 W9 V: v. s0 h7 M" G9 J
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 H- I- R! z: `/ N' s/ W% L4 y b
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ E4 D* h) f& ]% P' X$ a, e: ]' b
0 ~2 c* f: Q7 k9 N7 }- H; e2 ?, m
/ J) L' N7 I- K2 |. e
|
|