|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * _% k! \( S- [& e2 A4 s! p
- [code]EDMA sample test application
/ Z5 b% f, i+ a - /*9 Y' l- X- v/ d
- * edma_test.c
7 \6 ~) U7 X- F+ P- |5 u% a - *, \4 `8 F2 U+ o% X. t; k3 v( v
- * brief EDMA3 Test Application
9 D4 J5 _3 N0 w - *
( T5 [( l" v& y0 M- C- T - * This file contains EDMA3 Test code.
! o( X# H1 |1 X4 ?9 f2 L - *
% u9 e+ E5 j3 n" U - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 B3 L5 \* S) }$ h4 X0 F. P
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
; B2 H( X9 Y: v e6 m - * TO CHANGE.
4 ^5 b( S" i0 f: [3 s - *
h! q6 d& R. W4 w/ w, d. U `* q - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ _: r/ K- V. J# x0 G
- *
- ?& M2 G X( Q - * This program is free software; you can redistribute it and/or5 A4 g P2 _' C1 Z, g5 \9 i
- * modify it under the terms of the GNU General Public License as
4 W; E8 z# V9 j: M - * published by the Free Software Foundation version 2.
6 Q1 n( v8 X5 {% }1 [. f/ A2 D. \ - *, U9 q, E7 y4 w; J
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
$ E- U2 Z) M2 R" {' o% ? - * kind, whether express or implied; without even the implied warranty8 ?+ ^$ u0 n0 {. k* w
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the! m Q- U4 I' i$ T* H
- * GNU General Public License for more details.# f& q& M( v9 M
- */
1 ^- Z; y# X1 g7 I
6 X$ A" u0 M. x/ t2 Q/ C6 }% Z- #include <linux/module.h>* o& P1 c) c9 y+ w# B+ Y: f s
- #include <linux/init.h>9 r& v M0 E; Z1 c- ?2 x
- #include <linux/errno.h>$ s9 l; Q3 ?; f# {7 g
- #include <linux/types.h>
, O- O, O# o& V - #include <linux/interrupt.h>
; p: o* }4 s) Y1 X7 P - #include <asm/io.h>! F) |3 A8 [! `1 L/ I! m. f" p
- #include <linux/moduleparam.h>
) q, n+ u2 H0 C4 g2 Z - #include <linux/sysctl.h>
! p3 |' T/ D4 s. F - #include <linux/mm.h>
, G7 ^5 s3 W- L - #include <linux/dma-mapping.h>" i: m! |" n. P+ J9 P. B
$ J! d' ^2 N2 s- #include <mach/memory.h>9 z4 k% ~ v( E, \
- #include <mach/hardware.h>
, d0 t9 D& _" x: i! t - #include <mach/irqs.h>
0 X* R( N( |) x! S- L - #include <asm/hardware/edma.h>8 ]. ^* H0 K$ O
- + _6 R: R- `" w, f) d9 [* ~$ `# _- O# J
- #undef EDMA3_DEBUG
9 q% H3 o, B! h! ?% R - /*#define EDMA3_DEBUG*/9 p: e# }! |8 i
! a' K7 X0 l2 e& y3 q- #ifdef EDMA3_DEBUG% {! q- s& @1 v$ l
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
7 ?0 M/ I/ L% k2 k& L n - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
B* V( J" g) r2 U4 N+ U9 D - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 r& N& t4 z$ f4 \3 D* a0 T
- #else6 U' u& S& e( p3 ~1 G
- #define DMA_PRINTK( x... )
6 C% B0 `! J+ o; |, x/ U& p5 Z- f0 i7 ] - #define DMA_FN_IN/ }2 L' P1 _: |! w5 R7 E
- #define DMA_FN_OUT
: z; H' [* q V9 c. [ - #endif
! {1 v# r" ~7 V: I' [/ N8 }8 G - - M, H; N/ V2 s9 ]* G0 I" f3 d
- #define MAX_DMA_TRANSFER_IN_BYTES (32768): D9 \+ d2 G; F7 j8 q% ?
- #define STATIC_SHIFT 3* j6 W/ S0 i7 ~5 \
- #define TCINTEN_SHIFT 20& H+ f, A( g% ^; M
- #define ITCINTEN_SHIFT 21
; C) U( d& E3 b6 f - #define TCCHEN_SHIFT 22) H$ ^1 z- }% z# n
- #define ITCCHEN_SHIFT 23
! E7 ]3 N) e/ ?4 D5 N {5 q0 L1 H3 r
' h7 v* ^8 @5 W* D- static volatile int irqraised1 = 0;
& m0 J% n! K+ i+ j) A - static volatile int irqraised2 = 0;
9 S2 u: `9 ^( T+ G! _
2 v; N" [! A3 ?/ _+ [- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
R( }! Z4 E+ k - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- b& o) [% D0 \4 l) e( M% V# y$ I - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ |& ^. a# x6 a$ C, o
- 3 S+ Z) u U" } S( _9 |" x
- dma_addr_t dmaphyssrc1 = 0;
6 L7 X6 w8 d# z5 X. W/ t: a - dma_addr_t dmaphyssrc2 = 0;7 n8 K( U$ t9 C7 i( r2 V( a. J( S
- dma_addr_t dmaphysdest1 = 0;" n" ^- [- x' [) l4 p
- dma_addr_t dmaphysdest2 = 0;6 }. n" b1 v+ c3 Q- X `9 o ?
/ A; e) ~8 y9 x0 }- char *dmabufsrc1 = NULL;
3 @' g) w! q& e) p$ W$ o% S8 V0 k - char *dmabufsrc2 = NULL;
) K. J( \1 a# g7 X1 P0 v( }7 ^: O - char *dmabufdest1 = NULL;$ I2 |2 P+ X; A' P; R( K1 @7 W
- char *dmabufdest2 = NULL;: c1 l8 U ~* p* V* r( z
# ?) `1 c. F0 T6 g/ j2 w- B! c- static int acnt = 512;! e& T( F% ^% b0 H9 v( ^9 b
- static int bcnt = 8;/ I" |. W! ?( i
- static int ccnt = 8;- j$ |$ i. Y4 f6 U8 Y
- t1 V( j2 w3 Z5 g; v- module_param(acnt, int, S_IRUGO);. n2 v, b# }' Z8 M, b
- module_param(bcnt, int, S_IRUGO);
2 o7 t. ~3 s# v) Q. E - module_param(ccnt, int, S_IRUGO);
复制代码 * p0 x& H3 @( r
4 J$ h( t2 m/ x7 G. S+ D 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# q) k% R7 i( J' narm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! e$ D* w9 y' ?6 a4 K- r
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# E6 H! L* _( a9 K/ M" C. C5 o- @ _( z+ p0 S, R
9 J) N' k: V' z |
|