|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 V4 L' A& P6 x- q! E. F
- [code]EDMA sample test application$ q; t8 t8 S+ \$ ^
- /*
2 x7 t" f7 ^9 K6 p - * edma_test.c! D w$ U" T& s
- *7 f& @7 D3 b' e( M% Z$ T
- * brief EDMA3 Test Application
% z) U! l9 a) W( k2 N' Q - *8 y C, A+ @" e/ R0 O
- * This file contains EDMA3 Test code." v9 o7 {4 F5 N0 r l" k. H, h
- *
. G9 N: R+ x Y0 Q+ ^5 h - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ c( o9 P6 f. t4 M2 N& ?
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
q5 H3 J1 ^2 `% d; t - * TO CHANGE.
! m5 A4 J6 h& j/ L* _* H - *6 u! X- [, v! O4 E$ T% D
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& ]* M( Q D: F5 v$ D+ o! a, x
- *
$ W/ I2 O$ g# B8 F - * This program is free software; you can redistribute it and/or5 |2 R7 R) G5 d
- * modify it under the terms of the GNU General Public License as
4 ?* C$ F" J: M0 V; r- F - * published by the Free Software Foundation version 2.
) Z3 X1 E, L% p9 f - *! ~# z; m) G* _
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
2 V, m/ F8 ]' g. s" c: A$ z* C - * kind, whether express or implied; without even the implied warranty
- _% a' @6 e* p* d. x/ ^0 G - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
$ q/ j* y5 r; D- T - * GNU General Public License for more details.
& y ^ q, ?/ \& G g6 { - */* A. x1 P( n8 }( y- ]( g
- ! h5 m, U# X5 I* k
- #include <linux/module.h>
5 {" Q( H2 c r: i/ ?8 g+ V/ Y - #include <linux/init.h>
5 {# }; |8 S" H( B3 G - #include <linux/errno.h>9 m d" l: l& x9 F; ]7 u8 w
- #include <linux/types.h>' G6 U& {9 k+ O0 Q/ K) P" J. W; K6 A& p( S
- #include <linux/interrupt.h>
6 z/ t f$ V1 G+ W- V; s - #include <asm/io.h>6 c2 k8 ~0 f6 R5 V
- #include <linux/moduleparam.h>
7 l. i2 J' C A2 Y( Z9 t+ W - #include <linux/sysctl.h>
`3 a6 N* [0 {. r* C3 P, m - #include <linux/mm.h> Y3 U( R' l: Q/ p; o0 m8 x. g" |) _. m
- #include <linux/dma-mapping.h>
# H$ f9 X; m- u1 d) q - ' G# o4 }# P/ T4 ^' t
- #include <mach/memory.h>
8 U C) _4 ^% @ - #include <mach/hardware.h>
M2 o" k1 s# |, A5 ^# y - #include <mach/irqs.h>4 Y' E# D+ I2 h. E1 e
- #include <asm/hardware/edma.h>
3 t1 q# G5 ]& W' R - 0 V) t2 x8 V. @6 @. D, B5 r
- #undef EDMA3_DEBUG
5 H2 t6 }6 o# P7 N2 N1 s - /*#define EDMA3_DEBUG*/
: H" }0 C' s( x$ S- I+ t
9 m' \5 f* Z. V- B/ X- #ifdef EDMA3_DEBUG0 ]% ]0 p7 ~* Q
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- F5 X0 W4 B$ A
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" [1 \ C* |( b3 X
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
' S7 A! {" m, `. s: C; c% }3 ~: y - #else: r! f+ v* Q; }- K9 [: E' D
- #define DMA_PRINTK( x... )
4 k# r# H+ v B% W - #define DMA_FN_IN
) S* l6 h% ^# j: n8 ]3 C4 e1 u% \' G5 e - #define DMA_FN_OUT
5 ?4 Y; h4 n8 t$ p$ ~. V- K G& D - #endif( R5 k- f, s8 N; \' m% [
& ~+ u' Q& K$ f/ i& Y, y1 l" Z' [( V- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
% S! V6 B/ j' Q5 t9 ]. e1 a - #define STATIC_SHIFT 3, G; ` a0 W; C) G5 o5 n. b
- #define TCINTEN_SHIFT 20
. J! |8 E+ }% w& w! y! P9 o5 @2 ?, L: I - #define ITCINTEN_SHIFT 210 r& e, q5 h( c
- #define TCCHEN_SHIFT 22
$ @) h6 p: m4 x q - #define ITCCHEN_SHIFT 23+ |$ ^. ?3 i: q* o+ j
$ ^0 Z; ]4 C) t- static volatile int irqraised1 = 0;
- B9 e- I/ n: E - static volatile int irqraised2 = 0;( t8 P! ~3 d2 e9 k, H% Y
$ J1 _. O* j+ l% q* Z' @. w- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! m" u" H6 `. V( |4 x- F - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. Q) [6 J1 o; x ]9 T' i. L
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 N! A \8 [4 d$ v$ G. V
L( ~0 C6 u6 j6 m& a4 ]- dma_addr_t dmaphyssrc1 = 0;
# k1 I3 j& h. j, _3 B1 s2 k5 C - dma_addr_t dmaphyssrc2 = 0;) q+ V% q2 l; q! ^8 Q* ?7 \
- dma_addr_t dmaphysdest1 = 0;( v! W4 c7 N! S% O! D9 @( I# F7 [) ]
- dma_addr_t dmaphysdest2 = 0;
& Z+ A) X$ `8 l- P* S9 `
0 d; O& ^1 R/ K- char *dmabufsrc1 = NULL;3 \: x# n: F& { {: {
- char *dmabufsrc2 = NULL;
7 d( K. K- ^0 `. }2 |' M8 \ - char *dmabufdest1 = NULL;
# q$ Z2 ^1 _ R% M6 } D, H) {* a - char *dmabufdest2 = NULL;
6 d# V4 E" z: s5 K - : Q7 v. p# @3 k2 A& J
- static int acnt = 512;
; h" h! s- L' c6 N7 C - static int bcnt = 8;
+ l1 V3 M Q2 j# n - static int ccnt = 8;$ r( d' V/ q+ V9 J
' p% R" B# K, E: O& c- module_param(acnt, int, S_IRUGO);
3 L7 g Q9 t! r+ q7 j - module_param(bcnt, int, S_IRUGO);
; H, K2 o( a( H9 a8 A - module_param(ccnt, int, S_IRUGO);
复制代码 # ]& s, E& ]2 _6 k
" D* S9 F4 q; c L" |6 ^2 V) r 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ O, Z+ f Q0 d7 y/ Q4 b. ^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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* E* C5 C h. B& L* m
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, y2 E @' M7 k/ D3 R/ Q$ }4 u; b& k U1 y5 z
' K+ m4 M1 b% J
|
|