|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: f! A1 C$ |$ j- Q- ]0 t* J w- [code]EDMA sample test application
: Q) C2 O1 v5 D; y! u: k' h - /*, d4 _$ F+ w, w4 [4 ]
- * edma_test.c/ l; L# |: T4 t8 u: N; F z
- *1 }3 h) t" o% N
- * brief EDMA3 Test Application& h/ p& s3 p/ C) t) [
- *
. y/ n- W5 \$ N6 G$ f& ` - * This file contains EDMA3 Test code.1 M. N6 z+ X- Y* D, z' V
- *: h6 z7 h6 d( f. Q/ l' d
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 w- Z1 s5 Y Z {
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
% d0 U2 g2 R8 { - * TO CHANGE.9 r! n6 O1 G$ g" h4 ]7 m9 i
- ** X& {7 _5 G5 o+ ~" {6 F1 e0 p
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
, o$ c0 b& }4 G - ** l h1 a, z% Z+ I$ o
- * This program is free software; you can redistribute it and/or
! h& a6 }1 j: Y% ^ b& ~2 D' { - * modify it under the terms of the GNU General Public License as
; h* _7 I! r: e2 y - * published by the Free Software Foundation version 2.; J# J: z% b, o: m
- *# c) C/ _2 ?; _- @# j& Y
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 K+ H) D0 M) k' `
- * kind, whether express or implied; without even the implied warranty
0 s: F+ G: a! d0 `$ k; Q# U - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5 u: J+ [9 Y- v% w% X: e - * GNU General Public License for more details.$ X4 n: N- x o, J. u2 F4 x% \
- */
$ \4 g; A6 S) k2 P) l5 `- v
2 y S9 \7 H1 f& n8 O: L- #include <linux/module.h>9 z. Q& c; R2 g
- #include <linux/init.h>
6 V4 d- e( {/ y, B& Y% F6 \ - #include <linux/errno.h>
, G+ |2 V, }1 j- H/ \- x/ [* ^ - #include <linux/types.h># X) D6 \6 u3 t2 A8 o# {
- #include <linux/interrupt.h>
, a' i5 S! w! U ?8 s, k - #include <asm/io.h>
4 ]) \' c6 ?5 V4 M- ^) e- `. n I - #include <linux/moduleparam.h>
3 _; c. h* V0 d9 n7 H - #include <linux/sysctl.h>
. `% [# s# }* a6 Q, g4 w' v - #include <linux/mm.h>" K$ Z n$ G2 z1 U. |7 i
- #include <linux/dma-mapping.h>6 k! [* \9 C2 S$ p) y
- / ]) y G) f( D2 g4 f0 V' T
- #include <mach/memory.h>- F6 X5 p0 J) h3 ^7 s* L; [8 J- c
- #include <mach/hardware.h>
* e* P# i$ H* k$ f - #include <mach/irqs.h>4 T! E s0 [) E7 F
- #include <asm/hardware/edma.h>
* P! g: f8 \6 z - e( J) Y/ n. ?; A
- #undef EDMA3_DEBUG2 b6 t1 o2 b. z' d% n. `6 [
- /*#define EDMA3_DEBUG*/
# [$ y. c" ? P0 |$ n - 6 h# a) i, V8 y4 g
- #ifdef EDMA3_DEBUG# H9 ?1 `- i( l
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
6 O; A$ ?- j0 k% B7 }+ P1 f - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
q2 w8 q4 P! z( |' P7 x3 x - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
1 `0 e6 k. v* ~' u4 O" Y - #else
% w% N+ O4 U* k9 T# K - #define DMA_PRINTK( x... )1 T7 h3 S6 t _7 b1 A/ }; w% Q
- #define DMA_FN_IN* P; A: }% L2 Q* {0 j G
- #define DMA_FN_OUT
# x- J4 }: t0 ~& B - #endif
7 O0 y+ A( L( w5 E( V - 0 A4 g/ s! m# ^. K$ T% l. ~
- #define MAX_DMA_TRANSFER_IN_BYTES (32768), B# c! i: X& K; S
- #define STATIC_SHIFT 3
( k! B, D9 A0 t) q2 R3 ^2 t* x$ M. V - #define TCINTEN_SHIFT 20
3 k6 N7 r; R5 O - #define ITCINTEN_SHIFT 21
2 D. K9 }: f; M( [! K - #define TCCHEN_SHIFT 22
. V( L2 t K( v* G - #define ITCCHEN_SHIFT 235 R! h; w( c$ M+ c. s) L# A0 i
9 w1 P6 |; x: e, b# X% q: u- static volatile int irqraised1 = 0;
+ z- | F' H5 z$ R k4 {8 Y0 j - static volatile int irqraised2 = 0;
# u; F7 b$ M& s. M- V9 B - ' O. Z( K" R- j9 f! x# m1 H
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& @9 [& e3 m8 c. ^" z
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
e' ?2 C# v2 R8 F/ A- C7 E; d - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ m2 D( m6 o4 t: {+ P& i1 Y: o3 Q
- 5 Y) m; ^; H5 N
- dma_addr_t dmaphyssrc1 = 0;
* v: C& R, e$ D) D0 K% x: S; z - dma_addr_t dmaphyssrc2 = 0;
7 {* t+ v9 p( ]2 X - dma_addr_t dmaphysdest1 = 0;" O( z5 P! ?- {9 T
- dma_addr_t dmaphysdest2 = 0;
/ L. H% K8 v3 p - : u R. V' Q) d" h8 a& c9 i) p6 f6 k
- char *dmabufsrc1 = NULL;' D0 S3 R) x" w
- char *dmabufsrc2 = NULL;
: e }& g3 \5 t7 Z: X - char *dmabufdest1 = NULL;5 I- C4 M+ R% S7 ~( B% P ]
- char *dmabufdest2 = NULL;
8 w, \5 A4 [+ |* X" D j9 w
; b6 x# h f) I9 X- static int acnt = 512;: z+ A8 R; ~/ ?' q
- static int bcnt = 8;
; q5 l3 }. D% e7 N, N; y! ^9 k7 c - static int ccnt = 8;
6 s0 P# i. f2 ?5 x4 C% B4 e7 H7 ^
( \8 x& J2 ~& c4 n( x5 ~- module_param(acnt, int, S_IRUGO);
# G! B& d5 H+ O p% Q - module_param(bcnt, int, S_IRUGO);
`$ q/ J# D: C n5 c - module_param(ccnt, int, S_IRUGO);
复制代码
0 x0 [& x% b9 D6 E, J$ j K* M, x7 _0 j( F& L
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* a) E3 a7 S: q5 }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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 I0 E6 z# S4 W; a3 x* V 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 e0 m6 o- t$ P) H" P: P4 ~" `) b! \
j9 ^* C+ Q/ A0 s
6 k6 V* D) f/ s y. G* Y |
|