|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! {9 u' H# M, X( n9 L
- [code]EDMA sample test application. M3 {% @, c+ n
- /*
* `- U3 z# m; m* S6 X+ \ - * edma_test.c
( U% ^0 e4 l1 r3 k* |- ] - ** O, s' u7 g# [& v
- * brief EDMA3 Test Application+ v+ A: ^ v( a' C S" R
- *& c1 d% Y* _- l/ a
- * This file contains EDMA3 Test code.
7 B) o4 H8 ^2 {' t+ J0 M - *
, f! `/ L) ~* Y' m. m - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
$ j M8 y& |+ {: V; m5 R% g - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
9 B+ t% R A: s% S/ r/ d! t - * TO CHANGE.) e z i4 U4 j
- *+ h3 B, g' X) N9 \) S
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
8 q1 R, C3 r. K* H - *7 e% u/ {1 e' o- s, {" b" c. t
- * This program is free software; you can redistribute it and/or
' ^& u# s# x8 K3 c* [, z' C; L, H - * modify it under the terms of the GNU General Public License as4 c2 [' ^! X6 m7 Y/ q
- * published by the Free Software Foundation version 2.
* s" P+ U+ T0 L; I; h9 o ~ - *
6 r- w K, r' B% M, I - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
0 V" F8 r" y) m6 G( ~. `. e7 T - * kind, whether express or implied; without even the implied warranty
# N/ [' O/ b2 ^: {' J5 k' [ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the4 p/ a! d! ~6 J% y
- * GNU General Public License for more details.- R- K9 _- u. w) X7 L1 w" M6 Z6 w$ {
- */
, d" h" B, D- I7 G1 ^# J
) y+ p+ J, j7 z7 @- #include <linux/module.h>% U% S6 V0 @) l/ c1 F' ~+ O1 p
- #include <linux/init.h>
6 @4 S8 L& ?9 g - #include <linux/errno.h>' D* y! U0 n$ J9 e# x6 i6 m
- #include <linux/types.h>
" ?. R4 e! [) Z K9 A- g - #include <linux/interrupt.h>
9 v: a9 ?- z' \; @; A/ C6 ?+ F - #include <asm/io.h>1 l+ k# |" f& C- ?. E+ ?
- #include <linux/moduleparam.h>
+ O3 n7 F% C- g - #include <linux/sysctl.h>! _, \; C* h8 \
- #include <linux/mm.h>8 v+ e& e- u s7 b! n0 W1 |6 H0 n% `
- #include <linux/dma-mapping.h>6 H& j$ C; ?) Y7 X& p% K. y$ f
- $ A4 W/ H6 ]2 v3 A
- #include <mach/memory.h>$ o4 m6 H, T- K- l0 d8 a( r
- #include <mach/hardware.h>, P' u) A. U# @4 s( I+ Q
- #include <mach/irqs.h>
% {5 v+ y7 d: n! x4 j0 R4 |( j2 u$ d- a - #include <asm/hardware/edma.h>
3 \0 a$ G, E* @6 i5 W3 O - 0 V3 R5 O" n& r: x
- #undef EDMA3_DEBUG' ?& Y: t' N8 ?5 s! m Q( l: a+ @! U
- /*#define EDMA3_DEBUG*/
1 H* `& d' ]7 c7 P8 C
* X. G M& E* N- #ifdef EDMA3_DEBUG
+ v& i8 t7 ~; h# W) ^ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
3 h' U. e9 ?/ l& W G - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
9 {) @# v% r5 \. X+ q& Q# V6 f - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 z( [8 X8 ^; s% r
- #else+ c( G: O' n) {' i1 |" ]
- #define DMA_PRINTK( x... )
\# E. r8 E: }3 N. U - #define DMA_FN_IN
' ~7 r4 a, \- j - #define DMA_FN_OUT
0 q8 b) i0 R" s& S# v7 i% T. s - #endif x4 |9 i+ |4 V$ \- L, c
- 9 i8 V4 |$ I2 D
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
- V9 ?2 s: `1 ~/ y/ Y* K0 r$ j- g - #define STATIC_SHIFT 34 X7 b7 P$ w) g6 d
- #define TCINTEN_SHIFT 20
$ F7 Y) f% K5 v) @2 \; N6 @0 [/ u - #define ITCINTEN_SHIFT 21; W3 \+ _: ], v8 a+ h
- #define TCCHEN_SHIFT 22- Y, M! c+ e' R! @' ]) l
- #define ITCCHEN_SHIFT 23
2 z* K! U! i" `) I0 u8 _; L
/ A) K; [: O9 g$ X, Z; C O c) U$ ^- static volatile int irqraised1 = 0;
) c) p3 ~* g1 _0 m7 m1 M - static volatile int irqraised2 = 0;
2 k- ?. D7 e( O5 k. z+ p8 c3 b# i
: g" \8 t' C% P0 [2 Q) i- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! s/ u7 l: }/ z: y- A5 @8 T6 H2 G
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 P. ]8 y$ {* T4 ^1 x6 B! F
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; }& r* k7 A" F* R% f8 w' Q
- ( } L+ ~4 c6 v3 q4 U4 [0 U4 c& T
- dma_addr_t dmaphyssrc1 = 0;
3 j6 L( P1 a; J, H+ g' T - dma_addr_t dmaphyssrc2 = 0;0 a) Z, d# F; T/ V5 L/ _/ Y
- dma_addr_t dmaphysdest1 = 0;4 j J8 g/ V. S5 p- Y, J
- dma_addr_t dmaphysdest2 = 0;
- H7 ]- H- z( n! r - ! \7 [# `4 c& y, \' h; [
- char *dmabufsrc1 = NULL;
& M6 n5 g4 e6 u: h" A$ o( b - char *dmabufsrc2 = NULL;
& ^# R* ~( L, C - char *dmabufdest1 = NULL;
) X* ?. A7 t: C2 f" T5 ^ - char *dmabufdest2 = NULL;
# v7 l8 m" s5 H! ~ - 4 ^ g2 m. n8 @; m; g8 |. z: l
- static int acnt = 512;
}) D( @( x, i- j' [ - static int bcnt = 8;. a( D: \/ S: W( A0 m& s
- static int ccnt = 8;* B: d" W! A3 t! w0 l
7 v" V0 u. F8 ^: D `, |* o4 X- module_param(acnt, int, S_IRUGO);* o7 ^9 z. z6 Q5 T3 b
- module_param(bcnt, int, S_IRUGO);' I! [, U1 K x& g
- module_param(ccnt, int, S_IRUGO);
复制代码
6 ~; D; j5 d2 A6 @0 j. t& n7 G8 p4 w3 G6 {, a( l: \
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" q, v- t8 m; barm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ h& l: W, K5 k 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 ^& L5 K' z4 x$ \: ]/ U" Q: z( W7 A- p" ^
7 ?3 z/ m# I9 p2 t1 M8 H, h! i4 O
|
|