|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' y5 A- I8 D3 J3 N! ]; Q
- [code]EDMA sample test application7 h& g- z- k$ R: O' `! i
- /*) T3 I- C& w5 ?# K: I8 Q
- * edma_test.c0 z% i: f- S" I, O. h# B( m
- *
: v6 J$ U" l/ O7 z! H5 u6 m - * brief EDMA3 Test Application( d1 H; Z% W, R/ r4 F
- *0 w! l, P, F; j1 j% O
- * This file contains EDMA3 Test code.# O5 S" |5 X' ~
- *
* n' P5 T8 O0 D - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
" i1 y! e' I7 |; V V - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
2 \6 y8 m7 C* A. b5 K0 d- R - * TO CHANGE.* b! U& i- P. }) j4 M4 g0 K
- *4 V* A% W y, }3 R
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- s4 M# y- _* Y6 ~5 S1 W
- *5 Z+ c* j6 A$ i- |
- * This program is free software; you can redistribute it and/or3 G. \. W/ s5 ^1 C% c
- * modify it under the terms of the GNU General Public License as! Q) B8 ]1 q0 Y! A3 R
- * published by the Free Software Foundation version 2.
! D: E7 u- `1 E$ J6 r3 X - *& D7 a2 M# O8 a. ]' T) `3 U6 N
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
3 @. l% m% |1 Q; | - * kind, whether express or implied; without even the implied warranty
" Q7 r8 c7 b, T3 E4 z# ~$ v$ i - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1 o s! S5 S2 A% Y7 [8 R) R - * GNU General Public License for more details.; X4 D+ ? G4 d1 z4 N' V
- */
5 k: ~, Z* q. C8 z# _6 y; Z: P# _ - 2 B0 N7 Y9 Y7 y+ y5 y" {
- #include <linux/module.h>
9 E3 _. o9 o! y+ q/ V - #include <linux/init.h>
& r& q# U, r5 l; T - #include <linux/errno.h>
* f4 @0 y1 E# v& @, k3 M - #include <linux/types.h> O$ X5 ?) U3 B- a3 b/ \; b
- #include <linux/interrupt.h>* N& ^ h* `2 g% S- i- ?
- #include <asm/io.h>; C2 ?! c" s; c- P3 S3 e
- #include <linux/moduleparam.h>- d0 D% Y3 f8 ~) g. ^# i
- #include <linux/sysctl.h>4 f8 @7 a" a+ ?- R" a3 e' B
- #include <linux/mm.h>4 H" b `7 c: z% O! I
- #include <linux/dma-mapping.h>5 Z0 h: k( g( ^8 e( j. L
- B; ?$ I( m4 \* l
- #include <mach/memory.h>
- j& ?; K* ?+ t2 d - #include <mach/hardware.h>6 `( }8 b4 |; ^# E. I
- #include <mach/irqs.h>& {$ ^0 N4 u$ T3 i. r3 i
- #include <asm/hardware/edma.h>
0 B+ k0 D* o4 ?" A. S" i4 T; s- { - ~, o5 f, s0 r$ _3 A
- #undef EDMA3_DEBUG
& R j2 r7 u; H V - /*#define EDMA3_DEBUG*/
8 K, o& {/ C, R* ^9 u1 x/ X; H+ e
! P8 b8 w$ t" K$ [. h- #ifdef EDMA3_DEBUG
+ H% v0 H+ y1 t# ~ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); u+ g4 q0 ]+ i/ k9 c4 y1 c! G
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
- S5 U9 e6 p% [4 R$ o* z% F - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* H3 w4 f9 s* {. t1 L2 ]8 H
- #else% k! z7 S O1 v- g! A
- #define DMA_PRINTK( x... )! K, k+ a! H6 P# {' z4 z
- #define DMA_FN_IN
, l! {, Y( x8 [( J - #define DMA_FN_OUT
0 V7 h1 ]- ]5 E1 F - #endif2 T' f% ~4 l! }* l! I5 e
- $ m. {' |& O q8 H2 \
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)9 U) c5 ?3 p, h$ M4 O9 B; \- W, c
- #define STATIC_SHIFT 3
* M. L- |& M# _" S3 ` - #define TCINTEN_SHIFT 20
$ O8 u/ I J/ C* q - #define ITCINTEN_SHIFT 21/ R; W/ W- U" J: K; g
- #define TCCHEN_SHIFT 220 B; Y2 o S+ F5 H8 c5 M& J9 F! A
- #define ITCCHEN_SHIFT 23. z: f% W( m4 `( ?$ G
. H% J. u, c& K; B \6 K* p8 w- static volatile int irqraised1 = 0;
$ Q) u* ?- z6 d j - static volatile int irqraised2 = 0;
9 ^- a, m ]( L2 U, f
0 Q- ~3 d% @! V) l: ]2 b- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 f/ [* _" j) {/ ]* h - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 r. c" ]* f; E* P- H% `
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; g$ h; |8 s5 V& g M
* {( Y* W; Z4 s9 X7 X- dma_addr_t dmaphyssrc1 = 0;6 }4 V$ w7 m* z" D$ E3 S
- dma_addr_t dmaphyssrc2 = 0;8 t% G( X) R4 L2 |/ g
- dma_addr_t dmaphysdest1 = 0;
. j* m: L4 N6 Q - dma_addr_t dmaphysdest2 = 0;0 R$ v9 W( P8 V
- , N5 u* R! A4 s7 A+ e9 `1 r
- char *dmabufsrc1 = NULL;6 ^: q; \, b, M6 w7 z6 N
- char *dmabufsrc2 = NULL;
9 O( \6 K/ {2 s* S0 m) ? - char *dmabufdest1 = NULL;7 V8 n- |! u) n2 ]+ M: x. H
- char *dmabufdest2 = NULL;% m, O& Y, x9 N+ w7 D! I
- , B5 S' d) ~. j& I# G9 g `$ B K
- static int acnt = 512;6 p( H7 s, u: ~3 k3 | o) d
- static int bcnt = 8;
& R$ M* J0 a6 U0 H1 f( F; D - static int ccnt = 8;! I, {# C. P; G; v' r
$ t: ?( C4 a( r( M& [8 V( n. a# y- module_param(acnt, int, S_IRUGO);
7 i7 q& y$ ]! x0 s7 i1 n/ H - module_param(bcnt, int, S_IRUGO);
6 j- d$ A* s: B - module_param(ccnt, int, S_IRUGO);
复制代码
l' l4 ^0 _7 K2 a" J0 Q7 r& ~) v9 B) Y) ~8 @8 B- n! l
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ |! R9 }9 J! q' B6 R2 n3 Z1 ~
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) _/ k. C. C8 M, { h3 u% A 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) U2 x* |9 ]; H3 L
0 w# g: e; v& {0 K4 Z
3 U, f9 J! B3 [, {5 [& {& v
|
|