|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 T# f# o1 M0 }! f7 T- S% [
- [code]EDMA sample test application
8 g8 R0 N. } V2 ^9 |) F2 P. A - /*' ~0 i5 m! T2 ~& z
- * edma_test.c
/ K2 b# K2 @5 A: \ - *
$ `. R& u- Z! R - * brief EDMA3 Test Application
* g7 m7 |' }# x" b - *
7 F# G' m/ H5 Z/ g - * This file contains EDMA3 Test code.
/ k) a: L( L2 ^4 }* W. { - *+ A4 ^5 W2 `7 I$ W$ J' w; r' w
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ e' G4 |6 o* S
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ h0 l4 }# f0 C( z! K% [1 {3 {# D8 R
- * TO CHANGE.5 V# c8 w! k2 v' Y
- *
6 ?" R) n9 P5 E, R/ z - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' X' }9 r: l2 Q/ J3 ?, x8 U
- *
v% ]2 K6 i: o' z3 E - * This program is free software; you can redistribute it and/or7 d: R) m. z1 T# f
- * modify it under the terms of the GNU General Public License as: k+ X% w8 c* G/ N/ ?
- * published by the Free Software Foundation version 2.; @2 c2 D/ X. j: x. t: _
- *
5 `( g0 h- I, j& d& b/ D - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
' t' |( t$ B# n/ ? - * kind, whether express or implied; without even the implied warranty+ _- I+ t, ^, ^3 W9 @- G$ f `$ j
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 H! p$ s% O- X d j - * GNU General Public License for more details.# v; X5 g$ P n2 U' W5 D
- */
2 b2 K+ c. q8 n! `
8 L6 ]' t* N+ l' A9 F$ k0 z- #include <linux/module.h>
$ z1 T: I" \1 P' c4 P7 a; ~ - #include <linux/init.h>
: q3 |' B" }$ B - #include <linux/errno.h>6 T. R6 Y; }) C* w# U% u3 `3 B
- #include <linux/types.h>' ~ J' u0 Z& [
- #include <linux/interrupt.h>5 I1 M. f5 F8 f# y# ^% |8 N
- #include <asm/io.h>+ G- `: ^) T% U- u+ e) Z
- #include <linux/moduleparam.h>
" L H. O# q1 v7 z; p - #include <linux/sysctl.h>& P# O+ d# t; W. J4 I$ f1 k
- #include <linux/mm.h>
8 M- E+ H; g4 S: T$ a- Y: g( w - #include <linux/dma-mapping.h>; I ]' i; `' J* ]$ o4 }
- ) U* B* c6 B* F( C' x6 I& L/ `
- #include <mach/memory.h>, o9 E- w5 ~ N- j7 t% Y
- #include <mach/hardware.h>
1 M; k$ }/ s4 _) x - #include <mach/irqs.h>
4 l; f8 Z% z9 f" C# c; V$ M - #include <asm/hardware/edma.h> G& I9 I9 x2 K+ l6 C6 m3 l$ h
- $ c; o) }3 h2 H+ f) r' Z0 i d
- #undef EDMA3_DEBUG
$ D1 d& m% O% r0 A - /*#define EDMA3_DEBUG*/4 ? m j1 V% @! r0 @3 f* I' g: b
- % l, \! j: C+ |- ^& F
- #ifdef EDMA3_DEBUG% x" k& @! `$ {$ u v
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 G2 s" Q2 {1 u" H" R" w( ]
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 ]4 y# m A' d; A3 b8 H# S% Y
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 X2 v+ [ u2 B$ e7 W
- #else3 C" z1 L/ g( M, { O
- #define DMA_PRINTK( x... )
& w; K4 M# ~$ g - #define DMA_FN_IN
& p3 y E% k. ]6 C/ I- \' A - #define DMA_FN_OUT
6 [ X. U% {7 Z8 k - #endif
+ N8 _2 F0 k6 U3 e% n
4 `1 t/ {; l0 H8 ]- #define MAX_DMA_TRANSFER_IN_BYTES (32768)3 D2 s7 f& i( E, |" D, M& ~/ b
- #define STATIC_SHIFT 3
9 Y( w$ x% ]8 t8 n3 l - #define TCINTEN_SHIFT 204 W$ T" E2 l9 f3 K5 f; u. H: ^( o1 @
- #define ITCINTEN_SHIFT 21) K( i5 N7 {: N8 z6 ^1 I m
- #define TCCHEN_SHIFT 22
5 u: H! [3 S* I" ?7 z$ _0 Q - #define ITCCHEN_SHIFT 23/ Y4 \) z# p% @. |2 Z' A8 m' u, L8 [
: n* o$ S g+ B; C( R( P- static volatile int irqraised1 = 0;
7 m/ Q0 R* E" S1 u - static volatile int irqraised2 = 0;. u6 \1 B' J0 g7 b, N# |8 ]
3 p: O- B* `7 P$ J! U- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( i8 |/ @1 @/ p+ p - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" S7 J7 b- [7 q- u: [$ m) B9 r
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ _9 C4 j2 A! U8 o8 c
- - s% ?# I' e4 f( B/ c! d: y
- dma_addr_t dmaphyssrc1 = 0;
7 u2 l* E( k/ f( V) @, _% L - dma_addr_t dmaphyssrc2 = 0;' _6 F! O$ W& C
- dma_addr_t dmaphysdest1 = 0;2 s; s0 ^) P5 D& ?2 H1 K$ h
- dma_addr_t dmaphysdest2 = 0;0 E' {2 ^% f2 @ `9 M
' _$ j {' t, S4 w- char *dmabufsrc1 = NULL;
7 F; c! W: K2 W( h1 F4 V: W- Z7 b - char *dmabufsrc2 = NULL;5 x4 |, t8 G5 r1 {* j0 u s% O
- char *dmabufdest1 = NULL;+ d0 S) J) |& {: b' R! a- _1 E
- char *dmabufdest2 = NULL;
1 P! Q/ \2 p* X& m5 x8 c - 5 r" r5 C% W1 L
- static int acnt = 512;
; s5 K+ [0 I1 {5 L, S# _1 u - static int bcnt = 8;: F! R& L1 X+ r+ r% R/ a3 q( T
- static int ccnt = 8;$ y8 N" r$ o6 J: H9 [3 o9 P
8 _1 M4 y; k4 p/ x+ w+ e6 M- module_param(acnt, int, S_IRUGO);9 O: B- P+ |- P! e# U0 z- b
- module_param(bcnt, int, S_IRUGO);
- @6 [/ O2 ? s+ V/ l5 A - module_param(ccnt, int, S_IRUGO);
复制代码 % ?2 J& G( I( W7 M' l$ Z& z
& n# b. ^! I* h$ a( K% G; ?
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' _% W5 V* F4 a/ Z v* u( S" z- Y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& Q% s: y, _ ?$ o! z; g
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' R3 M' `. d2 ]! d/ M+ c1 V- N5 g& o+ O/ u" L
8 R8 f6 `, n, t/ C3 ], ~
|
|