|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ G' ^* I! k9 c% N, D0 x3 A5 q- [code]EDMA sample test application) G0 X# L$ F T, I/ o
- /*
* b8 {: |0 |# e3 d: ?! E - * edma_test.c' s' H. G9 O$ z4 m3 o
- *
2 j( j$ J: w9 u - * brief EDMA3 Test Application! ~6 l, @( y3 b( [% v7 T( n. E
- *, s$ `- F3 W; {
- * This file contains EDMA3 Test code.0 F+ ^& V7 N6 g+ n: x! c) `) h
- *
3 q) B" b9 T }$ L/ ^ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
" w: A+ c2 s% Z( Y+ P7 I$ w2 [ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) t- F" j$ S d" [; G
- * TO CHANGE. o$ Q9 w$ t: t5 k- s7 X
- *
1 R3 J% @3 x2 h9 W: P - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ B, u. w8 L L: g) F- n. {! ?
- *0 D9 ^3 M* B2 X8 P9 K
- * This program is free software; you can redistribute it and/or
9 k- [ a. P/ K9 p! s8 U - * modify it under the terms of the GNU General Public License as
/ a8 E; F: `- l% Z; { - * published by the Free Software Foundation version 2.
% V6 b1 U5 {) i3 v! |1 i! S1 l! v. o& R - *
7 a' ]' A: `6 D - * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ i/ z5 Q. I5 u, R2 ?$ l; t$ A
- * kind, whether express or implied; without even the implied warranty9 Y8 L; u7 [5 s
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the& A" F+ W0 [. v# u4 L3 `
- * GNU General Public License for more details.
7 R: z" N' c% D2 a, s - */
; d$ u% G1 y2 z# G" v$ p2 r
, P1 l2 K s1 E$ f9 M- #include <linux/module.h>7 ^/ t \- ~5 q2 y/ V
- #include <linux/init.h>( c* T' P' o( G+ Q- S7 k
- #include <linux/errno.h>% X# ^8 T1 b6 A
- #include <linux/types.h>
/ r" a8 C j+ J1 U! n( P" i - #include <linux/interrupt.h>
: ~" f8 O, @" K% C0 F7 R' x - #include <asm/io.h>0 o# u2 u3 Y7 e' G5 Y; t& Q
- #include <linux/moduleparam.h>
2 F7 d& p+ x+ @1 W# I - #include <linux/sysctl.h>6 w1 V4 g9 l& B/ H- P) V
- #include <linux/mm.h>
8 q% k: g, c$ {; z9 b" Q# Z - #include <linux/dma-mapping.h>1 B G ^' F" w# J p1 L
# m+ R8 T. A2 m* S0 C+ b' F- #include <mach/memory.h>
+ ` J7 g6 G7 _' ]# P c2 v5 r4 | - #include <mach/hardware.h>: N) r1 J4 y* `) a' N7 E
- #include <mach/irqs.h>
% R' Q. A9 J) h9 W: V - #include <asm/hardware/edma.h>. D8 `5 A9 f v* q
- ( _. S; X" o9 `5 S6 r! y
- #undef EDMA3_DEBUG
3 C. J8 o, R; k( p8 {2 F! f - /*#define EDMA3_DEBUG*/4 s2 V. p, X/ P% o/ ]* V, D
- f7 l& a* a: P; U; `# k3 H+ W- #ifdef EDMA3_DEBUG
- J- N$ Z$ X# h; q# A - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 r5 @5 E& F) u, e
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
8 ]9 x7 I: `$ n) D; f - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
( _& ?% e6 U5 V9 w% k - #else+ A$ Z; \- [: |! i, L
- #define DMA_PRINTK( x... )
: g$ D7 P: f; t* \4 y7 R0 } - #define DMA_FN_IN0 C, `% o" O& E/ L& |3 l! v
- #define DMA_FN_OUT% c2 x: y8 c: s7 E/ f0 i: ]7 x
- #endif. H2 \1 [$ v1 r0 b7 Y; g( }! r
- A! i7 N3 v9 u* u0 s; E
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
% l' w8 V: t7 p1 L T: V. S8 L& V - #define STATIC_SHIFT 3
$ D: h7 C- ], y' V' T - #define TCINTEN_SHIFT 20! m& j; z1 `7 _' b* R; d
- #define ITCINTEN_SHIFT 21, J6 m: C7 j2 D$ D/ p
- #define TCCHEN_SHIFT 22% z+ B, q1 {3 ^/ L+ u
- #define ITCCHEN_SHIFT 23
9 H- U4 Y1 i6 K+ K q
! e9 p+ F1 e9 ~5 j* X7 i. \- static volatile int irqraised1 = 0;
6 G" \( _6 l! C% t3 ~) V5 x( [ - static volatile int irqraised2 = 0;
& M# p4 W( e) D7 n& S - 7 N5 `! ~; U) w7 J
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 o/ \3 y6 ^# S x+ R. k K1 V
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
x" h8 s' J D/ y! O - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 |6 C3 q/ z7 I$ D. Z) W, t% h
3 r2 k/ S* s: b/ z- dma_addr_t dmaphyssrc1 = 0;6 D! h1 U( j: T7 M) ^, ]
- dma_addr_t dmaphyssrc2 = 0;
. o+ A2 \2 z6 K' T; ^8 Q6 ?2 V - dma_addr_t dmaphysdest1 = 0;, x2 ^ [1 F& Z& S
- dma_addr_t dmaphysdest2 = 0;3 j9 d5 z" x0 t/ G6 I( O
- 8 l7 W3 J9 @% {8 O! n
- char *dmabufsrc1 = NULL;- i& I/ n& |4 G
- char *dmabufsrc2 = NULL;
1 w$ T5 w4 M; F. Z- v- h) O - char *dmabufdest1 = NULL;! k2 [( k" G" X& D x J t& v
- char *dmabufdest2 = NULL;
/ Q5 V" {) W. K2 p# \
* X7 Z) m! x. j- static int acnt = 512;
4 ?" s& y5 i% [. d - static int bcnt = 8;
8 L S$ w5 k3 c. y2 B4 c - static int ccnt = 8;
( F) r8 g( K0 B) j" e4 T - , Y7 u0 @) u$ {
- module_param(acnt, int, S_IRUGO);' Y, n& q+ e1 K! R( S2 {! K
- module_param(bcnt, int, S_IRUGO);, Y9 \1 A, i" x2 P
- module_param(ccnt, int, S_IRUGO);
复制代码
8 A" Q$ N1 b) s) j
0 Q+ P# S2 \" U- A$ e/ B 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
`* H8 u! A4 \" Farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 e( ?/ T) n3 K3 s 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# p: J- a- V0 J
5 \" R9 L5 Y- r2 s9 e0 \/ ?/ L' O0 j3 M8 v' b
|
|