|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ K; o! {- }; l1 C* d- [code]EDMA sample test application
- t ]6 M e. q1 t5 D7 O - /*
4 N: `3 F2 S- T$ q" j$ Q2 ? - * edma_test.c/ D7 T% D0 g) g7 ~; r. C
- *
) {& d6 `* ^, N! N! r- Y - * brief EDMA3 Test Application
# o/ y! y: y) r" f" y t - *
7 s# y! ^' x6 H7 ^2 O7 F# j - * This file contains EDMA3 Test code. c6 T5 }9 A- C; F4 \( m7 `) u
- *- M1 N" a' e! N% z8 j) T% W
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, y6 u; V, M+ g) \
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, |, K! K8 D9 v# B* m
- * TO CHANGE.; M) J, P d2 A
- *" L# s/ |$ e6 ~' V2 p0 f
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
3 C4 K c$ v* h3 T8 M% I - *
8 ^# `7 N2 b- k! R - * This program is free software; you can redistribute it and/or U" [& k* M/ t4 [# z* m
- * modify it under the terms of the GNU General Public License as1 |2 ^+ `2 T( F3 b3 T+ Q8 e6 O( Q
- * published by the Free Software Foundation version 2.
# |" W/ L, U: M d' v* ` - *1 s- ^* _9 k5 L# H8 z' B* x
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any; V% c& {. E# y
- * kind, whether express or implied; without even the implied warranty
4 u& h8 L1 m- [: ^1 ` [6 k - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the: H% T& l O( |; I0 k5 ]" F. @
- * GNU General Public License for more details.3 |1 R" i5 l+ P: B# ]
- */
3 Q; k' S7 B& W
U: E+ b: f$ z4 m9 v/ K- #include <linux/module.h>
1 t7 }; Q" a' _, M - #include <linux/init.h>
+ J5 k3 s" r* \+ \; N - #include <linux/errno.h>: N! |/ ^: {6 Z
- #include <linux/types.h>
. ^$ ~6 g2 E5 j$ F7 ^ - #include <linux/interrupt.h>
# H9 K" C6 |- M5 v5 K - #include <asm/io.h>
8 a7 T+ q. U. A: G* {: \( R - #include <linux/moduleparam.h>
2 V) {) ~' v( a4 d q' |4 d - #include <linux/sysctl.h>
+ e3 j* q, z9 o' ^6 Y; K! r8 ^2 [ - #include <linux/mm.h>
( x) r8 t8 M" Y( `2 k* d - #include <linux/dma-mapping.h>: a4 S* J/ H% O7 M3 X; x7 d
- 0 O( G2 z" f: ~5 }
- #include <mach/memory.h>- B4 G, k5 M+ Z! e: q( V; y0 ]
- #include <mach/hardware.h>3 j6 P/ Y/ i1 v1 ], Q
- #include <mach/irqs.h>
( l- u/ f9 \1 D4 n+ a- T3 y - #include <asm/hardware/edma.h>- |* w) c+ O5 @4 T8 B
- i. T! P7 _( C, d
- #undef EDMA3_DEBUG
) q8 X8 w4 _+ e, p! P ~# ^- b2 r, g - /*#define EDMA3_DEBUG*/
4 N, s# o$ t( S/ u7 p1 H% B - ) ?# x2 U: p# E
- #ifdef EDMA3_DEBUG
! B) z8 `5 m5 p - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! H. F6 w9 S0 s7 ^2 j# z
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 J U9 D3 T Z4 S8 Q
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
+ Y6 T5 ]4 t+ L- L% z - #else
* j+ Q. w- F0 X. ` - #define DMA_PRINTK( x... )
* b* W! M4 R) z5 n) [% G2 { J - #define DMA_FN_IN) ~' c. T. i' M* `0 Z
- #define DMA_FN_OUT
" V: w/ ?4 {. a( \. ~ - #endif% t! k; x# I2 C
( n! v" x3 M! R* H9 I( O4 |- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
( @- }) Z3 L# m* }) a; M% _) _ - #define STATIC_SHIFT 3
' i. y% V- c! z0 F A - #define TCINTEN_SHIFT 207 j& p7 S# F1 V% A9 T
- #define ITCINTEN_SHIFT 21, N: b: N- b; R( S3 M/ @
- #define TCCHEN_SHIFT 22
0 n9 K, q1 P0 }* t5 j! b - #define ITCCHEN_SHIFT 23
% G4 w- q, P2 J2 M' ~3 k# U/ `8 f7 N - 4 ?% P1 D9 x+ \
- static volatile int irqraised1 = 0;
; J6 {' u- v: V! z$ j - static volatile int irqraised2 = 0;3 K5 @ \! F v, }
- : B _- E7 ?" N- m3 f" f, A4 N
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; b" ~3 `; S. Q# s
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" W9 u+ {* U, W U9 l" b
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 B1 t0 O" u+ L; X6 O& Y) D3 z% `
6 T. o1 g1 K$ ?- dma_addr_t dmaphyssrc1 = 0;
/ h7 l& a) g7 i- \0 f) H. q3 j - dma_addr_t dmaphyssrc2 = 0;) s U- [: L: i: C Z9 M
- dma_addr_t dmaphysdest1 = 0;
" ~1 j9 f$ O1 d7 \3 ?, r1 ` - dma_addr_t dmaphysdest2 = 0;
# K1 U) I$ W& y4 v) t
: E2 {/ \5 [, s0 l$ Y" ^1 Q- char *dmabufsrc1 = NULL;5 u- `3 n. W) T- y- b9 {/ e' q
- char *dmabufsrc2 = NULL;8 n( W3 A5 P+ |$ u \
- char *dmabufdest1 = NULL;
9 c, p8 c) a: y, B - char *dmabufdest2 = NULL;, {4 d/ ?- G4 i6 i. `4 a
* m K9 d4 @! f! ^: r, Y. Y- static int acnt = 512;
( m d' Z6 j! O, d1 D y) I - static int bcnt = 8;: l/ f, J- c: O+ p& C4 o: F& o
- static int ccnt = 8;$ S9 S! g9 i0 B
( c% b; J5 K' @& e5 r- module_param(acnt, int, S_IRUGO);$ J3 E6 E: h& ]! ]$ ]
- module_param(bcnt, int, S_IRUGO);" _& @* r! k' M0 H0 m7 P
- module_param(ccnt, int, S_IRUGO);
复制代码 ! ^9 g4 C. }4 s
* F e: l8 l P 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 {- R/ I0 N; L* T1 barm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
3 W8 Q o, X) s8 b7 G! Z7 | 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 ?, q" ^9 b' f5 Z" _8 |) Q
v/ X+ r* Y# {. L3 A
! {2 s; o2 x9 i
|
|