|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * C- K( [1 e4 g9 o7 s/ y# k
- [code]EDMA sample test application
$ v# t! p- o; j: M! V2 a% H - /*4 j8 q' C0 L3 [' r4 K
- * edma_test.c
2 W* O2 F1 }+ ] - *9 K3 V4 n7 U3 O
- * brief EDMA3 Test Application
8 j8 m1 l) G+ d; ~ - *
# v& s; k% a3 O% n - * This file contains EDMA3 Test code.& k; S1 e% x% V( r) }, o' E" S
- *3 C& u$ _" j8 Q+ A3 }0 S
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ h; h8 R* X+ c& t, M8 i9 q
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
0 }6 I# c0 I% R5 O - * TO CHANGE. P( Y% @* K! f+ F
- *! t' w4 {' E9 ^
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 s: I) s6 x) m; n, s! q+ c0 d
- *
- m, k. M6 }4 |) \* v& {/ } - * This program is free software; you can redistribute it and/or2 A( b2 a& w" v! J5 @
- * modify it under the terms of the GNU General Public License as0 v7 @- O3 s' @( z# R
- * published by the Free Software Foundation version 2.
6 b k( i+ c U0 |4 M" c+ ^ - *
3 j4 v+ M) I, Q. F" X - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
( I# ? U# q: R5 a$ Q" E% ~ - * kind, whether express or implied; without even the implied warranty
5 ]& O* l) ^7 i8 t) K - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# [7 V: V9 C" Y3 k6 L) J [ - * GNU General Public License for more details.
5 O! L' G R9 F - */
+ t3 p0 a2 Q) B, L; ^4 }2 ~
, |+ E. P0 S$ }( S7 i# k6 M+ D5 k- #include <linux/module.h>, v" W! ]9 b& [. ^) ~* l! c# l
- #include <linux/init.h>2 N: M3 z, G, Y; q# Y1 i
- #include <linux/errno.h>1 }! D' c7 i% e3 n
- #include <linux/types.h>2 T' o* h1 `+ a# @& w
- #include <linux/interrupt.h>
" c; j) H9 M- g" n - #include <asm/io.h>, {# R6 }& ]+ s% R9 H* B
- #include <linux/moduleparam.h>
% D; f3 y/ K0 V T - #include <linux/sysctl.h>3 T# {/ B1 b& M# O2 s
- #include <linux/mm.h>4 g6 c+ p+ j* V; t- Y! O- Y
- #include <linux/dma-mapping.h>
/ i/ n: {! q+ f, ?5 o8 q [
! I( O: ]; l3 p3 K( Q/ m- #include <mach/memory.h>' C. z3 W* q( }1 S
- #include <mach/hardware.h>5 b9 | p, t3 e! s/ ^- F
- #include <mach/irqs.h># S- s9 {$ v, a+ b; y/ f6 B0 l
- #include <asm/hardware/edma.h>
; F7 X. G5 b3 r; V* X - - u! X" r; V/ p/ t2 @. h& X
- #undef EDMA3_DEBUG+ i' R; s. y- {; r9 {# [; _. P9 h
- /*#define EDMA3_DEBUG*/* N, [# J* X2 X2 }9 @& [
3 p8 y7 }: h# H- I- #ifdef EDMA3_DEBUG
4 L q: V- u P - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 g w+ Z7 l# M9 ? o/ @
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
3 y, `- k8 N4 o" `3 V - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ T2 L# }9 x" Z0 V% }
- #else( O+ V' r, K& N
- #define DMA_PRINTK( x... )6 U: e# ]; O _
- #define DMA_FN_IN9 [+ v! Y2 v$ `" ?- f, M O
- #define DMA_FN_OUT" R( L( j: o4 r8 p2 {) K
- #endif! V I1 f0 J6 m! `4 q* r
- ' V* D) k& E. V; h; E) j M
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)( k; Y# o; F& M$ {/ I2 A5 p: c
- #define STATIC_SHIFT 3
4 _8 B ?: H) G' g% r - #define TCINTEN_SHIFT 20
- x; h0 U' W/ W0 O - #define ITCINTEN_SHIFT 21* L0 ~, k/ n& A0 |0 D
- #define TCCHEN_SHIFT 223 c: T( r' ^/ v8 j: u! \) b
- #define ITCCHEN_SHIFT 23
* }3 b% x- r4 e, d
1 v2 b; Z# R8 D9 D3 e- static volatile int irqraised1 = 0;
. E. A' J2 k8 h- u* Y - static volatile int irqraised2 = 0;
3 s$ O! `9 H0 N+ K
w, R9 D: F: \- q- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 N2 A" r. F; w; ^. P. E
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 B8 l! q+ z/ a - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 Q# J* I8 U2 \/ x7 w: S( N, Z - 8 w' H; j. H: L* R2 s
- dma_addr_t dmaphyssrc1 = 0;2 b! g( ~2 h. \, E& [1 c# Z4 B: E
- dma_addr_t dmaphyssrc2 = 0;) g# r3 x& ?2 i( z R* G2 ?' u& d
- dma_addr_t dmaphysdest1 = 0;
; r) B4 {* K2 `" Z6 g0 } - dma_addr_t dmaphysdest2 = 0;1 d; v4 W) \) \
7 G( i0 ]! o4 ]" {) \9 ^& {- char *dmabufsrc1 = NULL;
& C/ g6 ^' e- `( b8 \7 m. j* h$ ^ - char *dmabufsrc2 = NULL;
# n1 B) [5 X; t+ J - char *dmabufdest1 = NULL;
; y. d# W7 _7 u! n. _, J - char *dmabufdest2 = NULL;
m& ]" t" Z, M$ Y# ]
6 b" x# g$ ]6 g* E- n# d; ^- static int acnt = 512;3 V d& n1 h8 r; A- ?, R, o! }
- static int bcnt = 8;" ~0 B$ o: l6 v6 z
- static int ccnt = 8;
2 m2 y& g5 ~6 u/ A8 T - ( Q6 j/ i" r4 j) m3 O* e9 s; Q: p
- module_param(acnt, int, S_IRUGO);; \. s) O; I% [1 F
- module_param(bcnt, int, S_IRUGO);
1 q+ P0 L2 p% R+ i5 U - module_param(ccnt, int, S_IRUGO);
复制代码 # Y8 j3 M; G. ^2 W
& l" m7 _" p: C, I; j5 [% F; U 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- \: x* r/ O& I0 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& @7 c3 ~* h. T 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
k8 C2 H3 l: D: Z' M& {; U' @9 m. v7 n3 }8 d0 p1 g5 h, x
0 d) s- P# B* O; t |
|