|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" J) _! z" c/ P% P7 ?- [code]EDMA sample test application! o# B, j" ?' ^
- /*- f2 C$ D7 C9 v6 F9 X: _
- * edma_test.c
# n. ?) x& v: n0 }$ o0 n9 m: [ - *. K* ^6 }3 P7 C# t0 K' c
- * brief EDMA3 Test Application' I5 J1 Q+ J: b* D! l
- *6 O( F% e8 e' L
- * This file contains EDMA3 Test code.
( i3 x2 q: Y9 R+ j- T# ` L - *
! `# R9 z& [' h2 j8 r7 a - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ r8 X* W6 Z8 K1 m. f
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 x* G/ ?5 {9 r
- * TO CHANGE.1 r: H! E/ R* W& w* l& |5 j" N
- * } m. P, x" o& t8 K
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ Y3 D4 e* j+ Y* }) @
- *. n( H. I( k3 o: P
- * This program is free software; you can redistribute it and/or+ |6 b& q3 l3 P. i* [$ ]. U e- V
- * modify it under the terms of the GNU General Public License as x3 R- X$ m. O, C( [" q( w
- * published by the Free Software Foundation version 2.
* r6 A9 F7 K P- N+ Z, \# p - *
! \0 P- x) c5 f; [ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
. z9 @" x3 W* W N Z - * kind, whether express or implied; without even the implied warranty
7 [. V/ u; O% q/ d5 d: q- _' o - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the& J5 _* L) `* s5 V
- * GNU General Public License for more details.3 R2 L' T" E. m* x c- v* X
- */2 k' n x6 i' w
- : k* V" ]- ]0 I L, v. u0 ~
- #include <linux/module.h>
) R6 M1 e% d8 H) X& [1 P+ W* k; }. @% F - #include <linux/init.h>
/ A% C9 h7 S; Q8 e, [8 ^& S+ t - #include <linux/errno.h>7 v7 F' ]% ^ a8 C3 X/ w
- #include <linux/types.h>, H# l1 Y8 [* z9 @5 u
- #include <linux/interrupt.h>
/ N5 h/ K9 B6 N3 }9 G6 A; X V - #include <asm/io.h>
$ x* G& w5 `; o# O5 E - #include <linux/moduleparam.h>
8 J7 ~$ \8 d( y, w+ a) o+ r; N - #include <linux/sysctl.h>
4 z; |& W! w3 m w3 J - #include <linux/mm.h>
7 s4 h) t: i6 ~ - #include <linux/dma-mapping.h>+ \* o6 {, ~( g8 _8 q& q7 @
# W4 E( Y8 S6 Q* k0 e8 U8 M. g- #include <mach/memory.h>
4 z; [ w+ d- q9 U% V* d, ^ - #include <mach/hardware.h>& {+ r2 Q8 W* X. R9 c3 `! ~7 k
- #include <mach/irqs.h> o/ S5 W7 K* O' a7 Q
- #include <asm/hardware/edma.h>8 [! @- h8 k. X8 z9 @
- 6 [, q, [$ U+ W* h$ e) w7 N; R) o7 ^
- #undef EDMA3_DEBUG
. v+ w& V2 Y# f5 m# A9 O0 L - /*#define EDMA3_DEBUG*/
1 \! g) o/ b/ R' D2 O! n+ H5 ?
8 I0 W; J; U1 x% c! H v- #ifdef EDMA3_DEBUG
3 n1 k1 L6 x* `- [9 u - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
, x! t6 _, y1 ^! ] - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). b; z* [$ R8 P9 B
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
6 ^ {- ]% ?) a0 U! d% h - #else
4 @1 K' s( j9 s( n- q - #define DMA_PRINTK( x... )5 A/ D3 c! L% [/ g/ e
- #define DMA_FN_IN4 {1 r% U7 f; a+ i$ Q9 ~4 \
- #define DMA_FN_OUT
) ]0 v* {. J# w - #endif$ F8 l- e9 ?! E; W, _6 s; g% ^0 P" C
9 r9 R1 \7 {6 J" K. y. \& V6 K- #define MAX_DMA_TRANSFER_IN_BYTES (32768)/ V9 d/ Y* w: {, Z% `& @
- #define STATIC_SHIFT 3 Y7 \: s) p# Y3 k/ x; ?
- #define TCINTEN_SHIFT 20
3 F2 ^# i- j+ Y9 Z - #define ITCINTEN_SHIFT 215 `! t: Z" }) J5 M: t0 S3 D7 X7 Y4 a5 c
- #define TCCHEN_SHIFT 22
^+ t% e. A/ O4 z! @- h! O - #define ITCCHEN_SHIFT 23, x% s, v# Y' S; R5 |6 O! n+ e
* d, P% T4 v# g. |1 G; b$ I( j- static volatile int irqraised1 = 0;
+ R0 T+ ^& |: H4 M; O - static volatile int irqraised2 = 0;
# O$ ~5 w" F" l% [" a2 C - ; Y6 R5 M3 b. P
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 I& p& H+ n. q) @+ x
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 ~7 Q& w, J4 Y2 d
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 q% z8 q7 r$ V; j# n9 w. b
- $ t4 ]' A6 n7 g" [, a9 `6 t Y
- dma_addr_t dmaphyssrc1 = 0;
7 k$ g4 t& E6 V, H; x - dma_addr_t dmaphyssrc2 = 0;5 T# c3 q% ?2 |$ ~; W5 C9 k# j
- dma_addr_t dmaphysdest1 = 0;1 _4 w" w" Q( s" }' u
- dma_addr_t dmaphysdest2 = 0;4 t. y) W/ K" X6 y
- 0 p: J5 x' H p5 v. {. Q+ ^
- char *dmabufsrc1 = NULL;
: Y% ?8 ^+ g1 }; T - char *dmabufsrc2 = NULL;
) s4 o+ I% k5 G - char *dmabufdest1 = NULL;4 v: D3 q. K l) | q
- char *dmabufdest2 = NULL;! S: R% u# u: ~1 i9 j- T
- + f; R) g' m8 ~( d7 v f/ q
- static int acnt = 512;
* _% q% q j, |% r. y( D - static int bcnt = 8;
u8 u0 A% O8 Q! t( P: _ - static int ccnt = 8;6 I; O" ^+ r$ t" p$ j
' I2 v6 w/ _! }$ m. D) }; b/ x2 V- module_param(acnt, int, S_IRUGO);0 d& D& J+ K. O* P$ C
- module_param(bcnt, int, S_IRUGO);; B2 U6 @6 @: S: H# o" z. R; N% n
- module_param(ccnt, int, S_IRUGO);
复制代码 9 r @- F2 o; `4 v/ S
$ X# B" P* f0 v$ I+ }2 c
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! d8 R7 J/ c/ I% z* ~. e" v2 Carm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: d3 h5 p& E" S% t
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
N# ^( L* }% R% J0 U2 `7 J% `# j% q7 W8 j; P2 J
6 c0 l( p9 N1 R' } |
|