|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 \& n. W* A" |& @2 G) n
- [code]EDMA sample test application
$ w) [6 A# Z6 X3 d, k" o z& O - /*; y$ l# k2 B' r
- * edma_test.c
( M1 k/ P" x$ t* r9 R& e/ U6 X - *
S. i* c' w6 k! t - * brief EDMA3 Test Application# {0 ~$ A' l9 n, `. ^% T
- *! S3 B$ ]( z. Z2 C8 l; F: [
- * This file contains EDMA3 Test code." x- K0 P/ `9 H- D) I! z9 X
- *
! ]; ^8 r) K ], D' J - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! F+ p1 ?% Y0 C) ^6 d# k( {
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- ?1 ?: }# \4 a; O( {
- * TO CHANGE.
6 V: v1 j( z o0 [- A2 j - *; Y) f* G, f- V3 L7 `2 r
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
5 p& {( o% A( d$ v - *7 o* E+ F. [( a+ J- m9 J8 I. j7 R
- * This program is free software; you can redistribute it and/or/ o: f0 j( C7 P T; Z: S
- * modify it under the terms of the GNU General Public License as
$ e8 ~1 K, d& P. O6 w' Y/ L+ n+ r - * published by the Free Software Foundation version 2.
% d$ {; p! I; | - *
# g) l3 z' d2 a2 S# l4 h9 \0 f - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
4 I* O8 G; y9 ^7 ^1 F2 ^9 V/ ^ - * kind, whether express or implied; without even the implied warranty* S& J9 B) |; z9 A% |$ W; V
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the$ T( o6 l: }( o. R$ h1 q
- * GNU General Public License for more details.1 R% p6 C. s' y+ k1 ]% v
- */
& u+ a X( G+ B& Z7 ?
$ y$ O& W0 Q) Z+ k/ A3 c3 } y- #include <linux/module.h>
* R) A9 K9 z1 \; }; {/ A" O - #include <linux/init.h>% W) Q' T. N+ a5 U) x; ^
- #include <linux/errno.h>
! R! Y! w% j; u3 Q! j+ R - #include <linux/types.h>
, }! B" m8 l: V5 \, F, k - #include <linux/interrupt.h>/ m3 V9 x4 w c: s6 M) ~2 k
- #include <asm/io.h>
' A1 Q X& q. Z/ z - #include <linux/moduleparam.h>
/ n) \4 V7 m. K" a( c) [" w- x - #include <linux/sysctl.h>
, h2 g2 {! X9 w T9 k* [ - #include <linux/mm.h>3 W& a% L' d: e! }/ f
- #include <linux/dma-mapping.h>7 Z* J' p( `/ ~$ y
4 V1 x) A3 `& P1 u1 V1 P- #include <mach/memory.h>
# B- a- \ V) {, P' b) ? - #include <mach/hardware.h>
. V7 |1 J* O$ l) e0 j - #include <mach/irqs.h>2 }. U! d5 ]6 A$ U, q1 Y
- #include <asm/hardware/edma.h>
/ I4 J7 }- |7 K [; g$ e - ) I! N5 c% b# m1 Y! `8 r
- #undef EDMA3_DEBUG; z9 p& B5 p$ E3 Y2 ~% P0 M F" X
- /*#define EDMA3_DEBUG*/# u1 d# v/ g, Q1 z' B
- 8 R; \" A" v3 E1 {$ y
- #ifdef EDMA3_DEBUG
; C9 ^ @. c, b# t) \1 K4 g* J - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! c" C3 c/ ]" z6 z. o- o8 n
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__) a+ [/ S! `) S2 O
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! N$ w5 Z6 }( E- v9 Q
- #else
- m# Y3 m0 m! Y* }& p9 _% A9 t - #define DMA_PRINTK( x... ), W8 q9 m C* h, ]; p0 w
- #define DMA_FN_IN' I# [2 |$ L% O4 X0 I9 [2 l
- #define DMA_FN_OUT( d3 W* j( L( v3 [) y5 Z, \/ c
- #endif8 h+ s1 r) A% N, h7 ?
! O4 M _. r. n( ^- #define MAX_DMA_TRANSFER_IN_BYTES (32768): z6 u j9 S; w- X/ T/ O5 _
- #define STATIC_SHIFT 3
1 o* E7 `4 r. E5 s8 F - #define TCINTEN_SHIFT 205 u, K* ~, r, Y
- #define ITCINTEN_SHIFT 212 T( k6 t/ N9 k% H' u/ D
- #define TCCHEN_SHIFT 22
) z3 b. s* X# Z3 h$ i: y - #define ITCCHEN_SHIFT 23 N z3 i# \: t* N- ?
- . h2 L8 a" _) G/ P; n' l4 f+ {4 t
- static volatile int irqraised1 = 0;
& J1 `( p" s. q9 ]& A1 t - static volatile int irqraised2 = 0;3 t" [9 L7 j% z% l* Q4 M8 H) u
7 W9 h. o8 W, d4 ?) S- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 ?' }; g0 [/ a/ @' X+ m: j; ]3 T - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& y5 \5 Y1 Y9 x - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 N4 Q/ V+ Z' s% b$ I/ o/ @; I# A
- 6 t/ I, c3 L! @9 }
- dma_addr_t dmaphyssrc1 = 0;
3 p/ `- q4 h* h/ N& ] - dma_addr_t dmaphyssrc2 = 0;
" N( w( B! g% K3 f" a% n6 y6 u - dma_addr_t dmaphysdest1 = 0;
4 y- z. u/ @# Z: a( Z4 t$ m% B - dma_addr_t dmaphysdest2 = 0;
' B; g/ U! K4 v- l- p% `$ |5 A - ( G! o: q7 X& U! R6 F# H$ B
- char *dmabufsrc1 = NULL;& f- ~& c3 D( L' |, W ]$ f2 s1 e
- char *dmabufsrc2 = NULL;
& @3 m. y9 B: ^0 g* ?8 F* ? - char *dmabufdest1 = NULL;! B4 h$ Y7 M. e8 p, d1 e' \
- char *dmabufdest2 = NULL;( `) a. W/ a; o# P3 E& K
) U& u) Z7 W- v. z# {. O* {1 R- static int acnt = 512;$ R7 Y! s7 _% x8 I3 L, V
- static int bcnt = 8;8 \* L. [! i/ a- S/ l! c! Y
- static int ccnt = 8;
* ^$ y; g) A+ W - , B2 t. Q7 Z' U, `" P% ~4 n
- module_param(acnt, int, S_IRUGO);; U) H' L9 T1 I5 F
- module_param(bcnt, int, S_IRUGO);
; ^) ?3 D0 h h0 H( B6 b - module_param(ccnt, int, S_IRUGO);
复制代码
: t2 P) a1 ^, v; v' P% V4 J J) Q* l/ j+ m+ P; ?2 f3 j' b0 U5 V1 w) O
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 p5 C" V: b5 S. U' }2 k' darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" ]; b7 z% K6 ~% U6 ^
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) \8 u, B' H* w% v6 Y& o$ A! |- G! ^( D( H9 Y5 l) c
4 d5 I; b# p# m* B |
|