|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 {" ~) T: l" N3 r2 i3 u- `
- [code]EDMA sample test application
" t/ W Z: y% O/ d, J - /*) X0 l5 H8 L; }% L, T6 v7 p
- * edma_test.c
. i2 I* Q/ j& z+ {/ U - *, \8 s0 n5 r3 z9 z2 Q) v& v
- * brief EDMA3 Test Application x# q$ Y; T" E
- *; k9 A# W0 X; J! I
- * This file contains EDMA3 Test code.1 g/ B& r1 l; {! r8 C" Y( G
- ** l% Z$ E) B8 u: b! \/ A
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ Z6 N9 m2 a. v- R6 }5 N$ T
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 S( v3 c( t9 G/ |5 i: O; T
- * TO CHANGE.
+ n/ R& a1 F$ r( f8 A - *
9 E3 ?. y- R) l! ]" t2 q6 c) a# a, U - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 s2 [3 J6 p9 T |
- *
* U) c9 I3 X, Y# J - * This program is free software; you can redistribute it and/or
2 k R, h8 k' ~% I( [: Y5 u. V - * modify it under the terms of the GNU General Public License as
" X7 S" }, B4 U( q0 Q2 F5 x - * published by the Free Software Foundation version 2.
' }8 s( `: N& r/ r - *, \4 r2 P' k& r# U7 _
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
$ ?) t- z0 o+ b6 e0 k. o9 l* Y - * kind, whether express or implied; without even the implied warranty8 z' T" p# R8 P0 Y9 C
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the' G1 C6 f* ~9 i5 `3 D
- * GNU General Public License for more details.4 P) L& b' m4 ~! {/ W$ T9 u6 X
- */
7 Y- U4 f* C# L; U$ o - * j9 f' A4 D* f# s3 J9 W
- #include <linux/module.h>: `# p9 ~# Z0 t$ m' R+ ^
- #include <linux/init.h>
1 m v6 h! P4 v* L# F% E u - #include <linux/errno.h>
6 P8 P' ]/ X4 J% V0 u! m - #include <linux/types.h>
' l, o2 t: D9 W& _ - #include <linux/interrupt.h>
* o3 S- B' R4 D - #include <asm/io.h>- X' e# |, |, H' j
- #include <linux/moduleparam.h>) Y0 J& W2 a( Z9 z1 S
- #include <linux/sysctl.h>5 h( {1 `7 K/ c1 N% T
- #include <linux/mm.h>( w& b. S4 t" I( @
- #include <linux/dma-mapping.h>
: i4 Y: y Y/ c8 d5 k
) v4 i w0 x8 P; N# G- #include <mach/memory.h>
* @4 I# ?1 \4 L/ ?; y( d) }3 B9 H - #include <mach/hardware.h>
* g5 C9 m r7 T: D' G. d - #include <mach/irqs.h>( q6 y6 f( [$ ~# P
- #include <asm/hardware/edma.h>
- o v' J5 D3 `+ P. g - % v, G) [( f; X _! p3 N/ B
- #undef EDMA3_DEBUG x0 h& R- ?3 l: }# I
- /*#define EDMA3_DEBUG*/! H1 ?7 i* E& |, F) t' I' D6 `
- ) \$ Z. Z4 c8 X% ^
- #ifdef EDMA3_DEBUG. c2 D7 n( r5 t4 N8 p' }# C1 M4 ^
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# I! A; d& E9 {, L8 {& ~( @9 v
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ y7 S* G9 D# b* H$ N3 r
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ V4 c( x$ x+ [' H7 m% l
- #else
( S* Z. G! m9 d/ A/ B; ~ - #define DMA_PRINTK( x... )4 q4 `- H1 w- I$ B# G* i
- #define DMA_FN_IN
, @. \: X/ {7 X8 Z5 G4 p - #define DMA_FN_OUT
. V6 s" d1 O8 w0 q' \6 c3 a. e - #endif
2 l0 F5 m3 J' s - 8 |6 d5 i* `& a! ^8 s3 x
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
7 ~0 G& y: D& b- l1 n, _ - #define STATIC_SHIFT 3% x( ?' e. E0 ?1 c W; }4 R8 m: O
- #define TCINTEN_SHIFT 20, ^$ a4 \0 i1 I0 F1 t2 M
- #define ITCINTEN_SHIFT 21& ~- [4 F) h. }; p
- #define TCCHEN_SHIFT 22. d" S, g" {+ `+ s9 Q1 d
- #define ITCCHEN_SHIFT 237 W: ]9 S3 A. Z& \
* p. `0 R) |; o2 {) n4 c- static volatile int irqraised1 = 0;
! t+ U: W' ^+ { - static volatile int irqraised2 = 0;
( i4 h" P8 l" d$ _! | - & a& F* G0 H: v2 c% X4 B4 {
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 A5 G Q5 H9 p$ }
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) w+ S& s* a4 d; d
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 j: _4 S/ ]" [* j) f, P1 k$ C" q
- + S. v/ C' k$ l) x7 p6 g4 {
- dma_addr_t dmaphyssrc1 = 0;
2 i1 g, a0 c# I# i4 [2 h8 A' C - dma_addr_t dmaphyssrc2 = 0;
. u: {! Z& F* G2 p - dma_addr_t dmaphysdest1 = 0;5 Z, b# n4 h7 M- J( m: R! ?
- dma_addr_t dmaphysdest2 = 0;
4 s y: ?$ F$ g0 T
% d( J- V, s3 Z; z% a- char *dmabufsrc1 = NULL;
; H5 @9 t' o: v% w - char *dmabufsrc2 = NULL;
% p' u" o# f, s8 ]2 E+ S1 u - char *dmabufdest1 = NULL;
# W7 l2 y/ p* ` - char *dmabufdest2 = NULL;2 s$ }3 D/ C1 o1 l" H" z E
9 |6 f$ h% x- X; x3 d1 C- static int acnt = 512;2 x, n' t$ n* W; \; f
- static int bcnt = 8;
2 s( @0 m4 R6 Y( D" z% @4 i - static int ccnt = 8;
$ p1 _8 g& _; J, J" Z# ] - 4 \. I. l+ U" D. V1 J
- module_param(acnt, int, S_IRUGO);
- I/ b I" c9 o J6 p - module_param(bcnt, int, S_IRUGO);$ Y& r! Y7 W/ A* o! z7 Z1 z
- module_param(ccnt, int, S_IRUGO);
复制代码
5 G! o, _) H- o1 Z! v& L$ p
6 e( L1 i1 Z X2 D# N 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ |( ]) ?4 `1 D* @- W) 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 ^7 [% A, w: Y6 K! z
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, X$ C7 A: ` n1 n6 l) I
) p! P* F4 E# a6 I% z9 B! h8 ?* n# u2 W4 G$ X: t; E! y4 t0 |
|
|