|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ L) l) R5 `' Y& N' n- [code]EDMA sample test application# j1 {7 t: S+ A6 B- w
- /*
) h% Y# J p' V3 Y - * edma_test.c
, F: z0 _( o8 B& _- w3 r: U - *
5 a+ e2 O$ K- E3 B" D2 h - * brief EDMA3 Test Application! o5 j! z# F/ B, B+ ]
- *( a3 t; C/ P+ Q" b/ g5 C& }# j
- * This file contains EDMA3 Test code.3 {! c; c# d, i& _
- *
, f( B9 ^' {) W: k* D% _ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
: T4 z$ q# Z$ j W, Y- p) n - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
; O" X$ B- h$ j3 y% M/ H0 D3 y: j - * TO CHANGE.: O; V- U: B9 _( L) F+ A- v
- *
) n; f9 n) T: ~* Q0 [ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
7 o( y+ c4 s$ s g! A# I/ `0 r! t - *4 v9 r0 q# r: e- E3 u, ]
- * This program is free software; you can redistribute it and/or
& D: v: d( n! a8 t6 n. A4 Y# H7 V - * modify it under the terms of the GNU General Public License as$ x+ ?8 N5 S) E0 g
- * published by the Free Software Foundation version 2.
# h, O' `) b2 {5 u& ] - *
. H0 n$ x# M0 e# Q( | - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
0 Q8 O# q2 h0 W - * kind, whether express or implied; without even the implied warranty
- m+ \% L! {! L" D* I - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5 _; X3 `' b! o, z4 z6 y8 i - * GNU General Public License for more details." i6 ~6 Y/ ?$ ~( X; }
- */
9 e4 O, _0 B% c" L) k
8 l. { v* v) t' p, T6 z- #include <linux/module.h>
. y& |6 R+ ^1 c6 i - #include <linux/init.h>5 `7 O1 T P. D# v$ J7 b" j
- #include <linux/errno.h>
# ~6 b1 h3 y$ S' G - #include <linux/types.h>0 V* Y6 n" p4 P% K) I% C4 E
- #include <linux/interrupt.h>* i0 W/ Y9 E& ^1 o3 D/ v8 a: M
- #include <asm/io.h># O' _0 ~: g# ^# q1 j; A- l1 Y
- #include <linux/moduleparam.h>
e- O0 I0 J+ U, g4 Z1 r - #include <linux/sysctl.h>
4 @" ]3 t k; Q) | ^4 p - #include <linux/mm.h>
3 _- `. e" [) L - #include <linux/dma-mapping.h>
. z, k+ F& O3 M' o - & g) {8 N- q* ?6 x5 } ^
- #include <mach/memory.h>/ v: z/ }( a t( N4 c9 m( f# l$ U
- #include <mach/hardware.h>3 t9 d5 b( @& g
- #include <mach/irqs.h>
( C4 r- N9 |/ c - #include <asm/hardware/edma.h>
$ k; m& f. S& \; m. M# G+ y- i
# E u c/ }0 }' L% Q- #undef EDMA3_DEBUG
7 b' ]( {5 y, N0 \8 {" l - /*#define EDMA3_DEBUG*/9 x; H1 Y+ g5 U0 h7 B6 i& a7 \' |
" L5 y$ [, M6 M$ @) `' _* w- #ifdef EDMA3_DEBUG
7 G, T8 b& N, ~0 Q - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
k' B' U0 g1 V" t( e) I - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
+ l( O1 r/ I. d4 U: ^6 f - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
9 d2 z$ O' z# S5 q) g% l - #else
% J0 w. Z/ a( h$ c! ]7 o) _: u+ l - #define DMA_PRINTK( x... )+ }2 w* y' B! T) U$ K# K" N7 J
- #define DMA_FN_IN
2 V; i0 F' ?5 x% V* }8 C* } - #define DMA_FN_OUT% t+ x! }3 |% J
- #endif
0 P" C$ q y3 g - 9 U: b% \' d0 j
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
* H0 ?+ ?' R5 l% V - #define STATIC_SHIFT 3
+ p% G: V3 {. L* s" M( ^ - #define TCINTEN_SHIFT 20
% u1 M/ e. E8 U: t. `+ p+ l% Y - #define ITCINTEN_SHIFT 21
7 b# S- i `, E6 R: G$ J! d0 ? - #define TCCHEN_SHIFT 22* o% k# H; ]* s) i$ ]7 x
- #define ITCCHEN_SHIFT 23# ~8 D/ A# W R# @
- ' e' G: s& m8 B8 `
- static volatile int irqraised1 = 0;4 Z4 |; ^ P1 l
- static volatile int irqraised2 = 0;5 q. Z* E1 [ c" W& J" b
, w" `- { C: N. d2 V/ v, D" R- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( W$ }5 S: u4 l% ]
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, j' L# M, P8 g& {1 A, ^9 I - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- R3 `/ `! Y# ?, @9 U( m' ^
7 x8 Z* N4 d% @0 E k x8 B- dma_addr_t dmaphyssrc1 = 0;
# _: V. U. l# k( ` - dma_addr_t dmaphyssrc2 = 0; F! k9 t* W# G/ c) W
- dma_addr_t dmaphysdest1 = 0;
0 d/ P5 p' _6 K- I. u( B' X5 }: d - dma_addr_t dmaphysdest2 = 0;
% b. ^3 n/ v; u6 t# c
' S. P, r/ B& L, Y$ ~! k- char *dmabufsrc1 = NULL;+ b' d- v, \8 n. O; x
- char *dmabufsrc2 = NULL;
/ N7 }$ E O% j/ g - char *dmabufdest1 = NULL;
. b% ~1 L4 ]! {4 n7 C - char *dmabufdest2 = NULL;
5 b' \ x7 K# j6 { - % F( b# f& t& H0 {# i
- static int acnt = 512;) J$ m8 T" G- n4 @
- static int bcnt = 8;
8 G$ k$ V, G6 X; s b - static int ccnt = 8;
. B& p6 r5 e3 {8 t4 Q
& U2 K) m* _1 f- module_param(acnt, int, S_IRUGO);
, f8 }- p0 D* r7 f9 t& P; A - module_param(bcnt, int, S_IRUGO);
" J. B: H1 a& v( U. m- F, k - module_param(ccnt, int, S_IRUGO);
复制代码
7 Z% `, `* `3 v! b, K0 Z6 q, {
1 @3 z8 z3 J% h$ k! w2 s( a9 e 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! G) i& B A; E$ J/ a. N
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. V2 |. W( A' H# u7 `7 S 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 K5 G+ ?1 m; i; {3 E. b
& q" ?7 C5 y# U8 S
& H/ {# z) ^, J" V7 S% s" Z: v
|
|