|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 L2 V; I9 H8 G, {7 u f4 k( w. y9 c- [code]EDMA sample test application( r! w# C1 _1 ?7 _( |$ V
- /*6 y' `% H1 }% s
- * edma_test.c4 o% u. \7 @+ U; P4 ^. G9 B9 y
- *
8 @/ V6 }+ |/ V, B" L, q - * brief EDMA3 Test Application( {* k) K* J1 u) L0 f
- *
7 l. o" G5 [0 r2 m - * This file contains EDMA3 Test code.# q; p/ ^$ B' a3 D# D* ]& }, M
- *
& h; E& r0 p% }) X/ S - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- j; d1 b r) z4 O$ G
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
" f S+ k1 R' d! u* @& O - * TO CHANGE.) h# t. {& Y4 P( X, t
- *) x; `6 |5 t4 n( Q S
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ I! N* d) G, B5 _ V; o- q
- *) y; H2 ~0 s2 M0 [
- * This program is free software; you can redistribute it and/or% Y3 O/ C2 I$ G
- * modify it under the terms of the GNU General Public License as
+ B C: P& s- @1 b$ _5 g, k - * published by the Free Software Foundation version 2.0 t- y \* z' M( ? m$ O$ G- `0 `
- *5 _5 D2 b9 x- V1 T! f' Y
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9 ?- t9 g ]# G! x - * kind, whether express or implied; without even the implied warranty' t( L' r% |6 } P, Z, s6 D$ `
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the' `# v# `3 c$ C( {" R2 s2 K
- * GNU General Public License for more details.8 A8 [, g3 w' f+ T+ H( [
- */
7 k7 X$ C. [3 A; M9 X - ! h. M+ S8 O! e) h
- #include <linux/module.h>- e( L* i8 E' I
- #include <linux/init.h>
, d8 i" X+ O0 L1 C# | - #include <linux/errno.h>
' q8 t1 K4 O2 G. T% y5 ] - #include <linux/types.h>
/ q1 h; ~3 S& m* v' Z+ V - #include <linux/interrupt.h>
. c2 A! A% Q3 N4 I& ~ h1 T - #include <asm/io.h>
5 e& D2 ` q) q$ M9 ^' ~ \2 k" v7 y - #include <linux/moduleparam.h>
8 }* I8 w+ L- h8 N$ v - #include <linux/sysctl.h>
# a! z. o7 ~6 B7 V - #include <linux/mm.h>5 c6 c9 I) ?& ^3 c5 g( ]
- #include <linux/dma-mapping.h>
5 t7 P# V# J$ C+ c - " H' p: P5 l! N
- #include <mach/memory.h>
- Q) X8 {4 L7 j( F - #include <mach/hardware.h>
3 c' g8 n5 Q: N$ x |( T$ g! N - #include <mach/irqs.h>/ L) d* E. }( ^. s- F# O8 t
- #include <asm/hardware/edma.h>+ ], ?8 Q# E9 C$ }: M' a
) Q+ p, U/ w3 X$ ?2 h- #undef EDMA3_DEBUG% H% y) D9 ]9 H! d
- /*#define EDMA3_DEBUG*/- I/ x4 s) o$ @$ w* `/ p5 n
( L- K$ \8 I' `- #ifdef EDMA3_DEBUG
6 t. T: I2 A7 @8 a - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# \' E% g3 M. q V, Q
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- l. ^+ y4 r/ `' D$ j- e! E$ a
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 y1 \! t1 l5 _6 x+ Y% s
- #else
9 i1 m/ b( G- ?1 J - #define DMA_PRINTK( x... )4 h/ Q3 X1 L5 q- D. y
- #define DMA_FN_IN: _9 c1 T- M0 A6 I7 |
- #define DMA_FN_OUT
2 Z7 G) Q8 z+ _8 u m5 y& W% e - #endif
4 r4 g) O& \. ?, }4 `
% s% u, O' N7 s' J- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
; m |8 F/ z3 d" e - #define STATIC_SHIFT 3
' R7 d( B1 c+ R+ M4 J2 L6 n - #define TCINTEN_SHIFT 20
8 S6 \" s# \* x8 S* B; | - #define ITCINTEN_SHIFT 21
6 |" Z$ s3 D% f) `8 M, j. q - #define TCCHEN_SHIFT 22
% J2 q7 {* Y- z - #define ITCCHEN_SHIFT 233 ?* u7 x" ]: y! c7 ^# o# L! | S/ X
) R7 I" [- C3 m! O& [1 a& h- static volatile int irqraised1 = 0;, J7 |( x" c0 T6 k! u) C: b
- static volatile int irqraised2 = 0;1 O9 s, j! p1 o! E$ F
0 F, O! D6 a! g5 z. _- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- V8 @; U7 a5 }4 z - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 `; B# Q/ b1 |7 S( o - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( S8 M7 {3 ?% @. E7 `# p - 1 c, i( ]* E; Z# [/ @+ B
- dma_addr_t dmaphyssrc1 = 0;
: X4 l5 b; a4 S - dma_addr_t dmaphyssrc2 = 0;3 {+ r& X. Z X
- dma_addr_t dmaphysdest1 = 0;/ [* i5 }. E3 o
- dma_addr_t dmaphysdest2 = 0;2 m' k/ [: ?7 k2 o; [& w9 s2 }
. u1 d7 F. ?/ J4 e9 J9 L3 X# k- char *dmabufsrc1 = NULL;3 W" l6 W; j' g' g, ?) ?3 Y& c
- char *dmabufsrc2 = NULL;
8 `4 \0 e, ]9 U- w( c: ^4 w, I - char *dmabufdest1 = NULL;
, {: {) C$ h+ d - char *dmabufdest2 = NULL;; r) q2 a+ q/ g3 q& a
7 C5 J' j4 S5 ^1 E- static int acnt = 512;
" J: \& C) C; |! Z8 i - static int bcnt = 8;
0 n T; S: ]! Y6 c' R. Z" d! l0 M0 |. ^ - static int ccnt = 8;" K1 E% l* @0 @7 X) R" m# q& D
- ( [$ z8 Q) @ \" q$ E6 {( I0 o
- module_param(acnt, int, S_IRUGO);
5 X% l7 R0 z. d6 V0 S - module_param(bcnt, int, S_IRUGO);
5 P* O/ q6 s p( @0 C - module_param(ccnt, int, S_IRUGO);
复制代码 7 p, v9 r+ a$ X( }& T6 ]
$ ^* x3 X$ B( S0 Q& |. i* Z& C
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 D, Q8 u# s- D; s- D3 f) ~. I" c
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' k' Q2 F' n v' F& ?( D0 _
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 M0 J2 }8 o0 R2 ~- x) A% s; R. x( _4 Q
; _3 v: ? U: _" e% k/ p |
|