|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ n! H: g" N: T# C5 p- [code]EDMA sample test application
- m! Z6 {" g. c2 C& T2 N, O - /*5 V. H: S+ u! b9 @0 a
- * edma_test.c
1 {4 ]- A3 J+ U' c2 @2 O8 b& t4 I3 M - *
$ k: j0 u9 Y1 `* X r. u* w- U; G - * brief EDMA3 Test Application0 n3 @0 j& U2 p4 B- D* i, t
- *; |6 W4 Q5 Z; m7 v" G
- * This file contains EDMA3 Test code.# M, c5 E" b# E
- *3 F3 E" | {: w; A
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
$ ?" P y$ Y4 s4 l - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
" U+ l, N, O3 O& {- Y4 ]5 i8 z - * TO CHANGE.
M+ N' [4 |8 d& a4 \: w - *
; I+ K% L2 ~/ x - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# R4 x M2 `1 }
- *
2 }' ?* d A, i, V9 l1 s0 J - * This program is free software; you can redistribute it and/or
2 N9 n/ o0 ?( E$ ~+ w/ O7 @ - * modify it under the terms of the GNU General Public License as( k6 f+ U. M3 g. D2 |
- * published by the Free Software Foundation version 2.; l) V; ^4 Z% `0 d
- *% N2 U( v2 m! L0 W% `
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
$ ?' [, V. M8 j) s - * kind, whether express or implied; without even the implied warranty6 c' {+ Y9 _$ G& P- X6 Y6 I9 S
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7 \: i6 P, L& |' p m - * GNU General Public License for more details.
3 j3 ^2 B$ { R: I ~ - */! T) Q1 h# o' P0 h& L. F* f
, C; b5 h' v# V5 ~$ b, L6 v- #include <linux/module.h>: U& d: H0 N9 T, y% ?7 m7 P' G, u
- #include <linux/init.h>
; a4 c; [' s6 h" T; Q- G$ K - #include <linux/errno.h>
5 B! R) J" J1 o& ]) b! ~4 z - #include <linux/types.h>) |7 v+ I1 C7 _" Z; l5 L
- #include <linux/interrupt.h>7 r4 l; I" w$ a
- #include <asm/io.h>' A$ ~6 b2 O) T& A! @2 Z2 ~
- #include <linux/moduleparam.h>1 s, I% ^- L6 j- J# M. |" @& Y
- #include <linux/sysctl.h>2 J9 p# K9 E. h
- #include <linux/mm.h>+ W, ^! P" I& D/ {% ~
- #include <linux/dma-mapping.h>
3 b7 t" B5 `$ Y }) z+ Y - % c, y) N: n9 B) o6 Y& o$ n4 {
- #include <mach/memory.h>
q3 \( i1 j# H - #include <mach/hardware.h>
! k- u+ K, j# \3 p4 t - #include <mach/irqs.h>7 X: D) r: z' f( M$ R: g( J
- #include <asm/hardware/edma.h>
- M# c( X6 A( i/ t
9 W& u8 H9 q! @- B2 D7 Z3 j- #undef EDMA3_DEBUG# c O& j1 z7 ~2 G$ a y9 M- h
- /*#define EDMA3_DEBUG*/3 b, H+ ~+ K6 B" j
- - z& P+ e* v5 O3 O2 O# O
- #ifdef EDMA3_DEBUG+ j; i0 J% e2 _( t9 S( G
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# ]9 ^8 v3 J3 V. d g- {
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
4 I( U* v+ [, _/ f- r/ [9 g - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
' c6 G7 m0 n+ j3 r( ]* I - #else8 P, L0 l) A: O8 V' n
- #define DMA_PRINTK( x... )& P6 n- d X5 ~
- #define DMA_FN_IN
3 _9 l( c& ]4 {9 T# X. N! t' @+ h) Q - #define DMA_FN_OUT
1 W. n0 _3 w$ I# \2 S+ q) ~* y& G8 J - #endif
& `/ o! ?* n$ n
$ z# k( _! G4 ?+ \6 b- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
. q- M! n; J* E$ j+ F& d - #define STATIC_SHIFT 3
# }% J) U; h. s5 g - #define TCINTEN_SHIFT 20, U/ B7 H! W. i5 r* Z8 N% ?# m& j
- #define ITCINTEN_SHIFT 216 H. O# `0 O: Q: C: v
- #define TCCHEN_SHIFT 22: H( F7 {5 @2 e8 t% u6 a
- #define ITCCHEN_SHIFT 230 i0 U- k, e/ F) l: }5 B5 A, _
- / G1 I, @. X) r0 o! Z2 b- ?( d
- static volatile int irqraised1 = 0;
' B, y$ D! `) x# ~ - static volatile int irqraised2 = 0;
, K c. \9 r n. a b% Q3 [
6 u. k* g0 w% {: d( [- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 G! t9 _* ?& @) |- Q8 g! O - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( y( ~4 h# y; Q! O, K
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 k3 W1 r# I0 L* X! w
: K3 m& J% c* k# a3 l, m2 o: I- dma_addr_t dmaphyssrc1 = 0;2 l W1 x N- ]3 x, G8 M
- dma_addr_t dmaphyssrc2 = 0; s& P/ J! ]( e; @8 j; I# e7 n
- dma_addr_t dmaphysdest1 = 0;
! o$ n- @ t( K) [/ }% s, |5 N8 U - dma_addr_t dmaphysdest2 = 0;3 q- U' e7 x/ T' n$ Z
! I1 S& X4 ^4 U. H- char *dmabufsrc1 = NULL;( {1 C* x6 J6 R8 H- W- h- A, X/ Z5 R( X
- char *dmabufsrc2 = NULL; h0 O! k6 g( S7 p
- char *dmabufdest1 = NULL;
' r. P6 U8 n# q; o4 S! p9 P - char *dmabufdest2 = NULL;
) d7 W! H% n; H6 v# t - / |8 x& P+ ^* R# s
- static int acnt = 512;! b* P" k$ a8 d6 T( E2 e
- static int bcnt = 8;
0 b7 q4 l. a/ }" ^5 X8 @ - static int ccnt = 8;
3 `# i b: d, g3 l' R - " f9 V+ P, k$ L; e% { }
- module_param(acnt, int, S_IRUGO);
- K4 W( ^, A$ k i - module_param(bcnt, int, S_IRUGO);
& \) |- J; Y6 \ - module_param(ccnt, int, S_IRUGO);
复制代码
; O- h1 l6 b8 b% B [8 f3 u
: a" s8 y: t& b" u 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: n! D4 X7 ]( x% C' g/ C. Warm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 ~) w- _4 W& ~$ Y& w' D 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 F# y9 Y* H6 G% X, A8 i$ y" e1 U
5 f: }( E) K9 O8 t
) E$ f/ ]. l. S2 F |
|