|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( P4 X' B6 a0 O8 c9 N- [code]EDMA sample test application5 B% K( Z0 {5 R% i. n6 V
- /*
* r, q! C, o( t. H# f* `- s& Z5 B - * edma_test.c
5 f% w- p6 |. u; y* \1 l& Y* z1 T3 P - *2 D+ s5 Y# M* y- G) [6 l
- * brief EDMA3 Test Application. V5 y/ l; `3 ^* H! b
- *1 c8 _" s. `7 U! Q
- * This file contains EDMA3 Test code.' m4 y* m* j# ^' z; A2 i
- *: d# B+ W( A2 ` m' [
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
; X# e8 [) G j# H7 m6 F s* a - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 H5 \7 a5 |' S/ \8 t/ r/ n' g9 t- \& O
- * TO CHANGE./ D( ?* l" d% ?2 ^( O: U' K. X
- *! d% z( |* p0 ~7 Y. {0 _
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- \2 ]/ f% J0 G2 M8 x
- *
) I' N. h6 F! _* x% o" a/ T7 F - * This program is free software; you can redistribute it and/or
) F, w& B3 {5 z2 m3 m, B - * modify it under the terms of the GNU General Public License as4 U1 g1 R1 N1 E/ Y _3 z: L& y( k3 ^
- * published by the Free Software Foundation version 2.( Q" l, i. t4 `5 E, A* i
- *
, U+ o* K8 k" B3 { - * This program is distributed "as is" WITHOUT ANY WARRANTY of any: H$ j# o7 K Z7 T8 p
- * kind, whether express or implied; without even the implied warranty- f' c8 ^5 g4 g/ G1 I
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1 L# R/ {- i3 ^7 Q - * GNU General Public License for more details.1 O6 d" W9 J$ ^6 g, f5 i6 K3 b2 O0 y6 S
- */7 r$ U% Z7 B1 k. ?2 {. X `! N- P
- 2 D0 @* X! F, y" C3 t& I
- #include <linux/module.h>
: l8 P x3 {) o" C* O8 N8 p; q - #include <linux/init.h>
4 F0 m4 |9 p: T0 E - #include <linux/errno.h>
0 Q% K* ]2 E- X: S; J& L6 _ - #include <linux/types.h>
: t( E) B" r5 u8 Q - #include <linux/interrupt.h>
$ M) ]6 Q0 K: o/ I% C1 F0 B; R. m - #include <asm/io.h>
! x) H* C( D' E7 i h - #include <linux/moduleparam.h>
) n- e ~. V/ q: r - #include <linux/sysctl.h>) E5 _7 k: T4 _. J# N* \
- #include <linux/mm.h>
J3 N, m" P2 r h2 k% F$ P, |" ` - #include <linux/dma-mapping.h>
, ?- r: `- K* x$ j0 Z
b4 x4 f5 i" b: b' m2 m- #include <mach/memory.h>( `1 A( z5 G0 K. T: X& y
- #include <mach/hardware.h>
8 y$ y/ W& Q; n, A3 } - #include <mach/irqs.h>) n& C% A+ m# i1 x* \
- #include <asm/hardware/edma.h>
' W, N+ A U. X* t( M - 2 ~: y( R$ C, {+ s( l
- #undef EDMA3_DEBUG
$ N. K" x* H3 t( C- s) J - /*#define EDMA3_DEBUG*/
w5 V& s5 g0 ~1 ^( a
! P6 ^: d/ w% `" X- #ifdef EDMA3_DEBUG8 h( {5 O8 s- A, o( B2 b6 q( Q9 G
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 K4 f; y" D( d, D& d) `
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
, u1 {; d' H( M - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ X0 s. b+ C1 z; b
- #else
' k: Z/ |+ @9 k# y# W9 I - #define DMA_PRINTK( x... )5 C% C, a8 A# ^" r' n8 }' P
- #define DMA_FN_IN6 A# z- J$ p! R
- #define DMA_FN_OUT, _) J, P, Z: }' `8 E; t
- #endif
3 F8 L" F: Y0 z1 m - 4 O& _ d" V' J7 d" e; f M: Q
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
0 `3 T" m& z! E - #define STATIC_SHIFT 3
' ]: j& y7 {" ^! Y9 R - #define TCINTEN_SHIFT 20
8 |" _0 f+ I+ ?0 l5 [# e - #define ITCINTEN_SHIFT 21) ]& U) A2 V. P& T5 m: }
- #define TCCHEN_SHIFT 22! h% }8 U. K- m
- #define ITCCHEN_SHIFT 233 x" F( S( g2 Q/ u+ E4 E5 h
9 A" c9 x y, L. Q/ E3 r# v$ }- static volatile int irqraised1 = 0;3 \5 h+ N5 Z0 T6 ]9 x8 h* M
- static volatile int irqraised2 = 0;) ]3 N& m8 v9 [' G
- - f& n5 @, Q/ \, A A+ e
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" J# u0 v* ?+ f& C: T* L
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ n V; z7 }" o9 ~8 F" o
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); c6 c$ G& L* N3 K- l
) f5 W: i! ^" Z7 t- dma_addr_t dmaphyssrc1 = 0;
; Q. i; e F9 Y$ b/ y - dma_addr_t dmaphyssrc2 = 0;8 y) E2 c# v% z( E& U1 o$ `
- dma_addr_t dmaphysdest1 = 0;
, L6 z$ f6 f8 ^2 Z - dma_addr_t dmaphysdest2 = 0;8 ` f6 K8 D0 D! c% d5 u
% v; |3 x7 `3 u' |- char *dmabufsrc1 = NULL;
. H: U: ?- _. Q/ G& Z/ y* Y - char *dmabufsrc2 = NULL;" R% v! x7 Z5 y( y2 m1 b$ U
- char *dmabufdest1 = NULL;
7 [0 Y- [* V/ g' P/ u& Y - char *dmabufdest2 = NULL;+ `- \: E t _5 ^( f( R2 u
- 1 j/ ?! H8 @/ s, \0 [& E
- static int acnt = 512;
, C1 a) L5 i; q( J) b/ C - static int bcnt = 8;2 c5 V) `+ ?+ ~- w) r
- static int ccnt = 8;6 E4 m4 F& X1 r
2 F+ J/ @2 H6 y' n- module_param(acnt, int, S_IRUGO);
: x& q; m" ]/ d( D8 k' { - module_param(bcnt, int, S_IRUGO);' i* X' l* a* C8 U8 _. H
- module_param(ccnt, int, S_IRUGO);
复制代码
& M- M! r6 Y) A3 B5 N& F: T3 d) s" g. n' t. A: l" s9 ]
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 t$ k* H9 U' |) l: Q) {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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; h' X: t. S* T/ e
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) h& Y) Q& F% _" R& r. l
* O9 r, _1 z) m: t: m
: N- T9 m; Z% G5 {+ o, z- A2 n |
|