|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; H' a4 g' T6 \+ M
- [code]EDMA sample test application
" ~8 E5 d& K( n% _2 R - /*
9 X2 N6 Y& y' z$ E8 x4 ~! T+ g - * edma_test.c
1 A' u. d$ P; K; q4 _ - *
: g8 d9 N7 b0 v1 p4 o2 G5 k - * brief EDMA3 Test Application1 [* h5 e1 M& Z$ W! M! V O- F
- *3 k; U. b9 v2 o1 n. Q' Q5 r- [" z/ n
- * This file contains EDMA3 Test code.
! w- [- `6 b% s. [+ } - *
3 S6 h, E, j( ?% v0 [7 \ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
6 e) o0 ]5 e& `; j' z2 M3 ~ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! q% x3 `( [: h. J6 Q# w) V5 `
- * TO CHANGE.' o3 @0 h# J; X, O, ]; }$ p5 S( o4 G
- *4 Z4 z/ r/ i/ U3 d, w4 h2 c5 X
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! t' ^, Q; W5 B; J, n# i
- *
7 o. K1 X$ n1 Y* J) l- c - * This program is free software; you can redistribute it and/or
' l; g2 Y, H( V& ?' N9 G - * modify it under the terms of the GNU General Public License as- ~ o6 _' X2 \7 Q8 u
- * published by the Free Software Foundation version 2.0 o' f* @! H- }. K9 @
- *
: l8 N' L* x6 C, q+ r2 M - * This program is distributed "as is" WITHOUT ANY WARRANTY of any! X0 ?5 Q3 B- Y0 ?2 p
- * kind, whether express or implied; without even the implied warranty
0 \8 E( S, {% s* ^5 [& z2 J - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the% J3 m% C) r! ]8 M5 s* @9 t% I* _( @
- * GNU General Public License for more details.3 s3 Y8 P( n: G$ y; c. l& B3 r) U+ r
- */
2 \4 `5 {2 n9 q$ ]
2 C1 |* {0 \ L1 `2 l- #include <linux/module.h>
3 o, {. K: b7 x! ~! n# t* Y, c! w - #include <linux/init.h>5 q% }0 j c/ b+ k
- #include <linux/errno.h>* ], I$ |: o; b, e
- #include <linux/types.h>
0 s% y2 h# t& j! B3 ? - #include <linux/interrupt.h>
, Z: B, C$ w8 q - #include <asm/io.h>- c3 z/ o3 u4 K1 \' q. L4 a' z) @4 ?, H
- #include <linux/moduleparam.h>
' ~4 {. e( O& L4 a6 ~: t6 q - #include <linux/sysctl.h>
- _; s* J' j: q! P: d* Q - #include <linux/mm.h>
& t$ z! ]$ E# B* F' y! a - #include <linux/dma-mapping.h>9 [- Z+ d3 d# |" o) L
D/ n. I( z# Y- #include <mach/memory.h>
3 ?3 Z* C3 K- q5 E5 c0 v - #include <mach/hardware.h>5 P9 Y5 Q! ~1 M) s1 ]+ B Q
- #include <mach/irqs.h>) I4 w0 v( y3 Q
- #include <asm/hardware/edma.h>
2 D; n6 |. n! u: s& e, S& K
8 Y) z6 ]+ S- e& P- #undef EDMA3_DEBUG
2 P% g! g/ Q4 |' o - /*#define EDMA3_DEBUG*// S: G! K8 z* L
- 7 A" Z6 W& v" r
- #ifdef EDMA3_DEBUG
+ J4 ~/ J" A! ?9 q) a/ D0 g - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); _+ n7 N# L( _
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
# F0 C- o5 O' D6 @0 B+ Z6 \3 _5 \# ? - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), g1 N6 c- N' l, O; A$ B7 x
- #else
7 Q/ u# _) t5 V7 c! S7 s5 D - #define DMA_PRINTK( x... )4 {9 E5 V! z+ a" ~" m. W
- #define DMA_FN_IN
% S/ x4 _. R0 S h; S. v - #define DMA_FN_OUT
# ]9 r h, k6 ?* D0 N& |2 Y - #endif
% u. Z/ F1 l* o0 r - . v+ J+ C, q0 {. h
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
) a% J+ @# K1 m# R2 m& F! H8 c5 d" { - #define STATIC_SHIFT 3
& E0 R# ?! X8 I+ k* V - #define TCINTEN_SHIFT 20
; c7 |5 r2 G1 Y) @2 [* \ - #define ITCINTEN_SHIFT 21
2 ~7 [# v) ?. c - #define TCCHEN_SHIFT 221 C+ Q: d7 e4 a' D
- #define ITCCHEN_SHIFT 23! E) ~% n3 J! L( E o' T* [+ L
- 8 y! }/ x0 `9 V( T( F- ?6 P
- static volatile int irqraised1 = 0;
& U1 j' s7 t9 \" a - static volatile int irqraised2 = 0;: e! i7 O* ?- F0 L0 ^2 z2 O
- 5 B: M( Z/ p7 n- Y9 O+ H
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 ~- Q g1 x$ @) m7 e7 ]4 W
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( y% M+ \" g3 r8 e( V4 f
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ ~- b4 m% n! q l8 V7 r2 a
: ^) W/ i5 f1 V8 }' U7 t9 d" `( b- dma_addr_t dmaphyssrc1 = 0;
* Y! }% k1 P& R - dma_addr_t dmaphyssrc2 = 0;3 v1 N/ G2 W* p! G2 X
- dma_addr_t dmaphysdest1 = 0;! e3 z. T7 H( O2 Y) M
- dma_addr_t dmaphysdest2 = 0;% \& j3 t( o1 o7 k( [6 h
- 7 }1 m, D( \5 o& i% E
- char *dmabufsrc1 = NULL;/ Y- K8 H' G. }1 ]3 @, f
- char *dmabufsrc2 = NULL;
|7 g% ~3 `2 S$ ~; q( K! c - char *dmabufdest1 = NULL;
9 {9 W$ s. ]( ^$ n - char *dmabufdest2 = NULL;. r2 w3 j1 S0 ~* d
- ) f# U+ P, r8 A
- static int acnt = 512;
& ^4 o/ E+ _9 g( G - static int bcnt = 8;
5 m2 X% Q+ r7 s( T+ H - static int ccnt = 8;. K3 `2 S5 Q, H4 A# W6 j1 f
- ) E6 X: @- I# h2 @- |
- module_param(acnt, int, S_IRUGO);
; v% J5 I" t8 k- f- }8 ~ - module_param(bcnt, int, S_IRUGO);3 E- V' k1 ?* U, v8 t0 H5 n
- module_param(ccnt, int, S_IRUGO);
复制代码 ) m, E+ p5 W1 b$ T
( \3 X. S% \9 d
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% b0 |" z# \8 I# B9 [; {" L
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# y- e/ G# c0 k% Z% S3 r7 z
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, R7 w- I5 W9 z6 H% ]! w; X
' v. R P5 T! F: C3 I6 Q: ]! ~. \4 S
|
|