|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( [* X6 I+ w! j/ u9 n& a9 P4 b
- [code]EDMA sample test application3 h( \7 Q4 A8 H3 x
- /*
R7 f% i/ y0 E s6 U! h - * edma_test.c; b( w1 c, Z. `
- *
@$ e, F6 D5 D% q - * brief EDMA3 Test Application* P) a# v L8 u: f1 u# R* M4 `
- *
P& u0 \8 o5 A8 p% ~: I7 W1 D - * This file contains EDMA3 Test code.5 H2 F; y# t! \* [8 T J
- *3 v$ I- c: B6 x7 x
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ c d& z# Y9 {5 k1 M
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
Y$ ~- Z2 I& L. q$ Y$ S3 E - * TO CHANGE.
; }2 n9 A) m- s/ u; S4 q - *7 }: p# W( q4 r
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
" V! x9 h/ S' ?5 g' C- m, B( ] - *% i$ p9 z# q1 R6 q8 b
- * This program is free software; you can redistribute it and/or8 w. P! `4 ?1 w, [( R9 d' o
- * modify it under the terms of the GNU General Public License as
6 m* c( ^% M4 v# p# f - * published by the Free Software Foundation version 2." g( h* _. e; I l% ]+ h; Y
- *" p# H v% m. j
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ w/ l/ a' O5 H! k* |+ }
- * kind, whether express or implied; without even the implied warranty
! M8 d& F$ w w: ?. P - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the3 }# ~' P* v, P6 M3 {" T! _
- * GNU General Public License for more details.
$ d! k- ?8 _* d: w - */
3 e, P) E3 d. I$ N
& W: k4 P! E& O$ U7 {* h6 N- #include <linux/module.h>$ q- h3 e* {0 m: p) w9 {/ {
- #include <linux/init.h>
' Y% [! W# v- A3 ~9 p - #include <linux/errno.h>
9 b( |, E/ g2 W& Y - #include <linux/types.h>
R7 g- h. Q0 a. n/ N' \ - #include <linux/interrupt.h>
% b% T( X* G: {, d& `6 l" D - #include <asm/io.h>& d, x/ ^! V4 d" I
- #include <linux/moduleparam.h>
4 ?7 |1 U/ a0 D$ H1 a8 ` - #include <linux/sysctl.h>
+ y! ]& c6 B+ L5 F - #include <linux/mm.h>& r; _& c+ L! `6 |) p/ ~& L N
- #include <linux/dma-mapping.h>' G. M4 t' Q2 j9 Q3 _& S
; W" b d; n: N& ^- #include <mach/memory.h>2 d3 { z, m/ ]! u& o$ D; ^
- #include <mach/hardware.h>* X6 C" B% o3 j" R
- #include <mach/irqs.h>
* ]& \0 N c: o# @/ L( j. h - #include <asm/hardware/edma.h>
+ q* f$ f( F# u6 v$ Y/ c5 X - - z \6 J2 C) O5 C; \7 j/ r
- #undef EDMA3_DEBUG0 {- G* {2 B4 A% l
- /*#define EDMA3_DEBUG*/
; D% M2 ?6 n' t9 {$ L6 Z - " Y. |, S7 M; A3 V
- #ifdef EDMA3_DEBUG- \7 B& F4 ] j4 J; J
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
5 ]' S0 G; K, `9 O/ I0 j - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__) E/ m3 H; @5 b& z
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
& `0 x5 I8 S9 ]. T - #else
" \. H; U: K8 a5 [$ Z3 o# ~* U - #define DMA_PRINTK( x... )3 ^3 P" L: C Z( ~ g8 U {
- #define DMA_FN_IN
0 f2 d+ f3 r C% d/ g" V- o' L - #define DMA_FN_OUT
- w3 {) Y: `9 f, Y ?. J) Z - #endif# v8 \4 W! U" `7 G! Z- Y M; N' K8 S4 S
- 1 ~2 C( ~3 v: w: W$ o. Q" Y5 w1 ~; B: d
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)* F" d* q: g' d d6 e! w% `8 X
- #define STATIC_SHIFT 3! M5 H) a0 `( E8 d/ T
- #define TCINTEN_SHIFT 20
; T. S' G% }5 @ - #define ITCINTEN_SHIFT 21
2 |. ]; J) u. |- x: p- m - #define TCCHEN_SHIFT 220 z9 Z+ K6 B7 x8 U( |% w
- #define ITCCHEN_SHIFT 23
4 R( y1 x: r' b6 o4 q( n - 4 b) ^" g' V$ r* U& E
- static volatile int irqraised1 = 0;
7 Y% l d7 Y* Q e2 Q - static volatile int irqraised2 = 0;
. l/ u. ?. i& a2 s( G3 r - 4 {+ E) H" K2 y- _8 w1 F- m" L
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 n% I5 J* G2 X* J1 | - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* N* R0 Z& X/ P9 R# @ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 x- c6 W- n& |4 {( d. f8 G1 _
' G1 z( S( T( N% d- dma_addr_t dmaphyssrc1 = 0;. t- ~7 u1 A! X8 f
- dma_addr_t dmaphyssrc2 = 0;
9 u* \) N4 a. ^ b( ]% j" ? - dma_addr_t dmaphysdest1 = 0;
( `+ \% j% C Z - dma_addr_t dmaphysdest2 = 0;7 u& L+ h; S' v( W
- 3 R/ l* {; z- ^5 e2 h1 H2 L& U6 m
- char *dmabufsrc1 = NULL;$ i) M% A1 ~0 M. }5 P, j; s
- char *dmabufsrc2 = NULL;
4 p! d0 n$ X+ T X( u3 @; L - char *dmabufdest1 = NULL;# `! g8 G1 ]/ e
- char *dmabufdest2 = NULL;
' {7 k* |9 O: Z% j2 C - 9 W# Q9 X# t, F
- static int acnt = 512;8 }% M& f: z. ]' s
- static int bcnt = 8;6 e) j) Y" o" j! m! z. D, _6 G
- static int ccnt = 8;
a- F3 d4 b6 ^6 i - , ]1 {5 r9 q, [0 G0 K7 r
- module_param(acnt, int, S_IRUGO);" v2 d( ]" U4 y; ~9 ]$ ]4 Z
- module_param(bcnt, int, S_IRUGO);0 ~6 }$ S5 G" l0 T
- module_param(ccnt, int, S_IRUGO);
复制代码
+ }' N. o2 p3 I w# w0 f% x% _- ]
, L2 k! t+ t6 r/ b/ y 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 \7 ^* ?+ i( S# _! V& ~/ 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) }% o3 }% O/ i/ S
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; m/ o9 q0 y& `3 t9 N/ F0 g# d
" ^: H; {0 F; T( q# s' ^, I$ @
7 L* J) j+ e" F& [7 C. S9 t |
|