|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 _* ~+ z1 c$ Y
- [code]EDMA sample test application
* j$ V# P4 h* O0 D( |+ z; Y - /*5 m: Z* O- r# A2 }# i+ A
- * edma_test.c, B1 k( i# y. ]8 k+ q3 Z
- *+ Q! }8 |& v+ M# h( J6 V
- * brief EDMA3 Test Application
" z- d4 k2 P. N - *9 V! a0 u2 y( `% }) \
- * This file contains EDMA3 Test code.
# \& v: l {& K3 L - *
b Z' t/ F+ w; _4 v( [ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 q) c* x1 p% y9 _5 E" X* W
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
$ k2 \8 m. |) s4 z/ S: I - * TO CHANGE.
( ~( ~1 h& ^% |9 t0 d, Y - *1 K/ H4 t% q* q) c( k, m
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 n1 A; U1 Q* k
- *
7 F% R" p* R% n% `. f - * This program is free software; you can redistribute it and/or0 u4 s0 g, E! J1 ]5 @# G
- * modify it under the terms of the GNU General Public License as: R0 @9 h1 g9 S- r( b: {" t7 w4 n
- * published by the Free Software Foundation version 2.% B" K, s, \% m! e$ q! S+ S
- *
: W! ^% {5 @" M - * This program is distributed "as is" WITHOUT ANY WARRANTY of any- y8 r" K5 I1 W# x& [
- * kind, whether express or implied; without even the implied warranty
5 A3 n+ W* p- L - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the/ z$ }7 B9 s0 ]/ {$ A0 y
- * GNU General Public License for more details.) @' D8 S; o5 P- u4 j
- */
4 u5 e# _# Z: l; w& }+ h0 P
- e P& } y7 C/ @" M$ a7 N- #include <linux/module.h>( a6 j7 d) @. M" p: l
- #include <linux/init.h>
0 B) U& c2 }( C6 ?/ k6 y3 a - #include <linux/errno.h>" Z% i3 y. e, O: I: j. ~. G
- #include <linux/types.h>
& H, |( Q2 r! |. E% k2 f - #include <linux/interrupt.h>3 Q3 g! C+ {7 }7 S6 c5 ]6 ?
- #include <asm/io.h>
/ z" Q2 ?; Q; p6 N } - #include <linux/moduleparam.h>
! C/ ~% t' U, N. b - #include <linux/sysctl.h>' P Z2 A7 Y$ v! W5 u7 H n+ o
- #include <linux/mm.h>; C; R; a/ u# j/ p/ j( Q
- #include <linux/dma-mapping.h>
3 Q! D& Y0 V, @2 J4 Z$ d
0 l R# m0 S- p6 J( A2 J- #include <mach/memory.h>
# ], i& Y: v p' y4 O - #include <mach/hardware.h>" ^( Q! t2 I1 y8 f/ f; X
- #include <mach/irqs.h>) {9 |- a/ @$ x# r
- #include <asm/hardware/edma.h>: v& S. ^: z" D i0 Z
/ E9 I2 j2 P: a x. E8 Z- #undef EDMA3_DEBUG0 Q4 h, X) W* O* |: u
- /*#define EDMA3_DEBUG*/
! O7 u1 d% o+ g! v# S$ E
. G7 c% T+ W* o0 P* P- #ifdef EDMA3_DEBUG
, o$ A5 v L0 O, U, N - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
; [! i- y, q7 Q8 g9 T4 @. h5 b - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 O @, z& d; L( ]8 O: J& d2 Z9 ^/ |
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& R. l7 }/ o# f- t
- #else
' w& i" W. L5 v' {0 K' X; F5 J - #define DMA_PRINTK( x... )' q( ` k& `9 z: ~5 `
- #define DMA_FN_IN
3 E4 w( u5 s" T. g5 j0 \3 ^; h - #define DMA_FN_OUT5 p) ~5 B7 d" {
- #endif
: ~7 F$ B0 L8 H* [) Z% S0 X j - J+ w, |" w0 h5 i0 {
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
/ q" U2 M2 d; A$ ~$ ^2 N4 i - #define STATIC_SHIFT 3
3 [. m& z' W6 n* Q- [" {. o - #define TCINTEN_SHIFT 20
) H. A9 L% R7 l! T% y. w; v - #define ITCINTEN_SHIFT 21/ U* y$ g, E( {" B( T% J! p+ G$ P
- #define TCCHEN_SHIFT 22
9 @1 T! S- h" ^: s0 w( E - #define ITCCHEN_SHIFT 23
& s+ z& ?9 M9 C
, J# a$ y- Y# S9 U* R4 ^! F7 m- static volatile int irqraised1 = 0;
" B7 g3 a. H9 Y5 Z+ f - static volatile int irqraised2 = 0; Y8 u* c1 P: x" e: F4 l8 y
- , D5 j5 x# H& p8 O
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 O/ }9 ?7 W+ p5 j/ h
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ m/ W" Z; M5 h( M4 r5 M; Z! i
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& g4 b6 i y2 U" v r
- 0 l" a; e: N' T+ u5 z
- dma_addr_t dmaphyssrc1 = 0;) z/ G* F7 W( [# t6 d
- dma_addr_t dmaphyssrc2 = 0;
9 |9 b$ c d1 ^1 v. C+ {! r& [" n5 _% R - dma_addr_t dmaphysdest1 = 0;- r& T& a( m6 L( @) U( l. n
- dma_addr_t dmaphysdest2 = 0;. r! N3 L! @6 U& S
- ' {3 D6 h% j0 ]" Q1 a$ R
- char *dmabufsrc1 = NULL;
' J$ Y4 A! p0 p! i c0 R" k - char *dmabufsrc2 = NULL;2 h# I2 z: K& l# j7 d) p+ O
- char *dmabufdest1 = NULL;9 }3 i# [% k" P9 B8 q: j
- char *dmabufdest2 = NULL;
4 Q; q& w4 u" {
( ^3 l8 \3 J- ^5 X. y- static int acnt = 512;
& v& j8 k6 p( G3 U - static int bcnt = 8;
6 w7 k u% B8 e7 X% z: o* A$ L% d! n - static int ccnt = 8;" G8 Q* ]4 |: B! h
2 w% |! _( D+ i% V- N/ S- module_param(acnt, int, S_IRUGO); ?% Z5 p3 }* }/ l( m- T2 c
- module_param(bcnt, int, S_IRUGO);$ I4 p! s) u% h* m) }5 `
- module_param(ccnt, int, S_IRUGO);
复制代码 " w! R1 m1 r4 A8 D0 r1 d4 h
, p" }1 `9 D2 b( } ^) S- I 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 r7 @( ]9 s1 H) I6 n+ c+ R8 I `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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. Q* z' Z7 J+ o x1 b; V, @! \ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 Y1 G2 I* l8 b7 `3 q! T
8 M( X; a! n# w3 X
! G( N o/ k; d8 s' q+ f |
|