|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 l0 A8 V( Q% G3 f( v- [code]EDMA sample test application3 p; k3 x3 g0 L- r! b" ^2 b- _. v
- /*- q2 h6 y. _8 C2 [1 o p7 W7 ^
- * edma_test.c3 a) D; U8 G# {6 n, L) M
- *
" l6 r- G& {; M - * brief EDMA3 Test Application
4 Z( x9 u+ F0 a# S - *
j/ z; Q6 O4 N - * This file contains EDMA3 Test code.5 H2 R8 Z- [ X. f. k9 R
- *7 v5 Y0 t- ]3 w% ?
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 Y! F- P5 b8 U
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
% c. j8 d% z. ^4 K9 `7 ] - * TO CHANGE.0 Y4 T1 w: k# ?, q* X
- *
" l9 u2 D5 m% E - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
# ^& x! z; C3 f& E3 D - *7 c1 D3 }0 o8 q0 j0 l
- * This program is free software; you can redistribute it and/or
6 \$ b: e0 }, n2 z& a - * modify it under the terms of the GNU General Public License as
) V& m8 @4 P" w9 | - * published by the Free Software Foundation version 2., B- e( U; d- i4 i2 I) p
- *$ o5 ]9 z: {0 P m+ [
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ \/ ^! A% B# {/ l& i( k
- * kind, whether express or implied; without even the implied warranty0 _& O5 _1 y2 J0 [
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the. ^/ c. y) p) J# _$ _* h
- * GNU General Public License for more details.
1 {0 X4 e2 P# R+ z. }9 R - */
( v! @* A/ A" ^7 p( ]2 E* U$ W! `
$ W- B3 J: x' a1 b2 w- #include <linux/module.h>
5 ^* Q: P+ s: K: [' y, j, k - #include <linux/init.h>( ?% S8 C0 n9 u/ L2 r/ {
- #include <linux/errno.h>
" o4 K" ]: C, _( E/ V' p$ p% x4 p - #include <linux/types.h>
8 W! \/ U3 o+ N7 b" z3 t" v% W7 k - #include <linux/interrupt.h>- s( M# M( ^! h. r* a# k) c
- #include <asm/io.h>
8 g+ U2 f1 e+ K( ] n - #include <linux/moduleparam.h>
5 ?) x2 J$ `) C q( h! r# V - #include <linux/sysctl.h>" j d6 o8 f, b$ y! L
- #include <linux/mm.h>
7 L! y( j1 |' B/ R! a- P - #include <linux/dma-mapping.h> v5 `- H) g* j o
- + V* M3 e7 g0 S8 [8 r& G) I5 P
- #include <mach/memory.h>0 _+ O E) X& F
- #include <mach/hardware.h>
$ r e( h. X2 q. w( p5 Z - #include <mach/irqs.h>6 k$ }3 D, p, a
- #include <asm/hardware/edma.h>" a$ s; q- [$ F- u7 s% P, V& p
( f0 o, k7 P9 \$ y( v- #undef EDMA3_DEBUG
% ]0 [$ |% S6 Y) ]% d, S - /*#define EDMA3_DEBUG*/
: w2 v1 k* Z$ g' U$ O
' E+ d) s! J" p6 d2 Z$ Z: O2 a- #ifdef EDMA3_DEBUG: c0 ]7 F- ~" Z, @5 K8 S
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
' O5 Y( s+ ?* i/ ? - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ Z1 `+ [4 O& |( w& a; W. c( V
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
% e8 `# d0 i/ q/ X' @0 J - #else( S; \: ]; S# {0 |
- #define DMA_PRINTK( x... )( @& t/ A6 K- ^7 T
- #define DMA_FN_IN
8 \0 K& Q- C0 }% }! ]( Y |: e+ I7 V - #define DMA_FN_OUT
$ s8 p6 Y2 o8 I" M - #endif
4 G( C0 t% F k0 K# P
+ L' L3 t9 @( Q/ l) h- #define MAX_DMA_TRANSFER_IN_BYTES (32768)% K* I1 w6 G0 s; N' x
- #define STATIC_SHIFT 3( }) H" F0 Q4 G( U% q- r
- #define TCINTEN_SHIFT 20
0 r- b% y- d( M" X- ^( P# L- P - #define ITCINTEN_SHIFT 21
0 {* r9 E7 [! _. q+ m - #define TCCHEN_SHIFT 22& {9 h( g. a1 f- ^
- #define ITCCHEN_SHIFT 23& r2 t: G5 S7 P) z& R# F% w
- 7 B( `" ^3 U) k8 @& y. q5 \6 w
- static volatile int irqraised1 = 0;
# _+ g) q4 P: V - static volatile int irqraised2 = 0;% H0 o) K- I. x/ W0 }: X
) r9 y, H. R6 Z) C. U! o- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 ]; K5 r7 L. K& C5 D# s - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 `" n( S- P% I8 Z
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, l9 O( y5 P1 U
- 1 w( R6 K6 u+ b. ?% t |
- dma_addr_t dmaphyssrc1 = 0;& q7 s8 B- T2 Y0 S# T/ W, U
- dma_addr_t dmaphyssrc2 = 0;1 m! }0 s2 |. a
- dma_addr_t dmaphysdest1 = 0;9 W, P" |/ m2 G9 ]5 N
- dma_addr_t dmaphysdest2 = 0;9 v7 v( M0 R( a: t9 ^' s
; ]0 { E5 t( ~0 b7 A- char *dmabufsrc1 = NULL;
|9 C/ M: Q# w+ I7 ^ - char *dmabufsrc2 = NULL;: M3 F, H8 G& w+ e
- char *dmabufdest1 = NULL;
( k1 I M* U' u- ?) z: n0 ^5 [ - char *dmabufdest2 = NULL;
9 L% k/ J) A' c - ( u6 v+ _0 C" ]. N! b3 o( l, i0 T4 N
- static int acnt = 512; s, G$ J) P4 j# }) d A. I! h
- static int bcnt = 8;
0 h0 r5 }" u3 J# m# ~ - static int ccnt = 8; ?# z) E0 S% |4 v/ d
- / |8 U1 k$ }7 m" h
- module_param(acnt, int, S_IRUGO);% {: g( x2 w" x: i2 p' z
- module_param(bcnt, int, S_IRUGO);' A5 `9 h, v1 V( C. ^& z
- module_param(ccnt, int, S_IRUGO);
复制代码
/ q) u- L, q+ h0 u
2 l0 R0 l7 k0 v5 B2 i$ m 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ C9 c0 I( X2 C/ 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, r- h. J- E7 `2 ^' k2 {' k$ z# o 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 r/ |, Z) I! @6 r1 s8 N: L
: J9 z' I& A9 n1 c
" u: H( `- F! t4 y: l |
|