|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 S: s" m# I: ~6 {+ G- [code]EDMA sample test application5 Z9 Z+ b8 N1 f2 S8 C I
- /*
# v( ^) E) Q2 ?; f0 f3 E, O6 [ F - * edma_test.c8 m# ~. P3 M& g9 o
- *5 l2 @- B" z. v# }5 A& r# Q
- * brief EDMA3 Test Application9 ~, B; U# p( y2 B- F5 A' ~
- *$ S6 `1 Q$ j. Z" H3 O
- * This file contains EDMA3 Test code.! f7 ?/ J3 i [+ q
- *
& Y: D) T. ~7 k3 r - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, j, A: H, G2 R1 G0 A
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% D7 M7 w/ w3 d6 c; y/ f8 W
- * TO CHANGE.
/ |/ t( E2 F9 h7 F* q* N# R3 D - *$ A; [; R* i% _( c6 p1 B, `
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
$ r0 C' Z! Q* H/ H - *
+ c" f; f& D: ^) r! P( x) T - * This program is free software; you can redistribute it and/or
0 F$ p |0 C' p5 M7 h0 e: _+ j - * modify it under the terms of the GNU General Public License as
: }0 z& H) a$ ]0 ?8 q - * published by the Free Software Foundation version 2.) e% W" \. q3 l
- *+ P" S M2 Q8 {, A$ _
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 f& E% w- a& d
- * kind, whether express or implied; without even the implied warranty
5 l! m! f0 j# T/ C1 i - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! u% c9 L/ u2 E& c3 R# P - * GNU General Public License for more details.* V7 `0 h* ^/ U- w1 K
- */
2 {& I9 W, _; {1 F- f: k
8 T m' ~8 E" G7 q2 B: y5 Z- #include <linux/module.h>, n Q4 i) @ e/ S1 V
- #include <linux/init.h>
* A% {) C& {" G! v2 J; k0 E1 J0 X8 p - #include <linux/errno.h>* }/ ^9 \, ]! B# r
- #include <linux/types.h>$ Q/ B( j7 e" Y+ x0 `
- #include <linux/interrupt.h>, `" X! k' `+ B: {/ {7 g9 |
- #include <asm/io.h>
' Z/ U: e1 ]" t: w! T$ [ - #include <linux/moduleparam.h>% A* l1 O7 o% [- u5 ^% d
- #include <linux/sysctl.h>! r4 {/ g/ D2 f$ ?+ r0 L2 X
- #include <linux/mm.h>
: P% M* W6 m4 f; y& J - #include <linux/dma-mapping.h>; C" M: M$ E' l' t8 l0 D
7 O- M% n1 B8 D" z3 R% ~- #include <mach/memory.h>1 ]$ [% x A. Z8 o0 {) N
- #include <mach/hardware.h>' P4 |5 `5 ^( J* ?" _
- #include <mach/irqs.h>6 _! q$ C6 P2 \: k
- #include <asm/hardware/edma.h>
) v% p' M/ i A4 F5 p2 }' X& K - 8 T6 ~$ [- y) H: r& w; E
- #undef EDMA3_DEBUG
8 d, P' R1 ?* Z - /*#define EDMA3_DEBUG*/
, K' j0 F1 A. M* V! M6 x- Z$ n$ w
+ L& S1 L0 I' m, [8 u8 |- #ifdef EDMA3_DEBUG: V4 c' a2 Y( q
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
( D# B5 D6 F) o. Q' v9 p - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): B8 y' V& Y" s0 p
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# h5 u- h1 X/ X& ?, D5 J
- #else
( Q* G' K" f1 z8 m a - #define DMA_PRINTK( x... )3 {) Y0 |0 J# N7 U; L5 H" U
- #define DMA_FN_IN
4 J) t; s" X4 z' M - #define DMA_FN_OUT9 m/ A P3 Z3 `& K# h9 e- o# ^( @ h
- #endif) H+ |- _) {1 G7 P
- 0 Y6 R' j9 D# J+ F
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)& f2 _" S9 z5 }7 n
- #define STATIC_SHIFT 38 M+ l: {0 m4 \' S+ H! O
- #define TCINTEN_SHIFT 20' |, f5 c4 P4 K
- #define ITCINTEN_SHIFT 217 L7 j# } [ m: R- Z: w! `
- #define TCCHEN_SHIFT 228 @ H' a" \, k/ r4 o) P
- #define ITCCHEN_SHIFT 23
; M; ]: {2 h6 k* k - / ~& H. p1 L* x7 C% X6 ~
- static volatile int irqraised1 = 0;
$ K9 t* @6 }! X# ?# s - static volatile int irqraised2 = 0;2 @( g- g7 i: s b9 K
& d, E: z) F" d$ y0 h. o3 K/ K& P- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% C- }# h' p. U0 ?: ]$ ~ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" s5 O8 h5 r* f b& K+ a) {
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: Z2 r3 n& E$ j% u3 p/ o9 l
# ?. }8 `- G6 w' C" w/ e* A- dma_addr_t dmaphyssrc1 = 0;
5 S& f4 C) Z$ x+ J' x6 O - dma_addr_t dmaphyssrc2 = 0;) o8 K% s0 s- ~& ^
- dma_addr_t dmaphysdest1 = 0;
0 D3 B: G6 ^' z' t8 i( _ - dma_addr_t dmaphysdest2 = 0;
i5 X$ }5 P$ ~: M# K - 5 q T- M: p% [" k
- char *dmabufsrc1 = NULL;
0 {8 v# |; r' k5 L - char *dmabufsrc2 = NULL;
) t L$ O: O- N) R0 a - char *dmabufdest1 = NULL;
" G( I7 b7 A. e# _4 q# p3 g - char *dmabufdest2 = NULL;
# E; }5 w& Q$ X - 4 v% u; S; c- j/ M* a6 V4 V
- static int acnt = 512;
+ r c1 w) X2 u( V - static int bcnt = 8;, t' a( J/ }6 N+ y
- static int ccnt = 8;0 _/ P7 v* ~7 H5 I) \
0 Y# U$ P3 v# U( w! ]3 h. y* n- module_param(acnt, int, S_IRUGO);6 i! @8 l% n7 ~8 f8 q8 b* j
- module_param(bcnt, int, S_IRUGO);. r# y' i8 ?: V
- module_param(ccnt, int, S_IRUGO);
复制代码
- |& {9 A- J8 S* ?, N/ D9 Q5 g7 S% Q3 D; d/ \, X, Y4 B! N W
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ V: W2 G1 t2 aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& ~$ P1 O1 |2 B/ I# Q 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! {, L# O3 J% o% B& _1 I2 p
' |9 s, U7 t% a" x
; ]: A, Y: G3 @( ?, i2 v |
|