|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( }6 h& }, b& y7 e3 |
- [code]EDMA sample test application& Y- y( S* `# x3 ^; Y4 m7 g
- /*
/ c! E* N) ~6 T {/ e - * edma_test.c
0 y5 U+ o1 K3 y$ a - *
0 X/ M$ _9 P( p2 ~ - * brief EDMA3 Test Application2 ^' x0 t7 V6 J0 q2 P7 c+ k8 w
- *
5 B6 v6 u9 {% i" e3 g1 @ - * This file contains EDMA3 Test code.8 D/ P2 K0 o! p
- *9 Y+ M+ v, ?( E: w4 P1 U0 ~
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
' I% l( R. H& Y" M7 U5 r% |- `) [0 q - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% b$ L2 ?: R7 H, T$ c% p$ O2 ?) q
- * TO CHANGE., s% K/ |( J9 K0 k
- *# E9 B6 ?1 P6 S, h1 W- @1 M! @
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 g9 b! a$ T; k& Z( K% @( ?: n
- *
* v+ c x8 F: x! Y8 N3 S% F - * This program is free software; you can redistribute it and/or
' s3 k' I& a, ~' n - * modify it under the terms of the GNU General Public License as; ?. ~. v! p9 r) u+ D& I; W- C
- * published by the Free Software Foundation version 2.
# F# S) r8 b, t! ^ - *4 X" Q' g. M, R. `6 f
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
2 Y! |4 c" Q* w% v( s. N T. Y1 a- N - * kind, whether express or implied; without even the implied warranty
7 x( D& P" Q- ~8 _6 g$ ^ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the( c* q$ S" v, X9 ~9 {
- * GNU General Public License for more details.
9 [. i [0 V- o* O+ \% X n+ B - */0 e8 B: p/ E" D3 W
$ N$ L9 E' D0 `, T; u* \- #include <linux/module.h>
" H% {: }( `% t - #include <linux/init.h>
3 J X4 x/ l0 N% a0 C$ J' H) w5 m - #include <linux/errno.h>7 V9 H+ T+ Y2 l. }
- #include <linux/types.h>
* ~$ v. s8 A9 y _5 w$ v6 j: U( } - #include <linux/interrupt.h>
, ?6 T6 |1 K" u/ v4 Q& y5 Q# s, P - #include <asm/io.h>/ z; X" f5 Q% T' U
- #include <linux/moduleparam.h>9 ~ ?4 ^/ }! Z4 ?
- #include <linux/sysctl.h>
% y ^. \$ y$ ` t* X* s - #include <linux/mm.h>( [0 e% Y! t) }8 P: Y
- #include <linux/dma-mapping.h>, q# g! |! a2 P3 ~* I* _9 U
. x4 J9 ]4 z: N8 r0 \* [- D" r3 `- #include <mach/memory.h>( i0 f. K7 _- s
- #include <mach/hardware.h>
7 U) K6 e2 I( j - #include <mach/irqs.h>* z7 z7 ]+ a7 o! {, r) n
- #include <asm/hardware/edma.h>' ]7 v& w3 h s- L
- w* ]. L2 m! l% j7 D9 V! m+ E+ l- #undef EDMA3_DEBUG% ^0 F' `& L. O1 }- |: R: _
- /*#define EDMA3_DEBUG*/8 C9 W+ w$ _% t! f( ]4 \
- ! T& P$ I1 h* g& e5 \: R' r3 U1 h
- #ifdef EDMA3_DEBUG) G) ?4 G# ~6 |0 L
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS) u. H) h: M% j: o+ x! b
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
3 c; J) C7 J$ k# R# Z - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
0 |: ^3 g7 r7 g% j( \: U - #else) |7 h, q6 h% K3 z, @9 r& J
- #define DMA_PRINTK( x... )
9 g5 }- r. n4 s l# t" g B - #define DMA_FN_IN8 ?- l. U1 G# a0 C
- #define DMA_FN_OUT6 |+ J0 C4 ?1 d) ?1 `8 o2 Z! O( d
- #endif
2 j# g/ a7 h% h) ~# }) ` - 5 O3 @- {) P' w% K
- #define MAX_DMA_TRANSFER_IN_BYTES (32768) [$ T) L& @1 o% b8 q
- #define STATIC_SHIFT 3
9 Y" X; E" C. b: ?( G2 ] - #define TCINTEN_SHIFT 20
" y* G/ R- i3 k - #define ITCINTEN_SHIFT 21* r; h: H% m& C. o. Q z
- #define TCCHEN_SHIFT 223 U5 E: h1 R/ X
- #define ITCCHEN_SHIFT 23
" B0 {" V1 n3 c8 }6 a- p, L0 r - ( N9 p" c. o4 u/ `( ~
- static volatile int irqraised1 = 0;- Z: d/ S1 k, _6 E7 w. _& n, W
- static volatile int irqraised2 = 0;
0 r( c. w% d W1 M/ p% Y
$ A: e- p* {8 _, ^4 _( Q( {- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, z% O# H& R# X8 O0 U, H
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ S1 i) v- L2 d9 C - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& e% x- j% q2 {/ N0 T. r G - $ q) M, c4 v7 \2 G3 p! z
- dma_addr_t dmaphyssrc1 = 0;% p; u# ?8 j8 a# z$ o" P' N1 ^7 G) x
- dma_addr_t dmaphyssrc2 = 0;
8 A) ~# T4 x( _ H - dma_addr_t dmaphysdest1 = 0;. J: E, d. q: D9 @/ B$ U3 U5 N
- dma_addr_t dmaphysdest2 = 0;# C: i, |: E6 N: K4 m" [
# e$ {' T0 u" y9 y. w+ p3 X- char *dmabufsrc1 = NULL;
, w4 U9 v& l& h. U - char *dmabufsrc2 = NULL;8 Q0 L5 F# D1 y5 G9 g6 U. m
- char *dmabufdest1 = NULL;
6 L$ b0 k: ~7 H0 t - char *dmabufdest2 = NULL;! G( ]/ ^* `( o# `% e* _
- % Q. |$ g% F7 F$ L7 M3 E9 k: P5 M; h
- static int acnt = 512;, j3 l9 |, ]/ A R
- static int bcnt = 8;
1 F; ]. y3 x4 u6 i& _& Q - static int ccnt = 8;& O, }' u. l1 m, A
+ F* w8 F- O, K4 f6 L/ F- module_param(acnt, int, S_IRUGO);
+ b# L3 `. Z6 L9 B: v- J - module_param(bcnt, int, S_IRUGO);2 g" R! W9 r1 q5 ?: D+ v
- module_param(ccnt, int, S_IRUGO);
复制代码 " H! a" q; Q; w4 |5 N, u" c- K% ~ q2 [
- {! t+ p, t: G/ ]( d5 ? 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用 t6 O1 k3 P% ]3 u
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' L, y& X. ~& S @+ ?% d9 G/ g 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ s% ]+ P0 Z/ j ?4 Q2 x* \2 C
, z4 r+ M ^, t. N; \% m7 F
9 q& Y' V# k+ N( X0 }1 |, ]: `" A |
|