|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, r0 E( N- G) v# K- [code]EDMA sample test application/ l1 V! B s0 A- a! N' b2 ?! }
- /** R6 B; m* q% a, Q' {
- * edma_test.c
4 l+ T6 F, x1 z* E4 b% {% ?) L) [ - *
8 t/ `) b/ P) m3 s+ ] - * brief EDMA3 Test Application
4 A& }! F. X$ \ - *
. j4 ?* d: u# _ - * This file contains EDMA3 Test code.
+ L( ^& G7 r F5 M - ** T5 O/ Y1 |4 Q! G) h
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ R/ e+ x; f; I
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& E8 _* J8 n, ]! `4 O* e5 q# j
- * TO CHANGE.# {0 @% Y3 T: B* ?3 Z
- *3 s8 E) j+ `+ a
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 Z; g. [+ ~9 w1 D! ]0 k# M
- *% R# O0 f G7 O
- * This program is free software; you can redistribute it and/or
; w5 m& \6 D& Z* ~: R& w( | - * modify it under the terms of the GNU General Public License as
" i8 o5 E5 o4 N - * published by the Free Software Foundation version 2.* Y/ y% {* X, {7 e6 h5 F
- *$ J- ^& f" A o' D1 Z& n
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
) N* b. [6 G/ }9 b$ Y: b* o9 N - * kind, whether express or implied; without even the implied warranty
1 p7 b% Q/ a- b% n7 P z - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% L1 K7 l: N) o: Z% u7 E6 w - * GNU General Public License for more details.
1 [$ h3 P" _! h0 }, Y - */
( q! S ^. k q, J+ N
/ T# }6 ?& M! q/ k$ u- #include <linux/module.h>5 l# z. {+ y4 z" t8 S
- #include <linux/init.h>
+ _* p! ?1 u/ U6 } w - #include <linux/errno.h>% D4 p/ @: {" U3 l+ a! k" t
- #include <linux/types.h>/ S" j# ^1 m* F, G0 M8 v2 P: S9 M
- #include <linux/interrupt.h>
5 k; p$ e/ ^$ K2 T - #include <asm/io.h>2 X- _* w4 O6 ]( n8 E
- #include <linux/moduleparam.h>
( k/ {/ ?' ~1 H6 }& b0 q6 | - #include <linux/sysctl.h>! }7 }/ C, n! ^( \
- #include <linux/mm.h>: w2 [* z# n" v# X' a
- #include <linux/dma-mapping.h>; B* x" k' ]; e& Z9 v6 B1 S. v( S
- " @+ V" [* |: K3 g
- #include <mach/memory.h>
2 K) v: a1 r6 {# o) ` - #include <mach/hardware.h>
' j6 @' H& a, T: w- C$ ?, W/ X - #include <mach/irqs.h>
1 R [, z! n7 D5 X. w3 Y# S - #include <asm/hardware/edma.h>) L7 R/ G/ O8 |* ~$ Z7 G
- ; J5 I5 W0 h' \) s+ C( f. @
- #undef EDMA3_DEBUG
% W2 ^4 y6 Q/ ^7 S* E/ P- `- L - /*#define EDMA3_DEBUG*/- Q/ q! `: v2 r# a l7 j
8 Y+ E, ~! T! ~5 l- #ifdef EDMA3_DEBUG
/ {3 u/ a: C8 Y& v0 K - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ V' e$ b" T, Q! s! j0 x# {* d
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
8 L' Z; y% x, B- q7 T6 K4 x - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! e4 N( g& s4 r; K8 J/ |$ z
- #else
; Z2 Q* _) H* `" `( P - #define DMA_PRINTK( x... )
" ]% n ]4 Y- q. U - #define DMA_FN_IN
7 a8 k! a3 g5 o+ V - #define DMA_FN_OUT
" v/ u/ L4 z8 h' r! [. S$ O - #endif
8 I4 ~ C4 b, O - ( e5 ?" v" @( i
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)4 P, S' ^6 \; r% \7 m7 h; n9 R
- #define STATIC_SHIFT 35 f; X+ _3 `: g
- #define TCINTEN_SHIFT 20
: ?+ O+ n6 q; B% } - #define ITCINTEN_SHIFT 21
V, l# J( i6 b/ d! E: U - #define TCCHEN_SHIFT 22) e6 a5 K- Q1 V" k6 \
- #define ITCCHEN_SHIFT 23
9 n6 ^- \* k* _' S, a }# Z0 V
7 M6 R# \7 c6 i* ]- static volatile int irqraised1 = 0;
, C+ c8 G' M3 Y5 s3 k8 C- d% }0 R - static volatile int irqraised2 = 0;9 b" k$ D2 P/ D& ^
- 2 y. A b$ B7 L7 Q( ?: f7 c, P' y
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! u+ |2 ~( P0 D) k# w - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- c5 p, G1 d5 m; S% e
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- _' Q2 f: g' A# C+ {* I7 Z/ P
- 5 w T$ q) G, F
- dma_addr_t dmaphyssrc1 = 0;
. m! H1 Y4 h4 X - dma_addr_t dmaphyssrc2 = 0;
. B e: W0 H( [- q9 V - dma_addr_t dmaphysdest1 = 0;
" A* y% h+ F2 y1 X+ z4 f2 i% n - dma_addr_t dmaphysdest2 = 0;
/ d6 K; a8 k, X% J& J' }& \
; l+ ` I( f0 ^% Q- char *dmabufsrc1 = NULL;" ~6 H' l, u% V u
- char *dmabufsrc2 = NULL;
8 n) |- a+ h7 [: F: s6 L6 q - char *dmabufdest1 = NULL;
6 x1 X D% D( @ - char *dmabufdest2 = NULL;
1 e: B6 I, ~" I: {
+ I" \: B- e$ y7 C5 U6 \- static int acnt = 512;
+ V K) e' U4 t3 p3 p7 N - static int bcnt = 8;1 u7 m2 U9 O' i/ U" i9 [7 L, \
- static int ccnt = 8;
9 ^4 y# d M1 k6 g& q9 u" ^$ { Q
! R( ~$ j$ S& Q" f8 l3 d2 I6 H$ a( {- module_param(acnt, int, S_IRUGO);5 n% m: y. t K- R
- module_param(bcnt, int, S_IRUGO);! }" D& f# m# L9 k
- module_param(ccnt, int, S_IRUGO);
复制代码 ' m" u( w; E7 ?
& x8 @ {9 h$ J: B: E. m 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 X7 K- }2 _7 Y' N7 O- L8 Q
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 D- `9 v! w, r4 q$ {+ U
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( T3 f8 C. Q2 O" ?) K; u9 c$ E/ N
- D; t& o% d$ b% K2 J
6 V) \4 h {4 G |
|