|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 g) r0 p& o! J7 V" W- [code]EDMA sample test application2 B u x1 ^) O8 m) \& e
- /*
{ z4 A) p8 b+ [8 Y: f" i4 U5 D - * edma_test.c& Y$ K8 F! m( ^5 e2 Z3 N; H% a
- *
: |# t- d/ _. O; d - * brief EDMA3 Test Application2 n) y) O4 ?1 [6 X6 H U0 B
- *
' ~$ Y/ J u3 T) P. F - * This file contains EDMA3 Test code." L! w" F" S4 d
- *
; H% U; R1 X: y0 \9 L# W - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
1 x1 p- ~6 q( ]/ W' ` - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 z( |# h/ F y4 n$ [ h- {
- * TO CHANGE.
/ l6 Z( w$ Q6 i( P% X8 o - *4 v! M/ V0 b% \- @% l: e: s) S
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# r4 o9 J7 P& F
- *% f7 Y. n; [ X% l# D: F% g
- * This program is free software; you can redistribute it and/or! @9 w3 E0 _4 Q* Q3 A; `* ?6 M+ r
- * modify it under the terms of the GNU General Public License as) Y, ?7 y" X5 n4 Q: M. p' E
- * published by the Free Software Foundation version 2.; q: ^2 q/ a! k
- *
4 H9 O. S) D. }6 Q& G - * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 d( T3 P4 R- l' t5 D
- * kind, whether express or implied; without even the implied warranty7 @; B+ X0 k8 @: g# k* s
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the6 ?1 K! c$ F. P0 s; R
- * GNU General Public License for more details.% b, a0 A0 g, Q
- */
: }& A/ X: [5 t$ q# S - % \( m9 \, v4 j7 c
- #include <linux/module.h>; u- F1 Y4 |1 a1 x
- #include <linux/init.h>
: n0 u% {) R3 a7 Z* a - #include <linux/errno.h>* Y ^+ h! l- M8 O$ J4 E0 b) e2 |
- #include <linux/types.h>
/ M4 a0 d/ F* x! O5 o - #include <linux/interrupt.h>
* ^7 }3 J2 G _6 m7 t& v r6 i& [( { - #include <asm/io.h>
8 q5 o: ?. l: [1 _ - #include <linux/moduleparam.h>
' B+ q( v; G% ~. _ - #include <linux/sysctl.h>6 c( Z2 F1 N8 K* z" j" U
- #include <linux/mm.h>
. f1 g! D+ F1 g3 Y, m! e" K& @ - #include <linux/dma-mapping.h> g/ N+ N2 Y' P$ [1 n. y
- . c! N+ `% l+ D( l+ t
- #include <mach/memory.h>
0 j1 I7 ], \: r# e - #include <mach/hardware.h>* N2 Z6 u0 c! b$ G5 Q
- #include <mach/irqs.h>
& D8 H* P: ^; y: Q# L, K L8 _ - #include <asm/hardware/edma.h>
% y1 H$ O+ f% b. x0 r! l - % l# U" v% U& a- X7 C- n
- #undef EDMA3_DEBUG
3 Q' B) |1 z. n% _ v% { - /*#define EDMA3_DEBUG*/
4 n3 |, r" l6 a6 e E" U
T' ~ A4 C8 E4 }( M; a8 ]! g- #ifdef EDMA3_DEBUG
3 ~/ r$ s; o% E" H U0 F, z& y - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
* t/ E: |0 y; m% a. O$ D - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
! V! _# K* N2 R; a% K - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
/ C; p3 x# _$ P8 `8 T - #else
/ ` }* c$ q: U- N - #define DMA_PRINTK( x... )) }1 R2 \$ K: ]) r" [
- #define DMA_FN_IN0 Q" l+ O( [$ j0 I
- #define DMA_FN_OUT' P" U0 B: p. T9 U T: X
- #endif
Z& K6 A; ^) e. j; Y - : Y& b8 L& b3 ]* E
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
0 A5 K/ p, r- H8 d4 P$ E0 ] - #define STATIC_SHIFT 3
5 P2 B7 A ^2 H; R9 ~( [ - #define TCINTEN_SHIFT 20
1 }# E( W! e; }' I# T8 Q - #define ITCINTEN_SHIFT 21
2 I% s, t- }: I2 S - #define TCCHEN_SHIFT 22
6 ?! j+ B9 e0 D# W/ w - #define ITCCHEN_SHIFT 23
: ^$ e, v" w. g( w4 K
, C: _9 a$ h- t' Q- static volatile int irqraised1 = 0;
2 C2 K$ N) v. u. u. W - static volatile int irqraised2 = 0;, n. ~- Q4 w/ F+ G/ Q" n
( @0 `* k* x9 u* L$ ^: @5 z7 V- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 _, t7 w/ |8 t$ N. v
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- z& K* R# P' U% f* Z% C7 l$ R [3 H - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 A$ Z- {$ w) l
* ^+ ?2 {8 `0 b1 w; y- dma_addr_t dmaphyssrc1 = 0;$ @4 s5 s+ T4 H% V9 |8 b
- dma_addr_t dmaphyssrc2 = 0;
4 _1 A; P/ T5 }$ w/ ~ - dma_addr_t dmaphysdest1 = 0;7 j7 K+ p1 J6 C. r8 G: i8 F
- dma_addr_t dmaphysdest2 = 0;# [5 y& U( @/ Y5 `4 [5 p+ e
- / F3 D5 {* ?0 O, k9 k0 f# L1 e
- char *dmabufsrc1 = NULL;
1 `$ z% h: l, S+ k% T) b - char *dmabufsrc2 = NULL;
* _6 d6 m7 v* F - char *dmabufdest1 = NULL;
( I9 A$ {) a" {8 E, f5 ]: J5 i - char *dmabufdest2 = NULL;, ]. b) h1 M3 L" `5 a
0 n! v/ A! `! ^# [8 y- W- static int acnt = 512;) M$ _( X/ N' s
- static int bcnt = 8;
0 x/ Y& U r9 Z - static int ccnt = 8;# K* O7 M. v) c" Y; F/ U8 f) o4 L
& A( F Z* J$ F$ W, N1 b- module_param(acnt, int, S_IRUGO);
& S4 S" r0 Q' C- [* s9 b - module_param(bcnt, int, S_IRUGO);
( }) V- t4 w1 v4 [8 p6 d - module_param(ccnt, int, S_IRUGO);
复制代码 2 o& U9 }2 ^& w4 a& E- k8 Y' c) P
+ D4 d N# I+ s! {
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ b: k7 o/ o- `7 N; s5 i& ~
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. ?$ c4 G7 \( ~& l+ M- J
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, \+ _' [: j/ Q4 G$ u: y W* \( O
+ a/ s; c# B( d) z* b* A% r
8 @9 U$ H* N4 Q |
|