|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' k, q$ y0 I$ \4 R6 f
- [code]EDMA sample test application
5 h2 B0 M0 ]! |" X2 k* c, A - /*; S, Q8 N% w# r/ h+ u( S |' I3 ^
- * edma_test.c
- L, i( p- a' f/ X/ \ - *
3 n/ T' j/ I+ b) {' T$ z$ @ - * brief EDMA3 Test Application' `, j& U5 s9 ~) q8 x6 z
- *
5 M: k! x7 { T2 ~ r8 ]$ `+ S - * This file contains EDMA3 Test code.% Y: j8 R, m: \! n0 J% d) G9 b" o
- *
6 d+ |- s9 s0 j2 w - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ r+ h8 U# |' z! V! B, X2 P7 {
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
4 ?* }0 }2 [1 k2 V4 d. ~ - * TO CHANGE.+ a' ?8 \& s0 r) ~6 r7 n4 y' W. M6 {
- *
0 k2 D& T8 ^; F2 n - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 E; ~! q7 _: J! C% ~
- *
; ]% T0 ]( [. Z, v) b' B - * This program is free software; you can redistribute it and/or2 N$ {- o5 E5 {' {& q
- * modify it under the terms of the GNU General Public License as
- a1 `+ B6 f$ ] - * published by the Free Software Foundation version 2.
1 C# Q4 g4 M0 o% N# ~4 m - *' R( S9 M3 d# D5 q
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
' t0 A; a% x" U- \, R: V3 m - * kind, whether express or implied; without even the implied warranty$ Q2 F1 j- a# v# S: {3 K3 c% T
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
e+ Q! U& l1 e$ u; C8 o5 N2 r - * GNU General Public License for more details.; j2 v* B1 J1 n
- */7 q9 L7 Y5 J: F4 J
- - {" @9 o' U; d5 A* Z* D
- #include <linux/module.h>9 n8 o! h+ ^7 Q) M5 w3 h
- #include <linux/init.h>$ k2 r- V: x8 `+ P) i% _; L0 _
- #include <linux/errno.h>5 f5 i4 [# u% [* d
- #include <linux/types.h>; }" K5 r5 y, I6 a( S
- #include <linux/interrupt.h>
; G/ v2 t2 g1 e7 ?3 @' F - #include <asm/io.h>, U/ H0 T+ z1 s7 k, c v; C: H$ ^, w
- #include <linux/moduleparam.h>
8 B2 S6 n2 C- _ - #include <linux/sysctl.h>' [# P7 e' a x# y7 I9 Q* y& r* W
- #include <linux/mm.h>. O2 k- m, p4 v S* d
- #include <linux/dma-mapping.h>
' ~( {. o9 ?3 Y6 k# O; `
3 E: k' Z3 j/ w8 L- #include <mach/memory.h>
! |, ]; Z6 K- h% [3 L( V - #include <mach/hardware.h>, [' j# ?" _" R/ s! o5 t0 W! ^
- #include <mach/irqs.h>0 \4 J! d. a$ ^9 ]
- #include <asm/hardware/edma.h>
! e8 t$ g2 J8 `0 @ - % P* P, N3 S! u K2 Q
- #undef EDMA3_DEBUG8 \7 N& o4 j+ w# f
- /*#define EDMA3_DEBUG*/" t% v. M2 t/ S, B2 {- s
- ' e0 Q) H7 [" `- n6 ]% e
- #ifdef EDMA3_DEBUG. e- p; e- P! {
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) N+ J$ ~1 k- d
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 f8 g2 }1 b- i/ c+ P' O6 D
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) H. R- d9 F" C) }1 h: t- G3 V
- #else4 O+ U B# k2 j. f% f
- #define DMA_PRINTK( x... )
1 Y3 x7 R6 L# F - #define DMA_FN_IN; c* k/ ^4 f+ v1 t) H2 b
- #define DMA_FN_OUT0 d. i6 J& ]" @8 X1 l7 K! @& H
- #endif1 f0 ^. M* {( d; [' ]+ i4 M. R {
8 F) f) ^, d' W- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
8 R% j2 J7 j* @; q - #define STATIC_SHIFT 3
3 }8 k2 S. I4 m2 Q5 p7 s - #define TCINTEN_SHIFT 20 d B8 R% J5 n% \# D2 Y0 L3 p
- #define ITCINTEN_SHIFT 21
0 r4 |5 H' z, @9 U0 u - #define TCCHEN_SHIFT 22
- Z, H$ A' P! z; m- b - #define ITCCHEN_SHIFT 23( N: e& o! e& j% H9 `2 j
! ~, ]7 O9 S; Q' x. G- static volatile int irqraised1 = 0;
" \" \2 S5 S7 \' ]1 Y- @; ? - static volatile int irqraised2 = 0;
& m8 e) k1 C' o
/ q/ J2 T" O# a' l- O- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& W! E( I% x" b9 \( V2 ~( P
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* C# f6 Q7 t4 x/ @- v - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( J1 @7 Z$ L2 T4 R" ^. y3 p! c$ Y
- 6 f f0 k. F( c; K; s) l4 ]
- dma_addr_t dmaphyssrc1 = 0;
- W" G* k5 K: Q4 e - dma_addr_t dmaphyssrc2 = 0;, I0 @9 [0 h8 S7 R3 h
- dma_addr_t dmaphysdest1 = 0;3 c/ D1 P- N6 R* F6 [
- dma_addr_t dmaphysdest2 = 0;
. j. s- b8 r8 i' r. [
& R8 A6 T% Y. u' m: N- ?* ?- char *dmabufsrc1 = NULL;; x- Y/ C3 g3 {2 U' h! s
- char *dmabufsrc2 = NULL;
6 G) p& y3 g8 r0 r' A* L1 e! `9 h - char *dmabufdest1 = NULL;8 e, }! W! C* C `# z
- char *dmabufdest2 = NULL;+ j! E6 D' @; C, V( v# P8 E% z
J) r: t! u, g- @1 N/ ~- static int acnt = 512;3 ]* o! ]7 T [4 w; ~
- static int bcnt = 8;9 ~2 }" f1 S" M- p4 v$ l4 z* z/ @
- static int ccnt = 8;' A4 \% ^; A ]8 { [
4 ?" W- L# p5 D. `- module_param(acnt, int, S_IRUGO);
- C# r9 T$ P1 s3 e - module_param(bcnt, int, S_IRUGO);! ?3 r4 M m& C5 D4 b
- module_param(ccnt, int, S_IRUGO);
复制代码 : r$ k: l& @! Z6 S! P5 C3 ^
0 j/ k! z# t' Z3 K- }- `, G 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 z# p! ~. `2 F, {0 g% g! [
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" ~) A- J8 K' h. l6 b. P
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 z( G& n0 g5 F0 _
& I: {/ R) _# g3 u5 F- P4 g5 x( E( `
|
|