|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : ^" I2 Q {) F4 h
- [code]EDMA sample test application
* A3 e' S/ m v7 N2 S( E. d5 A - /*
4 a' S) T. V: @ - * edma_test.c1 p" ?4 j1 \2 p# w
- *$ k# m. R0 _! H+ d9 U6 b
- * brief EDMA3 Test Application: d) Z! p3 p1 G% K- I( e8 A
- ** y, ~: Z% l" F+ S4 P2 Q
- * This file contains EDMA3 Test code.
9 z6 y+ Z, \( `7 {" r - *5 n @9 Z& `+ D
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
5 E$ z+ s$ }! w( |0 b - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ L8 S8 L$ ^; N9 S! F4 e! O
- * TO CHANGE.
/ \3 |0 X3 i! S8 R3 o2 ~6 s8 f - *
0 z( ?0 D0 D) N; ~# Q* X- l - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ o% C0 z9 B7 T5 J2 n' d
- *$ g; |) M1 \( B
- * This program is free software; you can redistribute it and/or' @" d; }* A; h
- * modify it under the terms of the GNU General Public License as7 N5 h3 o9 g' N# ]$ n ^
- * published by the Free Software Foundation version 2.8 P# n0 k* s; C% k
- *7 X% e$ C3 d# n/ z5 i$ }2 v
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any( K" G) n8 a. Z u" A
- * kind, whether express or implied; without even the implied warranty
. G5 ^# c* n1 p# t% ^) ^) j9 k6 J - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 k/ w0 [7 c8 g8 b) H - * GNU General Public License for more details.
! N3 k+ L1 _6 C4 S - */ t: A1 R" W( H
- , z7 n, R! ?1 p# Z: {
- #include <linux/module.h>
4 @. u# p6 u& g8 K$ u' W ]% A5 | - #include <linux/init.h>6 d d- Q; e+ m$ E9 ]. {
- #include <linux/errno.h>
/ V# y v z( h; E" B, c. L - #include <linux/types.h>
# n$ M9 r2 c4 ^; x) v) B( ~& C - #include <linux/interrupt.h>; `. M0 |( H& J4 Q
- #include <asm/io.h>$ ~, e; M3 ~2 I g5 L
- #include <linux/moduleparam.h>) l* z2 ^ r- P' R1 w1 g" K
- #include <linux/sysctl.h>) t( O' C' s2 K9 g8 j' s% B* M0 M
- #include <linux/mm.h>1 k1 C* I# m: }! f" K6 n
- #include <linux/dma-mapping.h>
/ K2 K o* g' A& ~+ R# \6 V - 3 U, y8 L* P/ \$ A! J8 s1 o8 i
- #include <mach/memory.h>, T% u0 @/ Q; Q0 o
- #include <mach/hardware.h>2 [( c4 f: h! X# G0 W
- #include <mach/irqs.h>2 q2 Y+ x. H, G; {* i/ ]3 w. [
- #include <asm/hardware/edma.h>
5 b( v+ Y! F% D. X# _5 D* W
/ A- {4 X" F' H) o$ h% c- #undef EDMA3_DEBUG
" r2 j6 P5 N6 z/ M - /*#define EDMA3_DEBUG*/; c! V8 a6 ?+ j5 G& P
1 }+ [2 b& ^8 K( Q. d6 A3 ?- #ifdef EDMA3_DEBUG m1 O1 f4 `# M2 X# e/ B& `
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( e; G3 |9 l1 L5 y' [+ c
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
' M; X2 {! i/ I7 K# _/ m c3 m) R - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
3 `5 P7 m: Q5 u8 M! D# _4 A W - #else
4 z. t/ `9 e* n% ^; i - #define DMA_PRINTK( x... )+ O6 Q3 T2 K" _. }9 M" z0 S) Z- m& {
- #define DMA_FN_IN" l* s4 ~' D* s* n# y' X/ d
- #define DMA_FN_OUT& b7 @/ Z3 S) g! M7 R$ M/ K
- #endif6 l( d2 |' J, f+ @; ^
- * V2 F* O: x! z, ?
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
6 J: u( A$ a. p2 w7 f' z9 J# g - #define STATIC_SHIFT 3
7 P, A* D; C, P" ?2 l( N e- u - #define TCINTEN_SHIFT 20. X2 @/ f d% k( q4 c3 w7 f
- #define ITCINTEN_SHIFT 21! Z- _& X# d. n4 }
- #define TCCHEN_SHIFT 220 e6 S0 ^6 ~: z3 P7 S- r- s) t6 A
- #define ITCCHEN_SHIFT 23
* p* h+ U' x9 A. r. C6 [$ A - , k9 q+ [5 D! v* Q
- static volatile int irqraised1 = 0;# X* [3 t+ h. {: u
- static volatile int irqraised2 = 0;$ j% p/ A( H; f9 {3 n1 [2 \. K( w
- / V7 c& l4 d7 `4 U% q# N
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- [& A4 W r$ F
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! K/ E: K# R e, e2 X
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% M: {; R7 q0 X( o$ ]
: k: n7 Y7 Z! J8 ^/ F- dma_addr_t dmaphyssrc1 = 0;0 M: V. T/ {. C2 o
- dma_addr_t dmaphyssrc2 = 0;* F; E! m2 I! S/ Z0 i: t
- dma_addr_t dmaphysdest1 = 0;; y: \) Z( J$ f1 |7 P
- dma_addr_t dmaphysdest2 = 0;
# \4 N: d, ?( a$ }4 P4 ^1 Z - 7 k9 H- f0 d6 A
- char *dmabufsrc1 = NULL;
' n/ c; b. p& l0 e - char *dmabufsrc2 = NULL;* z$ {) I7 U s8 T y; T
- char *dmabufdest1 = NULL;
* G+ {% \, d" \9 T) ]* X - char *dmabufdest2 = NULL;
* ^1 \4 P# d( r0 O9 U) g' e6 P3 s
; Y" [ ]0 x1 c$ |- static int acnt = 512;
d9 t' @& n$ ~ - static int bcnt = 8;
2 {6 z: t" H8 f/ H1 n: \ - static int ccnt = 8;9 }7 B7 z* N0 X
6 l9 b3 K" A. n t: M9 p: t6 T- module_param(acnt, int, S_IRUGO);
7 _: d6 |! o! M* B4 }7 Y8 e' F - module_param(bcnt, int, S_IRUGO);* Z, C/ p7 w$ g% L. i0 ^( A- V
- module_param(ccnt, int, S_IRUGO);
复制代码
; D4 W/ r; X$ Z" q
& {1 R* c0 h0 N: H( j6 G3 c1 A 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; N8 Z6 u G5 G% narm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! A n; D t& E
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ k( N) k( `# D) A
+ U* ?+ d2 y/ L# I. g
% ^1 A4 {6 P' ^) M/ l& q |
|