|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 b& Y- K8 }' l) `, F# n
- [code]EDMA sample test application; s3 m1 L# ?7 F! s
- /*
7 G0 k. k# `) |! k. C/ O - * edma_test.c1 S& ]% @, ^7 X z0 i9 T6 w
- *
! c$ y0 A7 `" V6 T - * brief EDMA3 Test Application9 Z& s+ o* S! f* n
- *9 P( Y, }. u& W% M% \$ ^
- * This file contains EDMA3 Test code.! U2 l. P6 y6 i, l) \- w
- *
$ _) a$ D' b1 f3 I - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
8 G5 }$ K/ k3 i - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
% m1 v, h; n& ]" p$ W+ C' G - * TO CHANGE.1 L' H" `/ {+ t9 Z5 l! C4 N
- *
4 H) ?6 H4 x# z# o0 b ? l" b4 P! C- X1 N - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
, }$ l5 `% R+ s6 g. W - *- `* p' s# Q, {5 `/ A* [
- * This program is free software; you can redistribute it and/or
6 P" ?3 z6 Z$ M - * modify it under the terms of the GNU General Public License as
. Y" \+ }! F0 v2 k% Y - * published by the Free Software Foundation version 2.1 k1 |/ }/ O' I* P1 p; d1 x
- *
) d: V. v- |, a* V7 [ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ Z% C, n6 p+ c& ]9 H4 X
- * kind, whether express or implied; without even the implied warranty1 a, [( Y0 Q3 P, p: f
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! C* Q7 y# E& |- c$ k( k - * GNU General Public License for more details.4 W3 b$ e+ y6 n' S8 n
- *// \& j+ `; M* r# n2 U8 U
- / O$ {0 n9 }4 I9 f4 g9 c
- #include <linux/module.h>( V- P# F. \/ [0 {8 f8 q) y
- #include <linux/init.h>
; g& d/ a/ B2 f0 p6 K - #include <linux/errno.h>
- b, P2 [$ Z7 |$ i0 g) q - #include <linux/types.h> J! J+ [, s. K
- #include <linux/interrupt.h>2 z( I) l3 I- N( K* ~
- #include <asm/io.h>6 B H' ^0 L7 L2 N: |
- #include <linux/moduleparam.h>
; B2 h* x; s' {. F X" U - #include <linux/sysctl.h>4 S0 M+ [( f5 K; {" r
- #include <linux/mm.h>4 w6 F( k/ c" k. c. q4 F
- #include <linux/dma-mapping.h>2 M% Z9 S* |2 X' B
- 4 n# @% P9 T; ]
- #include <mach/memory.h>+ W& ]9 ?, O& i& }! c# ]
- #include <mach/hardware.h>
. s( r+ c( R. v, c6 [0 W* } - #include <mach/irqs.h>
/ L1 N$ j" T6 }# w7 ` |4 {2 L5 g - #include <asm/hardware/edma.h>
- v% ?9 M* k9 v% y* G
B0 j7 u' O3 Z6 b1 H& J- #undef EDMA3_DEBUG
, {8 F& }: B7 a, H | - /*#define EDMA3_DEBUG*/
$ L/ H2 o9 J* u" { - ! A1 m, W" Z0 {; H2 h9 D0 V
- #ifdef EDMA3_DEBUG3 ~6 p5 Q0 N- @2 d
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
; r: o* A0 @0 W4 c9 D - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
8 [7 k4 K! h( d - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! m4 V' s3 ~0 m/ Y% O$ x+ C: x
- #else
9 f4 i1 m- J1 B - #define DMA_PRINTK( x... )$ Y0 Y, v' M7 t6 r% z/ r
- #define DMA_FN_IN
1 C& n3 Y6 `' t - #define DMA_FN_OUT( X. N$ F0 w2 @7 |9 |4 z' f
- #endif. r- h4 V2 L% [1 U2 T
- / f( H3 k2 `/ h
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)" w+ q7 z# t( ]1 ^
- #define STATIC_SHIFT 3) k5 l4 N7 z, }1 U e4 F
- #define TCINTEN_SHIFT 20+ H. ]/ Q6 Y6 t1 R
- #define ITCINTEN_SHIFT 212 m( J7 ~( Q5 c4 F R9 e b
- #define TCCHEN_SHIFT 22( A$ K8 M5 J% i9 s, G8 ?: R
- #define ITCCHEN_SHIFT 23- s( }7 u1 w$ W( l/ F
1 h( g$ S) C! V- static volatile int irqraised1 = 0; q8 n5 G2 k* a/ |4 H! ^
- static volatile int irqraised2 = 0;
5 X+ W1 c5 k( H& `8 ^) p/ }
! S2 a8 b# B. v( ^. [5 g' i- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 m v, g9 X3 r - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; `' T9 _6 Q. j - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 Z; Y$ \" S0 \( ?6 O; B# ?+ d - # H: v. ?8 p& t% m& q
- dma_addr_t dmaphyssrc1 = 0;' |+ B& E: H5 f! @% g$ p
- dma_addr_t dmaphyssrc2 = 0;9 K9 |2 Q# V1 t6 V7 }9 \. o% E, H; L
- dma_addr_t dmaphysdest1 = 0;1 D4 v2 k: l/ T3 J4 _
- dma_addr_t dmaphysdest2 = 0;
; z, K' f5 A% X$ p1 z f' I - ; G9 B& ]. Y4 s/ i
- char *dmabufsrc1 = NULL;+ z9 ^% ~+ J& I2 L* K! K
- char *dmabufsrc2 = NULL;
; o' y4 ?9 ^0 \$ U - char *dmabufdest1 = NULL;3 J) v4 }; S+ U5 x. {+ ~+ |1 `
- char *dmabufdest2 = NULL;, P; h# v5 y7 t; ` C
- : o- N/ y. B% h* J' |1 o
- static int acnt = 512;
* m. u, @+ l: B% p/ j - static int bcnt = 8;" B: x0 ]/ T' ^, H: l) S0 c
- static int ccnt = 8;
0 t( q8 S M7 d9 h( ]
W4 i) J' v4 T; |- module_param(acnt, int, S_IRUGO);
0 G) T6 V' ^, L: G - module_param(bcnt, int, S_IRUGO);4 ~ `( I* e i" q7 Q1 d
- module_param(ccnt, int, S_IRUGO);
复制代码 6 J% p4 a8 n7 b" } S0 G
9 T; T$ Z" M6 w- S
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
9 t) i1 [% b, t, R: {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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) w2 g2 l- L* y/ e4 G 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 Z2 s- s) s4 z7 n. @ Q+ \& L! H" q# O/ c3 z" @" H8 h
: U3 C/ Z9 r0 ]. R% {
|
|