|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- k2 g! w8 ]/ |. m! @* z- [code]EDMA sample test application
+ v! }2 J1 G- P" b - /*4 r5 y8 M) W) n
- * edma_test.c
, M4 B3 c; S9 j" T) }$ q, z2 E - * \' H6 R' O% M* G+ L
- * brief EDMA3 Test Application! ]) a O$ ~9 {1 k# `- J
- *# w1 n- b. j) V l4 `1 E4 o1 c4 s
- * This file contains EDMA3 Test code.* J0 r" g- N$ d! ~
- *: p+ {1 ?6 t+ q( q' d/ q% R
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ n. n" _# h* h0 B' ^6 W: t
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
4 Y3 }# Q( ?" m w g - * TO CHANGE.
; @" ?- C3 n, E- R$ m - *
" E: E; I _' z. G) G1 Q - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- z3 j/ \6 c! D8 M2 z% X8 w* O
- *6 r9 c, O- I0 i; H
- * This program is free software; you can redistribute it and/or6 P6 m8 x, Y& m9 k
- * modify it under the terms of the GNU General Public License as, X7 k3 k0 }2 F% Y; M% U0 p2 c1 J- s
- * published by the Free Software Foundation version 2.
, D( Z# |/ H7 `# e+ Y0 F - *3 l0 r; k& C9 X& \* j, K
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
j" P- F6 d Q5 M6 A6 M- o2 c - * kind, whether express or implied; without even the implied warranty
: V% X, J- V) O4 p7 c - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ O7 @0 {1 c! a5 G9 C# n: y% {0 v! I - * GNU General Public License for more details.
+ b7 z6 R, s4 g4 n4 h# S6 H - */" M( n0 C0 G) Z- C) J* N
- 3 z: q0 H" f9 \- v) @. H; ~( p
- #include <linux/module.h>
1 V# c# R1 J$ O5 d3 ?% G* X - #include <linux/init.h>& O/ k- s1 u; ]$ q. D' ~/ F, B6 x
- #include <linux/errno.h>; F% [! y" G( ~4 J
- #include <linux/types.h>2 E# k' f, k% B+ t3 F) e L! V2 \' z
- #include <linux/interrupt.h>
2 R. T7 J4 r5 R8 w( V - #include <asm/io.h>' t* n9 c+ @/ H1 r+ Y) `
- #include <linux/moduleparam.h>
7 Z9 V8 N8 q2 R- }$ ? - #include <linux/sysctl.h>( Y4 n6 Q, `' ^9 y8 N
- #include <linux/mm.h>
+ X6 t- E+ y5 Y+ \0 t$ A% b1 X - #include <linux/dma-mapping.h>
; m# A: P0 `4 S, @; T - - N$ P# b, w/ x' d. D4 n, P
- #include <mach/memory.h>
3 f4 Z1 L/ l. t4 A% t( [# Q! V. j - #include <mach/hardware.h>
! z# J7 r! T+ O, D7 W1 p - #include <mach/irqs.h>
& @, C& v' {* q" I - #include <asm/hardware/edma.h>
$ U4 G/ T" f5 I" i - " g `, w M1 C$ b7 a
- #undef EDMA3_DEBUG
* b3 M4 b0 E6 N - /*#define EDMA3_DEBUG*/7 b$ p, P+ }5 Y4 ]* {8 g* G
- J7 y" K( k; g C- #ifdef EDMA3_DEBUG- T; F$ V7 S$ U1 [, \: z5 X$ Y
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 x2 U; B4 S1 @% L2 s8 Z" I
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 q8 V; Y. S# j4 t5 L6 E/ Y9 s
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
6 v3 g J# f: }' A3 ~% c - #else
8 a/ ^. H# e3 s# u; m% Z - #define DMA_PRINTK( x... )/ r, E6 ^! v1 |' l7 S: `7 u* S
- #define DMA_FN_IN k) K% s+ f6 I1 I2 {8 ~/ ~* J
- #define DMA_FN_OUT
0 \6 h! T# v) C$ d5 q5 k+ ~ - #endif. N5 K* [6 g, z9 j! m
- " Z9 n( M0 Z* u/ t* Y
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)5 Z! }; I% A: z5 ^8 Q2 z
- #define STATIC_SHIFT 3
" ?" E0 [0 \. d( e8 B9 Z+ O4 e; I - #define TCINTEN_SHIFT 20# e N4 R, R9 g% _7 H4 l
- #define ITCINTEN_SHIFT 21! H5 \5 r( L0 Y$ T% G
- #define TCCHEN_SHIFT 22/ H" E3 W8 A' l& Y2 ]
- #define ITCCHEN_SHIFT 231 N6 i) `' Z4 H2 o- |$ u
- 8 j! H, p" F+ O9 ?7 _ t
- static volatile int irqraised1 = 0;
" N5 |% \& G+ [. F - static volatile int irqraised2 = 0;- h: y. E3 z2 `3 Q
6 V1 l3 Z5 a I4 X' a5 K- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 n# ] r# ]: \. l, l" | - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, x" }* s2 K7 t - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 ~; L. j$ a, J: S. b - : W! u! u! r/ s8 l$ J, t5 m9 }
- dma_addr_t dmaphyssrc1 = 0;
0 X2 q) U M& P) w! _. i; M - dma_addr_t dmaphyssrc2 = 0;
1 T: F) Z* a F8 x - dma_addr_t dmaphysdest1 = 0; A, _9 u8 ]& b8 v, R
- dma_addr_t dmaphysdest2 = 0;
( i- A" J0 I9 j5 R0 U( d - ( I+ E: K* Z. d ]5 t1 M' v
- char *dmabufsrc1 = NULL;/ Y w( y6 l( N4 p) v" D- [% F
- char *dmabufsrc2 = NULL;
9 b" @8 S2 ^1 W- [5 e: c - char *dmabufdest1 = NULL;; {: @5 Q& K( J
- char *dmabufdest2 = NULL;6 r4 K$ R9 {8 u$ K4 J3 s
- , k) f& x. W7 K
- static int acnt = 512;& W. B0 Z& ?2 Y) u
- static int bcnt = 8;
) S: B* f( i0 c6 v# }/ K5 m - static int ccnt = 8;4 o* H/ [( K# w! \- {
. D9 z1 Y* p* K9 ]" c6 x- module_param(acnt, int, S_IRUGO);& w2 U8 |/ [: E' E8 _
- module_param(bcnt, int, S_IRUGO);/ [& Y- t; Y7 y. s& X& T* X
- module_param(ccnt, int, S_IRUGO);
复制代码 , w, z$ N4 R2 c) N7 r' H
0 A5 E" G+ Q" H, j- T 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) m9 p5 o3 H7 K; U) a, w
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 g' @+ L4 J1 p9 X7 O
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" C% t0 [- E0 B& B, q. @9 }3 N, ?
1 T1 W2 K6 i2 ^& @5 d7 b4 n2 J. `! o3 U' L1 g7 V5 L9 P Q
|
|