|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * A& ^0 _6 B6 I! t; K8 b
- [code]EDMA sample test application3 ~; R' P9 J" e
- /*
1 h' M4 S. A; O q% W+ U. E' o - * edma_test.c
* o3 I+ {* m" k1 L Y* g - *
8 ?$ \: c2 k1 m - * brief EDMA3 Test Application8 M Z1 O8 Y# l3 `: ?
- *9 |1 c( @0 j+ U" _4 |5 G R
- * This file contains EDMA3 Test code.
( H( G( q0 S: ^4 O- M - *
+ J' ]# E( _* p0 F' B - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. ~1 O" r8 ^/ b3 F# A
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
# g( t8 U' X! ]/ h+ Y: F - * TO CHANGE.- v) J! s) R2 `! y1 J) F* q2 q
- *
p; Y: r! @- o9 g! z# c2 ^ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, R) Q' a8 }9 m( g
- *
% O4 D% T" X4 Z- X4 _ - * This program is free software; you can redistribute it and/or
6 z- Z6 G8 h& S - * modify it under the terms of the GNU General Public License as
5 S) x5 @$ L$ }4 E: }9 B. C - * published by the Free Software Foundation version 2.
+ m2 ~; _8 `" Y3 j7 P% J - *
1 m, L, u3 ?8 i - * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 ?( S0 B+ q5 n, t8 d# ?
- * kind, whether express or implied; without even the implied warranty& S7 _+ g* E! M) K7 _. f
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0 i7 R' Z! {% C - * GNU General Public License for more details.
" L7 ?6 v4 g6 u - */! _7 E# Z, R& H# ^5 T$ P
- }3 z7 d- X7 B( d# z- #include <linux/module.h>
/ n, [2 M/ t; o - #include <linux/init.h>1 ]9 v; D/ g4 n7 e, Z5 F% x' E
- #include <linux/errno.h>
3 N+ P3 P$ v+ m' P - #include <linux/types.h>
! Y1 r5 J; X, t* l - #include <linux/interrupt.h>& G7 T! ]9 x, K4 t
- #include <asm/io.h>
3 A6 b% e, q9 ?* V - #include <linux/moduleparam.h>$ Y$ C9 j" h, O! z6 z1 Z1 c
- #include <linux/sysctl.h>
+ k6 g. I/ q. g - #include <linux/mm.h>
* K2 U4 J: R3 {, s; S( I5 D - #include <linux/dma-mapping.h>
9 j+ p1 G( l2 N' t1 h
- i* p0 m3 p1 H/ u0 ?# ~3 n- #include <mach/memory.h>6 ^( n+ F4 T) S C
- #include <mach/hardware.h>2 S5 h* m7 ^3 k7 F( N, G2 p
- #include <mach/irqs.h>" I$ w3 m. T/ |: |
- #include <asm/hardware/edma.h>
$ G: v0 E; b a5 n
6 X& H$ @+ ]$ ~- #undef EDMA3_DEBUG3 R5 F; u6 w$ u: ^( R" K
- /*#define EDMA3_DEBUG*/
' F- k: \' H; P
* e: X g6 T2 g) w- E7 { V4 i- #ifdef EDMA3_DEBUG: ?% G% R" e' A2 o% L
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
. `9 i2 g, q, J4 q) C$ D - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ `# O9 y6 e$ i4 K+ ^7 m
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 D5 N4 O7 b( P; q: P
- #else
9 G- p& I; A& ^: L/ J - #define DMA_PRINTK( x... )
- ^) n# a% k! `0 F9 h, u6 } - #define DMA_FN_IN) B$ k; A/ U& e$ H6 Y+ \
- #define DMA_FN_OUT
" y8 g: N+ I" p+ L5 X - #endif
! G+ R8 A) n8 h
4 f: ]0 S, e/ y* S- #define MAX_DMA_TRANSFER_IN_BYTES (32768)/ c# r; h }6 g/ l7 A+ m i
- #define STATIC_SHIFT 3
3 u. ` s6 J- o( }6 V, b - #define TCINTEN_SHIFT 208 S* l8 A- u+ T% `. B3 T
- #define ITCINTEN_SHIFT 21
* ^; Z: A7 |0 n- l/ ` - #define TCCHEN_SHIFT 22
. @' V% K1 ~# E) |. V& g/ g% n - #define ITCCHEN_SHIFT 23
# b* {# l; l; T# ~! F( h1 I - # ~( X- V% [. \4 [: k* n
- static volatile int irqraised1 = 0;1 x$ ^6 G9 d0 H) {9 a
- static volatile int irqraised2 = 0;% ~$ c8 r" r* Z
0 }8 b# E5 G, |. S- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ U+ S) M' u; P5 q+ s' n g! c
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( u; y3 X" X0 G, t$ A$ B, v
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 e& ^& N+ R" ?3 d- H
3 T* V% x; M6 n# d- dma_addr_t dmaphyssrc1 = 0;) l3 U3 r) B( O" i" t
- dma_addr_t dmaphyssrc2 = 0;3 C+ j9 t4 R% H$ W; g
- dma_addr_t dmaphysdest1 = 0;
/ a7 q4 T/ c+ n. \* _1 X - dma_addr_t dmaphysdest2 = 0;; Q" |5 u; _4 b3 L
- ' D( L/ f# h$ `7 ~& I9 P0 L) ^
- char *dmabufsrc1 = NULL;
7 N( x U( X9 K$ Y3 \4 o9 e0 E - char *dmabufsrc2 = NULL;) |1 L9 C* h* X
- char *dmabufdest1 = NULL;
1 P% H% Z5 X7 k& C - char *dmabufdest2 = NULL;
/ Q( k! V: K4 A9 `6 R
( O5 b( U" S& A6 b1 h4 V- static int acnt = 512;
g9 y/ y# L' Y7 `" s2 I M: Y - static int bcnt = 8;
~0 a: X6 a) u- o w - static int ccnt = 8;
' q( }8 i$ N+ x
& J! d2 e6 R, f; h# k- module_param(acnt, int, S_IRUGO);% a1 ]. _& Z E1 l5 q5 G$ g, L
- module_param(bcnt, int, S_IRUGO);* U1 {+ }- I; e/ Q* f C; H8 c* H# j
- module_param(ccnt, int, S_IRUGO);
复制代码
+ M, {. A1 }7 D6 q! g
2 k1 k" r. {/ Y 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ l: X! ^) b8 @1 r8 L/ {/ Karm-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# V9 L' E/ c6 C 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ L) t% F/ X+ @& ]
1 [* s4 A% n# }! ]: L4 Q
0 _0 K$ `7 A3 x- b. j
|
|