|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 @9 s# \; @' `( L- [code]EDMA sample test application4 z" X" I8 D9 ^2 r
- /*
% C8 _- R3 J( O9 E: K% ~& i - * edma_test.c
! D' _3 d: m' S6 b: K - *
3 _5 K2 I7 x2 |' w9 n& g - * brief EDMA3 Test Application
- m) _3 A, Z' Z$ X - *
, H( o- v* h1 [ T4 D - * This file contains EDMA3 Test code.' b# X# G& Z, v7 g
- *
8 E0 y1 F- k, r& v' O - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
5 a8 E ^4 q: J6 r* H5 L6 s - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
, Q" u9 T) Y5 O7 A% G: ` - * TO CHANGE.( f3 b, N r1 F7 A. y7 t9 j4 q3 f
- *
9 a: b+ x1 w Y% ^1 f - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: o/ B9 }8 f$ D3 P6 r3 u
- *
5 V9 V1 R* |1 T$ ~9 z i& [7 T - * This program is free software; you can redistribute it and/or
0 x. {: J4 {+ M1 M; u4 K - * modify it under the terms of the GNU General Public License as
2 o# |$ m% C* Z$ ?3 H7 B: J2 e - * published by the Free Software Foundation version 2.) p. Y7 v, S; g8 E7 h
- *
% j: {$ C5 ?* w6 i8 X! K4 L - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9 `8 e1 X0 K. @/ Z4 n - * kind, whether express or implied; without even the implied warranty: R$ e+ O! o& B. g4 \ o
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the3 l6 L7 l3 f% d
- * GNU General Public License for more details.
; _% \" c f$ x5 m, U - */. v( T8 M* L9 `. _" E, d E, [
" _: p$ b' T" O' y/ }2 ]- #include <linux/module.h>; t) ]( M5 y: F. n" E( `
- #include <linux/init.h>
* F1 Y/ z4 y9 d; Y5 A8 L4 T* D - #include <linux/errno.h>9 Y% G" }9 p0 [7 D) D9 U
- #include <linux/types.h>
9 g6 u- |! N0 l - #include <linux/interrupt.h>
" k4 S( j; l+ R6 I - #include <asm/io.h># ~1 |* h5 N/ L* H* g6 t, k
- #include <linux/moduleparam.h>
# C2 E% j% O0 K$ M2 l' G8 _ - #include <linux/sysctl.h>
7 X- X! Z$ e0 @: ?( b# H - #include <linux/mm.h>" u6 |' [& W/ n* J9 T, t
- #include <linux/dma-mapping.h>
) P7 ^1 p/ \$ c' d/ t: A
8 w( n$ q) f% p- #include <mach/memory.h>. u3 A. V+ z0 }# u
- #include <mach/hardware.h>
) ^, r: O6 f ?! t j8 W - #include <mach/irqs.h>
! ~" |( Y! {' i9 Q' | - #include <asm/hardware/edma.h>
3 x. Y3 Z" G% r) t/ m
# q; [! N' G7 v- #undef EDMA3_DEBUG
6 q/ L) y2 P* C1 U4 @+ {/ p - /*#define EDMA3_DEBUG*/
& z1 v4 ]4 I8 C
( T8 H8 C) J* ^+ L* i+ l( g) r- #ifdef EDMA3_DEBUG
" r: N' D! g/ f2 r3 \ h3 r. ]) k. I - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); t& r1 z: m6 z- m5 G
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% f6 `3 d8 s6 _. F. ~* E& i
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 m' ^1 r0 P9 c) |
- #else
/ B Y0 V6 S: L3 p9 w: F& I% _+ N; `: b - #define DMA_PRINTK( x... )
; d1 p: `+ j0 \9 z2 B - #define DMA_FN_IN7 n- P+ [8 C' t- t4 _! N( B1 G
- #define DMA_FN_OUT) B" O/ w6 G/ l. r% ~# `
- #endif
1 V/ o* Y) I2 x! z2 M
9 D1 }; I% x, O0 g- #define MAX_DMA_TRANSFER_IN_BYTES (32768)! | {1 V/ [/ n
- #define STATIC_SHIFT 3
0 p0 p! \! _$ Z5 E" }' b- d. k( D! u - #define TCINTEN_SHIFT 20, i4 P" W0 G6 B. t' n
- #define ITCINTEN_SHIFT 21
3 m' v$ Z: S5 w9 u0 M- g8 X7 x - #define TCCHEN_SHIFT 227 L- p; d! y! g( X0 H2 S1 t. _
- #define ITCCHEN_SHIFT 23
" a1 N/ N0 ^; s$ j, M% V$ g
. F6 S+ b# p: v5 d- static volatile int irqraised1 = 0;* Z0 u5 v/ G" w! W7 Z' Y8 @# Y
- static volatile int irqraised2 = 0;+ R5 k$ ^/ b# t3 g! j- H
9 b2 s' M3 r. n' f5 h, j! y- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 i; c, B5 z+ j: g+ t
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 V0 p# Y( l2 s - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, L7 G3 }" B, \4 c: c3 K5 ~
- 1 X; v( `! Z. c9 [5 {
- dma_addr_t dmaphyssrc1 = 0;9 v: w3 O1 d) I( F$ k; H
- dma_addr_t dmaphyssrc2 = 0;4 j. q, w) k# @; Q
- dma_addr_t dmaphysdest1 = 0;
: L+ @/ Y* [# n# r4 V* v - dma_addr_t dmaphysdest2 = 0;- S# m3 ~( L( G
: _% x1 Z/ r/ d$ f* v8 R( j9 h- char *dmabufsrc1 = NULL;
0 r7 p. W7 D9 t* w; z' g# M - char *dmabufsrc2 = NULL;1 q7 v% J8 q) N; Z9 a6 }' i
- char *dmabufdest1 = NULL;
& E- ` X$ F4 ~6 e9 {5 d - char *dmabufdest2 = NULL;
A7 U3 P) {% J8 S$ g v- K" G9 O3 p
4 y0 q: y) L: @/ Q& V2 I- static int acnt = 512;
6 X( p9 v0 s: n6 M - static int bcnt = 8;2 c$ Z H Y% j' O. W4 M& y0 m( N' F3 G
- static int ccnt = 8;4 y4 u1 Y2 U6 B2 F7 X8 i9 v
- " J" n6 L: _- J6 s, w; j
- module_param(acnt, int, S_IRUGO);
1 h; s& G% k4 {% o) n) V; V - module_param(bcnt, int, S_IRUGO);
' g8 C" n" L4 I$ B" n - module_param(ccnt, int, S_IRUGO);
复制代码 $ B0 {: F3 ? V; Q
# c0 w% t3 R# b! f4 w 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ P, u7 O1 F# Y' W0 n' S
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* x& m4 K T, Z1 r/ s: q
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 t# [: V+ V$ [& G* e9 C
2 R2 H. R- J3 u6 g, u% C2 l% B5 m, ~% l( Z3 f6 y3 c
|
|