|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
Z" |! Z0 K8 B) W5 q" q; M- [code]EDMA sample test application2 q$ ^# V5 q3 P* [+ ^
- /*
4 {' @( D3 y, z( L; [ - * edma_test.c
" d. T" x) _" ~5 o/ y! i6 }6 u* |7 i - *- f4 \6 q& ?; s$ @. v
- * brief EDMA3 Test Application
3 ^5 O5 e: M8 G - *8 o4 }/ T: { F% P7 d+ m
- * This file contains EDMA3 Test code.
2 M" X. y- K9 G5 t9 e' K5 O - *
: \ ]7 _0 _* g: I( c9 m - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
4 N* q8 `4 @+ W% g+ h6 u8 H: a) l - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' c r/ t) u9 p8 m
- * TO CHANGE.
# Y0 ^5 Z' Y% R% @' ^$ ~ - *+ E- L( g0 r. }& Q) ?+ l" I$ C: h
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 s9 j+ B) H! Z# d& L+ v/ ^$ S
- *$ \& n8 P: U- n
- * This program is free software; you can redistribute it and/or7 H5 x/ k8 N. P& d
- * modify it under the terms of the GNU General Public License as* r* B% h. ^$ S
- * published by the Free Software Foundation version 2.9 R/ ~2 W1 S3 y- z9 v F
- *
3 ^# O Y& X. ~5 W- R5 B% U: Q# X - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
! H- A* a9 N" d4 ^% A( _1 e# ` - * kind, whether express or implied; without even the implied warranty) a' W! S6 K- Z; ]$ |; ?
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! d+ O- L9 T# X; {- D- R9 ^6 V6 ~( X - * GNU General Public License for more details.
/ f0 C5 e }3 }5 @7 K/ Y& N - */% c' q$ e! T" x
1 O$ S8 B- E$ H- M3 i) a- #include <linux/module.h>1 s7 p3 y3 l1 R% k
- #include <linux/init.h>
& Q7 P8 V1 P, g! B1 ^2 F - #include <linux/errno.h>4 ^% n9 P7 q( a
- #include <linux/types.h># c# H# D+ ]- i" u9 S
- #include <linux/interrupt.h>
% d) R" ~( {! N1 {2 X4 d - #include <asm/io.h>
. K3 b) l; Z, ^1 E5 Z/ Z - #include <linux/moduleparam.h>
L$ i, j0 H v" @+ n) V0 K. f4 W - #include <linux/sysctl.h>
- ]- n/ s5 [. I" l {! n, n5 x - #include <linux/mm.h>
% r6 {( `# d! [# Z" M" d - #include <linux/dma-mapping.h>
9 p6 c {7 z0 M- n; q f
' {, B& z4 ]5 k8 K. K/ T- u- #include <mach/memory.h>
! R( V) G. A& \+ Z D+ m* { - #include <mach/hardware.h>
) S( ]) Q* N0 T) k' H; r) W$ E - #include <mach/irqs.h>
3 z7 R# c4 u( b: B# ~ - #include <asm/hardware/edma.h>, P' j4 w/ t2 c, |
- X. q: g: Z, R8 y
- #undef EDMA3_DEBUG4 D/ m2 Y% o/ N9 Y& G" y
- /*#define EDMA3_DEBUG*/
9 B& h! D+ S, v' \! i. ~
" i9 Z$ `# G$ Z! P- #ifdef EDMA3_DEBUG4 ]1 g. S6 q9 Y# y
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ D: R' V# z( l! E3 L
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 a5 L0 S1 x, l/ Q% K
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 [) d2 U* p4 j8 d0 B- _
- #else4 b W' S0 h R. u0 j
- #define DMA_PRINTK( x... )' M- q& | K. E* o4 o
- #define DMA_FN_IN; s6 I& r& d4 A/ r
- #define DMA_FN_OUT
' m$ S: U+ E+ y' @9 l" k - #endif/ [/ g; G" c6 a& P, X
9 W' u3 E3 \# K+ Q- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
& _1 S3 w& R/ r- k - #define STATIC_SHIFT 3
k9 G3 y- p& n+ m, H - #define TCINTEN_SHIFT 20
. l# W1 A, A& L7 \. R - #define ITCINTEN_SHIFT 21
) Q8 p! _; T" F# K+ {% B5 ^0 T - #define TCCHEN_SHIFT 22
3 t$ j0 \+ C& }% q- o- S - #define ITCCHEN_SHIFT 230 v+ v; ^; ?2 f) H
- 4 Z& v+ e- Q0 ^6 y
- static volatile int irqraised1 = 0;
( ^5 q) F- L" I& T$ D - static volatile int irqraised2 = 0;
* _ x1 N( B: \( Z( F
( j9 H0 X5 G" a" c! D) e- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( ^& {9 u* O Q4 z( }+ `( U
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. j! T' V, m; A( [% N+ f - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 n& N2 M* x# o6 i* [
4 m4 A$ Z( G2 U& H' V- dma_addr_t dmaphyssrc1 = 0;
8 T; Q6 s$ h* z. Y9 |/ w - dma_addr_t dmaphyssrc2 = 0;3 e" L0 f2 k; O! s3 e
- dma_addr_t dmaphysdest1 = 0;
$ N: ~9 Z, i; J% G8 J& A$ \* G. g - dma_addr_t dmaphysdest2 = 0;7 ^2 h& s( A5 \
- : J, v$ D# I+ ^- H
- char *dmabufsrc1 = NULL;- L* A6 |) ]. @: S' M0 C" @
- char *dmabufsrc2 = NULL;
% @' @- G; p. J$ q, G" j$ q. R - char *dmabufdest1 = NULL;
- ]8 M$ k5 g$ B8 X7 o1 g - char *dmabufdest2 = NULL;
! o& |& Y7 s4 k+ r' K8 _
* ^4 M ?4 v m# G- static int acnt = 512;
6 r6 |. P: f. `/ y) `2 v - static int bcnt = 8;
, M L6 e& n% I. t. B+ c - static int ccnt = 8;$ D# k9 q+ {% o% E
% [' |: t' d% X& e/ A. m: L- module_param(acnt, int, S_IRUGO); o( N$ R: a% s6 }( {. {0 Q3 D
- module_param(bcnt, int, S_IRUGO);
1 D& u# Z- F) X7 N; L, s8 { - module_param(ccnt, int, S_IRUGO);
复制代码
& l7 M7 g3 W( O; X* g, Y: b6 t0 R' d
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' y! e+ y. }; [ I6 D. iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# L' U( R F! @# ] 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ v6 I9 Y4 c$ E( s6 c4 L& T8 e
5 v2 [- b* {6 B4 h, _3 @7 l# X" D5 q8 ~
|
|