|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; C/ w+ \' N9 J; l6 D6 d" K' C* t+ Z
- [code]EDMA sample test application
2 k9 S1 Q8 v( G5 M% d+ i4 m - /*: F5 ?+ x- J* j1 N$ m/ n7 {. C
- * edma_test.c
" }& j/ w, p7 w7 ]4 l' F - *
: |8 Z: W/ } {% {1 t0 r- \' f* o - * brief EDMA3 Test Application$ o+ S8 T0 D$ h/ ~- l2 `
- *
1 z5 z& @* q. h9 D - * This file contains EDMA3 Test code.
5 g8 _ f R, N* F7 h2 O1 c2 B& O - *) n# E8 M7 p+ b6 e% K8 g8 d
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
* d5 F: W, b0 z$ A - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% Z* l& W1 `$ V
- * TO CHANGE./ ~. W {/ V* E8 D5 _
- *4 }' V+ S# H# ?$ O A3 e# R& b
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
! }* {" J" I6 v# q# Z2 z - *
6 u, m4 |6 u0 I: u% U! a6 f - * This program is free software; you can redistribute it and/or& L" O H0 x5 N2 {) ^; n- n: k
- * modify it under the terms of the GNU General Public License as
, A+ G6 q+ K- l0 y# k" V - * published by the Free Software Foundation version 2.
0 b/ B+ M* r! }9 ~ - *
5 j& Z: s5 J% K! F) K - * This program is distributed "as is" WITHOUT ANY WARRANTY of any' F, v- C' T$ B1 M' ^8 t" Q% p7 Z
- * kind, whether express or implied; without even the implied warranty' a% ?0 d8 v* O* }- |) e
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/ u2 ]/ v( X/ }1 a, s( r7 m - * GNU General Public License for more details.7 }' P" Z. \7 X2 i0 Q
- */
+ J$ U& `* u2 x4 |) Z. [5 M - . W& _" v4 I) x
- #include <linux/module.h>
( m9 t; k8 D5 { Z) t( z' P! ] - #include <linux/init.h>
, y. `1 z0 @9 b - #include <linux/errno.h>
+ T- g, o+ t' V - #include <linux/types.h>
! j2 Y3 x4 t4 Q - #include <linux/interrupt.h># J7 {- j& y; a# U
- #include <asm/io.h>
* z& e5 F$ C7 t# { G q - #include <linux/moduleparam.h>5 Q- ]8 E8 R% j) U
- #include <linux/sysctl.h>
1 @4 m( G/ r: R6 I7 i2 W6 a - #include <linux/mm.h>
/ X9 q0 {6 O3 @8 l$ J" { - #include <linux/dma-mapping.h>! [% u9 S) P: g g
( U: a+ ^ _- a1 F. [- #include <mach/memory.h>
' h: @+ e1 i4 W8 ` - #include <mach/hardware.h>; G: k2 n( |, \
- #include <mach/irqs.h>- r, c& u- s$ |( d+ t
- #include <asm/hardware/edma.h>
& `$ [! k. J- ^ - 0 ~% P# v2 C, ~2 V
- #undef EDMA3_DEBUG: C, c. ?6 ~0 B1 \# \8 ?
- /*#define EDMA3_DEBUG*/8 l2 g1 U) o- O2 Q; Y( f
- $ l: n& {9 |0 }0 g- x A' M. `
- #ifdef EDMA3_DEBUG
% }3 U$ s/ W/ ] s4 y4 R. U - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 m9 W% h% {+ V! l% W
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__) ]* T& j2 r, _1 v( I+ w
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
% Z2 I0 l3 p Z2 @' I5 n - #else5 \1 {/ U* v) {
- #define DMA_PRINTK( x... )4 ?& c& g$ `" q- K
- #define DMA_FN_IN" M5 y% u0 i; {( P
- #define DMA_FN_OUT9 p7 e" r! m0 F
- #endif
5 N" `) B# v5 x - & l7 E% j9 ~' D; X
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
! m+ D+ @6 k0 W5 F; G4 D7 o9 w2 H - #define STATIC_SHIFT 3
% J0 A; ~1 R, H; g. r4 k# U! M - #define TCINTEN_SHIFT 20
. x$ g; N, ^; N7 P- | - #define ITCINTEN_SHIFT 21
2 i& Z* c2 r& |2 V5 P! [* t - #define TCCHEN_SHIFT 22
1 L7 }& C( J2 X! v" l% ?) J6 ]8 A - #define ITCCHEN_SHIFT 23; U/ N$ ?4 u3 r8 P# j6 N
* J) S V v$ |- static volatile int irqraised1 = 0;; F, k; g, m5 M# ?
- static volatile int irqraised2 = 0;
. _2 r) |4 D5 m1 B2 p - 4 _, z, Y9 Z2 T
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 R L7 N4 C/ Y0 o- S - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! ]6 e6 \3 {! N: d- L - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( w( S) c' ~- a
/ p3 Q9 v" [ Y$ T' I- dma_addr_t dmaphyssrc1 = 0;
' ~5 I2 O# K. k) l - dma_addr_t dmaphyssrc2 = 0;, X1 \' H' b. O, P- A/ w! p
- dma_addr_t dmaphysdest1 = 0;
) z0 v/ F4 i; T0 ` E$ T" j0 @ - dma_addr_t dmaphysdest2 = 0;
5 \' k# W9 i- P8 b - ! p7 g2 J+ i5 ~5 D* b3 A
- char *dmabufsrc1 = NULL;9 ^2 e7 E. k' H/ z1 s
- char *dmabufsrc2 = NULL;- P, m# F, B( Q2 x$ G% k# i
- char *dmabufdest1 = NULL;
3 z/ v! e' M { - char *dmabufdest2 = NULL;
" E7 _* z$ x" A. Y8 X, r- W$ A
4 N/ `6 v1 y7 N2 z. \+ P2 }5 v( J7 _- static int acnt = 512;* Z6 |6 B+ E+ @1 C
- static int bcnt = 8;
5 E: h5 N0 Y) h9 B - static int ccnt = 8;
, R) e! K2 K1 c8 a8 u& q; Z - ; J+ q6 t( H+ e7 q' \! Z$ N' \ W
- module_param(acnt, int, S_IRUGO);
- H6 @% T- h4 I5 m! y - module_param(bcnt, int, S_IRUGO);
) R5 R8 ?' y( h: P* c - module_param(ccnt, int, S_IRUGO);
复制代码 2 R: w% B9 ]; x# @
7 D# a1 r( k& l& z0 i
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 t' F3 M& E3 _" {% _
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ k6 z; B" Q6 _0 ^6 k2 f 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# v/ p4 t) C$ b, H0 `
- L7 F$ B# K$ B7 J# I6 @
4 r# U1 F* V( @, V1 f* q2 Y |
|