|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( J' G) X4 r- [3 `; M* V- [code]EDMA sample test application. n, j# |& v! }0 r; j: R! m% G
- /*
" d: J& J$ A- G* M( X - * edma_test.c1 E% f3 D0 V/ _# }. v6 r/ v$ a! w
- *
" K: o7 w. I1 {! E3 N9 E - * brief EDMA3 Test Application
3 {& x9 F. X: u: O7 N! d$ w3 p4 p/ ~: M - *
/ t+ D! ~! K& P7 c2 I Q% K - * This file contains EDMA3 Test code.
& Z% M- T# n0 E! u - *
. V/ ~1 L2 E ?" T: y: }0 x8 n9 x - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
/ E/ s1 J/ F9 k( T2 j/ T3 { - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ ]$ s" h5 i) Z, V
- * TO CHANGE.
* l( _3 K x: V, M/ T - *
2 u$ |4 d- @: O& a2 r$ ] - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# ~4 S7 p9 L" `8 L/ b# J9 r
- *
: |4 L4 j! ?6 a0 o' V - * This program is free software; you can redistribute it and/or' y( F$ `% q* @2 o- ^. {! q" z
- * modify it under the terms of the GNU General Public License as2 w6 ^$ c! {! Z% x* x3 \* K
- * published by the Free Software Foundation version 2.. s0 K( g; p% M7 W, @; Z! o
- *
$ P" t) Y7 e% s) q - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
! E9 U6 A5 q+ w- v9 R - * kind, whether express or implied; without even the implied warranty
2 q! A2 c# x% @* k: A' ~" b5 z! G4 B6 D - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- B5 u# T3 [7 n' X, J9 p
- * GNU General Public License for more details.7 c9 Z9 p& [+ d3 y
- */
3 X# q9 R- q4 i1 N - B- t& _8 E) y( d$ P
- #include <linux/module.h> j2 N3 W g# R" g3 m
- #include <linux/init.h>
' e! q4 ~' Y/ h0 t9 ^ - #include <linux/errno.h>
2 }( M9 j5 h5 J9 F9 ?. P$ t - #include <linux/types.h>4 {2 A2 U7 M3 ]' B6 v
- #include <linux/interrupt.h>6 w6 _* V+ {) T; R' I# O: Q% K6 ^
- #include <asm/io.h>* I( D0 x% Q) R" K1 R' ?! r' E, b" x
- #include <linux/moduleparam.h>
- k' z' b8 C i* d5 K' I# A - #include <linux/sysctl.h>
6 G5 `( W7 K1 W1 Y8 r7 b6 \3 Q0 w5 R - #include <linux/mm.h>5 Q" T8 {" c1 D( O; C! N! p" x
- #include <linux/dma-mapping.h>
5 _; K+ W6 j& l7 H6 D! D
: A; M h" r5 z" D4 ^7 P4 f- #include <mach/memory.h>& ~. l2 T( L4 N( \* _8 b, p
- #include <mach/hardware.h>
7 J- `, }) |/ R7 U) K } - #include <mach/irqs.h>
P7 y( ]1 }. a4 r; c9 [! x: e - #include <asm/hardware/edma.h>1 Z4 j9 f9 q( o' P$ A6 {3 Y6 l1 [ D
* v. ^) U5 E L% g! ?- #undef EDMA3_DEBUG9 N! W$ b! ]' P+ A0 J6 L& M8 H
- /*#define EDMA3_DEBUG*/
) `; n; I5 k, d
2 t9 ?! ~9 |& _' V0 r' y- #ifdef EDMA3_DEBUG y9 E1 Y6 q. ]8 c8 i
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! ^2 h9 K, V- _. y9 N* F
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
) x6 N. Y) u7 d1 X( ` - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
& [' e9 W! m; `; K - #else& A( B0 ]3 t5 z/ D+ D1 l4 H) q
- #define DMA_PRINTK( x... )
. ~* t$ s ?* k% S8 A4 x - #define DMA_FN_IN
4 U$ B0 z0 U/ |/ C5 n2 e - #define DMA_FN_OUT
7 b. b. s' |1 o f) j6 G$ x) |6 p7 l- C - #endif
/ a4 `$ s. Y2 X8 c
; p; ]& y' `$ O3 N+ Q# d* o- #define MAX_DMA_TRANSFER_IN_BYTES (32768)( r! Z9 B; K( `7 |; L& \
- #define STATIC_SHIFT 3
q" N3 B7 f1 r% `; }: }! ?' ~ { - #define TCINTEN_SHIFT 20' g2 [/ y) `! p: X4 ?$ i$ n4 N
- #define ITCINTEN_SHIFT 21
% J2 M# ~2 n" a - #define TCCHEN_SHIFT 22; \& `" ^3 h, v: J
- #define ITCCHEN_SHIFT 23% n3 B# z& Y+ D# B q3 P
: W- _3 M z' d5 Q- static volatile int irqraised1 = 0;
U; c4 F2 S4 R$ t - static volatile int irqraised2 = 0;
( g% E% w; X+ k* C
# N6 k6 b" s5 m- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) X. f$ v! }5 W0 I1 d* i - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# P) s) N9 o, q( t) k
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 k, [: x9 t5 T! D6 ^
- ; T4 _% y+ a2 v/ J7 I2 S7 ?" s# D. L) H
- dma_addr_t dmaphyssrc1 = 0;: `1 g8 a' W! ]- w4 m M+ `! `
- dma_addr_t dmaphyssrc2 = 0;
K) L$ a+ Z0 i3 m6 a- g - dma_addr_t dmaphysdest1 = 0;# S3 u- D3 v: Z" m* G" G0 W( D' B& @
- dma_addr_t dmaphysdest2 = 0;3 i% a; S7 u# X1 M* Y/ T
# ^* [7 n7 o- d' w; \& A: b" _- char *dmabufsrc1 = NULL;" o J2 f2 t r
- char *dmabufsrc2 = NULL;
' _! u1 m+ `4 C/ Z U- r - char *dmabufdest1 = NULL;
+ z" l8 ]+ o! X* E. v - char *dmabufdest2 = NULL;
% [/ Z# h. {! q9 u v9 { - 6 r% G4 W9 `' g" w7 ^4 }6 Q$ @1 [
- static int acnt = 512;4 u- f, J8 D( i% x* Q! g
- static int bcnt = 8;
2 w+ N: [! ^+ _4 @1 j. l" R - static int ccnt = 8;4 T) _- m3 k% }6 ^* l' [, d
5 L) r3 Y- ~( B- _- module_param(acnt, int, S_IRUGO);: [& u8 o2 c" q: l$ b
- module_param(bcnt, int, S_IRUGO); o& _0 n3 v$ ^; Z
- module_param(ccnt, int, S_IRUGO);
复制代码
: o" b+ Q' `& E9 r& h9 _1 Z% I) I) T* S9 r
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' \3 ]+ Y' {/ a6 W* `- K+ N
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 H+ [% O* S K* V& s
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 P3 z r, v0 N, J; Z
* ^, [: ?* k: h5 n8 j c
' a0 c) ~7 h u0 Y+ p( e9 c) e& e |
|