|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, {: |6 X6 r- B) d0 c5 ?# c; ?7 q8 N- [code]EDMA sample test application
8 T8 e2 H1 G) w; S- q& @" c. n" y - /*
( c: x3 b2 i% \* s - * edma_test.c
8 k" K& O& c4 l; U' j - *- K! y5 r7 W: n3 h7 C
- * brief EDMA3 Test Application
/ E( @. ~. ]; [) ^ - *
! c. J R* W6 v0 k - * This file contains EDMA3 Test code.3 d+ `! L" K4 A2 a" _7 \$ k
- *! J. H2 W4 A2 M5 c* ?. l/ L% t2 p
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 u1 I: }2 ^& z) ^9 V5 f6 s) R
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' {* @; C. B2 s( A
- * TO CHANGE.! h8 Q' w7 ^6 L6 g' C
- *
) O( P) c$ d/ X1 ^1 Z T - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
8 Q0 q! x7 n/ r7 T; Y8 e - *2 ?- G; q! y9 X( }$ |* J$ v
- * This program is free software; you can redistribute it and/or
0 D; H' @0 b% i5 V( @ - * modify it under the terms of the GNU General Public License as
! l" J/ u( I, ^: o$ @ - * published by the Free Software Foundation version 2.- m9 c- U; y' K( k6 v
- *
3 ~' R8 D5 z; b" _& \- P% m) K - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
( \) a7 w7 A. g - * kind, whether express or implied; without even the implied warranty+ _$ k: d) M0 Y' c8 F
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the n, D# e# e$ U! O) ]
- * GNU General Public License for more details.
l: Q! L$ _! C5 R* a6 h, j - */* b* h8 X, d! i
- $ C1 v% _' r- n; U9 |0 j* C
- #include <linux/module.h>
( q0 g, D# ^' B( F( B - #include <linux/init.h>
- t. V0 p1 F6 D7 N( w. h% l - #include <linux/errno.h>
. q! f' N: P3 Y - #include <linux/types.h>
( } l- O$ r9 y8 p& Z# ]( T$ K - #include <linux/interrupt.h>
; |; L/ p: o+ y; ^ - #include <asm/io.h>1 p" h" J3 _& [4 L5 \- R
- #include <linux/moduleparam.h>7 x ^2 [6 B; p5 B
- #include <linux/sysctl.h>
+ i: Z0 _3 G* E - #include <linux/mm.h>, v" ]1 a5 d; Z8 V4 ~* |
- #include <linux/dma-mapping.h>7 t* u) X2 U+ g2 U$ i8 N7 [
- o. p8 f- K! F @9 y& \2 Y7 b
- #include <mach/memory.h>
, { F/ f! f2 L p! S5 d/ a - #include <mach/hardware.h>& t4 \( K7 f2 J# ]4 A/ e4 W
- #include <mach/irqs.h>
& B# n1 Q* n6 w: V' b$ Y - #include <asm/hardware/edma.h>
( |' {% |5 I" r9 H9 w - & T- ]6 ^5 I/ o. F2 H
- #undef EDMA3_DEBUG
, K" ]0 J- _7 K4 G* l! j - /*#define EDMA3_DEBUG*/7 [0 T# U3 g6 U! p( {$ C! o
- * I1 W5 p3 [# S
- #ifdef EDMA3_DEBUG6 G" h; {% P: u1 q0 j# z* \
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
' C+ M" E3 A7 r) s, N/ ^( ~ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
( g: ] N. X+ g - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% C/ H& U( [: f3 a
- #else
' f' w" v: C, f% O/ y5 a - #define DMA_PRINTK( x... )! R2 x7 F! i; Z5 p! U3 S& A$ u
- #define DMA_FN_IN
' [/ g9 q, M. Z6 w _+ C$ E7 ]. `3 a - #define DMA_FN_OUT
) W0 w: A# V- H' h; x1 R/ Q - #endif
) [4 T% x8 v0 e' s0 |5 L8 ?
7 F E6 k; y6 O& h5 c, w- #define MAX_DMA_TRANSFER_IN_BYTES (32768)2 ]/ H- b+ L/ r
- #define STATIC_SHIFT 30 J% L: W) ^/ Z: n! B4 P& c
- #define TCINTEN_SHIFT 20
1 D+ e8 k. z7 t$ _# M. d: P - #define ITCINTEN_SHIFT 21
+ ]+ p% ?5 Z7 F% ]# c* U - #define TCCHEN_SHIFT 22# n, u# d8 r6 _ @8 o8 P8 H4 v
- #define ITCCHEN_SHIFT 23$ b: n+ ^* ?8 K: R, }# n
- 2 ?2 C# {! Y: e- x7 U
- static volatile int irqraised1 = 0;0 a7 F2 w8 `7 Q3 X! f
- static volatile int irqraised2 = 0;
: d/ P% ~0 v% F2 P+ b - 8 O- T5 ^/ u8 |) r/ B
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. t; M, C b9 Y - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& ^: n4 Z* C9 \
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; `9 O( M; [9 D - + `( h6 z0 ~8 @' E' s& ]8 q5 t7 z
- dma_addr_t dmaphyssrc1 = 0;
$ {0 T* b0 w' W. L1 W/ w% T- @ - dma_addr_t dmaphyssrc2 = 0;/ X2 ~9 K( I, \7 Q
- dma_addr_t dmaphysdest1 = 0;
8 z( R) X* Y& G( N/ q - dma_addr_t dmaphysdest2 = 0;) [+ [7 |, d$ q: T, x; q
, N" k, k1 d" w: E# V. t- char *dmabufsrc1 = NULL;
& b2 U1 R: j' \6 v& L) m - char *dmabufsrc2 = NULL;
8 _2 i# H; J. R - char *dmabufdest1 = NULL;3 C9 L: R' r2 N* G5 K
- char *dmabufdest2 = NULL;
# Z1 I3 r& E z6 l# P. z5 u+ s
. b3 O+ x: X/ M' c- static int acnt = 512;& g* ]/ ?2 V$ @4 n
- static int bcnt = 8;
B& \0 b4 E1 L - static int ccnt = 8;" h5 N* c; \+ [9 a2 Q* Z1 n) D3 }4 w
: |5 _, a5 ~3 H, ~- module_param(acnt, int, S_IRUGO);
( w! Q2 M/ s! @5 D. H! R6 R2 q3 p7 T - module_param(bcnt, int, S_IRUGO);
2 Q1 I. F& _! S. D - module_param(ccnt, int, S_IRUGO);
复制代码
2 H6 u9 w w7 t/ E2 V6 o( E' [: L9 q4 E
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) v2 g" A: ^& F# }
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ u- ^, m" _; Y) T! N+ @9 m6 s 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: c+ T5 y% |2 R8 l7 m
5 L' h% h( N5 x8 M
. n% z9 Q3 n& @0 U% J |
|