|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , `: r. g9 c6 ]8 _8 Q1 g
- [code]EDMA sample test application4 R q v. x3 k" c2 }
- /*& o2 \3 q. I* \* n& ~, d
- * edma_test.c8 u8 d3 P3 r, P
- *
* `2 ]8 t6 t4 g+ V' i0 |) a - * brief EDMA3 Test Application- {0 Y! @. N8 R% C, f) O& @
- *1 ^4 v7 B; U; m/ r
- * This file contains EDMA3 Test code.
* W: S1 T9 C" n5 q: m - *$ z' v+ r; u+ d) t
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
% B/ w) ^7 _0 o - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
' i. I* u6 }+ J5 ^ - * TO CHANGE.
5 `: w! p( F3 R6 S3 {8 b. s - *
U) V4 b# p' k8 b; l - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
$ M8 E) w8 E. X& ^: k - *
: u. b, q. S! a* i( i- N - * This program is free software; you can redistribute it and/or1 F/ H7 P- i( u$ r% O7 B
- * modify it under the terms of the GNU General Public License as
& m. C: b! p: r5 d7 p; R, ` - * published by the Free Software Foundation version 2.
* \+ c$ q3 d* P7 Y - *
2 R3 \4 I. t& z1 l/ X - * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 t% N- E5 p- a
- * kind, whether express or implied; without even the implied warranty
" S$ }2 C$ R7 }, b5 O1 Z+ Q - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the& \ z7 o+ R) `2 t, j! q! ~
- * GNU General Public License for more details.
. q; S# Z, m% V. n O - */
* K( s: P% g2 Q8 w+ f
* I9 ^% z. Y- t& x- Q8 d* O7 T- #include <linux/module.h>
2 }) O! y: n) @8 H6 v1 p% ^+ r4 t - #include <linux/init.h>5 q# b1 a! ]+ F9 |
- #include <linux/errno.h>% k; T# R& m7 Z) G5 Z9 w
- #include <linux/types.h>
. r9 O$ i' y9 T( ]+ a3 A5 a - #include <linux/interrupt.h>
* t0 H; M/ q/ G3 q$ U$ i - #include <asm/io.h>
3 F1 c$ n+ H# S* {6 { i4 i( G - #include <linux/moduleparam.h>. t$ ]6 E& B2 T/ f' f- x; H
- #include <linux/sysctl.h>5 ~0 b- B6 P+ f6 z3 T
- #include <linux/mm.h>
" A' \" g, m1 |/ o7 P* t - #include <linux/dma-mapping.h>
6 t, U- s3 F; B' m7 c( U: @ - $ q2 y* M! s' a z2 e2 I- F
- #include <mach/memory.h>
. y. B- |. V- l* x+ ^ - #include <mach/hardware.h>
# R+ S& R% @* p- n; Y - #include <mach/irqs.h>5 j1 h# e3 Q* d, B7 Z8 W* K( @
- #include <asm/hardware/edma.h>. C1 R. n; u1 h+ D \* c+ t
- # m* s8 H8 s0 _/ m Z+ b
- #undef EDMA3_DEBUG
# T: D/ j1 u1 e2 I - /*#define EDMA3_DEBUG*/- f B+ i& f G3 W/ g7 a$ p
( c i" i. a! W- Q1 G" l2 E- #ifdef EDMA3_DEBUG/ p, m; I h* L! P1 X! @! {; Z
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
- I0 |1 V5 V% C! A) n5 K6 G - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% K- \. W$ x/ s
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* a5 {/ M# a- b1 v( } }* f
- #else# { ~& J9 n& u; M: J
- #define DMA_PRINTK( x... )* \- A4 O+ w1 G7 f. G# ] j
- #define DMA_FN_IN
; p5 L* H% w, @8 k3 `7 l - #define DMA_FN_OUT4 K! C+ {# V" m9 q8 L3 z
- #endif
7 _1 q: r) l, F: C0 J - 1 w( q9 x' k/ r6 T0 [ d; m
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
: r7 @. g9 S4 H) [9 v - #define STATIC_SHIFT 3# W' M3 E& e- j* V
- #define TCINTEN_SHIFT 20$ S$ h5 ?4 g3 \
- #define ITCINTEN_SHIFT 21/ i6 w# F5 @& M! ]8 u. D
- #define TCCHEN_SHIFT 22' d1 l' E* ^! `8 Q! a
- #define ITCCHEN_SHIFT 230 d( C5 {2 F6 {, C
* v3 R9 [ ?, [6 ?6 ?- static volatile int irqraised1 = 0;
5 E ^* H9 [- f; \2 ]2 g- \ - static volatile int irqraised2 = 0;) c4 L z# w5 ]2 | U
! D; N& H' l, l. t+ F2 i/ S4 i- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: b( ^+ e t5 ` Z7 s - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: f% ]8 T+ W. V - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, B! V7 O( v$ l: Y
. v C8 {+ J: g* ^' J2 V d. U4 h- dma_addr_t dmaphyssrc1 = 0;
; o* E' E& ~# C3 _ - dma_addr_t dmaphyssrc2 = 0;8 l2 L, u. y6 M% _% ]* B1 P
- dma_addr_t dmaphysdest1 = 0;- Z$ \: X* V3 T- l2 N2 a% O: R
- dma_addr_t dmaphysdest2 = 0;
& u u4 F% M; a; |* y! i - ; z0 i0 y$ f3 _
- char *dmabufsrc1 = NULL;( R' I- ~) L' n2 S
- char *dmabufsrc2 = NULL;+ S1 V$ [- o9 ~% s- m( D7 ~2 b# w
- char *dmabufdest1 = NULL;. U" B# Z# _& N( E% J( ?
- char *dmabufdest2 = NULL;9 @4 z! I2 L& |8 h
# @& x+ j8 e4 |0 x- static int acnt = 512;
. d6 Y5 l$ l$ s! c0 R: P0 z$ h - static int bcnt = 8;4 |$ P8 b7 ] n. Z
- static int ccnt = 8;' D" l- G7 R2 f6 C2 z: l( e; o- e' _4 I0 i
" Q' h$ r' C f- module_param(acnt, int, S_IRUGO);. T4 A: v1 T; R. S- M9 `# `7 ^5 |
- module_param(bcnt, int, S_IRUGO);8 q8 y' y! C$ Y* o4 s* S
- module_param(ccnt, int, S_IRUGO);
复制代码 9 f. T3 k2 Y5 |" y1 w& Y* _5 g
7 G( J( G" W' W* T9 [+ E5 M- i
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 R+ F/ t* P8 p8 `4 z6 R9 a! d, Darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 e# i7 g% D* Q) v1 l/ v" h 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: `, h, r8 o4 t" Z8 h
( t6 `4 w# c6 t" }" ]' N2 d# e3 K9 r6 y R8 `
|
|