|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( M! a7 r! w, _. b" t( q
- [code]EDMA sample test application
8 @ `* _8 o7 u1 A0 l8 s- b1 u - /*0 w& R; r# k+ a$ b4 a5 I
- * edma_test.c$ D7 A2 `9 q8 q3 i' m1 ]1 g: |
- *' L1 s5 O) [4 g* g* C9 c6 J; [8 }
- * brief EDMA3 Test Application7 Q0 w* O! K4 A& J: z
- *
6 ?: o3 |! @; T* c4 M4 h6 B - * This file contains EDMA3 Test code.
" S/ ^: o, C. b2 W( v/ P' V R: r( } - *% |" d; z3 Q% p$ ?- @, t
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" n$ q# R# s% m( `3 o( @
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
3 f- k$ `" d2 ^6 M# e - * TO CHANGE.! A3 T( {) f4 z$ d7 F9 f+ ^
- *
0 u1 Q2 F* S! O* e - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* Y2 @2 T8 K7 c* a1 R: F, N
- *
+ s" z1 }% i! a* v" | - * This program is free software; you can redistribute it and/or* j7 }4 E! v% _
- * modify it under the terms of the GNU General Public License as4 u% q; L! I( f: [: m9 {
- * published by the Free Software Foundation version 2.% O4 {/ b# N0 F) I9 R" F
- *' W9 Y& h! R% G1 K4 O9 E
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any. ^! {' X; Z) ~0 _; R \+ D @
- * kind, whether express or implied; without even the implied warranty
% v+ G" M7 L% k. _ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- [( o+ |- l/ \4 {( W - * GNU General Public License for more details.
2 ]6 D6 S# ]) _# C4 b5 t, g5 n - */
4 t: l) X* L( z7 \7 T$ n( i9 M - . P8 h$ E1 a7 b6 X
- #include <linux/module.h>: n# y3 I9 @3 I0 m. ? G( I
- #include <linux/init.h>
5 G- W p6 n- K6 v2 F5 b! ^ - #include <linux/errno.h>' N- \: U$ ^) s) d' a! M( @4 R7 ]) S- e
- #include <linux/types.h>: I' `8 s, c, u- k. i
- #include <linux/interrupt.h>
$ o+ K1 S+ @# t* k: J, m1 H" H% ] - #include <asm/io.h>
$ C. _- H- X8 X) O b0 c# Q. O* h% B - #include <linux/moduleparam.h>
. m0 f8 W% X; m0 u& f8 _! s# p! D0 F - #include <linux/sysctl.h>& W% ?2 v9 c& I9 D
- #include <linux/mm.h>
. K( N3 z- y: M I+ J. G6 M - #include <linux/dma-mapping.h>
1 a5 G, x2 b$ d. S
% P, o& p5 D9 h% a, e; r, z* U" W- #include <mach/memory.h>- M) z' n$ m7 Z$ l) T; N
- #include <mach/hardware.h>
' G& e* M5 s1 i. f Q$ w - #include <mach/irqs.h>( v8 ?5 H& z8 z( U# k7 c8 M
- #include <asm/hardware/edma.h>
/ Q! U$ Q1 z( u
5 E. W: ~0 h0 A' j- \+ Z- #undef EDMA3_DEBUG6 d9 j0 D' n5 z% h2 h
- /*#define EDMA3_DEBUG*/
- t* I# ]1 ?. x" ]* S U, ` - ) X. N9 d: y9 t& |
- #ifdef EDMA3_DEBUG
* @+ ^2 r& r5 |/ H, f% h - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
6 Z+ P, N, B/ p6 B, ?) E' x( h4 X - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__) B+ m0 A1 g3 i0 f
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& e/ z8 S, k! G* W5 o+ G* P1 U
- #else4 E# K" f3 _% s
- #define DMA_PRINTK( x... )1 a" R. L8 ~; R- d: x
- #define DMA_FN_IN
. {7 K; ~8 Q4 {5 l9 k* v7 C - #define DMA_FN_OUT
: J) _& @3 `9 m* u5 i/ r - #endif
7 L* U8 l" i9 v, J$ m
4 L0 ^6 X$ z! y7 J8 t8 o( A1 L- {- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
' X# E9 a4 b4 u0 F+ b& ` - #define STATIC_SHIFT 37 I, w4 K% p( [2 v( d8 q8 J, ~
- #define TCINTEN_SHIFT 20
& J$ O) ] B. }4 Z - #define ITCINTEN_SHIFT 217 j! v" Y6 `0 @+ s
- #define TCCHEN_SHIFT 22- r' P) X1 T( Y& G; k& Z# a
- #define ITCCHEN_SHIFT 23
* D5 l2 i! j! c( L* x1 s; W$ S
) D6 S, K1 [- a$ Q; b8 l& T/ a- static volatile int irqraised1 = 0; o5 A& o, m1 j1 l5 V4 s s
- static volatile int irqraised2 = 0;& j7 ?+ g" o* n( A
3 i% h, o2 q) b1 N- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 U: v& ?; b' d# P% ?* @4 X" A
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) M0 I! J% n4 ~' q( ~* h+ W. U4 x
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 u! \7 x- x4 B t
- _$ P/ W1 H3 r9 x$ @# `- dma_addr_t dmaphyssrc1 = 0;
$ K% d- l6 Q' Z6 m0 j4 m - dma_addr_t dmaphyssrc2 = 0;
9 } r% s1 n2 u' ?( t1 v - dma_addr_t dmaphysdest1 = 0;8 H4 L* `" n/ n! [7 }. A# J* B
- dma_addr_t dmaphysdest2 = 0;
* K) m& j1 v* x8 D - $ y6 _+ l; b3 n
- char *dmabufsrc1 = NULL;4 D4 j9 k& V0 ]$ I3 E, @
- char *dmabufsrc2 = NULL;
) Y6 R0 B4 c3 c - char *dmabufdest1 = NULL;5 m! z$ {" ]) ~1 V! E
- char *dmabufdest2 = NULL;
# `- Q" x* J b. b - 0 e8 z8 ?( |7 q! F
- static int acnt = 512;
# U2 E* R; ]6 d; J - static int bcnt = 8;
+ m0 ^0 `/ U) F2 |* l0 E% t) r - static int ccnt = 8;. v4 f% s+ e% l2 z9 f
4 V! _; }+ m" `9 A; D9 F- module_param(acnt, int, S_IRUGO);9 k/ y& u7 l8 H9 f
- module_param(bcnt, int, S_IRUGO);4 a r# X1 d) T& g# O4 m
- module_param(ccnt, int, S_IRUGO);
复制代码
h% l/ m2 N, U. A& i4 }
" J& h) N7 m5 l8 p! {) q3 { 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, J& }. j" M/ v! ?, ^
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, {0 v4 B6 b4 o) t
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。 U: C5 P7 F. Z# E T$ a
2 F N: w& ^; U/ Q( q
. i ~5 a, Q1 c, J5 G& e) x
|
|