|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 H; c. M$ w1 |2 V3 O- [code]EDMA sample test application" E J6 ~( V! r" B8 o
- /*
! \5 N8 c6 H! K9 l& l8 u' A7 w8 c/ ] - * edma_test.c, ]# B4 W- u: J
- *" \& O7 N; b* _; |/ G$ K7 L. N6 T2 Y' ^
- * brief EDMA3 Test Application
$ P1 v O/ |6 g' }6 L9 w - *; Y2 M( R5 I' ^4 D- b$ M* r
- * This file contains EDMA3 Test code.3 V) V% K; B7 p, s B. A
- *
+ M# r1 I" N5 ]- I - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
) _7 ^$ |! _6 B$ i4 n - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
/ L$ T6 ^: Y: S. d6 G9 T9 C3 [2 r - * TO CHANGE.
. n; @ W3 s* s/ F8 k1 v" A' V - *
3 K! l8 }% ]3 a0 A4 E8 e, [ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# I; K$ O5 w2 h
- *
6 }$ P) O" N; w& W - * This program is free software; you can redistribute it and/or7 X6 `1 b' E1 e& H% e
- * modify it under the terms of the GNU General Public License as/ i C" }, W+ [
- * published by the Free Software Foundation version 2.
, ?0 O) H$ @0 E) F; b - *3 A# i+ P U }1 X: j0 e$ ]' H
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
1 ^+ s* P; n$ V4 P1 X# B" k$ [- `3 d - * kind, whether express or implied; without even the implied warranty. }% k h& p; H, L- s, q' T
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the6 m1 |: s- J/ Q8 p4 q7 R
- * GNU General Public License for more details.; ?4 g$ `( k! Q! N* H) |" q
- */
" S% {( w2 X! `2 |, @5 Q
9 ?& o" a: f2 x* t+ s* [9 ^+ b- #include <linux/module.h>9 r4 B1 G3 x) J2 t1 a5 e+ w
- #include <linux/init.h>4 J0 h! q+ t1 |/ w: d
- #include <linux/errno.h>
' }3 v3 R8 Q- E: z' C) ~ - #include <linux/types.h>
( }3 W- w3 M5 O3 e# Q - #include <linux/interrupt.h>0 I$ x9 Q- m" \ |7 w
- #include <asm/io.h>3 S6 ~8 Z5 j4 E6 Q0 _8 p0 d4 K& x
- #include <linux/moduleparam.h>
v0 f% U7 i; W5 e0 m- U/ O - #include <linux/sysctl.h>
* a+ b9 B$ E# R2 L! c+ f% s7 W: g - #include <linux/mm.h>5 H+ z- M8 U* |6 `3 n9 {, E
- #include <linux/dma-mapping.h>6 ^% _3 K# R# `- e
H- _% d) x9 Z& L+ J- #include <mach/memory.h>, v$ P D6 Y* E' b) m
- #include <mach/hardware.h>( ` T& M( o. _0 j$ I
- #include <mach/irqs.h>
$ }; U: o' ^, ]2 d/ q% G1 D - #include <asm/hardware/edma.h>
9 l5 S/ I. \8 h+ V6 X* S. y - ; C, H' d0 J' F2 J' w) q
- #undef EDMA3_DEBUG, v1 I# O5 x) `# O; ^& \
- /*#define EDMA3_DEBUG*// s' h- ?3 D' `0 C5 j$ U
- 1 \0 ]* @. Y* N# i$ N/ U2 a+ F
- #ifdef EDMA3_DEBUG
: @( k! i* a# H2 i0 C0 x% R - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
! p J q( P- N1 } - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ j0 H4 ^( H& _7 @
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ p8 l) o) n" X" J K$ l
- #else
0 b. Q1 q8 ^* M" v! t - #define DMA_PRINTK( x... )
: E! G: `+ q$ L8 r - #define DMA_FN_IN/ s7 Q) w6 q6 t! \
- #define DMA_FN_OUT; i8 `* k8 N7 R7 {) I2 k
- #endif
5 G7 W# C& \4 X. B
% I/ x+ J' ?; X7 f$ J0 {9 m: W7 ^$ h- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
& G5 @, h4 Z u: \ - #define STATIC_SHIFT 3; K! {# H! q( t1 {
- #define TCINTEN_SHIFT 20
6 h) S* g, u5 j% E - #define ITCINTEN_SHIFT 21
3 A' Y0 | E& q - #define TCCHEN_SHIFT 22$ ~$ ^3 K& I- O2 t9 ~) p
- #define ITCCHEN_SHIFT 236 F2 i) X. a2 t: R2 d. x% ]0 x+ e, }' _
& K; Y% D; u" U( y! w7 b3 h3 S- static volatile int irqraised1 = 0;
3 w) o: I8 z3 i6 V2 ` - static volatile int irqraised2 = 0;; [+ Z% W1 E" W; S9 Z k$ p& l( e
: m4 n) l7 f) P- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) w$ `5 g& s* }. I w - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% q9 c4 z8 I( Q1 Z9 H! ]: E
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. V' H% j/ ^1 t* e' |' z; X$ p! z, J$ b7 v# E
/ A! x/ c8 l6 ]4 L* H- dma_addr_t dmaphyssrc1 = 0;
{% q- R* x3 Y0 [ - dma_addr_t dmaphyssrc2 = 0;
8 Y. ? L& O( X8 D& c4 T2 X - dma_addr_t dmaphysdest1 = 0;2 q, T: o: [2 U( M B, |& @
- dma_addr_t dmaphysdest2 = 0;
, L5 P- s# L0 T& f - 8 ^* C5 E1 z7 @/ Y
- char *dmabufsrc1 = NULL; v' N; D3 v7 |$ e- c$ D$ n- E
- char *dmabufsrc2 = NULL;3 ?3 L: u2 _" z9 i' B, P( Y
- char *dmabufdest1 = NULL;
2 k1 c* C! M& G. v5 r& \- M - char *dmabufdest2 = NULL;* R7 P: |# r5 G' ]* ?* t" B
; L& r- B) ~/ V) q3 V- static int acnt = 512;8 Z2 ~, J; q1 x0 T
- static int bcnt = 8;5 F' O5 J1 n4 F0 x% D# P0 V7 @8 n3 W
- static int ccnt = 8;# @2 s, u& x% F5 A) l+ s
h+ G# s6 q8 m2 G( z8 D; w& m* O% \- module_param(acnt, int, S_IRUGO);
: o q3 l2 [4 j# |6 X' f6 t* ` - module_param(bcnt, int, S_IRUGO);( A- B2 f+ o6 Z4 v" Q5 y, ?. ^
- module_param(ccnt, int, S_IRUGO);
复制代码
) t- s% V) @- {5 q% s* X) f
* T% e& z; C; Y' F$ b" r4 U. W/ w 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 B; a% g9 z3 ?% k6 Q% f& F& d
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 X! S9 N; U. C4 J, j- K5 G- J
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- n1 G3 K) O, J5 h$ h m
+ T2 y( U+ G) O! c
. {1 M$ A2 Z# d* G: Y) R/ v
|
|