|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 C2 a( o4 v7 w/ {0 r- [code]EDMA sample test application
. ^$ \8 |6 R" ~9 U/ L( @4 r9 a# s3 X% @ - /*& l2 |$ A+ O* D. [: |& m6 L
- * edma_test.c
! Z, Z1 a4 N! G3 D8 ^ - *
9 s! y( ~: Z& Y/ H - * brief EDMA3 Test Application1 ]* [% f2 {, ]6 h# L0 [
- *
# U' u" Y9 a* x9 G9 h% b - * This file contains EDMA3 Test code.
( L: Z3 T Y* ?( E+ w - *, n8 f8 ^! h# t9 l" n
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 T. W* T, Z+ M' b6 a6 A0 G
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: I5 Q) [3 O) d1 z% c- @
- * TO CHANGE.8 j+ x3 h0 p- p! _& Z i" l) Z
- *' K: |, q3 Q+ r$ k6 e) }( z) x5 y
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// d' g/ v Y5 X7 P7 X6 A1 c7 w4 z# U
- *( ~, N; O: Q% K* z1 _0 ^# s
- * This program is free software; you can redistribute it and/or- w' [: H, f4 `2 Y2 Y
- * modify it under the terms of the GNU General Public License as
( p9 w+ B- j' e; h1 [ - * published by the Free Software Foundation version 2., s. ?' Q! J- R9 W* z& h/ x; E
- ** S+ q) H& f2 X( ~' [& f) i
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
$ B* u% Q) e" c7 K. x/ G - * kind, whether express or implied; without even the implied warranty3 d9 }* p; b: g; k
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3 \4 h) E! @: E: O - * GNU General Public License for more details.# Y* u! k6 t! ]+ a: G
- */
" w& p6 B5 `; R - / d0 s' K: T! }
- #include <linux/module.h>9 y5 l" u9 D1 h( ?; E2 Z
- #include <linux/init.h>
4 W' s7 n, E! i* B, z - #include <linux/errno.h>: }4 ~ b4 j! v5 w, ~& o! }- C9 a
- #include <linux/types.h>7 B1 `1 N- y6 b+ c3 h J0 K# i( ]
- #include <linux/interrupt.h>
2 E0 p$ T3 }) V - #include <asm/io.h>' v2 l9 j' X7 [4 G
- #include <linux/moduleparam.h>4 A: h5 [ W8 a/ J8 P: ~& `0 ]
- #include <linux/sysctl.h>3 a# Z6 ^. g4 f) U3 v* B
- #include <linux/mm.h>
& D4 g. p" I3 m1 {1 ]6 I: h - #include <linux/dma-mapping.h>+ D6 W! j- L3 [
. D& R G% _. p# t% `- #include <mach/memory.h>7 C! v, F/ P- Z
- #include <mach/hardware.h>
5 P, W8 Q3 D" d. Q, [9 u - #include <mach/irqs.h>
$ e0 f7 i% s8 v* u$ G5 I6 a - #include <asm/hardware/edma.h>
+ T0 _. L* a0 ]' |3 [
6 u, G% J1 j9 N& T5 X0 D3 h- #undef EDMA3_DEBUG0 E x1 u+ c$ O( I
- /*#define EDMA3_DEBUG*/1 ~) k3 R% c, V5 }! u, W: ]8 q
- % ^4 m3 k! c% K6 \
- #ifdef EDMA3_DEBUG
4 |( ~! Y. _8 u# B - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
& E2 r0 R9 n* ^: E) m - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 H2 m5 Y- H5 Q2 ?
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). @7 i j9 Z! q& T# m8 `* M
- #else3 I9 ~( D4 b8 W- u. N
- #define DMA_PRINTK( x... )
; v2 ]. q2 p$ S - #define DMA_FN_IN
, Z2 K4 ]$ U4 T3 T! X3 i - #define DMA_FN_OUT
$ k4 ~/ g% N& U w. m - #endif& Y& ], F5 i. E5 a6 Y
- ! v3 Q6 `9 _( Z" B
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
1 X6 V8 H8 N( ~0 s5 k$ v8 T8 a0 e, P - #define STATIC_SHIFT 3" k" ^. T* c7 f0 W
- #define TCINTEN_SHIFT 20" V: J4 U4 @* w
- #define ITCINTEN_SHIFT 21
5 Y. j; d' N V - #define TCCHEN_SHIFT 22
/ ^4 s. |, e |" ~. e' x) R - #define ITCCHEN_SHIFT 23
0 u J" l$ K8 c8 j/ e7 m
& [$ Y# h4 M& S/ w- static volatile int irqraised1 = 0;* p6 `8 X$ p. b1 c1 } ^
- static volatile int irqraised2 = 0;' F7 I+ d4 Y: X- r' I# f) M* ^
- 9 |: S5 J2 `0 H- E& `1 `
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 s- c1 n6 }9 S' H" x
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 U F6 T# |) u* V V4 [3 O" v% Y
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' m- t3 h* g/ q$ {4 c( Z- i - * ~# j+ V# C# _7 \
- dma_addr_t dmaphyssrc1 = 0;
% t6 m4 R' Y( _# `1 o - dma_addr_t dmaphyssrc2 = 0;6 s1 J( Q& |6 Q
- dma_addr_t dmaphysdest1 = 0;
4 u. x$ B$ r" |+ A, j* g5 C - dma_addr_t dmaphysdest2 = 0;7 F5 s* O' m [$ H$ { }1 c
* M4 s) g) W* {/ p' o9 ?- char *dmabufsrc1 = NULL;
+ b$ a0 g, Y" q5 ^" q - char *dmabufsrc2 = NULL;
* V! K( _8 ^3 z% Q$ j/ a' U - char *dmabufdest1 = NULL;
2 z( Q6 w% o! r0 g - char *dmabufdest2 = NULL;
& z; o! r" E4 ]5 W$ J& r6 [ - 6 b6 i2 z2 F* I; H
- static int acnt = 512;
\+ a6 h* N% a2 F - static int bcnt = 8;2 j8 I+ t: E/ u5 q7 j
- static int ccnt = 8;
* G' p( z3 S% e1 [2 M/ ~2 t
/ I ~5 h2 [8 W- module_param(acnt, int, S_IRUGO);
& z$ }. S5 P% p% N- t$ e! } - module_param(bcnt, int, S_IRUGO); _# Z9 f4 u* i8 Y u
- module_param(ccnt, int, S_IRUGO);
复制代码 0 D5 O0 A' M" \4 r. t
# S/ \/ ^5 W+ O/ } 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* C' E3 l+ E, r" {9 n1 C. I
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% U0 ]) X" v# `4 b5 z 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ _0 v" Y: i! X, @/ l
! n4 h7 ?* S, ]8 x$ k7 F
$ H: s: K2 C; j6 N; d |
|