|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 a8 a4 e% f! [2 F/ v) _
- [code]EDMA sample test application
( \* o4 g' T% l1 G9 j6 c) E* t - /*/ S# Y7 B# X% |8 }, r* z1 z6 z
- * edma_test.c$ A! B8 ]( e5 ^, {
- *
1 @* b& L4 r! A6 i) S - * brief EDMA3 Test Application
0 E! p6 ?) J& E& I - *' Z+ u. T' |# s1 S) c1 F: t9 m
- * This file contains EDMA3 Test code.
- P d- V& K8 x$ o3 |8 k+ L - *
5 h$ c% m! C: |9 G5 Y! t! v: U - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 o" |' b% p7 o j5 ]
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
9 b4 q5 M/ ~; P: o - * TO CHANGE./ Y/ V; b& Q9 p& U
- *
; t4 Q7 z# z7 W - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 X# h2 {5 u/ P. I
- *6 k; I5 l' X3 W5 k, B. c3 D
- * This program is free software; you can redistribute it and/or
( L8 T; H+ |6 M. b" X - * modify it under the terms of the GNU General Public License as p7 A6 F' N2 D5 @: c s- t
- * published by the Free Software Foundation version 2.
6 h8 E6 O B* d8 U# [: H: z - *; P( `2 o# U+ D4 o% H8 s6 c4 O
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 [- k- I% S( _0 Y
- * kind, whether express or implied; without even the implied warranty& F: w$ q& H6 u# W1 h, C5 m p
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the* R& d6 N) b. r+ D% M- _
- * GNU General Public License for more details.
, y9 a1 m3 g* y8 r7 r& q8 L% U& _, x - */
' i. J' ?8 N3 a( P5 X2 h3 {; E
$ O6 O6 D; f2 @! R, N- #include <linux/module.h>& t. {: K7 s. U" z" C
- #include <linux/init.h>3 r' z- I- N: F% |6 C& o
- #include <linux/errno.h>
; j' ~/ c5 \4 H( e8 ] - #include <linux/types.h>
: G1 v6 \' ~/ Z) \ - #include <linux/interrupt.h>+ W2 l8 C; r+ o7 k8 f
- #include <asm/io.h>
- j# n' e) A# k1 B* s - #include <linux/moduleparam.h>( n' ?& J( w7 c. S
- #include <linux/sysctl.h>
) u% V5 n v4 I4 J6 S - #include <linux/mm.h>
- x3 z3 N$ p- H1 X9 _' L$ @- I - #include <linux/dma-mapping.h>6 _) _! Z% p# p; o" p0 {
8 n$ @6 k0 `, s1 p0 k- #include <mach/memory.h>5 Q( _& F& E! j! t7 O" Y3 j
- #include <mach/hardware.h>( Y& ~( A/ D: e6 ^" u! s9 J
- #include <mach/irqs.h>- n4 S4 F y5 V- N& [8 D# Q' S
- #include <asm/hardware/edma.h>$ t( s1 J% E) s# o7 L6 h/ [
- 2 |8 G# ]8 r; h+ B; P
- #undef EDMA3_DEBUG
0 o) N+ d, A" R) m - /*#define EDMA3_DEBUG*/
* S7 t. B! P6 M# M0 c/ h4 W1 I - * N6 l) B) T% j! z% S$ C
- #ifdef EDMA3_DEBUG
~/ y2 q* u. u4 U4 e* y! ? - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 f& g& h+ W) [' k0 `$ z$ C
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
- U/ `0 m+ O. M% h% [1 _: T - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
* N. u) W" V L( h7 x( U+ q6 M - #else: R& f* `( |5 J8 F. Q' w/ v1 ?
- #define DMA_PRINTK( x... )+ u* o @7 C! G8 u5 n: S
- #define DMA_FN_IN8 x: f# R, S' Q
- #define DMA_FN_OUT
9 m$ `" \& N: H, d, y/ F7 b( X - #endif! ~, L _* k3 R D5 b8 J9 S
) c& t( n- ]2 F0 W( y9 o" P+ a- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
9 b) U7 Y) }" M, S5 x - #define STATIC_SHIFT 38 r$ @9 r$ K+ W5 t- f
- #define TCINTEN_SHIFT 20( a4 v* S& F. `. L* S
- #define ITCINTEN_SHIFT 21
6 `! z8 J' {0 b2 R - #define TCCHEN_SHIFT 22 n" t. K3 _- D4 ~; C$ v
- #define ITCCHEN_SHIFT 23
) w. n0 |6 n/ Q0 ^
9 u4 t0 Q, @1 u2 \2 g5 [- static volatile int irqraised1 = 0;
3 y" @8 b. n9 e: W7 w9 y2 v - static volatile int irqraised2 = 0;) x. k0 \% D# D' ?" l3 m# X
- % J f$ x( p, G( \% ?7 Z' X
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! L* Z! g8 H! H- Q - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ s/ `7 u( C! h+ r
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ _9 E8 W4 ^1 e) g: s" O - % G$ Y8 ~* C3 \3 X
- dma_addr_t dmaphyssrc1 = 0;
, P" U; D: ?2 ]" Z - dma_addr_t dmaphyssrc2 = 0;
' E) ` l4 \) u- B# w) T - dma_addr_t dmaphysdest1 = 0;
/ N q- a \9 P$ N/ y - dma_addr_t dmaphysdest2 = 0;9 m' q( W g |0 W: k0 {! @$ ~
- % n3 ^0 T( {0 E+ T' i, R; i( i7 K
- char *dmabufsrc1 = NULL;
# L2 Q2 y2 q/ Y) V' v0 Y0 \, O - char *dmabufsrc2 = NULL;
$ w2 |# G# W" P; ~ - char *dmabufdest1 = NULL;5 d# V3 F; u! ? G/ N. x
- char *dmabufdest2 = NULL;
6 l4 ] ^) k1 J8 e4 k# T
* y2 ]6 Y% z8 _1 d- static int acnt = 512;7 P- L S1 ]1 ~; Y- O" d( i
- static int bcnt = 8;, N4 ~* v4 b% r- i$ }3 R
- static int ccnt = 8;
" M4 w$ y) `/ w0 H- @ - ( ^! Q$ e8 ~4 Z* S e4 p# s1 b
- module_param(acnt, int, S_IRUGO);
( D: }. o1 _4 m2 U - module_param(bcnt, int, S_IRUGO);
( `( M6 c! O7 `8 ~6 o8 q - module_param(ccnt, int, S_IRUGO);
复制代码 ) D) Y& Y6 f4 ~* Z3 P0 g/ {3 Z* [
" c) b# o* |% s
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: O7 l+ v" N9 {/ i
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ V: J2 ?; l- F, H* H" `1 G
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ ]/ J- q" H8 G1 G
9 Y3 B8 `4 K9 }
6 X, X' H; Z# P7 \1 | |
|