|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 ]" a E1 x, D/ G
- [code]EDMA sample test application6 I4 |; ~& P# k) j+ n) Z' l" n
- /*
( ]2 g( ]. t/ f& E - * edma_test.c
( }, E E* y% b; j) H2 ?: b - *8 e- V7 A6 i: A, j
- * brief EDMA3 Test Application
# @ `& P5 O3 o1 y) q - *' J8 h1 Q- s j7 f- j: ]
- * This file contains EDMA3 Test code.
. y- e( p$ l0 K- v- t3 a - *
2 W! Q5 F- |' }7 b1 z - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 j# P( @) W+ I/ D- |
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! b3 i3 ?) l& c8 h
- * TO CHANGE.
7 W/ V5 ]: I2 \( z9 R, k( u3 P7 a - *
0 _0 j( P+ G- L, ?$ }, E1 | - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 X8 `; S, K m2 m+ v. \
- *" P1 v! v% Q- g3 V) u, ?
- * This program is free software; you can redistribute it and/or
O; s. M7 o8 p2 | - * modify it under the terms of the GNU General Public License as
1 N( j* z* ?7 P- Y7 G+ a) `' ^- w - * published by the Free Software Foundation version 2.
- f1 D- h1 S. m6 e- ?' S& A! H, U0 { - *
' e$ l% J) J2 P! U; H! g! J - * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 h1 O+ @/ O: M0 N/ N4 j
- * kind, whether express or implied; without even the implied warranty
) S0 ] v# _/ i$ Z - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2 P% j- h" R8 [$ C - * GNU General Public License for more details.
+ }6 [5 z6 a3 V3 }0 }1 k - */
) C C$ @2 b5 w
" t( y7 Y. A7 s; g g3 u: p% @- L- #include <linux/module.h>
4 N) g7 T& f3 }& C. @5 @% X5 | - #include <linux/init.h>
K6 r) |. C3 i9 ]8 n# _; x - #include <linux/errno.h>. f/ u2 s# J2 j! \) V
- #include <linux/types.h>
W' F' U/ ^: ?: ^$ m3 A$ _ - #include <linux/interrupt.h>0 L8 R" K9 q' x' q
- #include <asm/io.h> c1 a$ n& m$ j3 i* \8 ?
- #include <linux/moduleparam.h>
* J# _: [, V' A* U2 N - #include <linux/sysctl.h># S4 g+ u* @0 _
- #include <linux/mm.h>* K1 ?) u' v. O, d7 b
- #include <linux/dma-mapping.h>( `* j4 N( o ]
- # y9 ^ a; W( L3 t& G
- #include <mach/memory.h>! _/ @' T z$ [ J N' @4 D- A
- #include <mach/hardware.h>" B, t$ {2 C! B' Y" L6 _
- #include <mach/irqs.h>
' E" M5 @+ d1 B# ^ - #include <asm/hardware/edma.h># l/ z# J( u4 I. I$ w( U2 L( Q
- 9 o3 C, g* j0 R: U9 m+ S, H
- #undef EDMA3_DEBUG. O3 |$ Y# ]& P# D% \( E
- /*#define EDMA3_DEBUG*/; b; v7 I; M8 I! m6 s0 k
* ^6 s- t6 {. j2 l v4 p* A- #ifdef EDMA3_DEBUG3 [8 H2 R# {# J
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS) I; F; w0 h, K( a$ l- h
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' E' f3 B5 L6 s7 J7 b# C, Y4 n2 f- w
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
8 u+ m8 S7 u9 b% p2 @0 ?7 m% V1 |$ L - #else
. y5 y( ~6 d- r$ _/ D: l - #define DMA_PRINTK( x... )
7 ]% m2 w0 t* |: K( T. h - #define DMA_FN_IN6 A5 v( [; m: r! p- Q" L4 A
- #define DMA_FN_OUT. q8 v. ]; w6 g
- #endif
2 Z# _+ a- N _& ^
# x' Q* |" s: \ S+ X+ x- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
5 k G* N- u: Z( X, X# f0 f - #define STATIC_SHIFT 3
$ |$ R$ A4 {4 I( U: h, M' y - #define TCINTEN_SHIFT 208 ^/ C) c t' g! \' ]( K
- #define ITCINTEN_SHIFT 215 M' ~! C# h+ ~6 U- f' o( D
- #define TCCHEN_SHIFT 227 j* O+ r$ \* e L, x; H
- #define ITCCHEN_SHIFT 23- d' R& n% E$ s2 ]9 w0 `
- 4 {) o( h) x ~8 r- k6 K7 N
- static volatile int irqraised1 = 0;6 i+ [- p" E1 X; `
- static volatile int irqraised2 = 0;
& Z+ c; {, C% n4 O - ; Y/ d/ y8 G3 r1 n
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 u! Z/ D/ l0 n$ }( z; i4 ^
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% u6 Z1 v$ ?9 q! M" j; j
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' `: Q1 d8 E: f3 b. v4 C+ ^7 i% I - ; {' v. S6 E' _! a
- dma_addr_t dmaphyssrc1 = 0;" O! m8 [) J8 u4 |5 M
- dma_addr_t dmaphyssrc2 = 0;
' r0 h$ j0 M: e* Z/ F" J1 A - dma_addr_t dmaphysdest1 = 0;' k4 P. L* q' V. s
- dma_addr_t dmaphysdest2 = 0;8 m1 O& C& n. I* Y, `, K. |5 G. f
- ' O3 N; c! {% p! G C5 Z: ?
- char *dmabufsrc1 = NULL;
% G4 |) b+ F/ I* N- X - char *dmabufsrc2 = NULL;. ~4 [# k* F. n
- char *dmabufdest1 = NULL;, b9 p8 n% R& o8 _7 e5 ]
- char *dmabufdest2 = NULL;; M' q7 Y. i0 l. Z5 n, h
- " n6 P0 ?2 ?/ Z7 W+ x" Y
- static int acnt = 512;4 z7 ^; g* o: z; n5 _" g
- static int bcnt = 8;
& e* h! j; X) K5 E- W% ` - static int ccnt = 8;
3 h$ G ]2 o8 Y! p9 Y& M/ F% m
8 \3 @ z4 D' k* i1 V& `. ^7 Y- module_param(acnt, int, S_IRUGO);
1 p/ X- v g+ P t - module_param(bcnt, int, S_IRUGO);7 `7 y3 f# L5 |7 z# |
- module_param(ccnt, int, S_IRUGO);
复制代码 8 L5 A$ ~7 c6 ^) l' h: [/ _
9 \- `5 y+ x' H3 E8 a 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 `1 t1 v! X3 j# 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% q& w* q7 {0 h: E 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ d; y/ g0 \+ V, M* }, ?
y; V# [: b, h; Q; R4 |$ H) L) Y, {- W; c: x9 P/ G# A
|
|