|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 K& j& ^. M' L' }) `4 B+ [9 n- [code]EDMA sample test application
/ b9 }. a2 Y% B& S' f) z2 ^ - /*" D- P4 \* T$ |6 A! l
- * edma_test.c
5 k; O7 a- ^; Y" ?2 ]) u - *
+ |4 N( x4 ^* j0 W( L& q2 \& ? - * brief EDMA3 Test Application' H R5 A# \) M# p/ s
- */ k- Z% r2 p1 S
- * This file contains EDMA3 Test code., U: S8 h1 P; m8 Y& ?1 P4 `
- *7 j9 [# g$ P, | _5 p3 A
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
1 S7 n4 I6 e) Z" f) g2 T - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
! q7 f3 D& p& j; b% P. l I - * TO CHANGE. u5 y- x5 k0 T1 e6 x
- *! ~- @- l8 J0 M4 H& v9 {, s
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
! }& K2 v* k( [, Z* _( T - * P& c' a& V; z/ x- M, N0 R2 x' Z
- * This program is free software; you can redistribute it and/or0 Z* V; }9 K% H) k) `) U
- * modify it under the terms of the GNU General Public License as6 [ R* w8 \( ^; p* U$ Q' l) H$ t; P
- * published by the Free Software Foundation version 2.
: M: |% `9 Z$ i - */ s; |3 I( t+ m' k6 h i
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 f b$ r: Q& T" {
- * kind, whether express or implied; without even the implied warranty
. P$ n! P7 `7 ^ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the8 `) l2 p. W8 m7 D$ D0 O
- * GNU General Public License for more details.
# a2 c) [! C1 W- `3 G - */
7 f* S- O4 p/ a1 b: t- m - 4 V# T# {% ^0 Y/ t
- #include <linux/module.h>
2 {* `" l# b2 @7 } - #include <linux/init.h>
1 V X, r* z6 F - #include <linux/errno.h>" u- Y0 Q8 ~; u" {% ~! [
- #include <linux/types.h>
: b1 p9 c8 n! P' _& ?2 n - #include <linux/interrupt.h>
- a% e: C2 o% R3 N3 p - #include <asm/io.h>
9 n$ v z& L9 d - #include <linux/moduleparam.h>
# G* C( P+ O' H6 o( }3 e* K - #include <linux/sysctl.h>, N5 n# v' o0 y! S
- #include <linux/mm.h>
?# }/ n% E9 L1 `: ~, [) S - #include <linux/dma-mapping.h>
6 n% i" V3 W6 d4 d( X% f) N |
9 X7 A- A( F+ O& z8 V- #include <mach/memory.h>( ~3 m8 d* h; |3 U4 l* N
- #include <mach/hardware.h>
5 w, y" f a$ s - #include <mach/irqs.h>6 z8 n7 [4 P) d
- #include <asm/hardware/edma.h>
1 H! A5 B2 z9 H5 f/ O0 W - ; |( m' | _3 g: J/ }% t
- #undef EDMA3_DEBUG
n* [# E$ }, n4 Q/ w' [ - /*#define EDMA3_DEBUG*/: v2 c' |3 R) }+ i! o3 V
- 2 ~! Z% ^6 i1 T8 ~ t- U
- #ifdef EDMA3_DEBUG
% W6 r0 K' o0 M/ ~# L - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
9 Q7 u) E" a- q - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& F: D8 V: }7 Z$ u2 U2 P% P% b
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
3 U# S, L8 ^* w9 m, h' V - #else
0 i& Z. G$ h3 n! Y1 \$ N( n - #define DMA_PRINTK( x... )3 z; T. s9 G/ v& ]
- #define DMA_FN_IN
+ \- a. j" O# {7 H$ A; {% ~ - #define DMA_FN_OUT
8 g. M- X" F4 L6 h - #endif
8 C1 O) D9 N6 p. t. w1 Y; J; H, [
% G' g. D* t6 H; X9 t1 p- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
- ]" m( {( O7 P+ b, c! a/ U, L& U( H k - #define STATIC_SHIFT 3: x. Y, W* b6 Y& S# R) W
- #define TCINTEN_SHIFT 20* U3 B% G9 l. ^# O; |+ o0 ^0 R8 P
- #define ITCINTEN_SHIFT 21
3 g/ ^+ k8 e# d! } - #define TCCHEN_SHIFT 22
7 k2 X! Z$ ^4 E2 @% q. z O - #define ITCCHEN_SHIFT 23
. ] m. M' l+ q: _, U j
# c. B+ g ?% o4 m8 ]- static volatile int irqraised1 = 0;6 `) u$ E4 d# O; Q4 D
- static volatile int irqraised2 = 0;7 ]( R$ P' z9 a( G! n, {
- , R% s/ O2 P+ j4 a
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& M! a3 X& Z3 y2 Z; ] - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! i1 J# X+ d2 S/ F1 S X
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( m8 i4 ]2 o6 j9 w8 e( t
- : J, D) g1 x2 c8 g( P, ?; p
- dma_addr_t dmaphyssrc1 = 0;4 t7 `2 j" a, p4 {
- dma_addr_t dmaphyssrc2 = 0;1 X& l$ [( y+ k
- dma_addr_t dmaphysdest1 = 0;
/ B* S- g1 I7 \4 T+ _2 u$ | - dma_addr_t dmaphysdest2 = 0;
; r9 t4 D" ]0 X3 e
; V2 \' ]# v# n$ M; l Q- char *dmabufsrc1 = NULL;4 j6 g V0 Z, u B! U: W
- char *dmabufsrc2 = NULL;
+ o+ g- ~3 @3 n0 l Z - char *dmabufdest1 = NULL;" Q8 G, I5 \8 W( T- ~; ^* @- V
- char *dmabufdest2 = NULL;& H1 a' G: D0 I, ^
- - t4 i+ ]' U- o
- static int acnt = 512;8 `. F/ J/ J. o: z
- static int bcnt = 8;
. t( E, F2 R& Y6 y r! L6 ` - static int ccnt = 8;
: h$ }: C7 r7 O9 }' B/ Q
9 t0 S( ], t/ n+ E/ w- module_param(acnt, int, S_IRUGO);
' T( m- O q& t0 r+ ` - module_param(bcnt, int, S_IRUGO);
' K/ L/ \6 w- N' t3 N - module_param(ccnt, int, S_IRUGO);
复制代码 ( V3 n9 ^ y$ Q' E) @
( U& {0 Y+ `; G4 X 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. ?) t. s" Q! Y: @4 @/ {
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 j7 G+ [: Q" u% `5 Y' _ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! b* @& {3 w* D" W% G6 j
9 M. e0 E0 Z& I$ D! X0 E! _0 i' ]
- E! p$ K ]' o( ? C. L) L0 c
|
|