|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 R0 d4 X& S8 U! [( }# v4 L d- [code]EDMA sample test application0 H+ k# a5 s7 L+ S6 m
- /*
* M- |) P/ E1 V1 \5 z3 E9 L - * edma_test.c
: E+ X* K, g4 G/ [' s - *5 d' A# T C, P5 I# A: U" Y
- * brief EDMA3 Test Application8 _1 q7 F) p( [) g: M; K) u
- *$ U) f! C2 I: s, g U& I. p
- * This file contains EDMA3 Test code.# a8 c D) _ l9 h- F! e
- *! ?4 @7 w! h+ [* N7 _# x* {% r
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
) h& _# H; H+ _% Y9 u - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ M& k1 d/ W* K O
- * TO CHANGE.
/ O) A4 y% N" U - *
+ i; ^1 A" T) {' m - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 D- G* @* _" o! c4 r
- *
8 F7 {% v) E) z6 i* R - * This program is free software; you can redistribute it and/or7 n9 u, v6 _3 V. C# ]! t
- * modify it under the terms of the GNU General Public License as9 k" _1 C3 n- c! ~! O, F
- * published by the Free Software Foundation version 2.
% l' K, I' B# w! i# c" V' F - *
+ J$ Y u8 Q( ^3 C, Q - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
- [$ w+ V; X0 F! P* g - * kind, whether express or implied; without even the implied warranty# k! Y' O/ C* e) x0 d/ F1 h2 a1 D
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the8 X5 c! @) j; c
- * GNU General Public License for more details.
: u' e9 L ]+ ?5 h9 M - */
7 b# }( v/ j. `8 i4 M. N - % m; g" _* ~! m8 t& D1 C' p% y& E
- #include <linux/module.h>3 K% T* u5 K9 I, e0 I
- #include <linux/init.h>$ M2 Z) `% g: W& y) m' t
- #include <linux/errno.h>
" D+ {2 U; m. ?/ x - #include <linux/types.h>3 l- V; N& P" r. F
- #include <linux/interrupt.h>. |* U4 @$ W- X; v+ B" q+ a
- #include <asm/io.h>6 ?. ^6 e; w, \9 \4 o$ s* t
- #include <linux/moduleparam.h>
: `3 }( x8 J/ p5 X - #include <linux/sysctl.h>) x, f7 }5 q, u' q
- #include <linux/mm.h>
- e- K0 S# u/ |' |$ W+ \ - #include <linux/dma-mapping.h>/ c7 z; W0 [4 k; }- F
- + W+ w- A+ N% ]' {1 @3 Y
- #include <mach/memory.h>
2 S& [' `. a. X4 u* h& w - #include <mach/hardware.h>3 P: u* Q$ l$ _
- #include <mach/irqs.h>
8 O& A/ j- ?) k) e - #include <asm/hardware/edma.h>% b. `9 Q0 P* S. f% Q- f% E* a- Y
9 X ~4 D; f: j+ R7 g$ S- #undef EDMA3_DEBUG& Z1 \6 z m6 d# u+ ~- z
- /*#define EDMA3_DEBUG*/5 U1 T% A7 g% H/ L$ e
- " P, |/ [/ q3 [6 L# T L8 S
- #ifdef EDMA3_DEBUG
9 k3 J: _% E* `6 S8 O9 j: L - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS) L4 X, m& E3 n4 U+ x- h
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
, T+ j1 N6 e; {* q - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
. P: i( {# o% B. ?$ h - #else
) f/ o9 ~ s6 l$ w$ e4 @ - #define DMA_PRINTK( x... ) U/ h# r7 x& t3 g0 @* O
- #define DMA_FN_IN+ t7 n0 f! G3 E; S E' ^
- #define DMA_FN_OUT( N8 I# B9 j& G* J. f9 J* P; f
- #endif L7 F* H# E0 t" R. Q! g! j7 ]
- {4 T2 b+ }- L. a
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)# @, G! t8 O/ E2 q
- #define STATIC_SHIFT 38 ]0 M) ?' L# I4 u
- #define TCINTEN_SHIFT 20
2 {/ z& j; e/ _/ D2 x - #define ITCINTEN_SHIFT 21$ x! D( X! ^: ~4 T2 U1 V0 P( N% l
- #define TCCHEN_SHIFT 22
' P$ X3 y$ C, c( Z3 S& V. L3 ^ - #define ITCCHEN_SHIFT 23& N% C; ?+ o; k& i7 l0 ^$ b6 }- _
3 X j% h2 ]) T+ @/ o* ]- static volatile int irqraised1 = 0;
; `% U8 r- Q; b8 M! u+ u- Q - static volatile int irqraised2 = 0;4 O; r) F7 |, `7 ~% O5 U7 ]
- $ i* b. ]3 X- K" t, s' y, L9 P
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) E. K2 J2 F, v/ A T: H - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ P, r# A$ }) L8 h
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 J2 M W! G# w& `, a2 C- L
6 s8 K, ]7 ^$ {$ d' |# w8 L- dma_addr_t dmaphyssrc1 = 0;
5 u( X# W7 w2 Z3 n1 n1 B - dma_addr_t dmaphyssrc2 = 0;5 k: U( }! h/ y
- dma_addr_t dmaphysdest1 = 0;4 }# R8 y. R, }, w; q7 E6 r. c, }
- dma_addr_t dmaphysdest2 = 0;/ V8 v0 `+ J7 N+ ]0 N
8 i5 o7 Z# P, t+ p- J" M- char *dmabufsrc1 = NULL;
( U8 ~5 W* A8 p9 l4 V& ~; ^7 ~% | - char *dmabufsrc2 = NULL;
9 U) N% |8 s1 G4 v' F) h: E% ~ - char *dmabufdest1 = NULL;+ F; q0 D8 P3 l9 ^
- char *dmabufdest2 = NULL;
9 Z5 @3 s! F! i% t - ; v2 s- q* G5 G6 v; r8 _2 d
- static int acnt = 512;% m3 n/ \1 x. U: |% O- } T7 S
- static int bcnt = 8;; [5 x: |5 @* G
- static int ccnt = 8;" c* q1 o) Q2 L8 n( T
- 5 u. k* O$ R1 j/ u7 K
- module_param(acnt, int, S_IRUGO);
% z, ^4 ~! X; A9 H6 g- @# n - module_param(bcnt, int, S_IRUGO);
6 p/ h% _* @0 b - module_param(ccnt, int, S_IRUGO);
复制代码
) l+ \, q$ s9 W/ E+ _7 g) ^4 g5 y- s# P- [6 n: Z+ i
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( @, |. n% F& s1 ?
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" B/ |0 C, n0 N$ _0 N
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. Y# a1 n. `9 ` i0 n
& H7 K6 v2 h* y
$ Z; I6 x# l7 [( S
|
|