|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' _' t8 [8 Y; ~( Y2 p- [code]EDMA sample test application7 ~! a- z2 M+ m, G0 K; ?+ M8 V7 ~
- /*
8 Z+ E' g G, [9 q2 [8 C - * edma_test.c/ c* ]$ g2 h# }8 |/ ^% l
- ** Z/ h8 u8 ^1 W0 M; C( N' i0 e
- * brief EDMA3 Test Application
! N9 s5 z, B) L3 y. s+ q - *# ^& @" g8 P. |" l, z
- * This file contains EDMA3 Test code.1 o! t8 T1 a8 m: E& Q
- *1 o: ~" q) i# B% }( C2 l
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
% T) y$ E( T+ s. W; t - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
9 ]5 `' k! o1 H6 m. J) _ - * TO CHANGE." G, e0 U! T: q6 j
- *
1 D4 L) m6 H/ _0 z3 i5 v& K9 T - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, d% B4 f/ s! l& |3 f0 n
- *
. k: U W2 D1 O, N - * This program is free software; you can redistribute it and/or
0 v& v( m7 b1 p4 @6 S5 { - * modify it under the terms of the GNU General Public License as, c- v5 i/ \3 V' k! {
- * published by the Free Software Foundation version 2.
1 \; t* g* t5 E! ^3 {0 a - *$ @. N& F X: d6 X6 `
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any w7 i' s- a6 ^+ X* m
- * kind, whether express or implied; without even the implied warranty
6 r) N7 {- }8 Y3 r: S7 H" c" _ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ [6 U" F- s9 b0 {) ? - * GNU General Public License for more details.
( @5 N/ S: C# H2 w - */
3 n' J9 T+ e' x* t - % t6 h9 K" b! H g
- #include <linux/module.h>1 k0 |. y+ }8 ^0 r! ` l
- #include <linux/init.h>" R- Q9 w" a$ s5 y# ]6 X& ?+ a( w
- #include <linux/errno.h>
S, w/ v- @$ f' F* \9 |' j# @3 m: @ - #include <linux/types.h>
* t, x* p8 c( z7 @+ {( j( o - #include <linux/interrupt.h>
f; W4 f, V) E; K* i4 P - #include <asm/io.h>
& ]- Y* |# Q' D' t9 K5 Y: L - #include <linux/moduleparam.h>
) T6 E" \* i! Z8 i) t - #include <linux/sysctl.h>
* ~. r* u9 \0 M h- j2 U; y - #include <linux/mm.h>
! f+ S; u# r( | \. |- K( v+ T' Z - #include <linux/dma-mapping.h>1 H0 t& [& z% w0 \; i5 c! }* K
: R2 E! O4 x. u$ L' }- #include <mach/memory.h>3 h1 D% v8 K; ^2 w. G: z0 R& b
- #include <mach/hardware.h>
2 }$ \+ X. t4 P5 r9 F5 x( Q: A" T - #include <mach/irqs.h>; a; h3 u; d# T- u F! r+ _
- #include <asm/hardware/edma.h>
Y; U5 l6 d8 \! l
! z: m8 b7 t, n7 T% T+ H2 u, X- #undef EDMA3_DEBUG2 z$ [( q0 T7 C% a
- /*#define EDMA3_DEBUG*/
2 W$ Y6 e6 ]9 G/ | - 2 N! N+ x/ H( Z7 J- X
- #ifdef EDMA3_DEBUG8 ?1 B' d6 z0 }: O H
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
! m3 l& g6 ^4 U( F0 q5 S2 b - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
: o; y" |4 Q/ M% D5 e- `6 k5 D - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
; m& O9 n9 A; A; z/ d, w' W' h; s - #else" V$ W/ \+ ~% F. \
- #define DMA_PRINTK( x... )' K5 J! i4 a! N4 m d2 b3 X3 z
- #define DMA_FN_IN
$ B2 f7 S/ M) v0 Z8 H - #define DMA_FN_OUT
6 v* Y& A% W- t3 Q- a' n! }0 P" O - #endif
; t' D* P) T1 K
1 E; K# R/ O. {# e& n- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
0 m4 W0 K: c1 F* x7 _% ^: b: h1 T - #define STATIC_SHIFT 3
! q) n, n; g( y2 L' V - #define TCINTEN_SHIFT 20
3 x! S2 L0 t0 _ - #define ITCINTEN_SHIFT 21
; `9 [* ^; U* X2 w' y - #define TCCHEN_SHIFT 22
$ o; e3 y9 F, {4 O - #define ITCCHEN_SHIFT 239 d: Z$ ]5 `% F$ {; P" ]9 w
- 4 x0 R# y2 L( @* {0 G8 l
- static volatile int irqraised1 = 0;
( B6 u, n1 \. U4 z: K$ e3 f - static volatile int irqraised2 = 0;# J9 I7 X7 ]' e: s1 S
- 5 v6 \) R% j* ^4 t! N5 x
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& }4 ]0 t+ D3 B% u- ~/ c5 F, d - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 I' }( ~! w. ]6 @
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
N" _3 U7 V* [) [1 y9 p! i
- t# l8 [1 r# T+ r! h- dma_addr_t dmaphyssrc1 = 0;
8 T. e# C/ ]) z: R+ T - dma_addr_t dmaphyssrc2 = 0;
/ D1 c3 R* p, X3 g - dma_addr_t dmaphysdest1 = 0;
7 `8 J; G+ s2 v3 p2 V" r# `, y1 d - dma_addr_t dmaphysdest2 = 0;/ n) _1 V3 j, Z$ O5 s6 q, J
- # M# r0 D5 ^4 i( B/ ]6 {) t
- char *dmabufsrc1 = NULL;/ Q- O, Q% a1 P8 N# h
- char *dmabufsrc2 = NULL;
/ [5 [, a6 ?/ b4 w; O9 n - char *dmabufdest1 = NULL;
) v# ]* n K1 u% ]9 g& v+ B# U( N6 w - char *dmabufdest2 = NULL;
4 M; S. e% P- {+ |
2 c7 |: \% H+ L- static int acnt = 512;. T" E; x' y7 ~% u8 P" x
- static int bcnt = 8;( L- i3 J( F/ F
- static int ccnt = 8;: u* P! a& u2 R4 g7 o- [
- $ w. S! [; I$ ~
- module_param(acnt, int, S_IRUGO);
* ]: p6 o, Y; Y d; [ - module_param(bcnt, int, S_IRUGO);' C1 j" |- v& t% `
- module_param(ccnt, int, S_IRUGO);
复制代码 3 m4 t4 n3 s$ Z8 Y+ `. v4 G: b
0 q5 n3 n3 [9 B' o 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用 a4 p" i' V2 p' h* c
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 U ^& ?: d: `5 w. m0 @9 t3 W 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) e8 V# y- m1 f' v4 m7 x
+ @0 J' Y. u- g
( k. ?7 a ], [7 ?. A) x0 C$ X |
|