|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # X/ w2 @' N% W* V
- [code]EDMA sample test application
. g; h% [* Z; |. r4 h - /*8 w* D J: O/ d
- * edma_test.c
% C$ s9 _: z1 u* S. C - *6 n$ p% `1 N* H. t- @
- * brief EDMA3 Test Application
2 J: R. i: P8 L8 u3 F1 {' V7 b0 j - *+ s, \: {) k2 _7 s0 V" s# k1 P
- * This file contains EDMA3 Test code.5 p8 R* F! [6 O
- *
. N9 d7 {2 Z+ x( D5 F - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) o7 V4 G7 D& k7 E
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* J$ D- q( X, I0 H. R1 f
- * TO CHANGE.- G. Z- c( ?3 \1 q
- *
8 Z' x' M1 f* y# T - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
v9 L) E5 c, J/ ]7 Z3 U - *8 {& R+ J* u9 Q
- * This program is free software; you can redistribute it and/or% y8 c* w6 d' _/ J* _" q) i
- * modify it under the terms of the GNU General Public License as
2 j* n2 z+ u2 M6 V' P - * published by the Free Software Foundation version 2.5 i$ i [, U$ }* k( x
- *
. x8 \, o1 s' V6 j- F8 C - * This program is distributed "as is" WITHOUT ANY WARRANTY of any; z/ v, T$ R& @* i) f
- * kind, whether express or implied; without even the implied warranty
3 V# @. T# K1 p& j. ` - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the8 H! i+ B" F$ P
- * GNU General Public License for more details.
& P1 y1 o* `% {. h! B4 D% y8 @ - */
5 K; o% b8 Q1 \% [; O6 a. n( h - 5 J2 c* W% [9 |! j* C. Y
- #include <linux/module.h>) ^, R0 u$ X: ^: ?" R% e
- #include <linux/init.h>3 n8 Y3 f/ ^1 |( x6 w% s: c
- #include <linux/errno.h>
. d* x( i, N& Z+ T% I4 j - #include <linux/types.h>- |% D, k" ] t/ O' x& r
- #include <linux/interrupt.h>
/ s' l" i: @! R2 X2 [/ n6 J+ V - #include <asm/io.h>
$ K( d0 f6 m" D+ v4 e+ K2 k - #include <linux/moduleparam.h>8 V* b5 y; e) g. y/ d+ Y
- #include <linux/sysctl.h>
# Y h3 b7 d+ ]9 w4 c - #include <linux/mm.h>* p6 N( S! g. u; o7 V8 P- g
- #include <linux/dma-mapping.h>
" ], @1 Z- J/ G6 S- g/ t5 _5 ]
. L! i4 y& ]9 n- #include <mach/memory.h>1 W7 j$ j- ^7 \; a, R: j+ `
- #include <mach/hardware.h>
( w1 c$ f- _& L - #include <mach/irqs.h>
& P5 _7 g; V1 V. M - #include <asm/hardware/edma.h>
" i$ l( D( _) G2 }' p - - ?6 H2 {1 M2 L/ {$ G
- #undef EDMA3_DEBUG
" V2 m9 _& w6 w& S1 c - /*#define EDMA3_DEBUG*/
: Q2 S1 b! w2 a4 e. ] - - x5 D" h0 Q8 Q% ]! r
- #ifdef EDMA3_DEBUG
4 _$ B- V, P& e! t6 J - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" i/ h p% ?: U- ^1 F$ d8 A# y
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! s# y. |9 r& a: s7 A6 D7 c- t
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
- k6 o' E+ ~0 b - #else
. t3 r& H) \/ L, z7 r - #define DMA_PRINTK( x... )2 @0 s+ p7 F% q" ?
- #define DMA_FN_IN! p) M8 l, d) Z+ P2 a0 L
- #define DMA_FN_OUT; [% L5 M- s: e; O" z9 {- f
- #endif2 Z" G. ]" n# y; }, [ B$ P
: [6 y7 @+ I5 c- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
. F. |- k' W0 |+ V! L3 M C - #define STATIC_SHIFT 37 _+ J7 h# I! ?) B; G* y
- #define TCINTEN_SHIFT 20* G, [* F8 ?; b: b) b' v
- #define ITCINTEN_SHIFT 21
! d' u: ^& a# Z3 ~9 A - #define TCCHEN_SHIFT 22( h% A* u2 Y3 W, Q; Q6 n: _8 a
- #define ITCCHEN_SHIFT 23
% P1 u9 x8 {/ s& L8 v! c - 6 F8 X; R) m+ j6 O: h5 D3 D
- static volatile int irqraised1 = 0;
# N6 P; H. h5 e) d& [5 ` B - static volatile int irqraised2 = 0;
, N0 y, X5 r' g! E1 Z! @ - 8 F/ Y4 v5 m# u
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# G' W$ c. j" Y: o" N - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 ^) }4 X& L) e- A6 u - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# ?- ^- l3 n% f$ J - 2 R) N h1 l3 P9 S7 Z
- dma_addr_t dmaphyssrc1 = 0;
7 @7 ~* ~ E! u& g1 _# m - dma_addr_t dmaphyssrc2 = 0;
" o. M0 ^3 b& |+ N& _' g# m6 x; U - dma_addr_t dmaphysdest1 = 0;
! W6 |1 q6 c8 V; k - dma_addr_t dmaphysdest2 = 0;; O* K' C R' R+ B3 p$ N! V
- q# } Y/ S' H( \( A4 A3 M& k3 D- char *dmabufsrc1 = NULL;9 C2 N; M4 h5 R/ J: d- K/ m
- char *dmabufsrc2 = NULL;, a+ h9 y1 R4 u- v, Z7 F8 u
- char *dmabufdest1 = NULL;
+ m: Z( w! }4 g( z/ m. I- a0 Y - char *dmabufdest2 = NULL;
" L1 T8 T, o, }9 ? - 6 E' ? A( l4 z+ ~$ o
- static int acnt = 512;* N" R- Q3 q+ [9 M0 b
- static int bcnt = 8;: g* E1 E" q2 h- o
- static int ccnt = 8;0 @; t9 d$ P) }. ?& k% G( ^6 F
$ p) Z! P2 D' A- module_param(acnt, int, S_IRUGO);
1 l8 ?% n& B3 o# n. }( }4 Y0 ] - module_param(bcnt, int, S_IRUGO);5 S8 g" T" ~8 g- S6 f( A& J- H
- module_param(ccnt, int, S_IRUGO);
复制代码
+ F+ A. d. F. J* j8 }
; O* N" c9 O Z' A2 K4 H 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% \$ m: l% i. Q9 [6 h. Narm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ `; j A2 g- n* q( h) J# I+ u' J 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ b% Z4 M) w, o5 ~$ P! A
* C j: }2 W D+ i3 n5 q6 k
& R0 n; f0 ^6 M, \* A h5 g |
|