|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" }. R# U* }* d8 P: }- [code]EDMA sample test application
0 }3 n ^7 X4 r' @8 L1 R5 [$ l - /*
8 a7 q0 y' L5 R9 T, r - * edma_test.c7 w: x. r3 V# Z4 F7 s& }
- *
( |9 g4 H+ K2 v - * brief EDMA3 Test Application
5 g6 ~- `/ Y3 R$ f - *& s: T- h/ h u4 l( {6 Y& X; T
- * This file contains EDMA3 Test code.% G6 @1 p* X9 L8 W7 Z
- *
% N) b- b' p) [6 Y - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE R: a- H& [# b. o, N, h2 }- T
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! ^6 Y3 P1 s8 M6 l3 S, V# J
- * TO CHANGE.2 u( ^" e& x. u& f) V
- *0 R; W; w! d7 P+ f' O4 n6 r$ P
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
9 k2 l$ _- L4 d5 E% ], s+ T - *
" k: p; [& B/ F/ Y+ Z* w5 ]- o% | - * This program is free software; you can redistribute it and/or4 G# \$ i' I2 J$ h7 s
- * modify it under the terms of the GNU General Public License as
; r2 F/ O# U" Z, K J! ~ - * published by the Free Software Foundation version 2.6 l# K& K+ g) N
- *7 C" r- e& P4 A
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
5 s. \+ ]0 I' J - * kind, whether express or implied; without even the implied warranty/ l& N* Z- t$ z/ E
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the9 `' H5 v- i% {: L. F
- * GNU General Public License for more details.3 B4 E9 w0 B* E- ~" a. ]0 V
- */
+ X7 n3 j" N: Y
3 {# z1 X: y$ L9 O& F% _9 E- #include <linux/module.h>5 f8 }) J( z4 o+ ]; O
- #include <linux/init.h>
, b6 d; b+ S& a' d. p4 \ - #include <linux/errno.h>; {0 K6 C4 u0 x# ]. H
- #include <linux/types.h>
' K5 m/ @6 s, c+ b* |( z1 C5 `3 T: D - #include <linux/interrupt.h>
6 B2 G+ W* s& K, d- ~( M - #include <asm/io.h>
6 H* g7 V! T7 n: g4 _ - #include <linux/moduleparam.h>
3 S) u: y& r3 p- [7 y - #include <linux/sysctl.h>/ p$ H: s; h6 \0 i
- #include <linux/mm.h>6 S4 V0 B- ^( A* D" }; ]. D
- #include <linux/dma-mapping.h>. S- i2 D# Q+ D8 |2 V
- 3 o3 u6 j; I1 C7 G+ f
- #include <mach/memory.h>6 r3 B8 S/ o: g# y# G
- #include <mach/hardware.h>+ o$ w- _0 H1 h* r9 {7 g6 C
- #include <mach/irqs.h>' u% B6 [: B, @- |9 x( X0 y
- #include <asm/hardware/edma.h>+ Z# D* R/ Z3 B9 r7 v
- ! V3 r1 H* @+ x* G/ F
- #undef EDMA3_DEBUG
( m1 ?+ t- c N7 L, ^ - /*#define EDMA3_DEBUG*/, D8 T2 N9 X- [, K! a, z1 X3 n
& c6 M" r5 r# Y( v+ c# a2 l- #ifdef EDMA3_DEBUG
; o6 \0 s# ^! q0 Q, E6 M# a2 [ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
1 k: h6 k& v! V F* a( [4 ]' _ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
# w: B) h& Y) C - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
$ {: D4 P. V. [ - #else
( H' E, @+ y/ p# h - #define DMA_PRINTK( x... )
1 j3 \1 N, s' G$ w- D' y) ?5 }2 m - #define DMA_FN_IN; l+ a+ Z# a9 E/ @9 A
- #define DMA_FN_OUT
) j' w) O, V6 u. L - #endif& y+ I% s" ^7 d9 a
- & G2 T8 h/ S( P0 c1 [, Y/ M1 Z
- #define MAX_DMA_TRANSFER_IN_BYTES (32768). u3 K; e3 i- F3 {* v( W4 {
- #define STATIC_SHIFT 3
6 s: N3 S+ F' ^8 ~5 J - #define TCINTEN_SHIFT 20
5 `* \) T; ]& ^# ?& g5 o - #define ITCINTEN_SHIFT 21
$ X0 f, R, W! O" E) v" c. c - #define TCCHEN_SHIFT 22# {( o2 ?0 j0 V) N: ^6 D' R
- #define ITCCHEN_SHIFT 233 |' W; p2 ]/ b* m! R6 a
4 z2 R. G) I! a5 L1 \- static volatile int irqraised1 = 0;$ H/ O- F9 \& G! g& L
- static volatile int irqraised2 = 0;6 q8 G4 Z: {7 |! H7 g: \/ |
- + u2 M a. }1 [; R* c$ A9 U4 s
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( l3 @. L; m. F) q) w - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ s8 A3 c* x% h, f5 ]
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 d+ g& S( o- I4 J
- 4 D: a C! G5 f8 L) R4 A
- dma_addr_t dmaphyssrc1 = 0;4 v7 n+ L% _: Y' z# y
- dma_addr_t dmaphyssrc2 = 0;" V" p; h4 [* h5 G
- dma_addr_t dmaphysdest1 = 0;" h0 [9 K# z. _$ E$ F ^
- dma_addr_t dmaphysdest2 = 0;8 i! m/ O, t0 ^2 F5 M/ K$ E. \
- 0 F$ F! p, g. u6 ?% U2 F5 _
- char *dmabufsrc1 = NULL;1 a/ Z) Q6 J; C( h
- char *dmabufsrc2 = NULL;- y! u" O) M! N& m
- char *dmabufdest1 = NULL;
3 L* A0 X8 Y4 _' \, u - char *dmabufdest2 = NULL;8 X! N: n7 I. V: V% q9 e' w
- & ~. U T8 G1 ?6 R7 I8 n6 j; \2 F
- static int acnt = 512;
$ W6 m5 J/ I) \8 W; a - static int bcnt = 8;
* z2 y9 }4 G# z B5 R - static int ccnt = 8;
8 C0 F1 T! R# @2 n$ j
( Y1 o* C; h+ u& T- module_param(acnt, int, S_IRUGO);
# J K( }+ k; L5 m3 j- I - module_param(bcnt, int, S_IRUGO);
. a- L: Q9 _9 f1 c, K6 E" M - module_param(ccnt, int, S_IRUGO);
复制代码 9 p; }# `2 J7 d$ i+ R6 m! i* \% s' F
! A' Z( y+ K* F6 i8 C 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, w, _. V+ i' W) Q9 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! Q |$ G$ l7 ]! }2 P2 S2 G
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 ^( q1 O$ T/ Y7 e9 V7 s
4 Z8 S# C2 u( ~. c/ ?& N1 s8 U7 T" m* \
|
|