|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% U; \1 `, Q' ]8 p% ]7 ?- [code]EDMA sample test application
# _7 f; H4 H* R) R1 y- K - /*
+ X! L6 O: L% o6 h) M- N0 E' @ - * edma_test.c( O1 ~5 Q& K, N4 d' _0 S$ ?( |
- *
/ A' F8 a; x+ x& B; O* y& h - * brief EDMA3 Test Application
o! p: D" T9 ]& R: X- t5 E - *1 v% `. x* @" Q" @
- * This file contains EDMA3 Test code.7 f& v5 y. J4 N
- *
( I! L' D8 B: b; u5 l - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: L2 F8 m: N' H, u% _3 {2 |0 s
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! q3 f! M. Q' L. I* b
- * TO CHANGE.
5 m# z# C) r6 o% c - *
: X* P, D* l" o3 c% M; Y - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
G7 c0 t( S0 ?2 C - *. {& r6 J) t- K X' S
- * This program is free software; you can redistribute it and/or
; ]. T9 T( `$ L. a# M9 ~ - * modify it under the terms of the GNU General Public License as. W& M& l" z. L' t1 C
- * published by the Free Software Foundation version 2.
! r! V) p# ]9 ^1 h1 p - *8 b( W' T4 G/ S$ ]1 S ^1 ?# Y8 E1 R
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
# a6 x- i# o* u - * kind, whether express or implied; without even the implied warranty
1 {/ e% o9 v2 K7 O/ J - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- p# I# P' ]3 F9 [8 Y - * GNU General Public License for more details.
# C/ \$ @! Q+ G1 V - */
5 _9 a+ S" ^. s$ N; a
v/ y/ |$ l( s- #include <linux/module.h>
j9 e' N- G$ { - #include <linux/init.h>
! f+ ]2 \: {2 r K - #include <linux/errno.h>% }: V; i2 r/ e
- #include <linux/types.h>
" f5 `/ X F, R) A - #include <linux/interrupt.h>$ \+ [" V" r) E; M2 _/ [# d
- #include <asm/io.h>: j* b2 R2 p# m) i9 Q- E6 g8 |
- #include <linux/moduleparam.h> S& ~( c, M% r# q& |
- #include <linux/sysctl.h># I8 X. T; Q3 \7 M+ Q
- #include <linux/mm.h>+ q! c6 c2 ]+ D+ D" k7 `( `
- #include <linux/dma-mapping.h>5 D& |. K4 D; ]( ~& B6 i2 k
4 K) b0 X- B8 j* G, T4 ^' l" c- #include <mach/memory.h>
# K& l3 X' W# g - #include <mach/hardware.h>8 \" D# n: `; I! w
- #include <mach/irqs.h>8 f( J0 y4 t1 M
- #include <asm/hardware/edma.h>
# i9 S+ b8 Z9 I# z1 O4 O( o+ |/ w - 7 n0 t) }% Z3 z+ q
- #undef EDMA3_DEBUG# Z6 ^) V8 |0 H$ i& c
- /*#define EDMA3_DEBUG*// g0 C# D( r& ?9 p4 F( q
- $ O9 q b2 ?3 ]
- #ifdef EDMA3_DEBUG
$ j' Q+ Q4 r% h* L1 _' C - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" }! b% _. ]3 o( P8 n
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 ?/ `% x: I1 a y
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 n0 k" {, y( l# K R' O
- #else
$ O6 ]7 ?: Y& B% e# Q$ k2 w" y - #define DMA_PRINTK( x... )
G9 G( F; |! L' ~ - #define DMA_FN_IN
K3 ]% f+ ]+ ~" ?. {4 h- Z - #define DMA_FN_OUT
# [8 ]4 t" V4 R - #endif6 N4 T6 L7 a ~# H! x, c* @
2 ?& V* Y4 W8 N9 E6 ^- #define MAX_DMA_TRANSFER_IN_BYTES (32768)5 ~% I# h2 G4 g1 _. n) L
- #define STATIC_SHIFT 3
$ m) e8 N* r, l, z: U5 ~3 D - #define TCINTEN_SHIFT 20
7 h5 A4 {5 e& k1 R8 r7 G9 f% Z6 I - #define ITCINTEN_SHIFT 21
, A" \9 O) @; F9 Y3 x, H& Y& B2 g - #define TCCHEN_SHIFT 22
; I0 f4 E+ ~5 [! Y) n7 `9 e; P - #define ITCCHEN_SHIFT 23
8 X& {9 G! |, v& A - # u3 m: A& e7 h& X1 K2 n
- static volatile int irqraised1 = 0;$ }9 w! V$ s6 O" x0 E+ U7 b/ F+ r% v
- static volatile int irqraised2 = 0;
; p' g5 D( H1 y" k8 [7 V) M - / g, J/ h+ s% T" q( W" Y2 H2 t
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) O% b- j7 W9 N, l8 ^ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; _5 u# A' G/ i$ |0 `5 s
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
c6 s; e+ k/ U$ X
, x; T/ Q! Z8 Y8 D0 A! r- dma_addr_t dmaphyssrc1 = 0;
" ~1 D" @7 @( Z* b( R8 N - dma_addr_t dmaphyssrc2 = 0;) p1 T* ^# h6 v# S0 W
- dma_addr_t dmaphysdest1 = 0;+ E$ E! W. O/ A$ d3 ]6 B
- dma_addr_t dmaphysdest2 = 0;
( H/ J7 A. U, D$ w: b! ~
( O% b) k& X V3 l/ O0 m3 G- char *dmabufsrc1 = NULL;) ]# ]9 Y r3 o, V3 D0 k
- char *dmabufsrc2 = NULL;
8 Z d+ J9 f8 g/ w- R R' c - char *dmabufdest1 = NULL;
( q; P( C" R& u; Y) T: U - char *dmabufdest2 = NULL;0 U* X( y5 F0 D, a& |# N% C+ n# v
- . U3 B$ N% K$ K' X7 U
- static int acnt = 512;4 @- ?9 \7 f8 r6 i
- static int bcnt = 8;9 o) B8 m% l: U. c* n: i6 @. E7 u
- static int ccnt = 8;
. z' {4 J/ M# H! l5 D o! P% M - N( H# N# c0 G: L: r
- module_param(acnt, int, S_IRUGO);
. t7 S T# Y4 O1 P4 c' J - module_param(bcnt, int, S_IRUGO);
Z" |) B" K5 W. K9 `% B - module_param(ccnt, int, S_IRUGO);
复制代码 ( K* x/ j0 }- w( V- x! Y+ _$ U4 m
( X, t5 ?( b6 @- w: T
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ K3 \8 G& f% m& b
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% C2 `. a$ Y& E( u 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! }+ m ]* S7 r9 K% S% R! {* ]
: N- P, v) N) E" h; v3 k
, c, {) ?2 c1 L+ C7 F+ o+ t |
|