|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : l5 k" Y1 E5 d9 _$ f7 q
- [code]EDMA sample test application# s p7 ?# D3 K& z: M
- /*) c$ r+ N/ _/ p5 i9 W& G% f" ?. x4 U
- * edma_test.c
- A4 K4 W% J- _ - *
; t4 o4 ]3 R- f& Q8 r4 w - * brief EDMA3 Test Application
1 L' I3 B* K5 b# [; P% n - *
8 p7 ?# k* n$ S. {5 E9 T- E) W - * This file contains EDMA3 Test code.- W- }; o2 ?% W2 p: \2 @8 w6 O$ \' {
- *
9 [2 {2 [! \4 U7 d" i5 N - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
2 Y5 F1 `7 y; i2 R% i% ` - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
) W" z1 j. ^' t' _4 J; c% T - * TO CHANGE.. }4 c( h! G; ~- X
- *" R& C2 d* l8 V. x" n
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
6 V" ~* V7 j1 Z! K' j - * b% C* T- Z# z/ @# h: v
- * This program is free software; you can redistribute it and/or2 N) O5 X; g. _$ B8 y5 n5 a
- * modify it under the terms of the GNU General Public License as1 p J; u# }% d" x$ @
- * published by the Free Software Foundation version 2.0 }# p) l* M! R) N- q
- *
% s$ @" X5 Q* Z - * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ b9 T- i' `1 N, Q$ ?& o/ d5 a
- * kind, whether express or implied; without even the implied warranty
7 [% |9 V* e5 y, O2 x0 \% s - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0 c f# p4 o, ^& ~* j - * GNU General Public License for more details.7 x O: s6 ^- G
- */
/ v6 n3 {0 w& @3 G! S2 h - ! \) |1 ]+ h' h
- #include <linux/module.h>
& q0 n$ g1 v I) w - #include <linux/init.h>
9 ?7 D% [% e" G3 a T - #include <linux/errno.h>
! R' k: E8 P9 `' m: a0 d- S& ] - #include <linux/types.h>' x# }- q1 L, ~
- #include <linux/interrupt.h>2 s' W% y4 h& }( }. n& K: Y+ G
- #include <asm/io.h>
$ c ]+ y& b5 v+ R. ~ - #include <linux/moduleparam.h>6 k8 Z& w7 M1 a: _' }$ G/ W7 u
- #include <linux/sysctl.h>
- D+ e J4 }- P1 p - #include <linux/mm.h>! W Z( k- y) O; L
- #include <linux/dma-mapping.h>
4 ?, m& J; M' V3 S% H: w- O( Q8 y - ) a3 e6 M/ J3 {1 M4 O$ E9 s/ `
- #include <mach/memory.h>1 c4 c/ C4 d) M6 P: @' e" ?2 P
- #include <mach/hardware.h>+ Y3 }7 E* b+ T, _- `/ ]
- #include <mach/irqs.h>
/ _4 I. ]' _7 N( Z: A - #include <asm/hardware/edma.h>& @2 _* B: `) Z) T7 Z
- 7 k1 q" ~! ^! `. t
- #undef EDMA3_DEBUG! ~2 d# S5 E. I# o" f/ @
- /*#define EDMA3_DEBUG*/
# R) \' A# m5 ^& v/ f9 l( H
$ _% v* p/ X. F- #ifdef EDMA3_DEBUG: z( e6 Q7 R. a8 G9 a/ l/ u
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
' V3 R! U5 E$ ]( \. C - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
: g3 G1 O4 N/ Q* A8 m0 p( G - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
7 R' K: ~+ _6 D C; V) C; C - #else: S- a0 V: P0 Z
- #define DMA_PRINTK( x... )
* O7 V% k! y% q t4 ?& D - #define DMA_FN_IN
& N5 n2 ?) ]; u - #define DMA_FN_OUT( q8 E; ~" l' Q
- #endif
# g7 g: ^2 _6 N3 j
8 w4 L9 O3 G+ T2 ?( R- #define MAX_DMA_TRANSFER_IN_BYTES (32768)0 E9 t! [& N) p& j. U+ [( v
- #define STATIC_SHIFT 37 F& s6 ]' H& b8 i
- #define TCINTEN_SHIFT 20$ R; J7 t# V3 }# Y2 r9 p- J/ A D
- #define ITCINTEN_SHIFT 21
; H7 I' \% q# w' \" f$ _ - #define TCCHEN_SHIFT 22
% O9 x; b0 B1 m* u# j% ] - #define ITCCHEN_SHIFT 234 o1 R2 N4 \; i- E. \
- 0 N8 {) s' }- U B& G: e2 j; n# C8 K% @
- static volatile int irqraised1 = 0;# r7 g( c0 g/ Z& H0 {5 X
- static volatile int irqraised2 = 0;
* ?$ I6 {# H+ y8 U# A
. X7 _) a# y' H. u# Y- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 L+ O5 M6 m3 h* Z& p; V - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& c3 z; o! [1 j1 \& f+ Y; b8 l% g - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 Y* j2 N; X4 E. M! p' H
1 w* o6 }9 F3 H( z- dma_addr_t dmaphyssrc1 = 0;
4 c/ q7 }2 [ B& o7 r, k - dma_addr_t dmaphyssrc2 = 0;
4 q6 s5 x- n K& L - dma_addr_t dmaphysdest1 = 0;) L9 m7 D" }& @) M' A: j
- dma_addr_t dmaphysdest2 = 0;9 r' o8 K+ n L+ S/ N
- 4 L0 O: \- a/ R5 e' l. a
- char *dmabufsrc1 = NULL;7 [' V5 A8 [7 `
- char *dmabufsrc2 = NULL;
v) q( l% I. V7 P9 \ - char *dmabufdest1 = NULL;
! G/ l( h! o( i" g, V; W - char *dmabufdest2 = NULL;
' N% h) z/ Q- }. o, _& Q - : L* t' ]. o' ~" n! Y
- static int acnt = 512;/ H; V( q" K, t: x
- static int bcnt = 8;
( W$ T3 D3 @3 e. }, G+ l! L9 l% m - static int ccnt = 8;
& A/ q2 S: P5 U' R- k, A2 t( y0 S
; o% O+ _/ d) k L2 b4 F/ Q- module_param(acnt, int, S_IRUGO);
: K3 p. A4 U; U/ v% K4 @ - module_param(bcnt, int, S_IRUGO);$ o$ p# w* d& b$ M, ?6 [
- module_param(ccnt, int, S_IRUGO);
复制代码 ! U# i) N5 K3 [/ n
0 ]2 H- k$ W% C4 k% _/ }6 u 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: k1 w+ e5 m: L8 ^
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: q2 w, z% Y6 U2 H) {2 @. y 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 e% Z4 o8 v; R ]% B% Y. z3 \: W3 i& [6 T) @" k8 ~5 u' j
$ Y6 K6 y1 Y+ I: c v; O1 o
|
|