|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 j( G; d- b# k% g7 y! ]8 y4 c
- [code]EDMA sample test application2 C! P/ ?$ z: J) v! S9 @0 j+ l) @6 T
- /*
4 ?( U% P) E2 V3 @8 w. V) f0 R - * edma_test.c! t! d: B: M1 H6 ^* ^( g* U% t
- *
& X; {( C1 p7 i, ^( r1 P - * brief EDMA3 Test Application
' z( x% Z/ [5 w' `) ` - *
2 c5 E* h( O; ]' g8 Q( @ - * This file contains EDMA3 Test code.9 G' C9 ?9 i6 S
- *5 e. J8 C7 m: A4 K
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* I) }% B/ O! r4 E' C0 j: A D0 E
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 E9 m3 h% R1 Y& n) y% M2 p
- * TO CHANGE.
8 B5 `2 I* o: j8 B1 _& W9 S - *
4 o! H) B1 i' ~/ F) @: N - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
% n9 g" b! M- w: f i - *8 M' `" H$ g0 K! ^' j) g# w( `. E( h
- * This program is free software; you can redistribute it and/or
; c; j2 S! [; \6 |% Q - * modify it under the terms of the GNU General Public License as
' H7 j' x9 `* r8 J - * published by the Free Software Foundation version 2.
' Z1 B' L# ^( S - *
! T" ?$ w7 E4 I4 G - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
% E' e0 K. Z8 i( g* y - * kind, whether express or implied; without even the implied warranty \: U: n1 {0 ~9 @, n" c
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ r. O0 A: b. [8 K( ?- n0 T - * GNU General Public License for more details.
$ K }# E- e* w8 e$ D( v$ ~: `2 t" W - */
/ c& C! K! W/ g. n0 v
2 u2 J3 `- I% T' K# ]. W- {- #include <linux/module.h>
# O4 L9 F/ X. | |- _( P - #include <linux/init.h>; N2 p0 r! [* x- C5 m
- #include <linux/errno.h>6 }3 F# H& \) b( L/ T
- #include <linux/types.h>
+ u* x+ o/ ]: R4 N7 H4 o/ i' [ - #include <linux/interrupt.h>" y5 x R) _ I
- #include <asm/io.h>! P5 h8 V' s8 X2 U0 n& D% y$ n" @
- #include <linux/moduleparam.h>
! X* r/ _# {. r% `' y2 o/ E - #include <linux/sysctl.h>- b( u w$ u4 _. P4 ]$ m$ @$ v
- #include <linux/mm.h>6 \5 O; |! S$ t, H# G0 H4 _; u
- #include <linux/dma-mapping.h>
$ w: a5 F* V ?( m' n
6 Z, ?$ I8 Q0 Y# s( K3 [5 Q- #include <mach/memory.h>
, }+ t* S& B9 `' e+ j0 `# y$ t - #include <mach/hardware.h>; {' z. S# @3 u; b# g5 O
- #include <mach/irqs.h>
9 O1 K7 k; N0 F1 `. c2 y. U - #include <asm/hardware/edma.h>5 a% X7 q% ?$ ^5 P0 r3 C, A/ U8 c
# T3 W% D/ T* ] P; v$ m: u$ l3 w- #undef EDMA3_DEBUG
% B% v2 D# e0 b* ~$ @) ^' A - /*#define EDMA3_DEBUG*/
3 E1 i, h1 A% j7 Z7 T9 G
6 T* Q# {( J3 _$ ^4 \7 f1 {! w! P- #ifdef EDMA3_DEBUG
+ Y9 U8 |1 p A - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
4 ^# B6 o, p/ b) a) u& \: | - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
) C6 }, C2 M' X9 ~1 S - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 Z4 l9 P$ A) w) I/ G3 ?$ f
- #else
/ s* j' @" z9 _: M8 ] - #define DMA_PRINTK( x... )
+ q0 c/ x: q7 b, `( G8 k - #define DMA_FN_IN9 |( O- t$ s! A0 A; c; c
- #define DMA_FN_OUT
$ C/ [; I( V2 h* ` - #endif
+ N/ K/ e6 _, v; S: o+ x7 B! L/ A - 0 S" k, {) H; b/ F. ]; @
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
& n- [+ p2 |: T) {( A* B. K- y - #define STATIC_SHIFT 3
]0 g' ?: Y! e2 W& g) I' ?3 i - #define TCINTEN_SHIFT 20# T9 O1 L! K: t5 x6 ` i9 f- {9 y+ m
- #define ITCINTEN_SHIFT 211 x: D+ U; K0 C% V u! h7 Z
- #define TCCHEN_SHIFT 22- I* y8 s4 g2 R
- #define ITCCHEN_SHIFT 23: Z$ g7 [! J5 n
# c+ W! L5 \1 b+ U/ }% ^5 b9 a- static volatile int irqraised1 = 0;8 K- ]- v' N$ X) D6 U% r2 r% S& I3 a5 R
- static volatile int irqraised2 = 0;& D# n' f: N% P9 @3 Z; D! N. f
- $ V0 R$ w, Q9 h8 q
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& K- G6 p8 z# B; _0 B( S' x2 }* p - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 `) o& O: a0 C) B) h - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 f# ^) m7 _0 d3 Z, F( V" K
$ t* f) I0 z) q; B: Y' W- dma_addr_t dmaphyssrc1 = 0;8 C$ C; ~+ F3 q( N8 F w
- dma_addr_t dmaphyssrc2 = 0;, B# @$ t; f: k& ]& P
- dma_addr_t dmaphysdest1 = 0;, C7 \, z% h: J }5 ]
- dma_addr_t dmaphysdest2 = 0;. z; v H( O7 c
- / t: y! @# |$ |2 S* P: N
- char *dmabufsrc1 = NULL;4 j) k6 g2 \- Z
- char *dmabufsrc2 = NULL;
5 D/ R1 m+ I0 k6 K: I# R - char *dmabufdest1 = NULL;
$ [8 V; q+ }. g; D u1 ` - char *dmabufdest2 = NULL;6 k; {$ c' o& C! p. V& I. ?* i
5 q( U+ G8 X$ T3 U- static int acnt = 512;* |2 s' @) x' Q# @+ T
- static int bcnt = 8;
! I( G5 ^' B: M9 u. I- G - static int ccnt = 8;; f4 Q" ^' u, x, s6 U5 a1 T2 V
3 \+ N8 K& w/ t0 [6 o; Q( t- module_param(acnt, int, S_IRUGO);
( r8 s! P$ R5 s5 @2 \) }! {* E. r7 ]" l3 O2 ^ - module_param(bcnt, int, S_IRUGO);; Y( E# D( \- n* D7 H% I+ W! z
- module_param(ccnt, int, S_IRUGO);
复制代码 ; D- b; Z) T1 R4 L
+ B' h8 \7 n2 L0 F' y5 E7 q1 h
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 W; c$ }5 _3 G& Y7 q/ U+ U5 ~: A
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ p7 e7 ?. c. t! n2 {8 [
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 m4 y2 Q5 H; n7 u
0 v ] P z* m9 r# ^$ {4 x% e
& [: z% R9 @5 V3 v5 u. ` |
|