|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 U6 n9 \/ [4 k- Q- e D- [code]EDMA sample test application5 ~( T, ?& C% x7 w" ]+ w. F
- /*( L, P6 S" }# H% s, j* @* E& Q. R- U. a
- * edma_test.c/ ]% L" w' Z6 D1 @
- *9 x2 g+ h% S4 \+ \$ K1 B# j
- * brief EDMA3 Test Application
3 y% \0 l# N9 Q( h) F- T7 `- y2 ~ - *
7 v& S1 i( Z2 U; d - * This file contains EDMA3 Test code.: Z# w. r' F" @1 o# H' o$ }
- *
* z- h# p Q; X9 [% w$ S/ ] - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
1 Q$ O' ^1 s; u7 ? h - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
- J. m% W1 e$ { - * TO CHANGE.8 L' [' g* d5 W# N' C, J$ J+ R3 K
- *9 {5 n# I% l6 Q* w3 S
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 f/ c% @% r, l) w
- *7 j# j; F V; D U3 R
- * This program is free software; you can redistribute it and/or
+ R) c: @) Q9 B8 L* Y$ x' W - * modify it under the terms of the GNU General Public License as
" p5 ^* G: i9 G! g - * published by the Free Software Foundation version 2.9 ]- [* u2 k) _* P: x' ^# N1 p! ]9 Z
- *9 h; }; t4 h5 w* M3 G4 I. B( }
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
) s. U) B" q& ~, w" O6 [7 V - * kind, whether express or implied; without even the implied warranty
0 r2 {* X D, Y4 H/ T) j7 }. u - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6 N9 l! W% z' h# B3 f" T6 @% @ - * GNU General Public License for more details.
1 Z& P& s4 Q! \9 } - */) ]% G1 @$ H; F# ^1 t5 h
- , |5 Q( z" A8 B1 ?
- #include <linux/module.h>
/ f# C; F; S0 W! n - #include <linux/init.h>1 Q6 T8 Y$ u% f5 c4 E' F6 o0 c6 x
- #include <linux/errno.h>
8 b0 h0 _3 T4 @, t, a% X& k& _ - #include <linux/types.h>7 J+ E, N5 F0 f; B+ q
- #include <linux/interrupt.h>
! L6 z! |# ^4 n3 K* ^# @& M+ u - #include <asm/io.h>
$ d# T& P4 `! |9 F - #include <linux/moduleparam.h>/ C8 j4 J# t% e H6 f s/ ?
- #include <linux/sysctl.h>! |7 J, D5 K# p. X2 H
- #include <linux/mm.h>3 y, ~# O+ W/ q8 f# H6 q
- #include <linux/dma-mapping.h>2 m6 A" r5 ]: _9 q% O! r
/ S& ]3 o4 x9 `; P- #include <mach/memory.h>
7 u/ V* v: z% ^4 @ - #include <mach/hardware.h>
% n, D; c" ~. ]1 s - #include <mach/irqs.h>
! k d2 y% B- C - #include <asm/hardware/edma.h>
& m9 i8 ~+ a) E4 i
4 B! i* A6 b" k- #undef EDMA3_DEBUG* F/ y- T, j0 h+ v, x
- /*#define EDMA3_DEBUG*/
" v3 D3 E. B C/ s3 u
( H- B, h! e7 G/ D0 ?- H- #ifdef EDMA3_DEBUG" s N! X( j: V7 J
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
9 @! Y* s4 k& v - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# Y j0 c6 L4 }2 b
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
( d. _1 n9 o/ F - #else2 N* `' U* c: `( y
- #define DMA_PRINTK( x... )
. b0 n: h, } \7 m( g1 A. i; Y5 y% w4 U' e - #define DMA_FN_IN; y( {6 @! e1 Q# x2 Z* r9 H
- #define DMA_FN_OUT+ O/ [) t! D5 r7 y1 ^! H+ d2 _
- #endif2 a; e, o0 |4 F5 L# x
- M2 [0 u0 R0 h& u& ]# _4 k
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)+ b! f5 t2 T" h7 |& c- b& }9 T
- #define STATIC_SHIFT 3
7 ?4 i5 r7 b4 u& S% J1 ^% f - #define TCINTEN_SHIFT 20
" r% y$ ^& |, q4 m - #define ITCINTEN_SHIFT 216 T* p' t& |: j
- #define TCCHEN_SHIFT 22
3 e/ Q9 k* p/ o( F, k - #define ITCCHEN_SHIFT 23
! d% r: A) r( N: `) N |) o - : M& J. A. C. y6 h$ o
- static volatile int irqraised1 = 0;/ S' S) @$ B- x: c# t* j- V
- static volatile int irqraised2 = 0;
: `) Z& u5 L8 H5 Y8 A - 7 O8 P3 r) _7 ]
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! F. Y5 Y$ r$ C3 Z1 b7 J$ o
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( d2 W7 }2 Q7 K- s0 a
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 b+ m9 Q1 [5 k+ i0 X- S; s
- 6 O$ ^1 g- D/ N# p& C
- dma_addr_t dmaphyssrc1 = 0;
$ J& A4 b9 Q4 {* e: F% j0 `( t1 \ - dma_addr_t dmaphyssrc2 = 0;
6 n7 h7 H. ~# o2 u; p - dma_addr_t dmaphysdest1 = 0;% S# g. z# p5 m+ ~
- dma_addr_t dmaphysdest2 = 0;
! ^3 ?( S0 ]0 ~ - 8 C4 E) O- D9 D E1 ]& u1 M
- char *dmabufsrc1 = NULL;
7 S. o, y3 h; v) U* C - char *dmabufsrc2 = NULL;
) H9 c+ D3 i- W* h - char *dmabufdest1 = NULL;
& z+ N; m T5 X9 _( N - char *dmabufdest2 = NULL;$ d/ ^, u; P; c: S+ t2 a
- 5 V) a& s0 y6 b1 M, q/ n8 T
- static int acnt = 512;5 R& @0 P9 D. Y& G, `) r1 a: t( r
- static int bcnt = 8;
9 Y3 w1 r& D1 @- H" v5 m, y - static int ccnt = 8;
V' y. D& P" U* f - ! z; u! v) r+ {4 ^
- module_param(acnt, int, S_IRUGO);
6 d+ A$ J4 ?1 |3 C* r8 p" c - module_param(bcnt, int, S_IRUGO);3 m G: k8 u/ x
- module_param(ccnt, int, S_IRUGO);
复制代码
$ T; X# I& k# u4 o) L4 _
2 H6 A5 _4 \* H# W: `1 m+ h 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 \ |! h4 |# l2 Y6 o1 g% @- l ~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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ V! H5 t% j( t- m% y/ l: e. C
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ L6 d7 t4 R/ Z
. j5 W% R5 b/ ~) R+ ^4 X' e
& o7 K# t6 z: e, j; C
|
|