|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( V! K; @) E( t0 [2 Z- [code]EDMA sample test application
- p. S$ j& l# ^8 L3 i4 Y6 U- r - /*
: t3 U3 ~. y' Y% b# h9 F, Y - * edma_test.c
& [) t" |1 M( z6 m, P: C+ H( \ - *. u; k# ]! b# \. S2 }! v
- * brief EDMA3 Test Application/ }& \% Y' m: \" T% [1 s
- *- F( e9 M( C% s8 u- y5 a* D, P% x% n
- * This file contains EDMA3 Test code.
1 v! u% X2 J3 s, {3 Z - *
2 `) `' o8 P- R7 }' Y! D - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; s+ R& z6 A9 z5 c
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
8 ~. q L' N1 h8 w+ T A8 E8 B4 R* @ - * TO CHANGE.
' P4 ~1 u9 O4 B. ? M, O0 p - *& D9 w- O) ]2 N0 C7 k
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
4 t7 n {; Q8 S, s5 N - *4 y: [" [& {5 O0 D! _
- * This program is free software; you can redistribute it and/or
4 D( e/ E! `. @3 l1 { - * modify it under the terms of the GNU General Public License as# l: T* _ h {4 B7 J! O, e: d; }
- * published by the Free Software Foundation version 2." {& E3 r( y% ~! h/ ]
- */ a! D+ l! Z; Z$ ~* c
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
3 _" C( r: \1 c( m" w% P5 _5 M - * kind, whether express or implied; without even the implied warranty0 `% j! n! M6 N/ }7 J2 ` ~
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3 v1 j- d2 q; u) N - * GNU General Public License for more details.0 |- ~$ i# {/ e2 p1 K! s1 l
- */
* N$ e) R( J* k - ' ?1 V2 B0 P0 N; h7 C
- #include <linux/module.h>
! |4 k j8 o M& {% ^. [- m: y - #include <linux/init.h>- V1 g/ N- S9 X+ A$ e
- #include <linux/errno.h>3 @) F8 x6 G% r4 M; g
- #include <linux/types.h>; E+ t, Q, f1 V$ _" U
- #include <linux/interrupt.h>
/ {# y2 y8 z( U$ K - #include <asm/io.h>$ v L9 m9 l" c
- #include <linux/moduleparam.h>
5 A1 p! g6 b. k" e; U - #include <linux/sysctl.h>
# N- A+ u+ i) L# j - #include <linux/mm.h>
* \$ \% D, @$ v. Q3 d - #include <linux/dma-mapping.h>
$ z+ y- m5 ^0 n
7 L8 L+ I; z( _+ p- #include <mach/memory.h>
; x. ]# U3 b) p t( ^ - #include <mach/hardware.h>/ m5 a( E7 G$ g0 A9 p9 y/ u
- #include <mach/irqs.h>
0 P7 S/ [+ o8 P* z - #include <asm/hardware/edma.h>. ?4 U0 D5 t# T, w* i7 i# I8 W2 D
- ( W' v' @, b6 L' m: _! S
- #undef EDMA3_DEBUG0 \6 y7 W. G* R8 V) F
- /*#define EDMA3_DEBUG*/
1 }" x* o' m" O - 6 v" r* g9 X3 x$ C; S) g* k) ?6 i
- #ifdef EDMA3_DEBUG+ I' ?* \1 p! Q" n' Z( i
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
6 R4 ~( C: `( d2 f; y) i- \# l9 ]$ f3 _) M - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). Z* ^' J) ]% L/ D) x/ M( Y
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
. A U2 V7 x" u& |- o! ` - #else2 a' g$ L0 F; l8 _; }( g$ z0 O ?
- #define DMA_PRINTK( x... )
/ z0 b$ P$ W$ E5 ^ G' t% R - #define DMA_FN_IN: V- F5 a' }9 Q% O- @9 [) `# s0 ^
- #define DMA_FN_OUT; F. \5 k; t( n1 T
- #endif
* k) U7 W8 ], q9 _' r - 5 C* M1 u6 ?; |: a
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)0 z1 t+ E5 Z2 p
- #define STATIC_SHIFT 3
2 q) A4 _: g. \4 I - #define TCINTEN_SHIFT 204 f5 H3 c: Y8 f& a
- #define ITCINTEN_SHIFT 21
3 Q' B3 L; b+ V5 `, F J - #define TCCHEN_SHIFT 221 i* e, ~% j L6 O) E
- #define ITCCHEN_SHIFT 23/ ^& e6 R( w! U
- ( Q5 X, @! ]! M; @7 M
- static volatile int irqraised1 = 0;
% B9 W8 d& ?6 t" C - static volatile int irqraised2 = 0;) S' o/ W7 H' |) X- L
4 ^$ R) N* V$ s5 }- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- f! s) k/ c: k; y2 p( U. H: D: Y - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 O5 Q2 G3 ^3 G3 y3 H4 A$ V - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( r: Z _3 N N, I' m5 v4 C
- 0 x( k/ M2 O" W9 B/ W
- dma_addr_t dmaphyssrc1 = 0;/ @3 P" w2 t4 |2 i U
- dma_addr_t dmaphyssrc2 = 0;+ i( `/ H+ O: K$ u2 S- I
- dma_addr_t dmaphysdest1 = 0;1 N# x6 @3 i0 U$ c9 r2 x. w% u* F
- dma_addr_t dmaphysdest2 = 0;% N, i( I/ k6 U! b8 X% m
3 }, h' X4 R3 _- char *dmabufsrc1 = NULL;' x9 q0 B0 U6 ^, P. I
- char *dmabufsrc2 = NULL;
" _" b) q4 C% W4 D( q1 ? - char *dmabufdest1 = NULL;
P" T$ x0 n% M - char *dmabufdest2 = NULL;+ S, I' `% }: J% J
& l2 u# W+ t: m9 R0 K. Q- static int acnt = 512;7 J/ J0 E) Q5 h& F( S9 A4 i& a* O
- static int bcnt = 8;6 ?& B* O$ B4 t9 }) X6 D/ v6 Z: L
- static int ccnt = 8;
2 p! s5 h9 W! m0 O: \ - 8 q5 |7 ^- _0 C$ k0 G
- module_param(acnt, int, S_IRUGO);
. {' f; E/ [0 H: q/ i - module_param(bcnt, int, S_IRUGO);3 ]5 `( f) p$ N" [. }; H
- module_param(ccnt, int, S_IRUGO);
复制代码
7 ]" m# f l; x; T6 ?5 S% V0 A
' n% A9 j" m r2 a' V. f 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 d+ S6 b5 r3 M) q# U3 m* Zarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( h6 u# R3 s7 M: P5 f3 ]6 H0 `
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# _1 r8 S9 M. M" t9 \
! w6 i J/ T1 h) I" i/ M
' K L, W1 N# n$ Z% ]
|
|