|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 @' U% Z+ R6 a
- [code]EDMA sample test application
! p" A5 ^; r5 o4 }) ? - /*
( K2 s* n* \$ X7 g6 Z1 W7 V! f - * edma_test.c
$ j' K& d9 z2 @$ C - *, v- N' n s% D( ]6 j
- * brief EDMA3 Test Application
/ A) h, J2 S0 r - *
7 x( G" ]- C9 W% R$ E# V - * This file contains EDMA3 Test code.
6 k" Q& O- N1 e2 X4 T4 K# J - *
- @$ `: ^% O9 _( ~4 E; `/ E - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
7 D/ a& h) A( B/ J - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
$ ?6 D& U/ T; Z+ o1 ? - * TO CHANGE.
" O0 {5 W- h e; j& M - *
- o( J2 b6 J q/ K6 } m* |! b - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 e8 _9 l- `. w
- *
5 p# K* v: [ G) y: N% q) u+ R; j - * This program is free software; you can redistribute it and/or
8 ~* o8 A1 ~8 n! ^! p$ c& h8 U3 ` - * modify it under the terms of the GNU General Public License as
0 m, o* O' b/ T0 _7 V - * published by the Free Software Foundation version 2.4 [& }5 f; h) W; q) t+ W; _% L4 t
- *
! F+ ^8 C4 y" L" | - * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 }3 V9 s) }) L- p+ ]8 v5 p
- * kind, whether express or implied; without even the implied warranty+ S' X! k5 P; @7 x
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0 H5 I5 [1 R9 Y; T8 c& U+ l - * GNU General Public License for more details.
: [8 K1 H4 @) v/ C5 c - */9 _6 v# T# m3 l+ o' M
; J* w0 `7 K& {0 R% B/ m/ Y+ l9 Z. b7 }9 m- #include <linux/module.h>2 ~% q5 @, g8 e
- #include <linux/init.h>
2 B3 \ P8 K. a+ h - #include <linux/errno.h>: ?% z! v+ {; |) \- g# Q1 [
- #include <linux/types.h> |+ T5 o! D% Y( @
- #include <linux/interrupt.h>
b% y( f. V* p6 i3 s - #include <asm/io.h>( w( s2 R) s: a% q% W) e% s# h6 h
- #include <linux/moduleparam.h>& `3 I8 t; j, D( q @
- #include <linux/sysctl.h>8 D# T; k0 {/ C3 _ L& j5 R9 [/ O
- #include <linux/mm.h>
& s" u s; f# G+ F4 I5 h - #include <linux/dma-mapping.h>
% V# }" h8 K; @2 a8 h - ! q! s. e( L( t, k9 ?0 y( \! f- i
- #include <mach/memory.h>
6 I+ r9 F& u- O3 S& a6 R - #include <mach/hardware.h>. o" R c* q1 E. e' D
- #include <mach/irqs.h>
2 n; y( q2 ^$ ~5 u - #include <asm/hardware/edma.h>
8 e7 C* J; [' j. k; L$ Z8 l
. V0 F% Z+ e }$ v% P- #undef EDMA3_DEBUG
. O5 y2 e5 H0 K9 l3 v - /*#define EDMA3_DEBUG*/
7 N7 I6 R" Z& c/ Z" y& ` - 4 I2 G. g9 c% T9 d. }+ Q: p
- #ifdef EDMA3_DEBUG5 z R2 f1 P# a
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
& a3 R0 E+ i9 @ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
/ R; y" c, d9 J% R4 o. Y - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); Z+ | k6 c( {$ b
- #else& r; M7 v' ?# c5 x" c. r2 Q# ?
- #define DMA_PRINTK( x... )- w6 o- C! l) b7 Q8 H6 P/ H: p
- #define DMA_FN_IN3 n0 V" d2 S/ Q! i# D
- #define DMA_FN_OUT7 Q' L& J( ^( ^0 u9 f- W* \, \
- #endif
9 F) A, R" x5 Q" i3 W) x - 6 Z! {+ O. X4 c5 a* g
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
3 N! n. a, \1 t7 O" Y8 u4 ^ - #define STATIC_SHIFT 3
! w3 A! p4 F* g- |# ^+ v - #define TCINTEN_SHIFT 20; ~3 N7 B- |5 J2 [2 g6 {" d& K
- #define ITCINTEN_SHIFT 21: j+ l# l* K; ]) X: a+ g; M
- #define TCCHEN_SHIFT 222 L) j8 \( [' L0 F' f- t- i
- #define ITCCHEN_SHIFT 231 N) D1 z8 u* `
" W ^( K( r* Z- j( ^7 f1 }7 L- static volatile int irqraised1 = 0;
_. A, m" u/ W- q - static volatile int irqraised2 = 0;
6 y# Q$ `6 v3 F" X - & c9 T1 a2 r l
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 |4 P0 H. Z7 a1 c
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& U% I6 @; N& ^0 y - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 O" {1 W- L( K) O* b3 f) O3 c
0 I! F0 L! ?0 ~* v+ b- dma_addr_t dmaphyssrc1 = 0;
7 R- k, i1 V6 [- A; r# _5 w @ - dma_addr_t dmaphyssrc2 = 0;3 q, {6 F" a5 u) K# ?
- dma_addr_t dmaphysdest1 = 0;* A3 `' ?# a7 C: p- E
- dma_addr_t dmaphysdest2 = 0;
/ M, E( y, o3 K. ?8 Z& i: A# | - 4 ^4 X9 ~' J+ R9 V
- char *dmabufsrc1 = NULL;/ i, b8 X$ S( {: p" _
- char *dmabufsrc2 = NULL;
/ j0 Z3 Y2 h" E! \5 x) R2 s4 ^ - char *dmabufdest1 = NULL;/ ^ L' @& C$ S$ t3 q5 g
- char *dmabufdest2 = NULL;. M& C: U5 [ M p
- ]# U+ J6 q( v0 x8 f
- static int acnt = 512;+ ]. Y: O) F$ N; u
- static int bcnt = 8;- U$ T/ {' G' O- x
- static int ccnt = 8;( o _7 H2 r2 R
, S2 W" d3 h; \: m2 E' o% x- module_param(acnt, int, S_IRUGO);
. _5 Q( i/ i6 s7 c1 H - module_param(bcnt, int, S_IRUGO);4 s/ G5 M9 ?4 v6 L) U% L
- module_param(ccnt, int, S_IRUGO);
复制代码 0 |0 F, X" R: k# Y" d- f; T9 _
$ W, \- R3 B. S& c 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" @( b7 M2 R' ^" S: @6 x
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 L& G# F' |6 s 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( A& b/ x, u' V+ ]( t6 a' g% v% E
* [1 a6 }8 f0 s3 M) j1 o+ ]( s# z0 K- V+ m p
|
|