|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
y9 U2 F$ j% K% j5 x- [code]EDMA sample test application% W2 L- u+ u* u2 X: V& R. K
- /*" }5 i9 }# v, D
- * edma_test.c0 X% B# v) X2 A0 A7 Q4 }
- *
# f. \& c; m b" Y: w - * brief EDMA3 Test Application" ?: W# h6 F9 v. `. {! e
- *
* }" ]1 S0 q$ y* T: D - * This file contains EDMA3 Test code.) l# O" w- `0 N3 [/ Z% p g
- *
$ ]2 @6 C2 \/ [0 L; i# o - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: M1 {3 J) l: W$ s3 g5 A
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
! B+ w/ r1 ^$ _, ~9 {- \ - * TO CHANGE.
) e/ g: d! N r( [6 K - *
, K9 b/ X+ B# N4 H3 e# t - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
5 Y/ `- S4 Y$ v- ^% C' ] - *: ]/ O# B( _9 N/ N# D
- * This program is free software; you can redistribute it and/or, B' t! S7 \" P. K
- * modify it under the terms of the GNU General Public License as
/ y: r m! i: f4 D1 J) ~ - * published by the Free Software Foundation version 2.1 v0 F& t, C8 D# F; n/ T
- *
$ `% k# |4 ]( h2 a - * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 c! @" x: e! p0 t
- * kind, whether express or implied; without even the implied warranty5 z0 _" x6 z! h0 `7 S
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the$ o9 _: j4 R! C y( _! ~
- * GNU General Public License for more details.
1 W* A3 A2 {; _( C; S9 _/ n, e - */
2 k( ~( R- E: O& i$ p* W" ? - 1 |* @" H, @3 e4 @- F+ _, r
- #include <linux/module.h> v* X+ V* m$ W1 l, f2 s
- #include <linux/init.h>
: a) N; h4 |# a8 h2 g$ G - #include <linux/errno.h>
' [) g4 N, m, w7 H3 p7 W+ r& Z - #include <linux/types.h>5 N" O+ U7 S8 @
- #include <linux/interrupt.h>! ?# ]3 H, K o4 w% @4 \
- #include <asm/io.h>- V) _' B ^; h
- #include <linux/moduleparam.h>2 }7 }4 B9 d. K0 i7 ~+ ~
- #include <linux/sysctl.h>7 p9 d, f) d* h6 Z1 i0 n
- #include <linux/mm.h>- o# p: `& A, e0 O# q
- #include <linux/dma-mapping.h>
8 {( x( l4 R. Q5 K% u - 8 N, ~8 G. J- p6 P
- #include <mach/memory.h>8 w) l1 ^- n0 K o
- #include <mach/hardware.h>
2 i+ R# J& u d+ h0 \4 a - #include <mach/irqs.h>' s# v. }9 \( l, Z9 o* }. S
- #include <asm/hardware/edma.h>
1 B5 }1 F% F* V2 l" ^; U: E
* @* E* b. o2 `2 Y% _/ h- E# V7 J- #undef EDMA3_DEBUG7 x) [0 X+ d1 S! g
- /*#define EDMA3_DEBUG*/7 ]) }2 ~( k0 L. w: |# `: D5 N
- 5 s! H% N2 y# v% e" o
- #ifdef EDMA3_DEBUG
9 G' [" @" C4 q4 C0 X+ N - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
) S: M8 i- R) c - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( y& ~! @2 R6 W1 h! [' r7 i
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- I% G1 y9 S4 @
- #else
, m% X* A/ X6 q& O- O/ @ - #define DMA_PRINTK( x... )- i% {: g# S. Z+ H3 d' P
- #define DMA_FN_IN1 k) C- \* x4 z; y7 n/ o4 B" I
- #define DMA_FN_OUT2 i$ w& U% q* `- ?- `, G; s6 m
- #endif
4 b8 m1 t) X8 J, L0 Z6 E - $ l2 F2 j5 j# O& j/ ^6 }5 R3 P, [
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
+ L$ x5 m3 E) _. M0 X - #define STATIC_SHIFT 3% R5 W' c1 F) S5 h7 T' @
- #define TCINTEN_SHIFT 20" }4 y! ~; w, ]. D* x$ |
- #define ITCINTEN_SHIFT 21" |# i" V9 Y* a, s
- #define TCCHEN_SHIFT 22/ V( q# {6 {8 ^% b& Q
- #define ITCCHEN_SHIFT 23
. x; u8 P6 v3 \) q
" B8 ^7 n: E$ x% M4 I6 [- static volatile int irqraised1 = 0;% Q, i, k' G3 C: @; c2 L
- static volatile int irqraised2 = 0;
9 O3 V2 ~/ i, c7 V- C - 0 J+ R, y0 b% C! l* a* ^+ ^) ~
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( m5 R+ {2 y* _! O6 Y1 L* s" f - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" U! E- \' ~: E* w( `* G - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ q5 x5 r2 A( \& V8 d3 }* P
5 ?8 ~( p7 D9 \2 b8 ~- dma_addr_t dmaphyssrc1 = 0;
) J* Y5 S9 A5 Z( B% m) a - dma_addr_t dmaphyssrc2 = 0;
7 p) F6 d J; d5 O$ T5 L! e' u, I - dma_addr_t dmaphysdest1 = 0;
8 w, E! Z( c0 z5 t' n% [5 T - dma_addr_t dmaphysdest2 = 0;
4 S) y& W: j: O6 ^
4 h5 t. F. C; f, K/ V- char *dmabufsrc1 = NULL;
" Q1 c0 w5 p* j" u5 J/ |/ K% m - char *dmabufsrc2 = NULL;
+ }% v# O, a2 b - char *dmabufdest1 = NULL;
+ C S2 _' [' n: q! [4 V/ q - char *dmabufdest2 = NULL;$ Q* T% B _/ V2 @9 u
- : m0 r) J( e' e- E7 e% P2 q
- static int acnt = 512;7 E* ]3 L) D3 w. p5 s2 O- R
- static int bcnt = 8;
7 b+ U# S; P4 F2 i - static int ccnt = 8;
) _3 L }3 x2 M8 v* r; A7 i4 \1 B* ~ - 3 Z9 R2 B' A9 X7 n
- module_param(acnt, int, S_IRUGO);
9 ?( ~* b, v- s# G - module_param(bcnt, int, S_IRUGO);8 x$ d, q3 q3 M" `; F! j; R
- module_param(ccnt, int, S_IRUGO);
复制代码
3 Z% x0 j* U4 J! j+ ~) b% o
' f& ^3 ?+ ?/ ?1 j1 {* _+ @& q 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, X- v- W: v4 e# o4 A( ^
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: W% W% n3 y. a7 P 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% {- q3 v' u6 k9 Q8 M6 V9 a$ b3 ^; f! i( L, |* G
7 I1 o$ Z5 Q7 w# Z! O0 J3 L" M
|
|