|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 Q# U( L9 g/ X4 x" p
- [code]EDMA sample test application w7 U7 }% y( E2 U, ]! w. J
- /*
* Q* @7 s7 Q' d+ t - * edma_test.c
/ V$ L0 ~/ B4 X. x& W - *3 x# H' q4 z+ h; x5 K; X: D/ P
- * brief EDMA3 Test Application
& X2 g: m& F% { - *
9 R0 D! E; l6 i! ]. Y6 P - * This file contains EDMA3 Test code.+ e7 N. B( U5 a# h, ^% v2 X( O
- *
% \( k8 _. V# L2 k. Z8 |9 N - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
1 e: n! M+ m" ]5 T! ]0 _ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 a) K5 h( S( q G, ?
- * TO CHANGE.
" y8 M" f& ?* G0 \2 Y; p - *# K( U( M8 E5 Y& K. d( E+ |
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
% w4 d5 w+ P/ Q; c' { R: ~ - *& c6 a7 F1 I2 O3 i/ b7 c4 S: c/ n
- * This program is free software; you can redistribute it and/or
. T% J O- ]) V# u A0 ^ - * modify it under the terms of the GNU General Public License as
8 i, {) q- ?; y0 f. {+ r- x - * published by the Free Software Foundation version 2.4 f0 S9 ~% T; p7 l
- *
0 M0 d$ s: T4 E6 N ~, h0 l - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
" Y1 l; Y5 Q0 {2 R! d8 F5 K - * kind, whether express or implied; without even the implied warranty! o3 O1 M# o6 S6 A% t8 c$ d1 E: U
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the3 q, x, B4 f& \& }' t5 w; e( Z
- * GNU General Public License for more details.2 J H4 T3 Q" ^' H8 A0 x: ~
- */# J0 h; L( {% _
- L5 \/ ?1 o% b! m" z$ _9 `8 K
- #include <linux/module.h>0 a5 B4 U, N$ U* l# E( n$ ?
- #include <linux/init.h>0 R( L% a6 y0 c' {* \! s4 F6 y
- #include <linux/errno.h>; U9 w- M; |% j/ J- y& h5 @! y
- #include <linux/types.h>! F, Z9 N4 m; V
- #include <linux/interrupt.h>8 d% ^+ V0 o& A, n! j
- #include <asm/io.h>
7 Q( V5 [, U' B. a! ?' v" ~ - #include <linux/moduleparam.h>
9 q3 Y9 _* g# C+ E6 Z - #include <linux/sysctl.h>/ c& v0 @; k4 D/ n. n1 `
- #include <linux/mm.h>
! q& e5 o$ E ~2 Q( P/ c - #include <linux/dma-mapping.h>
6 g# h( |* c, V: v" n' {/ V
" r% R1 e7 Z, D+ ~- #include <mach/memory.h>
+ O& ~' j; T$ S - #include <mach/hardware.h>: I [% M: Q- E% r$ z! j* ~/ I" u: G
- #include <mach/irqs.h>; H) v6 R7 z" t* }! ?
- #include <asm/hardware/edma.h>9 X2 a( v; Y/ K( I6 X
- , P' {/ {# A& ~
- #undef EDMA3_DEBUG
# B4 e' x+ H8 E7 h5 z - /*#define EDMA3_DEBUG*/
- \. u3 e& h, m) c$ _
3 d1 U+ c0 c' |* ~7 W% i: r- #ifdef EDMA3_DEBUG
* V- h- O% G' x# ] - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
1 D# K) G5 I' Z- g+ O - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 A( R$ i$ u- ~. Q# g
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! [1 _; h6 i+ \8 V' R
- #else
( E3 M: W% r) y - #define DMA_PRINTK( x... )7 e7 p9 k. S% \/ d4 N
- #define DMA_FN_IN9 z8 s0 X6 x, Q6 d Z. F& w( h
- #define DMA_FN_OUT
. ~( h. ^/ T9 ~$ O! R0 o1 l; G& j - #endif! m5 |! P% q2 t5 ?( W4 P: Q, @4 v7 Y
( |/ J* n4 w1 `+ j3 M1 g Q- #define MAX_DMA_TRANSFER_IN_BYTES (32768)* I& K/ U! {3 c" y4 r% C
- #define STATIC_SHIFT 3
4 A# E. d. f0 o0 ]! a - #define TCINTEN_SHIFT 20
. N& X, D0 l/ _( K - #define ITCINTEN_SHIFT 214 o' I2 s/ U; X7 S8 y
- #define TCCHEN_SHIFT 22( z( E% L# G3 N) t% ^
- #define ITCCHEN_SHIFT 23
0 f4 ^1 I8 b" J( L% j' t - ' j8 n/ i a" Y1 T
- static volatile int irqraised1 = 0;6 ~3 l, m7 A3 B) f# F) E- G: ]9 o6 @; B
- static volatile int irqraised2 = 0;
' [4 Z- q5 |5 m
' G4 e. O/ M4 L' J- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ H& M3 p) i& z2 h( X
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: _5 W" M6 r3 Y( n
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 Q: ]& K0 H7 Z* n! b# \
3 ] n9 Z2 } U! ~- dma_addr_t dmaphyssrc1 = 0;+ N5 G' v5 X$ h. k
- dma_addr_t dmaphyssrc2 = 0;8 w7 k9 y& \( R! ^
- dma_addr_t dmaphysdest1 = 0;9 O: a! J7 p2 m, w3 s# t! b% o3 E
- dma_addr_t dmaphysdest2 = 0;( z l$ L: A9 ? L2 _
3 @# j" O3 w4 p9 J4 o- [! [- char *dmabufsrc1 = NULL;
. K# u$ @; H- x. T - char *dmabufsrc2 = NULL;
( G$ a: h! F1 _/ L5 x- ]: g# z* k - char *dmabufdest1 = NULL;
0 m! }" G- K9 j ?0 z - char *dmabufdest2 = NULL;, a# R+ X9 |6 G2 {
- + c) D! J+ g& l; ~' A
- static int acnt = 512;
8 B( B* K7 g g - static int bcnt = 8;) G6 |( [8 d+ }& Q2 i) v/ X
- static int ccnt = 8;
! F! X" ~2 m9 w5 k' t- j
9 d; m8 g! v/ R4 Y; g( s; @. a6 x- module_param(acnt, int, S_IRUGO);
# U- t" x+ \, J" w2 N - module_param(bcnt, int, S_IRUGO); Q$ i# c! g7 G" Q" q* L
- module_param(ccnt, int, S_IRUGO);
复制代码 % W ^7 Y$ k) e* r/ b
: H7 r0 i. o5 d! C# |5 u y
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 Y# t1 O( I- ]7 Q* 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; ]2 b4 {* T' M+ J% s$ I: L
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 _" w8 d# i8 S8 M( z5 B
8 L1 v7 l; `3 d
3 N2 o4 r( y( D# R) j$ j4 \
|
|