|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 t' Q7 E# v$ w% x9 `0 k |1 n
- [code]EDMA sample test application0 C7 L8 \2 u l0 O* P
- /*
$ K: L5 t8 E- p1 ^: \! E - * edma_test.c$ \3 B3 h8 l5 t4 q
- *5 j4 Z0 q. V( l3 H3 w2 ?
- * brief EDMA3 Test Application
( l5 @% @3 U+ ]# {$ P, \& L - *0 L+ D' G/ l/ V4 H! e- L/ n
- * This file contains EDMA3 Test code." h# D6 I. N1 g' v. ^7 t
- *
( j/ b: v7 }8 p- B* [ S - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
6 o7 h% D$ y8 K& A+ u. S, b* W - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
+ {9 N" L; ]& l) j, K - * TO CHANGE.
& J6 D: s" P2 D5 u, `/ `% X( l - *
N3 v( c4 y" n1 P3 Y6 S - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ K2 S9 `4 k& \* ~! P% Q
- *
9 A; v& F- e0 f% M6 b; [ - * This program is free software; you can redistribute it and/or
. N+ Z+ ]; x+ l- f+ W }8 L - * modify it under the terms of the GNU General Public License as6 i) ` F8 F" I% \
- * published by the Free Software Foundation version 2.- T. Y9 ]5 p0 x2 h7 l# T* d
- *
( D( u( ` M# ]! Q: k v& } - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
8 h- `, \) I% E - * kind, whether express or implied; without even the implied warranty1 v# C- V2 \9 Z7 Z3 E/ {3 p
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the E6 Z' R% o6 S3 J7 W& b" @! T
- * GNU General Public License for more details.
$ K" U% o/ g3 |& B4 I - *// ]: @/ H4 q8 M) g$ ?2 h8 x
& s% p0 t! [, @/ l- #include <linux/module.h>6 m- a1 u. W; D; h6 C1 ?* D! f
- #include <linux/init.h>
6 L) l7 }; L4 ^1 Q - #include <linux/errno.h>9 r" D: Y% ^, h/ R+ y \
- #include <linux/types.h># [) g5 v- R, v( e1 c; u3 I
- #include <linux/interrupt.h> z8 L+ e: F3 u
- #include <asm/io.h>$ z; I# r' Q' A2 h/ b9 Q, g
- #include <linux/moduleparam.h>
; @% S0 l9 {/ V' E - #include <linux/sysctl.h>
3 ?! N" ]3 b5 V. ~ - #include <linux/mm.h>
- o) k! Y. ^% y) |0 s! q! `& I - #include <linux/dma-mapping.h>( f* |3 E# i$ U, p& T% \( I
$ F5 o4 m% g+ _5 n4 z. w- x6 O( d- #include <mach/memory.h>. F6 S: l0 O x& d2 a
- #include <mach/hardware.h>6 i$ o9 |8 B, `0 j( I
- #include <mach/irqs.h>$ Y; M" v5 e# T
- #include <asm/hardware/edma.h>
' Z6 G( g6 b( g- E2 M* _$ d - , b A# r/ n7 ^ a
- #undef EDMA3_DEBUG
: [) _9 e3 K4 ^, G' h" w+ | - /*#define EDMA3_DEBUG*/
, f6 o9 y! B* f8 ^) h* ? - ( G* }6 D Z7 \: o0 r
- #ifdef EDMA3_DEBUG, ?1 {& [- @! n2 i7 S% a
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 V: s# m" g/ z! P* y& V$ R4 n
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
% m$ Y% t3 u9 w: c' t& }" d) ~ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! U; S c9 S) T3 }! d: B6 I
- #else
. x7 N4 f. T8 I4 X# f - #define DMA_PRINTK( x... )
; J' z( r4 g6 C8 L. L - #define DMA_FN_IN& K6 ]/ F7 Q* d# ^9 s& ?
- #define DMA_FN_OUT2 h/ @4 K0 ]% x' R- P
- #endif6 h1 k$ E5 x4 L8 d4 |( W
3 _% ?- H/ \+ {: k/ e- #define MAX_DMA_TRANSFER_IN_BYTES (32768)! `* E. G7 i4 j
- #define STATIC_SHIFT 3
5 L4 A, ^6 B4 l, @/ F3 Q - #define TCINTEN_SHIFT 20
9 m5 ?/ H+ f, V( m& l# Z N8 L, @7 {# { - #define ITCINTEN_SHIFT 21+ p! _9 j( X7 m% m* ^6 Q
- #define TCCHEN_SHIFT 22 |7 w3 [0 u( e4 T* `- ]* T
- #define ITCCHEN_SHIFT 234 H8 Y, C) M# L* P
- * ]% t* P/ u! x. P" c& ]. z
- static volatile int irqraised1 = 0;0 i& O3 I. Q( ]. y4 |
- static volatile int irqraised2 = 0;
0 Y8 J1 n% f3 X( X" L+ d6 \) V4 u% S - , v& b. i8 h5 m8 c% {+ I
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' y! Z, {' t c4 M, s, T* T - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ R/ Z& u+ S1 A6 n, p( L# i
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 p* V" c8 p& u! t- Y6 o
3 J0 h r, s3 _8 D6 i+ H- dma_addr_t dmaphyssrc1 = 0;+ g/ Q+ `) M+ N F% D
- dma_addr_t dmaphyssrc2 = 0;
* W6 d; a7 l3 |8 L% E7 G - dma_addr_t dmaphysdest1 = 0;0 r$ Z: B: o% _3 L- y
- dma_addr_t dmaphysdest2 = 0;
, V8 X5 [3 z! r/ f5 K
7 _1 e" |9 g& @. r* l4 r2 @) j0 Z/ J- char *dmabufsrc1 = NULL;
R% l* F# t) e7 @: @! a( ~ - char *dmabufsrc2 = NULL;
8 L! }6 Q0 Y0 s; t: y$ H" P1 b - char *dmabufdest1 = NULL;
/ m; Z" ~/ z8 `6 j5 o; Z4 M" P - char *dmabufdest2 = NULL;% e1 u1 [; d) D6 f. Q5 a
( N+ v" l. H2 M/ t7 c1 G- static int acnt = 512;7 h' c) M4 H, a q) I
- static int bcnt = 8;
8 |4 ^ y% C# J, d9 }/ c% w3 M9 f - static int ccnt = 8;
' R- t1 C4 w6 _0 q' c
/ Q( g* u+ V/ ^# I( o7 R- module_param(acnt, int, S_IRUGO);
: b; g, u7 H$ Y B, S0 C - module_param(bcnt, int, S_IRUGO);
& S4 A! i5 V; L$ N - module_param(ccnt, int, S_IRUGO);
复制代码
! A3 G# i% N- w1 E, j$ |+ o( e+ ]+ x# a/ Y0 j& @
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' M4 n# j! ~ v4 x2 P) v
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 x1 ]# D3 _
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ B; o, j0 ]8 m% M# D
; |" u" G" e3 G0 d; A6 n3 J& N" H& j' F0 d
|
|