|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 }. o) p" ]8 a6 [7 t5 z5 f
- [code]EDMA sample test application
* \# r4 w' S" v3 {. b' @ - /** l* Z( ?& m2 z& W4 I
- * edma_test.c: J2 p4 h8 b' ~# w2 b, |
- *
/ E' U1 }# S4 @2 ^ - * brief EDMA3 Test Application
" }# M9 S1 L' z) _ - *
+ r7 b; C G9 E! h - * This file contains EDMA3 Test code.
- d/ _2 p0 J5 @ - *
+ C# j! z( [1 ]/ N - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE i& ?, Y( F; D# ]# t0 ?
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" ^/ D9 w0 t) w# k
- * TO CHANGE.4 K8 h2 o9 X+ w3 D' X8 h4 w8 i
- *
; D0 C$ @8 X$ ?. { - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
( ?! x, l/ c+ t- \5 Q" | - *
$ p) l O& x! J8 {8 }9 D - * This program is free software; you can redistribute it and/or
5 E, X/ q9 I( m( ?9 ^& r - * modify it under the terms of the GNU General Public License as
$ L$ @3 I. D' e4 l - * published by the Free Software Foundation version 2.
; w* ?% q$ U, o( i- @& X - *
& A J( q7 m! x. e# `/ n4 O - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
5 k1 n- B0 Y; e# u u* A5 y - * kind, whether express or implied; without even the implied warranty* E- P6 o1 A5 E% I
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
. M$ A$ W% [( a/ @" |9 l - * GNU General Public License for more details.. W9 ?" C j, y1 ~2 @# B
- */
) o1 J% i8 {$ \( F6 j - " k. _0 u* _+ l8 e5 F9 I/ E; ~! y% N
- #include <linux/module.h>
) v* E& w4 j* Q- O) n - #include <linux/init.h>
0 y/ F/ u Z, m4 v* |" `. @$ Y - #include <linux/errno.h>
& \+ p/ T& n7 x( J/ u# ` - #include <linux/types.h>
0 `. }- A1 Y9 R$ t( D9 i - #include <linux/interrupt.h>/ t# q, U3 D( p* @
- #include <asm/io.h>
- w x& v" p8 F+ G5 G5 G - #include <linux/moduleparam.h>! c6 B3 B T w5 A
- #include <linux/sysctl.h>9 c4 m( M( R2 n) l+ F, k- t
- #include <linux/mm.h>
0 _4 W2 H5 s1 l) x9 Y. m: u - #include <linux/dma-mapping.h>
F0 g5 E$ ^4 }: q7 h2 n1 C0 o - . M7 u1 ~6 h" ^9 |9 o
- #include <mach/memory.h>; l, R9 d7 i; C. l
- #include <mach/hardware.h>. g: n; F' B( R: E: ?9 e
- #include <mach/irqs.h>
' U. E7 g' z3 w, U9 |. w' [ - #include <asm/hardware/edma.h>
/ Q5 ^0 U y; J - 9 z2 \+ X7 q w: _! a: E
- #undef EDMA3_DEBUG
3 p# H( n) \7 n6 \: {. B. v( q - /*#define EDMA3_DEBUG*/' h# G: f1 M9 t D9 o2 R
- 6 e5 w( U5 C8 A
- #ifdef EDMA3_DEBUG
& D8 A/ z2 s. r( H% |+ g - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
* j- _# }) o- S6 [' [" i - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
4 f) _( W7 s8 Y+ O0 \ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 c3 n9 Y/ w# p& L
- #else4 r- m1 Z3 m# {# b
- #define DMA_PRINTK( x... )' E) S' w! `0 u! S* M' \
- #define DMA_FN_IN b1 O( ?. V: c: ~
- #define DMA_FN_OUT
) z$ ^, d1 H) v- a - #endif
" q! u" m9 m6 f* q/ V8 J5 ?5 a - 5 C. i/ _ B% o% Y$ T
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
, W: b( a R9 {: x9 B - #define STATIC_SHIFT 3
* {* n' [) ?1 E. }( P1 b; I5 U' d - #define TCINTEN_SHIFT 201 O, A, o# H/ i. D* o9 L
- #define ITCINTEN_SHIFT 21. c% i2 J' Q/ ?0 N
- #define TCCHEN_SHIFT 22
8 A3 i4 c. ^" Q - #define ITCCHEN_SHIFT 23. Q9 T; c6 U( J8 n1 } E
' T- K2 I) g" h+ @9 Q7 ^- static volatile int irqraised1 = 0;
' ^) k, O3 W" _. M6 M - static volatile int irqraised2 = 0;
1 X: n- h* ]0 h. j - 0 o# `# d6 b) h
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% y4 O, @! m8 s7 Y. `
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" x! v7 |7 }+ f. R& V8 ^ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 }' \8 W, p. V - $ y% |9 y% c* q
- dma_addr_t dmaphyssrc1 = 0;+ x* h) t9 g& [) M( s* i0 w K2 C
- dma_addr_t dmaphyssrc2 = 0;
3 D# o# G% Q. M8 h - dma_addr_t dmaphysdest1 = 0; S& Z' j. t% c. c! z) Q
- dma_addr_t dmaphysdest2 = 0;8 t" e$ [. q$ q+ Z( c& `2 @
- ; L* ?3 x: @% Q' n
- char *dmabufsrc1 = NULL;
9 U0 X1 }1 Z$ z4 Y3 P8 P2 U - char *dmabufsrc2 = NULL;1 q* c, A" i" ?3 u& U7 b, j! V, t
- char *dmabufdest1 = NULL;7 G9 ^" M; e" B& T' X
- char *dmabufdest2 = NULL;
- f4 I) e, T6 _- X5 V
8 {" }! D- D9 O5 q. Q% |" w) k( ~- static int acnt = 512;
: Q: z0 q( P/ _ - static int bcnt = 8;
5 o, Z1 d: S5 Y; [ - static int ccnt = 8;, l2 G3 c/ l0 J
- + H5 R3 B$ l& o
- module_param(acnt, int, S_IRUGO);
$ ^& X9 L- `7 H9 @' ], {9 {; y5 e) x - module_param(bcnt, int, S_IRUGO);* B9 A( ] d! z" d: v* M- z. \
- module_param(ccnt, int, S_IRUGO);
复制代码
! f6 I: a: l h: v2 s, }: Q0 M+ U& _
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ I! J& {! K9 W- t( `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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ B" h- {0 ]' s) {, J$ Z 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 d3 j! I& k$ J
/ R/ J' [" T/ Y' N; H2 }( p. t% n$ U0 {0 x6 a+ g
|
|