|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 x) i0 V# b: X k
- [code]EDMA sample test application d" C! ?2 v9 o0 o) t8 Q7 ]& J' q
- /*
" T' u% j, h' l, P3 Y7 n - * edma_test.c
3 E/ E- T3 `9 m; Y7 _% m - *
# W4 V, I8 s& V4 |/ g/ i - * brief EDMA3 Test Application4 V6 B4 a: [( O ~' t
- *
# k* n% F- _! e$ A5 x - * This file contains EDMA3 Test code.
( H2 T, z) A% R: E9 N. N - *7 G7 u w" T+ c2 f* D5 G* w$ k
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* p* c+ N' |' M' O0 U+ u
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
0 P0 Q; Z* j+ ~6 g5 f T - * TO CHANGE.
' @; O' a |& Z4 R2 [ - *# R0 o' P& f. z7 r
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' C; B# H* V, b3 [/ v' Y
- *
3 N4 ~/ R, E3 R7 C3 L R - * This program is free software; you can redistribute it and/or6 _% u+ {8 ^' e( ^1 r9 X
- * modify it under the terms of the GNU General Public License as
" B* p8 A$ i) p/ N2 ?/ S) K/ ~( J6 j - * published by the Free Software Foundation version 2.0 m! E6 U8 W: F" w, C
- *, E" r& Q L* X
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
" w5 K! T$ h( ?6 j2 T# K1 o' U* Y - * kind, whether express or implied; without even the implied warranty0 m" K- s% ~9 s9 U: z
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
b( r$ f9 s. @5 D P5 r0 m+ z - * GNU General Public License for more details.
" l& p6 f% }$ |. y2 E# P0 Q5 ?, l# {' { - */
% I! Y3 r, h+ r. w V/ s$ S - 0 H5 u. H- W. k6 P) C
- #include <linux/module.h>
( F. r0 S P: U" o( P+ c1 V - #include <linux/init.h>
2 b' X4 k/ _! v" ^2 g6 k, K - #include <linux/errno.h> \4 b' d5 i- ~( ]
- #include <linux/types.h>
+ I" r2 T3 F4 ^3 i w2 E - #include <linux/interrupt.h>
G: m' ?1 [5 t - #include <asm/io.h>
& Z3 \$ Q0 E% l& M) h; C1 q6 k - #include <linux/moduleparam.h>% ^; S; ]1 l5 c8 U7 K# y
- #include <linux/sysctl.h>, b/ n- U8 y7 w& k# C; L& [/ `
- #include <linux/mm.h>
% |9 ?7 b# @. T7 i1 X - #include <linux/dma-mapping.h>0 \" F' Z6 N# a( O2 [" ^
( Q; p) T) n8 G. b* t# N F1 G- #include <mach/memory.h> ?. F" w M6 B
- #include <mach/hardware.h>3 U% c0 R2 F4 z# i$ J: L8 f' I
- #include <mach/irqs.h>- a; E3 y/ t! c! O
- #include <asm/hardware/edma.h>- o1 L/ W' Z. D; X) K
- 6 [3 | \, w5 V2 u! P
- #undef EDMA3_DEBUG# G! q8 U2 l! v* i
- /*#define EDMA3_DEBUG*/
# C+ n" Y! ]% J, K2 p
' N- _: e; S6 U+ b9 b% m6 i1 C; i1 r- #ifdef EDMA3_DEBUG
0 L; M& \8 L4 _" W - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* ^, B6 Y! M+ i: a: o2 _3 V$ n
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
8 y. v' R; b6 G8 Y0 x4 `$ Q - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
+ i: |$ s; ]) F1 r. ~, ^ - #else% Q% R! y3 F" s4 z l8 v
- #define DMA_PRINTK( x... ); E1 b0 y8 R5 S- K" A
- #define DMA_FN_IN! P! m7 ]% X& c) ]/ n- V# m2 z
- #define DMA_FN_OUT
7 G% r# i3 j' L. c; ~2 Z - #endif
# a \$ k/ g2 z/ m+ B4 F - , I1 K1 d# n0 m
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
0 A* K& U' i; I& j6 d. b* V3 E' L - #define STATIC_SHIFT 35 h4 n7 Z) U0 _4 g1 s
- #define TCINTEN_SHIFT 205 _5 x- y1 e0 |% n$ Q% K$ w, z( Q
- #define ITCINTEN_SHIFT 21; a4 i" c0 J$ s0 x) q1 ?
- #define TCCHEN_SHIFT 22
" }6 @, ?3 ~! ?* ]$ Z4 ` Z - #define ITCCHEN_SHIFT 23) p5 W6 y3 V) ?+ h$ F% ^% K
- + U- m E( q- D. n) }/ Y$ m m$ D
- static volatile int irqraised1 = 0; B" \; H+ v, h
- static volatile int irqraised2 = 0;
$ s6 p! V0 k1 q5 I% U! G' Q. O - % H$ U+ `1 v- L2 {, M8 P
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 |& F- x! s5 n
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& ?- J9 r! S0 p+ g7 h( j8 H) O
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 |! m1 W. G1 G! S2 a+ a2 Q& s/ E - ; ^+ k; n' o6 s7 b
- dma_addr_t dmaphyssrc1 = 0;
1 _7 u8 ^3 }; M+ ^0 v9 w0 E - dma_addr_t dmaphyssrc2 = 0;
8 G7 A* x1 s4 d ^4 P( j - dma_addr_t dmaphysdest1 = 0;
& z/ v6 P4 I4 Q/ w - dma_addr_t dmaphysdest2 = 0;/ O* y9 J, I' B* X. }7 W
- , Z' O. X) G6 U; h
- char *dmabufsrc1 = NULL;8 r. E3 {. @; d. @2 Q$ L
- char *dmabufsrc2 = NULL;
, H0 E* c n1 q% M b( P4 _9 ` - char *dmabufdest1 = NULL;
! |. X' {# a2 T" J( H& f' ? - char *dmabufdest2 = NULL;
1 Y1 }- v4 y, |
. d% K |! C2 O& ~" T5 ^3 u/ q- static int acnt = 512;
4 P. L8 O6 E" q# L* P* m - static int bcnt = 8;; W: ?6 ^& G/ a; x9 Q; Q
- static int ccnt = 8;$ w: M0 D& I0 x0 }# Z+ D: e4 f8 J7 P
- ' D9 \: U3 v! [- D
- module_param(acnt, int, S_IRUGO);+ b$ m$ c. O( }
- module_param(bcnt, int, S_IRUGO);
0 \, ~. Q- s3 Z& b& O - module_param(ccnt, int, S_IRUGO);
复制代码 # z- A8 Q2 B$ \7 k( Z
" R$ k# W: E/ f {9 r: d6 A' |) U# ~ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) N" O/ j$ ~; h% A: y9 }3 z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% I* T- H% j/ g+ o 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# ~3 K+ C" u" G5 V# u7 H( q8 x8 l. A2 E1 B+ g8 ^6 G
1 O" ]( F: h- O) z. L1 @6 Z) `4 u- ]
|
|