|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # \7 R( D2 ~9 @1 p) Z9 h# {6 F. p5 k
- [code]EDMA sample test application
( B* K( t& p( k3 |" \: Q5 s - /*6 c' G% x5 n) H
- * edma_test.c
! k: F q# @6 U$ e2 C - *
4 ]# z/ [: S, [2 u. r - * brief EDMA3 Test Application
% a1 p& D9 h" m! f0 o) x; z - *+ k, q0 i% J" M4 K5 o" o6 S- R
- * This file contains EDMA3 Test code.7 r# }- I' L3 e
- *# f( O( L& k( @ p1 e' l' \7 H
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE y* [) x% f! A$ e: ~8 k( o
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 W1 r+ Q1 a' K$ J& }" I- c
- * TO CHANGE.3 `0 v$ Y& a+ s" K. h ]# E# ]0 _
- *6 v) L7 q# Z6 C9 R# y
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
: ^, Z8 o: ~6 G - *1 Q8 L" q$ O* I1 F: o* U1 T/ k
- * This program is free software; you can redistribute it and/or
4 V! W( H; @( J1 f - * modify it under the terms of the GNU General Public License as
: |& y3 q5 l/ Q$ O8 w3 }# T - * published by the Free Software Foundation version 2.
; m6 J5 C: h! Y' r5 V4 f - *
) b6 m5 |- ~6 [3 C2 ?/ i - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
. T- u& S4 T( w1 Q6 _7 G - * kind, whether express or implied; without even the implied warranty
: P, W3 [; ^: h. q0 w; Z7 Y9 @+ A - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the/ j7 T. j" ]7 ?- q7 L
- * GNU General Public License for more details.
9 @" X* a$ d- e - */
$ a/ k( J; b1 k$ Q. t4 Y0 m
7 {# D( h; k0 N- N% u6 N4 H( @- #include <linux/module.h>1 D! h# U) z) l0 j/ `) Z
- #include <linux/init.h>4 K6 U0 n6 S5 Q4 L
- #include <linux/errno.h>
3 S# f$ S+ Z" u( ~4 O, M4 D - #include <linux/types.h>
1 \3 J" K7 X% R5 d- \ - #include <linux/interrupt.h>
- i. t' i+ N' }$ N - #include <asm/io.h> V) ?0 n" Z; h1 t
- #include <linux/moduleparam.h>+ ^, [; j$ v3 P" `- S( x/ o" w* [
- #include <linux/sysctl.h>; e1 l+ l; k8 Z. j4 R1 _
- #include <linux/mm.h>
% V% ~% W* _4 f7 B - #include <linux/dma-mapping.h>
5 }( L% S; q+ U3 i0 M* j z
+ {- X; f+ F% L1 _: j- #include <mach/memory.h>( X' t( n2 h, X" M) ?0 R* Y1 s
- #include <mach/hardware.h>
# p- c9 }+ p3 X4 ]+ N2 P" v - #include <mach/irqs.h>
! f% I8 x) j/ o+ d: a - #include <asm/hardware/edma.h>
( s- ]- p3 D1 x5 Q
& c/ d6 u9 j. A$ j! R; z. Y- #undef EDMA3_DEBUG
9 G2 F' ^- I) X* u' c% T1 ~ - /*#define EDMA3_DEBUG*/
- t0 M/ z) m) D - 8 [5 _4 N3 w. `, ^8 T: e. f
- #ifdef EDMA3_DEBUG6 F( U, Z0 ~" B# K" @ k; @# B% k
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS) z9 G( |* E# U5 P: q+ @
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
3 Q% }8 C* r+ }0 V/ g6 W1 Q, O - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 t! e1 g8 e, ]3 w! Y+ _$ v6 f
- #else
$ C6 U9 R x# }! D# @: s- l - #define DMA_PRINTK( x... )+ e" _. c2 G; P8 E* S
- #define DMA_FN_IN
I3 w2 ^% @$ e c - #define DMA_FN_OUT! m1 q9 f. a/ I$ X8 M1 P" L# K/ p
- #endif, {+ \+ i- i+ m; d7 Z3 M
( P1 z A# j6 p- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
) @) g6 L8 \ V% d - #define STATIC_SHIFT 3
r1 N1 I: v# S: }. K7 h# P - #define TCINTEN_SHIFT 20
) h3 `8 f$ _# s r- a# R, j - #define ITCINTEN_SHIFT 21
" I& d# s; Q2 w8 }, L7 v% s7 j* Q9 Q - #define TCCHEN_SHIFT 22
" K, Q0 C& z+ ^9 u4 ?# _ - #define ITCCHEN_SHIFT 234 e: l9 k) H, S* Y! ~
/ A( ?% V/ E/ `- v- static volatile int irqraised1 = 0;
7 @6 e9 H7 x9 r% S* M1 K. ? - static volatile int irqraised2 = 0;
4 _$ ~/ L' A# b3 H( N+ b - ; P8 C. |; u7 A3 b6 }
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 _6 X3 B+ y5 |7 S, O - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* ]4 S# w* Q! o- B. u, M- w1 ]+ K0 m
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 |$ K+ ^( c$ r9 s4 m; x
# b$ d0 o( A( j7 T! r7 Z* R- K. O- dma_addr_t dmaphyssrc1 = 0;4 L2 @( Q p( P9 x+ b$ D" }+ G/ ?7 q
- dma_addr_t dmaphyssrc2 = 0;$ z5 [5 s! r% R! D ~7 ?0 P- Y
- dma_addr_t dmaphysdest1 = 0;
8 s- I4 O M7 F9 d/ ^: | - dma_addr_t dmaphysdest2 = 0;2 w; W( N K+ D2 p, I j
) x8 J% h4 N7 x' r/ U; _- char *dmabufsrc1 = NULL;; b# V }7 O: J) v' I2 i' P
- char *dmabufsrc2 = NULL;
# C1 K: O" ]- b - char *dmabufdest1 = NULL;
% ^5 L6 G/ o+ A( B& a+ C - char *dmabufdest2 = NULL;( U' w( v0 D8 ~" K" D8 Q
- . u' K& n5 S$ C; U
- static int acnt = 512;
5 V5 S' T7 t, u$ W - static int bcnt = 8;
3 S t, v" U* I: K2 t% {; k. K - static int ccnt = 8;; j9 r1 Y$ R' P) {# y4 b3 x
- 6 @+ @/ c: g* x* i' ~" o
- module_param(acnt, int, S_IRUGO);
4 ~9 ]: b# B# X - module_param(bcnt, int, S_IRUGO);
6 h& w& Q3 D5 x% ]) W# l" i$ I p& E - module_param(ccnt, int, S_IRUGO);
复制代码 % o ?. `- S/ M/ b
3 D+ q& @6 T1 f5 I, L5 C 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 u. r5 F" t! Y. e* L0 m
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; g- d1 ^$ ~. @: ?: W
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, Y- y# g: Q0 J- o
; L6 x! j) U6 H" u
) Q& H4 E3 b" y" l |
|