|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . S& Y" i" ^9 i q5 N1 }! Q' k1 i
- [code]EDMA sample test application
% e0 e( n8 f$ g2 w. Q/ Q0 S - /*
" O& k* o# A) O; O4 B - * edma_test.c6 O7 b0 W( e! H) q
- *
_* f% F! b' q - * brief EDMA3 Test Application' _8 l1 |, }, q* n; r3 f" d- [
- *! s$ z; C/ k% q& B5 w, D' {
- * This file contains EDMA3 Test code.6 U9 x8 ^3 }$ u, W! Z k3 |
- *
! w4 j7 J- C0 Z6 ^8 t$ \$ \+ M - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 t9 P) b- N& K2 X7 S* p) }1 I( a
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
c$ R3 Q& {* n3 ]; `; u - * TO CHANGE.: H. p' [0 ?3 D! W5 y% X
- *
/ w6 n. o$ g- ]+ `' V) f/ n5 h - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: g, U5 W d4 _3 w
- *
- W% f, O/ x3 z& n% r - * This program is free software; you can redistribute it and/or! A' @. p- Q8 |! i- f# p) T
- * modify it under the terms of the GNU General Public License as
% s% t2 @4 q ]3 ~ - * published by the Free Software Foundation version 2.
5 [ S& K+ G$ U7 H T$ q - *
9 T* k/ |! A1 M! O - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
6 k' Y8 ^% f# ?) q3 I7 i& ?# t) O - * kind, whether express or implied; without even the implied warranty# Q+ r& I4 F2 x
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the" S# L- T# t# @! |8 X) v5 @8 {
- * GNU General Public License for more details.
J1 G/ F! a. L6 K - */
/ a6 T$ ~ t) Q4 ~, R* Z3 t
" G" j5 Z4 n' @" D0 Z2 p% [4 e- #include <linux/module.h>
3 x1 Y- N3 g* u2 ? p+ |+ _( p% |" g+ p - #include <linux/init.h>
3 q, R9 B( u; e/ j - #include <linux/errno.h>
$ o5 K( y9 Q4 E/ ^* m1 d. V - #include <linux/types.h>
# T& ]0 E; V) ]5 f: A0 F7 L - #include <linux/interrupt.h>2 N( M) P1 [/ s" G, V
- #include <asm/io.h> Q2 q2 j& R' Z" o$ H2 r
- #include <linux/moduleparam.h>! m# q/ k) B/ r8 ^6 d3 l: t. W
- #include <linux/sysctl.h>6 v: z. q: s' s8 V" T
- #include <linux/mm.h>( b; U1 S2 E3 B1 g' s5 {- c
- #include <linux/dma-mapping.h>4 V# s/ e+ r c1 \9 } p, {
- ' g* ~& x6 q6 q7 O
- #include <mach/memory.h>' r. r% N# \* z6 s) A- h
- #include <mach/hardware.h>
0 a3 C) B( ^( L5 |" d, e6 A - #include <mach/irqs.h>
7 Q+ q. u3 ?9 ` l/ q. \7 [ - #include <asm/hardware/edma.h>: a; a1 o; H9 U* l+ ], D9 H$ d
* r- P! v% K; R- #undef EDMA3_DEBUG
. {9 F0 O% [; f4 H3 N# Q - /*#define EDMA3_DEBUG*/# b3 F1 L: n- h
6 x a6 @2 d& z( _+ D- #ifdef EDMA3_DEBUG7 n3 T2 z, e4 s
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
+ ^' s: k) ]( v) E" V, J$ N - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), ]1 P8 N6 N& h, ^
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); N' a2 Q6 R! q3 r
- #else$ E5 q# ], m* Q2 m) t3 b2 s9 g
- #define DMA_PRINTK( x... ), Z. C. ]7 e8 [- T1 N' u* r
- #define DMA_FN_IN
0 S3 e( L! m+ F6 D - #define DMA_FN_OUT8 k! S; L% t L
- #endif
$ a) N; O7 \8 s, U$ q
9 ~ |( B n: q- #define MAX_DMA_TRANSFER_IN_BYTES (32768); U4 n- e2 F- K. g$ W! x; ~9 v
- #define STATIC_SHIFT 3: J! G" g/ h* j1 e- \
- #define TCINTEN_SHIFT 205 D' G- |& y) q
- #define ITCINTEN_SHIFT 218 f$ t1 P* u4 ]# n3 J: x- H9 Y' ]. n
- #define TCCHEN_SHIFT 22
. ?& K/ | j _7 X - #define ITCCHEN_SHIFT 238 F/ z/ v: x* V4 S1 r+ i
5 t. y0 M- h5 o f. n/ C- static volatile int irqraised1 = 0;
1 j* M' n1 \/ Y( x - static volatile int irqraised2 = 0;
9 |% S9 }2 {/ K0 `+ I I - : a4 V& h) j; u, D* N
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! g r+ ] \" G. Y1 p/ H9 j
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ A2 k$ E+ Y: ]$ N - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! T7 @ R2 A9 ?9 W$ l5 l - 3 t8 r6 J1 c% T/ \& c' f4 E7 x* Y
- dma_addr_t dmaphyssrc1 = 0;0 u8 X0 I( G, z) Q& U% t
- dma_addr_t dmaphyssrc2 = 0;
( J. T& s) ` t0 G5 P - dma_addr_t dmaphysdest1 = 0;
' j- {- Z; C. j: c5 c - dma_addr_t dmaphysdest2 = 0;
. Y! `3 S4 [- N% G5 R, O - 4 u( p" A9 T8 d' R
- char *dmabufsrc1 = NULL;, d7 q$ @3 A' x. f/ H! m
- char *dmabufsrc2 = NULL;
1 p w6 ^& N/ b1 ~ - char *dmabufdest1 = NULL;
% R$ R5 p/ _8 y- d - char *dmabufdest2 = NULL;' N* r/ k( ]. k2 h1 J
- ! m/ ?* W5 d9 x! i# P5 e+ Q: P
- static int acnt = 512;
5 g$ f. }, h! ^ - static int bcnt = 8;
4 |! b0 P: `0 U, h - static int ccnt = 8;, w7 o5 `+ D/ C0 G8 V8 J
- b7 Z w/ \) o, d/ K- I
- module_param(acnt, int, S_IRUGO);1 b* x7 b+ k0 z* O' N
- module_param(bcnt, int, S_IRUGO);/ H0 } X0 x& _5 T
- module_param(ccnt, int, S_IRUGO);
复制代码
6 h T3 {8 a. r& e. m7 ^( g! |- l, j, |! H
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ J2 H$ M1 C/ _) x( ~7 _5 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ U: {+ ~+ i' X
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ ?3 B" O8 b% t+ e( V# d1 Y
0 C, b1 y9 V- [( Q
: P; D. n6 _* ]4 v4 p
|
|