|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " y$ i6 w9 C6 J! U
- [code]EDMA sample test application
8 a: G8 v* R9 [9 S( `2 } - /*( h# F! I% V; X
- * edma_test.c
& A, K% k1 n! _ - *' N9 X s- Q; g8 b# ~! h9 y" G
- * brief EDMA3 Test Application
% [0 T. L! q) e! o, W# a - *
: y) C+ ?, }2 z5 k+ D. p* p - * This file contains EDMA3 Test code.
; J+ p' U; a7 n+ z - *
8 d+ O, M- y) y H, u( l0 u7 g6 r - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ ?; }9 f: t8 G4 n% x
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
2 i8 ~* Q9 C$ Q - * TO CHANGE.
- r, b6 c4 U% f - *
2 ^* ~/ U( E& K - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% s6 y8 ^ y1 K* }. m
- *4 l9 |) w' T0 m
- * This program is free software; you can redistribute it and/or' }/ w) @& t. R8 N4 d0 |' u* b
- * modify it under the terms of the GNU General Public License as1 J4 f% F4 {- I* H( f/ L6 C3 Y
- * published by the Free Software Foundation version 2.
3 N! D7 {( N- M9 A - *
* Y6 P. l4 Q6 e - * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 v& E9 C6 L- }0 }6 a$ R* x4 ^
- * kind, whether express or implied; without even the implied warranty2 P- S1 u. q9 ?! D
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the) o$ _; `% a0 E/ z
- * GNU General Public License for more details.
( ~$ t3 c- Z" _% Z - */7 I# m, x0 R; J# v' I9 K" @
- & F* P& s7 c& ~8 w; k5 Q; f. [
- #include <linux/module.h>1 {5 S( w# M3 o& } S0 u4 G. \% ~
- #include <linux/init.h>1 l) T: P# ^, x! V
- #include <linux/errno.h>+ _1 a2 G" C0 V5 j: T
- #include <linux/types.h>
& ~$ Q9 s# p! F7 O- ^% ^8 P( t - #include <linux/interrupt.h> f7 M" z2 F4 |4 s* F
- #include <asm/io.h>
2 L1 t2 d- }& K$ m4 Z) u7 f( j% Q) I - #include <linux/moduleparam.h>2 z7 Y& L! w( q9 i% w" w
- #include <linux/sysctl.h>$ O1 b' q8 A/ L4 ` s
- #include <linux/mm.h>
* z' }* U6 G! {. p# e - #include <linux/dma-mapping.h>
( x: ~$ r3 `2 ` - P5 r8 T$ ^0 r
- #include <mach/memory.h># C/ N3 h1 C8 D: Z
- #include <mach/hardware.h>/ q: J$ x: g2 K4 j
- #include <mach/irqs.h>: D$ U+ s0 U: O2 P+ a- ^7 I7 ^
- #include <asm/hardware/edma.h>
* ], n! C& O3 @) C9 C4 R0 b
0 k* u9 {& W" H! z- #undef EDMA3_DEBUG
$ s# D; d6 z* B; L' L - /*#define EDMA3_DEBUG*// j5 u' b. q+ }5 ~
- # _# y3 L. ~* T, @1 T+ J, O
- #ifdef EDMA3_DEBUG- ]9 C& `8 [; L/ N
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 t9 o I$ x Q" w" A" [
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
6 n/ H! E" j" x: _ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
+ P$ B; C3 {* R2 l - #else- |0 g7 K% M) Q8 J
- #define DMA_PRINTK( x... )1 f/ B! R! H* f
- #define DMA_FN_IN
0 h" |: q* x/ p' U8 _9 h - #define DMA_FN_OUT7 o/ B! \- v6 p4 @- [+ _- ?( _
- #endif
" ~0 w& O6 T/ M, F. q - * l' b }- ?6 U s6 i. W& U2 m$ F
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
; m0 U) z Q" B3 k0 Y - #define STATIC_SHIFT 3. p7 o, r' A8 H
- #define TCINTEN_SHIFT 208 Q) M2 K3 W/ w1 s1 J W
- #define ITCINTEN_SHIFT 213 \# ]' T; B' N. }! A* f2 N6 X$ |
- #define TCCHEN_SHIFT 22# c/ K9 k6 Y0 P9 F8 o
- #define ITCCHEN_SHIFT 233 {+ c5 |: H) b, z# t7 u! S
- " Z# [3 l' S! J% E$ d
- static volatile int irqraised1 = 0;
8 N, S) s7 ^' q; W; E - static volatile int irqraised2 = 0;! J7 l/ t5 q3 f2 i: L5 L8 z
- ' N% F' l% d( @8 H0 Q
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 v8 p0 d, g2 n1 \
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" M% x6 P- p" I$ H! k* H
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 o' b7 ]7 |! `3 U6 K( x% \ - 1 }( j+ q8 l0 X
- dma_addr_t dmaphyssrc1 = 0;2 |; B8 t! r8 p( H: u2 y0 v
- dma_addr_t dmaphyssrc2 = 0;' ?0 d% }, o' V
- dma_addr_t dmaphysdest1 = 0;
, ~: x$ g( m; y - dma_addr_t dmaphysdest2 = 0;8 X& D3 s9 I3 ?) u& S4 p
- # ?* C e( I/ P
- char *dmabufsrc1 = NULL;
0 [: E5 Q N; i% H& j - char *dmabufsrc2 = NULL;
/ P8 J F0 V. w - char *dmabufdest1 = NULL;! y% h; t1 B0 g$ ~
- char *dmabufdest2 = NULL;, k2 w; N/ C0 h
% c2 ]& \% w& G |* e; }. T- static int acnt = 512;3 D+ O0 ^9 r5 ]" |# h
- static int bcnt = 8;
# C3 A9 ?7 U6 G7 F. K* D - static int ccnt = 8;
& H# n* x; q ^) F" A
8 s& n! N9 v( k8 g( |- module_param(acnt, int, S_IRUGO);' B2 e0 v4 c7 l" A2 F( N
- module_param(bcnt, int, S_IRUGO);" l; A; ~8 h. J( }4 O
- module_param(ccnt, int, S_IRUGO);
复制代码 2 \& U5 T! n) \9 j0 o t6 j
/ Q1 {( U% f1 r6 e3 J; N& u& x( n
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. k$ f) F; f/ R
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( W& t; a! k+ f9 n+ d 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ D% z3 q8 M& h N: I3 }' {1 ^+ }- v! t0 C3 o2 i% m/ I1 ?) U
$ f; C* K. R+ Q' a
|
|