|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 p. a- H1 J' A5 a1 I( H3 t& j
- [code]EDMA sample test application/ w7 r9 U5 q$ H. o: [
- /*
& B6 S/ `/ B" t. V& D' P - * edma_test.c
) o7 L* q2 V: Q - *, D- Y" @% l* t5 S0 O
- * brief EDMA3 Test Application$ F# f* f- ]$ A: V
- *
1 U" c) C. I! S - * This file contains EDMA3 Test code.
: @7 {% h) C9 R2 S) L - *6 X+ Z8 g* p& o7 V( f h
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
( E U9 ^' O. F4 H9 ]: A, H& E - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
1 A$ |$ d& c: S. b' o1 i5 m$ q4 Z; ^ - * TO CHANGE.7 U& x/ Z( f+ }% |9 s+ h5 i6 b7 k
- *! E, v8 T- u9 X) d' |. H
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
5 d2 `! ^, E! P5 W! _7 ]5 F - ** n, {! [* x& ^5 n z
- * This program is free software; you can redistribute it and/or
0 {" [5 X! L+ t7 q$ \, j - * modify it under the terms of the GNU General Public License as
# S! e4 g7 U/ ?8 P4 [ - * published by the Free Software Foundation version 2.
* U, O2 u/ a9 [ - *# c' u% u1 B4 r/ \, T
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any" b- B9 K( O% F9 x# d
- * kind, whether express or implied; without even the implied warranty8 F6 e. E( J5 m+ s) |$ L5 e+ {
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the! c$ F! S K& Y8 ^" G% d
- * GNU General Public License for more details.6 p/ m) \8 m8 l7 n* J* F7 A
- */. G. o8 z/ V% R0 y# @
- c% v+ _. c& R: _: d+ \- #include <linux/module.h>/ O4 ~) ` [7 v1 q: V; u' X
- #include <linux/init.h>
+ N: [; J3 q" Z$ s I - #include <linux/errno.h>2 p/ ]. B. j! x% X4 V
- #include <linux/types.h>3 q3 n+ P$ D( k
- #include <linux/interrupt.h>
# F( R: c- v; }+ l - #include <asm/io.h>. L7 s6 @% ]; T9 n$ c2 k4 K
- #include <linux/moduleparam.h>2 V% y$ f- m/ l8 y
- #include <linux/sysctl.h>
* F; Z7 k7 n6 X. t$ V - #include <linux/mm.h># I' O' N( ^. @, n( n8 ~8 j" X8 @
- #include <linux/dma-mapping.h> Y( w" {6 H) @) A8 ?/ N$ c
- $ P+ I& g: Y5 Z' C
- #include <mach/memory.h>- _8 @6 M: d! S
- #include <mach/hardware.h>( w, h3 D7 l+ o9 Q
- #include <mach/irqs.h>% ?. G4 j7 V; V) h4 Q% C" |
- #include <asm/hardware/edma.h>
# Q! V% Q u M1 K6 m+ o% D4 p - 3 q0 _! z4 g( Q6 G0 `
- #undef EDMA3_DEBUG
9 Y! F$ Z0 b4 Z4 ^5 H7 |$ } - /*#define EDMA3_DEBUG*/
! ^. x$ {9 A$ D3 S; y3 K7 S# i
8 e4 ~& r9 T7 ^9 ~2 Q9 B, `- #ifdef EDMA3_DEBUG
7 E8 F+ P& S+ E. z - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
( ^% C! M' o O& N3 K - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 A: Z2 \7 ]) ^) W1 f% W' c
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
* E6 m6 ^5 V: L0 a' ?1 t) Y - #else
) v+ F) [5 ]7 L! C7 ~' ?# ` - #define DMA_PRINTK( x... )
6 \* ]5 q* T$ m: ?6 J! n - #define DMA_FN_IN R3 W9 a8 j' t* E
- #define DMA_FN_OUT- g7 S1 M+ G1 h" z2 Q6 ?0 {/ P1 [' K) J9 z
- #endif K3 I1 o: s1 V8 i7 i# k
; P& j$ X7 N3 V' E) u. E& B2 j9 q- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
c) ? z' o. s" }3 G( w - #define STATIC_SHIFT 3! p6 z/ c# D' ^1 @: Q3 Y) L9 S
- #define TCINTEN_SHIFT 203 ~$ \7 A. J f6 i; Z
- #define ITCINTEN_SHIFT 21
: }% u* t+ y: b' E7 d8 u0 E( ?3 o4 g - #define TCCHEN_SHIFT 229 X3 l4 d) ~! L, b9 N
- #define ITCCHEN_SHIFT 23
& a6 P/ ~* g3 N+ |, d: u2 l) m+ S2 e* a - 3 ]) n- l, t8 I! \- ]
- static volatile int irqraised1 = 0;9 J8 B. x- x) G H6 R
- static volatile int irqraised2 = 0;
! {$ ]$ X$ ^3 B' j A
4 u/ A' p' J$ e0 i0 B7 v7 J- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ W" R" \: j9 c j
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- y5 |" P: l" d0 B" t& j( n - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. o; Z, ^- z8 g: I1 b, }0 Q' f: i
- / [1 I! e P9 ^7 |, Z# F
- dma_addr_t dmaphyssrc1 = 0;
5 r* p% G# e) G- V - dma_addr_t dmaphyssrc2 = 0;; N/ W/ Z( X% N a% a5 \% d
- dma_addr_t dmaphysdest1 = 0;
. m, G) O5 Z6 G2 W# z3 A9 O% P - dma_addr_t dmaphysdest2 = 0;1 K3 {6 l; u- {8 c2 P
- % \# R% W9 a, ~9 w1 a
- char *dmabufsrc1 = NULL;( P- m2 Y/ ^# f5 i$ A& d$ v1 d4 S
- char *dmabufsrc2 = NULL;
' o, O6 g i0 @$ O0 @ - char *dmabufdest1 = NULL; H" |0 v# R* W
- char *dmabufdest2 = NULL; `! _( z5 C7 B, l9 U k! n# L
- : A% E0 W7 w% u! m# ^9 `8 v$ o
- static int acnt = 512;
3 g7 Z/ t4 F+ j4 ]/ z3 N7 x - static int bcnt = 8;" p% P/ o) a7 v3 L* T% w
- static int ccnt = 8;" ^7 q' e4 ~3 }7 R. F
2 O2 L% C! C/ Q, F% _/ E- module_param(acnt, int, S_IRUGO);
; }+ G, k! W2 ~: k3 V - module_param(bcnt, int, S_IRUGO);
+ |; ~# {$ v9 V' Y - module_param(ccnt, int, S_IRUGO);
复制代码
5 M( X( @+ n. h; }
( O3 d* _1 o0 W9 R; y) l 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- k1 V+ U( X n8 L
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! n1 ^1 |" }1 n
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 w' X5 E' b& {4 {2 j1 L0 d- h
$ z- g; U( G& ~) {0 M8 M7 K* W. A8 Z
; F4 c( B, K% \, [1 M- F1 { |
|