|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 j2 a' B* w( j3 g3 S0 D2 p- [code]EDMA sample test application
, g8 @" D3 `2 |" J/ L - /* Y! t/ A/ x o
- * edma_test.c
- r! ]' V$ Y" M* ^ - *
5 V* u3 A7 b8 T8 K2 P$ N - * brief EDMA3 Test Application
7 }" d7 k- Z2 K# `' Q9 { - *
0 Z6 y! P1 U7 M$ U& x% {/ s - * This file contains EDMA3 Test code.- N9 O2 t2 A; }: v- R* _7 @
- *, S% K* i) m a. ^9 p' s, G. m* f
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
- [" S9 M- V/ t' A: b - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! Z& k5 R6 T/ b: }: z/ y
- * TO CHANGE.
, d8 V0 f& |4 D: ]2 A* y - *
n8 B6 r+ O6 t( o, w) F. V! P# e* B* ` - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
0 m6 ~0 V& {( \9 [# ]% I4 P - *
" u; {" i! N. v - * This program is free software; you can redistribute it and/or
% `+ R3 O7 J- H- l; ] - * modify it under the terms of the GNU General Public License as8 P, ^" Y2 W- ]. a6 c# Y
- * published by the Free Software Foundation version 2.( J5 n1 H& T; {" W/ y
- *
i4 b g! ~0 T2 J+ G - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
4 x2 x: D) Z8 i; y' }/ x3 G - * kind, whether express or implied; without even the implied warranty
( [" k3 S. k6 D5 r) I - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4 e1 f, p6 {4 w. f - * GNU General Public License for more details.: T _7 V* t, M3 h: g
- */* k% q. T3 n) y. }! E3 j7 z0 Y
+ y& i! x4 T* P, v, U0 L" j1 L- #include <linux/module.h>) I+ f) R! Z: n. Y9 n/ P
- #include <linux/init.h>9 z4 Y# u5 Q* {0 k2 L; @: `1 p
- #include <linux/errno.h>! a0 z' P0 R7 Z& ?' {2 a
- #include <linux/types.h>
4 G5 l5 c J h9 A - #include <linux/interrupt.h>
6 t9 D8 h7 M2 ~# s - #include <asm/io.h>
/ G; J$ q+ x( C) A5 L - #include <linux/moduleparam.h>/ a7 ^; y5 V$ v; u2 D7 p
- #include <linux/sysctl.h>
5 H( m" l) M% @/ e! f& `1 } - #include <linux/mm.h>
k/ |: q6 o/ u - #include <linux/dma-mapping.h>
. i8 ~* ?2 t% R
3 ]& P" x/ Q* k& H- #include <mach/memory.h>( H2 a' b+ Q0 t7 r* D: ?
- #include <mach/hardware.h>4 a7 K4 Y0 ^" ~7 ^- t
- #include <mach/irqs.h>
$ H n& I" @$ {' b4 a2 j$ U2 m7 S l - #include <asm/hardware/edma.h>
# T$ W, f6 o/ d$ o
/ E1 S( M. [' W) I" u- #undef EDMA3_DEBUG8 ]9 X; b" @* Y) k
- /*#define EDMA3_DEBUG*/% b1 }$ Z7 d: g; W, y* r/ P
- % Y7 }: q( D; |" M1 y9 M
- #ifdef EDMA3_DEBUG
( w4 S/ u5 ~8 E5 ]7 P% M7 B - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 O9 Y$ i8 Z$ R( r" S
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
4 X# F2 o4 y; r+ S' L q) o - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
# n) u. y0 L; S: F* N - #else, N3 V+ I$ \. a: I1 G4 F
- #define DMA_PRINTK( x... )
2 C7 k, o: C8 [ - #define DMA_FN_IN# }/ J G V; E! u$ E9 @3 `
- #define DMA_FN_OUT% s& J0 N/ Y8 }) L( W) `; y7 R
- #endif
7 q5 q% @& w( \/ y) v* \, C
! F0 _* ?4 E1 J2 F% Q- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
5 O9 a3 V' P6 T( Z0 n- ? - #define STATIC_SHIFT 3
3 c4 e+ P% M6 |. p* t: Q9 \$ o" U* y - #define TCINTEN_SHIFT 20
# i h/ k# Z, h* _ - #define ITCINTEN_SHIFT 21
* F2 Z6 N- Z! I' G1 n6 r - #define TCCHEN_SHIFT 22
( B1 t( M" w3 @- Q0 L- D- b0 f - #define ITCCHEN_SHIFT 23
0 ? f1 z1 }8 y( e$ H3 D - 4 i- e& e+ g7 D! q$ B% s
- static volatile int irqraised1 = 0;
2 `/ }7 X! v( X- e& @7 R6 B - static volatile int irqraised2 = 0;0 @: ?; L2 S' \( b: c0 y
- ) L1 f) S6 w( E" Y- z
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 m" w7 ?# v( x4 R/ A, U" J) u+ r
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: W) T" Q+ s5 X) m
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 V" T7 P7 M# Q5 v* M
" R3 D% N2 p$ \2 N, h6 b- dma_addr_t dmaphyssrc1 = 0;& ~: R$ t" `$ D8 a, ?
- dma_addr_t dmaphyssrc2 = 0; O4 f; u1 h5 ]
- dma_addr_t dmaphysdest1 = 0;# w9 F5 T! e! D0 N- c! m
- dma_addr_t dmaphysdest2 = 0;! z% C- |. a) Z
3 l4 I4 ^0 m! T" `' f2 o5 J3 X- char *dmabufsrc1 = NULL;
" P7 m5 {: x, a - char *dmabufsrc2 = NULL;
- m' x/ ~; E$ M4 o- `% R+ M - char *dmabufdest1 = NULL;7 }! ^+ G6 G; T- Q# i* F
- char *dmabufdest2 = NULL;
8 `) b- b. e1 N; J- P
0 s/ T2 |8 M9 S# h7 A3 P+ W! e% N- static int acnt = 512;# [: T) c) i' R2 p1 O# j3 H
- static int bcnt = 8;6 v8 ^/ n6 I( Y: {9 R: ]
- static int ccnt = 8;) v9 [' z$ ^9 [+ m/ ]. I" R
) D" g' ~, O$ e, F- module_param(acnt, int, S_IRUGO);
! X! K& j9 `7 O: A! w; e! k - module_param(bcnt, int, S_IRUGO);
# s W( L% y2 r, r8 w! ? - module_param(ccnt, int, S_IRUGO);
复制代码
. B1 x4 H3 Y! W: U! V( c. D/ }9 E$ k( `, v
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% u$ h* x% L+ ~
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, F- g4 f: |8 S 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ q a3 t) o' y" v9 E' {% W
* v2 s; X4 x) l/ m: ^/ a6 y% v4 ]1 _
|
|