|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # c, M H% a$ B# `4 z
- [code]EDMA sample test application0 g( A% V% l4 G2 x) \
- /*
8 G' Z( }8 [& ~9 A& B - * edma_test.c
! `+ C9 @$ V1 A! P9 M1 m - *
! e. v) Y1 ]0 I, F - * brief EDMA3 Test Application( B: y7 \: ~) z( b/ n" Q/ J' D3 ~
- *" ]) w$ p1 F$ T; [" a6 v
- * This file contains EDMA3 Test code.
8 j- _/ V% a) e; ^; w8 _ - *- ?1 O0 O; A* V7 o) ^8 S4 A: `
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
6 F7 I& C$ b" T5 I9 q- } - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
/ {( `: k! [0 g$ U6 [+ r - * TO CHANGE.
( c& Q6 @8 p) ?. ~! ~! `& r! w( h - *$ h1 S) e8 K( S
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ O; @' m5 B( ]: \0 { t
- */ k* v) F. B$ |, v. P
- * This program is free software; you can redistribute it and/or
0 y& U, D: p4 k - * modify it under the terms of the GNU General Public License as
9 K q7 ^ Z+ [9 S0 U' O( g6 m! @ - * published by the Free Software Foundation version 2.
6 U6 A' t; w: q& D2 U O - *
6 e8 D4 l5 |: Y' b4 r - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
& X3 i8 a' K, ] - * kind, whether express or implied; without even the implied warranty* f# N% m6 p7 A5 p9 K$ u6 k7 h
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
& q* N, ]+ F: n, {5 K - * GNU General Public License for more details.) }4 Y( G: B+ V
- */
5 L# c, {3 w% C - 9 I, l/ p6 L2 d+ w' a, h0 [
- #include <linux/module.h>
- p& B/ q% R) z. L6 I - #include <linux/init.h>
8 T8 z, n0 p% e, N - #include <linux/errno.h>
3 b5 R8 J7 Y, i6 S - #include <linux/types.h>
( B3 F) H3 ]; G. ^ - #include <linux/interrupt.h>6 J0 J& T( P3 i. Y9 H) T( `
- #include <asm/io.h>* L- ~) H6 T8 p5 |- H. O
- #include <linux/moduleparam.h>
" v0 u& b- t. o! d9 u3 a/ O - #include <linux/sysctl.h>
7 f$ X" `" D' T. I - #include <linux/mm.h>& q. u& C0 t; X" G) t7 e
- #include <linux/dma-mapping.h>. z! c* ^; I' S6 p: J0 T; D( [
' U0 m, p% b7 G& A. _! Z& e ^- #include <mach/memory.h>4 d B3 i [/ [
- #include <mach/hardware.h>
6 J/ H( q+ d/ {6 e, ` - #include <mach/irqs.h>9 l8 m! `- K/ G. B
- #include <asm/hardware/edma.h>6 N# b, u2 \4 F; R
- * s- w3 Q8 y4 z6 Q6 h# Y
- #undef EDMA3_DEBUG
& n3 L! _) H; j/ E$ _" N - /*#define EDMA3_DEBUG*/) ^8 v5 \) c& t. w
- 8 u' U8 H8 o- }/ h2 q$ y% J4 ?
- #ifdef EDMA3_DEBUG
5 t% H+ ]. n% |& v7 `$ F; N - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
" t5 s1 L8 j% q. ]" P( a - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
4 H' ?3 D+ a% `* f# | Z5 F& D5 c1 c9 a - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
+ r+ w( H; A( t) s9 S - #else( l* Z2 H/ o8 v; d$ J. I
- #define DMA_PRINTK( x... )
+ H9 v, [5 h% i - #define DMA_FN_IN
$ X$ s- E2 Q% D5 a/ L: Q - #define DMA_FN_OUT2 t2 K) u/ {; a, R4 V! B: O1 ?
- #endif
8 H3 P7 m" x8 @2 |- \2 @' Y" P v
/ U5 \4 v. |; m5 l j/ t2 W4 b0 X! E- #define MAX_DMA_TRANSFER_IN_BYTES (32768): T# Z# E5 Y/ T! h @
- #define STATIC_SHIFT 37 l7 S$ s- A: _' d/ k. {
- #define TCINTEN_SHIFT 20
0 T# z& U5 t$ K7 d- A - #define ITCINTEN_SHIFT 21
. } U) }9 e+ ?/ k% [+ h - #define TCCHEN_SHIFT 22+ K$ \; u% O% k* a, k+ l
- #define ITCCHEN_SHIFT 23
' O3 r0 ?' A- F: J6 c1 E) x
, t* h+ h) E6 j+ E- static volatile int irqraised1 = 0;- ?( u" w8 A3 ~( X! v8 K: E
- static volatile int irqraised2 = 0;
/ q7 j' a+ w0 x% @9 c+ C - - |+ M2 ^3 `* ~! ~1 D
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% C% K$ v, U% @: q8 \3 @
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& r/ Q% C% w5 p, d; ~ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; G- R7 B/ i- ?0 T* s6 z, q
- # u+ d; T6 F0 H5 {8 b# d9 o" z: P u
- dma_addr_t dmaphyssrc1 = 0;+ d/ P' {& a" E1 L7 @
- dma_addr_t dmaphyssrc2 = 0;
( L0 L1 |: i3 X) _4 [ - dma_addr_t dmaphysdest1 = 0;
2 l Y9 E1 d, Z2 t, w - dma_addr_t dmaphysdest2 = 0;
' B6 ? j9 ^6 b - 0 }& L& a* S O# a
- char *dmabufsrc1 = NULL;0 p# [- }( d& s! V( E/ I5 I0 j
- char *dmabufsrc2 = NULL;2 z/ \: ?. \+ n! j; i
- char *dmabufdest1 = NULL;
& c6 Y3 K8 v. z! x+ b/ h9 h - char *dmabufdest2 = NULL;
' Y9 ^ {( E9 ~9 a - ; W* x. u6 x' K) _" b4 q
- static int acnt = 512;; p% V. ?# _0 i, t5 D" l
- static int bcnt = 8;
2 k3 {! u8 X$ I* B - static int ccnt = 8;
0 t0 R4 k4 M% G1 a% P
& T+ [" T7 M( n/ x5 o6 K- module_param(acnt, int, S_IRUGO);+ t. N; i) w9 [ `
- module_param(bcnt, int, S_IRUGO);
! C- u M2 K Z$ _. h& S5 ] - module_param(ccnt, int, S_IRUGO);
复制代码
, f1 d" |0 `, e& Z- J( W! y. f
- I/ q' P- ~8 q, q0 e3 D7 Z 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 b$ X( U5 @0 R4 \1 R. 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ y q0 H7 |2 R* @: H 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% M& @( E t( j4 }# z0 b7 p
: k3 M" |4 x K% l1 }
: p2 w5 n, I' P# {8 x5 v. s |
|