|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% G% O0 Q, S+ f& y" i1 P- [code]EDMA sample test application
" Y2 t* R; Q, z1 f# w+ z* a - /*
) H& @4 g9 t& c" ]8 j& T2 l# d - * edma_test.c8 S, q" J/ U" a+ H
- *% v/ W% f! s9 u O0 N& \+ q& U
- * brief EDMA3 Test Application: {1 `) G( Z4 }, Q# Y# `
- *. {% z2 M2 L8 N- K; ~ U, y
- * This file contains EDMA3 Test code.
# S/ ^1 p9 L: F u5 e$ e! G - *' i8 C4 \; E6 [; P c
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
( }+ c6 Y: z' G' E( U1 Y; T* }) U8 F' A - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% i8 v3 E/ }( x% a4 H
- * TO CHANGE.
: V7 G; w* L m7 i3 D; P. q6 K - *4 {6 n. r/ K+ N+ G, A
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
' i2 _! M8 {$ d Q( ] - *
+ O" G; r6 m7 m0 Z- `, @0 [ g - * This program is free software; you can redistribute it and/or
- l4 w. M6 g% W; H" P; v" ]$ m! y( R - * modify it under the terms of the GNU General Public License as3 P* V) H5 H& e- t+ L6 m) F
- * published by the Free Software Foundation version 2.5 N G+ Z* s7 K3 Z2 i
- *
/ m: M/ J! \( y9 F - * This program is distributed "as is" WITHOUT ANY WARRANTY of any! v4 ?- j1 V3 M8 G) R; [
- * kind, whether express or implied; without even the implied warranty
* N- A$ \8 v# t% v1 w$ q: B - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the8 c, @ t9 Z) f! ^( E: e" |$ K% ^
- * GNU General Public License for more details.
. A3 T; W+ r" H$ i0 c - */
. p9 |7 P- f. |2 | - ' l" a6 ?1 f$ b) m# F
- #include <linux/module.h>
! o/ x( Y! e7 N/ L2 j Y - #include <linux/init.h>
6 U7 w a9 `& H& b3 \/ t1 I) u% r - #include <linux/errno.h>
( p- ~7 o' g0 _" g2 L+ T5 m - #include <linux/types.h>8 V8 j6 S. _/ K1 l) N" D1 Y
- #include <linux/interrupt.h>
/ |. x' N" t ]# x - #include <asm/io.h>5 d5 I' v# A: ^( |
- #include <linux/moduleparam.h>
9 O* a9 p! \/ H - #include <linux/sysctl.h>
U. x! R7 N5 \/ J - #include <linux/mm.h>8 L) J G( }( h; N% f C5 _1 q
- #include <linux/dma-mapping.h>
3 ~ k: z3 @% }! |. H
0 K# J1 ?/ @) E- #include <mach/memory.h>
6 f& x1 `- B# {$ A9 g( i! `) _ - #include <mach/hardware.h>$ a, }! x2 |7 h3 t) c
- #include <mach/irqs.h>( k' G+ ^5 G. M# i. V
- #include <asm/hardware/edma.h>; Y4 R; E, W; O) e" ]
8 t8 Q& t( w; Y3 ~+ d& N- #undef EDMA3_DEBUG; t0 N+ k9 O4 m9 P" ^% Y
- /*#define EDMA3_DEBUG*/4 y3 F' f: g) ?# K' _5 Y
- - h) ^# z; S0 O3 W
- #ifdef EDMA3_DEBUG
3 e8 e1 V4 k: D- J - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
0 x2 W! t( d% T7 I) | - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" f# c; z A6 I [9 O. F* y" T0 v
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
1 L8 t: z- ?# o. \4 l - #else$ i% c4 b% [2 U+ ]6 t
- #define DMA_PRINTK( x... )1 [( P9 R# G S0 }9 X5 }& A2 T
- #define DMA_FN_IN
: ?) P5 R8 a* g. b - #define DMA_FN_OUT
1 B+ Y& v. z+ Y6 E \4 M - #endif$ g) l. C6 r% y( |
- 2 x( s6 ?" z9 [' O- g2 @8 m" w
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
9 w* P1 F1 \* m! \5 T+ ]1 l' b - #define STATIC_SHIFT 3% S1 W: r0 V! d1 D2 u
- #define TCINTEN_SHIFT 205 w$ G4 r* s: k2 _. y$ s$ e
- #define ITCINTEN_SHIFT 21
6 Q9 o1 a1 D. W3 R3 K - #define TCCHEN_SHIFT 226 y. K, t8 b3 O& `5 U8 S
- #define ITCCHEN_SHIFT 23
4 U& [4 N+ x/ v& V - * _* B; q: g# }, L, _
- static volatile int irqraised1 = 0;
k- B( q# V9 f. w3 m - static volatile int irqraised2 = 0;
% o) U7 p* Z4 x" S. F0 k1 `3 f# G
1 k6 h S3 A' q( m1 d- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 B: a9 M g: B! P - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ S+ h6 Z6 O. W* O- |
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ @ |+ B! c; a+ o/ ~' X. ?+ g# u
* q: z2 l2 p6 ~- dma_addr_t dmaphyssrc1 = 0;& R' T( [0 a) D8 r% a. x2 b
- dma_addr_t dmaphyssrc2 = 0;
$ Y7 W) U; {) D3 P; Z - dma_addr_t dmaphysdest1 = 0;- I7 P$ O% {0 L5 r- }2 \- Y1 v" @0 d
- dma_addr_t dmaphysdest2 = 0;, l% ^; w0 V2 M, y
5 m! S* F: K. i' O3 o; S- char *dmabufsrc1 = NULL;- K; i, ?5 A' C* j b& E2 m
- char *dmabufsrc2 = NULL;
$ Q9 q0 z" h! b$ ?& p - char *dmabufdest1 = NULL;; A; b# E( U, ^) ~' G- G R
- char *dmabufdest2 = NULL;
- P3 G. _. \7 T* I, J0 S# ~ - z4 k9 Z; a" T1 [
- static int acnt = 512;
9 `, i. T& m* Q' R9 T D1 s9 s - static int bcnt = 8; ~2 H3 F1 X" M; t# M
- static int ccnt = 8;) v' S2 M4 C d2 B
/ `. {# j3 I- F' p- module_param(acnt, int, S_IRUGO);
/ r0 d5 B! K2 |) ] - module_param(bcnt, int, S_IRUGO);
% M" s3 L8 j! _# b& ?/ e+ w - module_param(ccnt, int, S_IRUGO);
复制代码
5 U* t$ [9 h/ r' H
- m7 D9 ~+ }( L1 I$ k 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% N- Z4 {3 e. R/ G) r& ~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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。% w( ]' _* k! p3 o, ?& H( V( D+ z) u
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# X5 L5 k$ ~+ `4 n/ {
9 |* k: ^! S) A; j# V( r' y2 ^* P; N- _6 O
|
|