|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & ^0 V% O6 L! [4 n/ E$ m3 y n: {& u
- [code]EDMA sample test application
, q4 B6 M8 g9 I6 Z$ I1 b2 w - /*
6 `2 R4 c9 Y1 c3 o; u1 p. N' ]& y, M - * edma_test.c5 j8 f- Y9 `2 j2 n# O' A
- *0 f: |; P8 l) n T; B2 X. [
- * brief EDMA3 Test Application/ |3 H' r% l$ e) N; Y
- *
& [5 c. X l1 m3 Y0 l- O2 A0 L& Z% ` - * This file contains EDMA3 Test code.
/ q+ q7 j# ?9 t: o" c7 f: @ - *& A8 J4 a1 A4 {9 g5 ]
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 l* n2 u% ]- d- `
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
, y0 b) p/ }+ `+ J* E( v - * TO CHANGE.1 i) ~3 M) d" N1 s7 ^* y
- *
, w3 e' i1 E5 z: d7 m9 G - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
$ I+ D# j' J- A3 J+ } - *
2 ~' J$ c9 J# L) U4 @ - * This program is free software; you can redistribute it and/or( _ @8 h. n Q- Y
- * modify it under the terms of the GNU General Public License as
+ l: `# y5 ] X - * published by the Free Software Foundation version 2.
0 r+ [: z/ p$ Y' Z - *
! z9 C/ K3 o, d8 s - * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 N/ e; _! E: f: ?2 Z+ F
- * kind, whether express or implied; without even the implied warranty+ e- b, Y6 P# k+ N" C) [
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the% b! a: R; F. k; c
- * GNU General Public License for more details.2 i9 o' ~0 D- N# y/ _
- */1 B+ W+ {3 ^0 E0 n v k, V$ A
- + @1 x+ I3 i( L$ D( ]# p* k& [
- #include <linux/module.h>
]$ w( B& Y, T7 I' w( r - #include <linux/init.h>0 A4 E' f( g5 a J: d
- #include <linux/errno.h>3 ~7 T, I8 }. U3 W
- #include <linux/types.h>' J; ], }; Y- N) |( @
- #include <linux/interrupt.h>! w/ U9 F) ?" Q
- #include <asm/io.h>
2 q% M1 e$ s1 J: ?/ w# ~6 a' E+ | - #include <linux/moduleparam.h>
. M/ q' X" }) r+ G# g' ] - #include <linux/sysctl.h>5 u% S. J! m) R P4 s, z7 t( B8 ?
- #include <linux/mm.h>
( X+ I1 D( ^3 `7 @ - #include <linux/dma-mapping.h>
, q* `/ n& Z- N8 n* |- r - 8 Q2 X/ l' A* l
- #include <mach/memory.h>4 S2 E1 \2 h9 w+ |: R9 l
- #include <mach/hardware.h>
6 ]/ P! R4 x8 X2 h& q6 z$ C - #include <mach/irqs.h>0 T% e2 k/ Q5 Q& c. K. o% E5 Q
- #include <asm/hardware/edma.h>1 b! i! P* t$ V) R0 [
- ( J- k( b( u# B7 z: ?
- #undef EDMA3_DEBUG
w# Y2 x% k" g0 _3 P - /*#define EDMA3_DEBUG*/
7 [ g/ u) X: b8 d# }) B
, J: ?* Q6 S2 n" S* p: ^) O' h- #ifdef EDMA3_DEBUG
% L9 v3 f T4 Q0 m- ` - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
) {, i2 L( I- V1 M( L. e - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( p" h: ~1 V7 `: g6 l
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ r7 `- ~3 i% H. F4 p0 b# s9 W
- #else
$ M# K: [6 \! A) I - #define DMA_PRINTK( x... )) o5 v: ]. k$ I$ b
- #define DMA_FN_IN
; l5 R) J; a a( \( C: U; ^2 ~ - #define DMA_FN_OUT) s0 }2 R, w/ t1 D) O# y
- #endif
6 {- S' r$ U! s {1 L$ j; h: ] - 0 a9 e7 L( o, Q
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
& s# F8 c" r6 f1 {$ D8 g - #define STATIC_SHIFT 3) |+ _, w) |4 S7 s/ r5 f
- #define TCINTEN_SHIFT 20
: L$ g3 Y" V# r" {6 d - #define ITCINTEN_SHIFT 21! v- v. |5 k) }
- #define TCCHEN_SHIFT 22
4 t! C) V" g2 C7 X; y% H - #define ITCCHEN_SHIFT 23
* ^' s1 V& N, g- h0 | - 3 L. h+ z' R9 M% c* y
- static volatile int irqraised1 = 0;) h# ?' ~% `# o' c: }
- static volatile int irqraised2 = 0;/ l- E! N1 r: @6 j, C8 Q: e0 V
. a) ~$ j: k' ?# B- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% t9 u. L8 Q) M, e
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 U8 ~; T8 r2 s5 I' ?7 N
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! ^0 H4 G, U, t
% h5 `9 Q2 D8 h9 p- dma_addr_t dmaphyssrc1 = 0;" e9 y. s) e- j/ ^
- dma_addr_t dmaphyssrc2 = 0;
! L+ [' P; a* r A - dma_addr_t dmaphysdest1 = 0;; \: m; Y- d( b4 w* j1 N _
- dma_addr_t dmaphysdest2 = 0;" x# f9 I9 y8 \2 y* a8 a
- ) F5 G) m) a( _. t0 y
- char *dmabufsrc1 = NULL;
" n o. X6 i: I; H - char *dmabufsrc2 = NULL;% w( g' H" {& i- t( V1 p+ X
- char *dmabufdest1 = NULL;
. l9 C {& M! ]9 [ - char *dmabufdest2 = NULL;
# F1 ^3 @: Y) P _9 y' ^: C) J( K: [ - ( m% Y8 F( k# B( A
- static int acnt = 512;
- W, h4 o7 i3 l0 G" l. J& Y/ z - static int bcnt = 8;! P5 X6 H9 q! f& M: S
- static int ccnt = 8;( S7 q, g5 T# W- A: b* O
- + p5 `: j, B) w4 n
- module_param(acnt, int, S_IRUGO);& d- a0 j' [( u. j( ]% z) H
- module_param(bcnt, int, S_IRUGO);6 K z; h& T1 W+ q
- module_param(ccnt, int, S_IRUGO);
复制代码 2 E& p" U- U- y* ~8 d3 {. Z
) z8 o8 I7 |. ?2 k! n* J/ {
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 l1 S1 S; S, D a& {! Q9 X
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# s$ n7 T% j5 @: r" G- v1 `0 O
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% Q# s$ S+ r# O- S, e! K
6 r" K" a4 ~# w, I3 F! Y# q$ V- L8 r. a* b4 D) L6 Z7 X
|
|