|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # O- B9 p! h+ e- g
- [code]EDMA sample test application$ q( n' g1 A1 w9 D9 `( K
- /*
/ }: }5 j, T: b6 ]- H; q9 V - * edma_test.c2 k# ?+ W+ b) q5 e
- *
, ~/ B' V: e& w8 w% e - * brief EDMA3 Test Application
$ N3 X$ M/ p9 t - *- Q; ]6 H, ]* q( e# |: [
- * This file contains EDMA3 Test code.
' K1 \" \- l5 {. |1 n - *$ U7 n3 F# Q1 [) {+ j- ?( O, I8 w
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* |& V& w8 E" V& f3 D* b# ^
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
; D6 H& K2 }4 [6 Q% J* K - * TO CHANGE.
; \2 x' x) Q! M9 p$ Z - *
* Z9 r+ Z i% C$ e$ ~; p" R; M# ^ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
/ R0 u+ H2 K0 p, W - *9 `4 [/ p5 B5 ]; c' M/ g2 ?
- * This program is free software; you can redistribute it and/or
2 `$ o' P1 G a0 A$ k7 D3 e# k - * modify it under the terms of the GNU General Public License as
! X$ X' O3 c/ F6 } - * published by the Free Software Foundation version 2.; l2 u6 M; o! o& Y* V T
- *
6 n X2 N) e* G* Y( H, z; C* x9 E* ~) v - * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 m1 ^' d8 [" D* i) D
- * kind, whether express or implied; without even the implied warranty
. a" N$ z5 q9 x8 D - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- z) J3 w/ }7 H - * GNU General Public License for more details.# Q# M% `3 U4 Z
- */& I' y. p* Z+ e/ r
- & u0 I) o O8 U6 s# p
- #include <linux/module.h>$ U7 Q' B+ J% G3 h4 l
- #include <linux/init.h>
/ V* w- J' V+ p: A& Z( S+ i - #include <linux/errno.h>
1 ]+ V5 |9 }0 v% y* F$ u - #include <linux/types.h>3 z" i( j9 f( H
- #include <linux/interrupt.h>
, @0 z* m' E8 r. u+ q - #include <asm/io.h>
9 {. b! j5 v* F' N8 g4 {& q# D( ] - #include <linux/moduleparam.h>
3 M; @; Q& t7 f# n4 Q: x) | - #include <linux/sysctl.h>
/ Q3 J0 ?/ ^3 I/ L0 O - #include <linux/mm.h>
$ j |# |9 B( `% L! R, g/ L6 z - #include <linux/dma-mapping.h>2 p/ ]9 B1 Y9 B. g
- 2 ~' e7 ?; S3 i% {( e) X1 b
- #include <mach/memory.h>5 Z0 U$ i ^6 `- H5 {5 f' }
- #include <mach/hardware.h>4 z7 S4 _7 i) V/ P/ o( T" m9 c
- #include <mach/irqs.h>4 W! W, ?5 n4 V6 z) q
- #include <asm/hardware/edma.h>
. Z7 N% x1 C" |& n, u5 I' d' G0 h% r" g - / d9 S( l t5 R r) M
- #undef EDMA3_DEBUG
4 m5 X' l1 y3 A4 g, s- z: c - /*#define EDMA3_DEBUG*/
/ J4 r/ F8 u2 C6 {( U3 h* C
/ V- F+ u6 t1 O& m9 A, X- d; @- #ifdef EDMA3_DEBUG
& Z. ]0 p3 G& ]0 s4 } - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! T7 W# A+ [# [9 z3 B
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 X; ~7 e+ G: t$ `
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 h d/ I K% `: O6 D5 v
- #else0 y$ c/ d0 S. @; N" R
- #define DMA_PRINTK( x... )
0 k) R7 D/ y7 m5 N3 z0 M' y% r. v - #define DMA_FN_IN* S% |. g7 s4 @3 r$ W0 ?7 Z3 c
- #define DMA_FN_OUT2 K8 l, i7 ]) V+ ]1 Y
- #endif! l* l8 _$ Y6 o# J, @
- % A0 d% J9 f4 x1 n. X4 G9 `
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
# Y+ y. K2 \& x% X - #define STATIC_SHIFT 3
: ]$ z/ ?, S/ v# z& {' O - #define TCINTEN_SHIFT 20
* W! J2 t4 r8 v+ i- }8 Z6 j - #define ITCINTEN_SHIFT 21
" y4 X4 }" w( x. a2 ?+ [* a - #define TCCHEN_SHIFT 22
4 m. U! G4 ?# r9 ~) r - #define ITCCHEN_SHIFT 23
/ l4 p8 `) g8 {, E \& \4 o - 8 |5 L: k/ V; t' n7 P M2 A! O
- static volatile int irqraised1 = 0;
, v) G0 l% y) u - static volatile int irqraised2 = 0;8 k/ y$ c$ q4 |
9 i( |. ?5 N0 B; X; {* }; C, g! U- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 A3 b& Y$ ^) H - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
a+ `* n8 P5 f - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% w: U$ ^& x3 Y4 ?: I5 m! \' I - 5 h) v; \/ M: F- F c+ t9 g" C% d M
- dma_addr_t dmaphyssrc1 = 0;
% [, H2 m2 s9 @. I7 b* z: n - dma_addr_t dmaphyssrc2 = 0;
, F( t. J4 g, Y3 o( B* {8 R' P - dma_addr_t dmaphysdest1 = 0;
8 ~& k( ~& i8 s - dma_addr_t dmaphysdest2 = 0;
3 `0 v, A" I9 A! H( k0 m
- n1 u0 m) W/ S+ X- char *dmabufsrc1 = NULL;
& X$ X1 n+ b) Y8 K2 w! b - char *dmabufsrc2 = NULL;$ S/ v7 H% O. ^+ c+ g9 _1 F/ b6 t
- char *dmabufdest1 = NULL;
9 t2 Z, }9 |" J' u% Y - char *dmabufdest2 = NULL;
2 q' D1 M7 ]" `6 e3 W
3 h) Q! R/ @' j5 t% F! [+ Y1 ]- static int acnt = 512;, {: p8 f: Z. J1 U; ~/ Y
- static int bcnt = 8;
/ W# t, c& |* G( k7 h9 e; F - static int ccnt = 8;
2 a7 ?4 B H$ t# d
2 P( ]% j8 I+ {! N' c o- module_param(acnt, int, S_IRUGO);, C' p1 U/ Z \
- module_param(bcnt, int, S_IRUGO);8 w: N) V, A- w; k. C' [: P) Z
- module_param(ccnt, int, S_IRUGO);
复制代码
/ T& v" y- h3 ?% b1 v
- G( d/ e8 R d9 p 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 I; V' K; O* P6 q B' o4 {( ^
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! ] g2 N% E4 z; h
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 s, K4 Y- [' G7 a# H( z2 N
- p- r- ?- k! e( S
; S Z( P# ]9 q2 ? |
|