|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % k5 P1 h& r! e' M( @9 ~
- [code]EDMA sample test application2 q9 M" ?! M, U* {* K) I' W
- /*$ A% L* G2 N+ l# ^2 j/ Y5 @+ ^* n
- * edma_test.c! T7 Z9 }. W' b9 @8 ?+ u0 a
- *" s) Y9 p; ^1 q) G. r9 x/ i" ?3 m) e; q
- * brief EDMA3 Test Application
7 F8 k5 u! m( G( L - *; o+ H7 M2 o5 d3 M+ H' Y8 z3 N
- * This file contains EDMA3 Test code.
9 g% a# V. W& m2 l# d, l* M - *; [: D( c0 X$ b4 {! q) V9 }: T
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
* [6 I# H' F3 }1 r0 P( z - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 C @) Q% V; o
- * TO CHANGE.! c; e$ _% Y& y) U& ]5 v# o. y
- *, r+ v W" j9 p! {: m
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
+ {' s: M( Y: Y2 T6 V; X b. A - *
8 H* B5 h. O) a+ m+ I5 Z( ~, X - * This program is free software; you can redistribute it and/or# g- n+ z/ @' S6 Y" f
- * modify it under the terms of the GNU General Public License as
2 h9 L r5 I# a9 ]1 J& F8 h% m Z - * published by the Free Software Foundation version 2./ J) r0 p' N# ]; G A# j9 D, \7 O3 v8 o
- *# i" D* S' E6 d( c, S
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
( m+ B' P" P& M, [8 _( b - * kind, whether express or implied; without even the implied warranty
, _7 h) ^/ _9 B% P/ Q3 A - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1 `! M- x: g" T- h# u6 W% H9 W
- * GNU General Public License for more details.
# w% C; N, m1 S2 R. y8 X0 D - */& i2 B" `- C- H' W1 s" T2 G
& P1 x. d; ^, K0 ^- #include <linux/module.h>
) v b6 b8 ]: V$ Q1 d4 ~/ F& E% @ - #include <linux/init.h>) j' T+ g- y# b" Y
- #include <linux/errno.h>
W" O& F A% {( a - #include <linux/types.h>1 J9 G m' o4 H0 n
- #include <linux/interrupt.h>
4 Z) l# v; `7 G4 A - #include <asm/io.h>7 ?, S# E0 A }# y! L
- #include <linux/moduleparam.h>
. F! s! A9 Z n - #include <linux/sysctl.h>. y: q4 o: b4 r3 S8 r8 S; e {9 j, l
- #include <linux/mm.h>2 I9 a3 o9 v# R7 g9 v+ \/ D
- #include <linux/dma-mapping.h>
4 N; t* ?- s2 w: y
t' N) [) i" a# C- #include <mach/memory.h>$ s5 g4 }$ f, `3 P5 S3 N# u
- #include <mach/hardware.h>1 E; m+ M- {3 c9 @1 R3 x% _
- #include <mach/irqs.h>
9 L# Y; ]! I( u" {0 D" W# ? - #include <asm/hardware/edma.h>$ F+ N3 f7 X Q9 K* `* H' B
- 4 R# d) `- C+ N) t! I7 W" D7 c
- #undef EDMA3_DEBUG
7 V, Z& J& s! i- M - /*#define EDMA3_DEBUG*/
. E i; z4 C' ]$ Q) t7 M! h7 e
, O6 {+ Q8 }3 `( h/ z4 A5 P) P- #ifdef EDMA3_DEBUG
5 h- F8 i$ z$ O2 w3 v/ n% j, } - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 l! |, N7 g, ~9 j) B
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ F5 l5 Y/ a; U7 e3 O
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
; B: @4 j+ d; [9 Q/ r5 N1 G - #else+ Z0 l5 v5 m# X: H$ P
- #define DMA_PRINTK( x... )
1 B8 |" ~* j. J' }+ A - #define DMA_FN_IN- r( V4 {0 K2 ~ s3 m( `2 r) X
- #define DMA_FN_OUT+ K: L) R: O+ D3 ^2 ~# w3 B
- #endif3 g6 C8 @7 k/ b7 T, K6 M
; ~+ K1 D; H) \# s- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
y# r9 X: t3 x! I O) E - #define STATIC_SHIFT 3
I& r! e( [! ^ - #define TCINTEN_SHIFT 20
3 w4 U- `3 E% C( c - #define ITCINTEN_SHIFT 21
% w( l0 Z3 ^- H- \" j4 w: L - #define TCCHEN_SHIFT 223 Y. Q! Y! J; K* U0 D
- #define ITCCHEN_SHIFT 23
( c2 H+ ~8 i* |6 D
" t' O2 x7 U; E6 X+ d0 B3 `1 e: U- static volatile int irqraised1 = 0;
9 H+ v7 p/ ]/ n: ?7 L - static volatile int irqraised2 = 0;
: H7 H: R# O8 q* Y& k - 1 q; z5 L/ F* ]3 P& Z3 i
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% }! Z% b! U8 s3 v4 J - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 G9 ]* O) I2 t1 I6 Y
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 e* V- |$ f6 w- s+ U( K
- m' j6 s& n. B* d$ S8 V- dma_addr_t dmaphyssrc1 = 0;/ a8 t& A: V2 |, g7 v) \
- dma_addr_t dmaphyssrc2 = 0;
* N" j1 ~+ Z; b; h - dma_addr_t dmaphysdest1 = 0;
" s' P/ Q3 U9 Z: u" Z - dma_addr_t dmaphysdest2 = 0;/ n) l/ C V, T5 g* J. S
2 k2 q: f# R2 L: N- char *dmabufsrc1 = NULL;
# F' s6 g, ~# o5 V' C - char *dmabufsrc2 = NULL;
- F5 t% s; y) y; h5 C( ^7 _- O* i& X - char *dmabufdest1 = NULL;6 r. o" I$ K( ]! b
- char *dmabufdest2 = NULL;
% {0 L( n/ Y' D( r: C$ p' ~
- b$ ?5 n- b- k% M- static int acnt = 512;
' H w7 O' A+ f3 ~ - static int bcnt = 8;0 C9 `# O5 X& G8 h( L) W% n( Z
- static int ccnt = 8;" ]" J' y' W/ h3 _3 [
- ; ]0 N; |4 _+ B
- module_param(acnt, int, S_IRUGO);) t [- l, G0 {
- module_param(bcnt, int, S_IRUGO);# v3 N; Z1 |8 `/ V/ }6 m) ?
- module_param(ccnt, int, S_IRUGO);
复制代码 4 Y" L) W6 @) l0 Z, g
( h* P& J& I$ h- Q3 e7 w8 X 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ y: o" D/ q0 H6 s' y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 k7 t/ U% {* [- C 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' G! V* s+ X; r5 q
. |0 [# I7 B' l2 U7 C) |7 K4 `" i1 ?6 d& t* V
|
|