|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ U" c7 W' p+ ~* g" p2 i& \/ F- [code]EDMA sample test application
/ m4 M- V- S9 G0 O) x - /*
, ], @; D- l' r1 ?' p7 E' ^+ H - * edma_test.c
5 r" N- j: c: Y7 |' e - *% W2 D1 E6 Z( N9 g& w$ G
- * brief EDMA3 Test Application
0 \( D/ \' V" q9 W - *
7 d1 W* J, J: B$ q. O; m/ O- n# G - * This file contains EDMA3 Test code.* ^3 G, g$ V0 n% z* q
- *
! R0 k! `- Y, F! F C7 \; Y" u! _ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 T5 ]% i% i7 o2 Y
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' u i! `8 J) |* D `
- * TO CHANGE.
4 p' y. y; O8 U5 s3 k - *7 C" L' C* u- ]
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
( B5 v3 [# O) \$ I - *" Q( ]6 z; g* e+ B
- * This program is free software; you can redistribute it and/or
: M& e- K8 I6 U+ X3 `- X; n - * modify it under the terms of the GNU General Public License as
1 f5 G, Y3 \ n9 F. y - * published by the Free Software Foundation version 2.1 j' ^, C7 Y/ ]9 I% ]8 b
- *
& r+ h" v3 N& J3 U3 a - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
: v$ K0 {$ O9 k* k - * kind, whether express or implied; without even the implied warranty6 y; w! e& u4 ?. \5 a, p3 {
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the: B9 |$ f9 U# Q; V+ v7 e
- * GNU General Public License for more details.1 L9 F5 V, y3 u2 b: f, i
- */& }# ~+ [$ b' x, q
- 3 u6 `" ~4 h; C" {
- #include <linux/module.h>
) ~* o( `9 C% y. B# [# q5 ? - #include <linux/init.h>
' J3 U2 P& T3 E4 s& J - #include <linux/errno.h>7 e( ? ^5 W5 v: I* R* c" t/ s
- #include <linux/types.h>
/ h J8 V8 Z0 @+ L7 Z$ y) \0 A - #include <linux/interrupt.h>4 A6 f2 `, f4 w/ P. Q
- #include <asm/io.h>& Q4 U" L6 f# ?
- #include <linux/moduleparam.h>% \! g- W v. d4 L9 s4 k; j1 x
- #include <linux/sysctl.h>
: m! S J5 ]" M( Z9 D4 k3 J - #include <linux/mm.h>
9 G& X, F2 m9 ~8 K) i( m - #include <linux/dma-mapping.h>
$ N r/ r2 E+ {0 m' U - + `5 i. p+ E, T, { s, A
- #include <mach/memory.h># r9 |( A9 B' b
- #include <mach/hardware.h>
" K) |$ s: o0 v- j - #include <mach/irqs.h>
2 D( s2 p z+ z, \' [. J - #include <asm/hardware/edma.h>$ ^/ x6 m, ^8 V; f. t0 ~1 c
- ( y7 B$ V8 w4 H3 V
- #undef EDMA3_DEBUG9 L# W9 n$ T* D0 R
- /*#define EDMA3_DEBUG*/1 _8 u3 L* Z! p
" A: _) ~6 X1 p: y1 C- #ifdef EDMA3_DEBUG! k7 i) r9 ^5 @+ s, I
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS) G: N1 p c( U4 u) F3 w" l# D
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
# x9 ^/ j4 }9 `$ S h - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 @+ C' b7 f* h0 W9 f4 J9 X
- #else
+ }& X( a. w3 p& E - #define DMA_PRINTK( x... )6 n6 H, M% e6 ^, p% @: P/ L
- #define DMA_FN_IN" t$ J7 Y& ^9 |4 U! w1 e( U
- #define DMA_FN_OUT
" M4 J6 P/ N8 F# `; _/ t - #endif, J! M6 l3 [5 y* z
- % ]& k* J' X" L' ]5 G6 B
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)0 m+ u& e: A. c1 p: L5 Z- a
- #define STATIC_SHIFT 3
8 O2 c" Y) \; V* {7 ^. Q7 c) O" M - #define TCINTEN_SHIFT 20) M/ W2 d: Q/ `$ c
- #define ITCINTEN_SHIFT 21: Z% J; ?1 Q* O6 S- M! H& U
- #define TCCHEN_SHIFT 229 b% }; R9 q3 h$ C* y0 m" ~" a
- #define ITCCHEN_SHIFT 23- `4 U, G- ^0 L7 d) R2 F2 f
- / @' C' B5 K; z& e: b7 ?9 y% ^
- static volatile int irqraised1 = 0;, W1 L# I( j- O( O/ n, ~& S
- static volatile int irqraised2 = 0;6 W3 c3 k1 H# R6 a7 [. {! `( j
! R0 E6 S: L7 I2 Y- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, b; E8 U( R1 ~6 i, ` - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); B1 `, o6 h% Q; I7 r K& W, D
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& ]! V: e" `" B( C+ I. u2 O! S' P& H - ; @# J+ s1 J! z; A1 K5 k+ e
- dma_addr_t dmaphyssrc1 = 0;
# S o# ?! @. ~2 u- } - dma_addr_t dmaphyssrc2 = 0;
) z l2 S- l0 k; P( `. ^0 u) R5 k1 L - dma_addr_t dmaphysdest1 = 0;/ b2 ]# H( E4 r% }/ j) f4 e: V
- dma_addr_t dmaphysdest2 = 0;$ a6 z, h7 W1 e4 f. x
- / b5 p; [3 s6 k. V, Q( L+ R
- char *dmabufsrc1 = NULL;1 f2 d& J( `6 e9 e: k7 B% q
- char *dmabufsrc2 = NULL;* ]+ L, J) W& w& E' |9 G1 c1 j* H
- char *dmabufdest1 = NULL;( z. Z4 }1 b7 k$ K1 `
- char *dmabufdest2 = NULL;
: @7 N; C* ]: A& B z! K
1 U/ C/ [7 v- E4 C- i# b2 L9 Z- static int acnt = 512;3 E9 P! v; ^! `& [5 n. B
- static int bcnt = 8;
- N, x! P1 G. l - static int ccnt = 8;
3 F: d9 M+ U- F
# m' l% W9 `+ F- module_param(acnt, int, S_IRUGO);
) N' p3 ?( R% g! g4 G8 e# ] - module_param(bcnt, int, S_IRUGO);& U, M- a5 W$ Q4 i$ ^
- module_param(ccnt, int, S_IRUGO);
复制代码 + V1 t# x+ k& L$ f" V, m$ H9 A
! q1 n3 g& w% d. `! o0 w
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 b9 V! Q# M7 F/ Tarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- h8 g+ M# b: J1 _# _8 K) k! Q7 Q
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- O+ p. X+ d& H! `$ ~2 U
* T6 e- @( ~6 ~4 p$ G# b
. } u6 p! N$ d* V2 v4 B |
|