|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 Z* u1 {- L3 G* a6 i& T; w ?
- [code]EDMA sample test application* P' ]: A) y. F: Q' f, Q
- /*
1 E8 H: O4 \& Q/ _ - * edma_test.c$ q& `* C. s% [
- *8 Z4 p0 k: u$ M; t& b# m- k' ~
- * brief EDMA3 Test Application: H$ P8 t2 u' t% x7 Q! b* E0 C
- *6 s* B, d; Y) G% `! _
- * This file contains EDMA3 Test code.
( J# }+ w( y+ t( t. h+ q3 m - *8 I% M2 f% K" t7 n! M
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
# A1 k- Y m: v& _( E1 d - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 _: l. k; }7 j. w$ u6 d9 z! w; {. X
- * TO CHANGE.
( l8 @& j; |' H2 a4 V' r, W - *
0 v7 O- d; B) c - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
% f5 h9 K1 M: j, J8 \; C - *0 k; Q, D5 B5 m# G6 [) O7 s* X; v
- * This program is free software; you can redistribute it and/or0 o) O) o6 w2 x H7 u: {
- * modify it under the terms of the GNU General Public License as" ?* p: M0 v5 k# M
- * published by the Free Software Foundation version 2.# R' y* k$ x2 F! Q- K% m+ C" }+ y
- *
; n) w! z1 A6 {& l - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
7 s" {9 R8 d8 K, ^+ Z! }. _ - * kind, whether express or implied; without even the implied warranty
1 K7 [0 T+ S: I5 b - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the% }- S/ w" H r3 g4 g+ S- S
- * GNU General Public License for more details. ]# S- l* W; J7 y
- */9 f( C- a6 B8 t s; n. H: {
! W& t- b2 b! A& p4 v- #include <linux/module.h>- Z+ _- s S0 N. h
- #include <linux/init.h>
5 N+ h" i X X% [ - #include <linux/errno.h>6 L7 o* I9 \9 e- x3 [
- #include <linux/types.h>- S: P' U. p7 C* c. E
- #include <linux/interrupt.h>
8 E2 \$ E& Q( X - #include <asm/io.h>
$ A Y6 H. S4 X2 t9 S3 k - #include <linux/moduleparam.h>
; V; Y g, A6 T, h) @3 U: |7 p - #include <linux/sysctl.h>
- V* i1 J! H& y9 S% z, G1 Z. N! a - #include <linux/mm.h>
! N7 D2 q3 I' R! m6 O }9 k - #include <linux/dma-mapping.h>
( i" ~( z1 k8 j
% o9 n& |) n) q$ i- #include <mach/memory.h>5 `' C( N0 i0 [2 w& e+ M6 s9 |
- #include <mach/hardware.h>
8 @2 P# `2 j, z& U - #include <mach/irqs.h>
/ C0 n/ a J' v9 l- V - #include <asm/hardware/edma.h>
# e& U5 }3 r# _# M. y9 Y
( i- P; @+ Y1 L; r* J, l- #undef EDMA3_DEBUG2 S g* T3 r Y
- /*#define EDMA3_DEBUG*/
/ o0 v) j% _" X) q% M
" q; [9 Q$ ^* |( N' G+ T- #ifdef EDMA3_DEBUG
( |4 @9 P" a% x - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). X- U% ^: X' b3 k, v; R
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
% ^( q- @9 _: M+ t6 h" z - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
* K$ `7 ~: b* s: M5 _ - #else
7 u# q& Q- F# E) K# J; [! U - #define DMA_PRINTK( x... )
; l! j) k, N* n+ K - #define DMA_FN_IN1 l+ N( X: t$ u% t" R* r/ Z4 {
- #define DMA_FN_OUT
, j1 B! y! n( `) U - #endif& L/ ~5 a" t2 }3 B5 o" o& b
- l7 R' R9 {5 W* j- #define MAX_DMA_TRANSFER_IN_BYTES (32768), [- C2 q/ P: J* k F3 R2 ^1 W7 C3 S
- #define STATIC_SHIFT 3
, V3 g0 ?$ K7 d' T9 i2 v; q4 i& Q7 o; q - #define TCINTEN_SHIFT 20
: o, `, N* x1 n/ ^4 w - #define ITCINTEN_SHIFT 21
. U. c& }$ ~6 b6 C8 ~3 _! @# Z, B - #define TCCHEN_SHIFT 22
, v' I+ X9 X& e - #define ITCCHEN_SHIFT 23! T& ]. A3 a$ I
- ; F1 J V o5 t i' ~/ l
- static volatile int irqraised1 = 0;- M ~% Q" F3 o& W' O
- static volatile int irqraised2 = 0;
8 ^- U' K& @; J5 G. _ - 8 X- _. m+ l& o
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# R, N! D9 p0 i
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 v4 F2 l& y; t7 P; z2 s. q
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) r9 Q2 D" {# L, I$ S) E - 0 X. n* P0 y% s$ P9 l
- dma_addr_t dmaphyssrc1 = 0;9 L+ [+ d. k0 K9 I& v4 _/ l
- dma_addr_t dmaphyssrc2 = 0;
; X! b, F' K' q' J/ S/ V - dma_addr_t dmaphysdest1 = 0;- d" V4 P8 l5 r0 \1 Y* s, {
- dma_addr_t dmaphysdest2 = 0;
5 X1 ?3 Z3 ~) j. J$ y7 R$ K+ h/ i
+ k& D0 l% u0 D8 Q- char *dmabufsrc1 = NULL;: U$ ^; V, L% y- z4 B
- char *dmabufsrc2 = NULL;$ i5 W$ J3 u/ R0 l
- char *dmabufdest1 = NULL;
, K1 Z" {5 H6 ^: V) L: A - char *dmabufdest2 = NULL;
& A! D7 T4 d; H* l
4 m) W. }( v0 ^7 e" o7 m# [) o- static int acnt = 512;
5 h9 K0 E; ~1 l - static int bcnt = 8;
+ f/ [' u2 \2 I; f4 u" d - static int ccnt = 8;) S- C2 T$ S- {4 k& {" m
8 n! N Y: o5 _3 A( W9 v- module_param(acnt, int, S_IRUGO); [; U u4 U6 Z
- module_param(bcnt, int, S_IRUGO);
: {9 d" a3 S* Y* ]& N - module_param(ccnt, int, S_IRUGO);
复制代码
. F x# f! M! O: d. E5 G
0 A2 n/ n/ d; y' g; `% y$ v' P 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 P+ d8 U' H r! e* Warm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; E' L* Q1 a% k* Z& a% @1 {
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# P" H& `2 ^1 o
1 o/ a/ @; S* J1 \& b
0 }. _0 b; X4 Q) Y" } |
|