|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : X1 K) l5 C, M! X) J
- [code]EDMA sample test application' J' H6 `" K' Z( K% q4 R
- /*
. z' c+ ~$ Z t$ a2 [ - * edma_test.c1 W6 {1 q8 C; V7 U' z% L5 P
- *
' J5 I$ L; H+ Q( T S2 A/ _ - * brief EDMA3 Test Application
3 l; `$ I' y8 K' t u3 ~% i - *; |5 @, h% B9 M+ `
- * This file contains EDMA3 Test code.- _4 g! l: U& i
- *
- L' ]9 z( V4 g- ?7 j - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
! B& A o' ?, X' M4 F& ?0 E& J - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! `; ` E8 [: ~; H+ _
- * TO CHANGE.
2 G n; d. @9 X4 H - *9 y J* m* b5 l. N' o
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
0 W% F. _ O9 C8 L+ R% D' O - *# y s: i. U r
- * This program is free software; you can redistribute it and/or- [9 f8 M- Y9 V+ R
- * modify it under the terms of the GNU General Public License as: T9 R5 i+ d, H; N/ Z
- * published by the Free Software Foundation version 2.
3 m& S& I% v& F1 Y. N0 e - *
1 E1 N8 o( I5 D# Z - * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 R0 `) p9 c5 `" ^
- * kind, whether express or implied; without even the implied warranty0 ~9 S5 s, U" \* z8 b! `' t) N' X
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the( ~9 M. D L1 @' S3 M
- * GNU General Public License for more details.
; G. C* k( G1 c, O" _- U - */8 \0 J) J1 m# b
- 9 t3 s1 W- [& H: d& f" Y, C/ M3 _
- #include <linux/module.h>; q+ X* B( g7 u- p4 j& `
- #include <linux/init.h>2 A& L0 G+ Q# |
- #include <linux/errno.h>* f" M% w: o% D. `& T2 ^
- #include <linux/types.h>
# Q: v8 L: g4 K; c: X& e1 d - #include <linux/interrupt.h>
2 I6 H5 Y* s' D8 r9 {- } - #include <asm/io.h>
. c; m5 s+ q3 _9 z/ A1 b - #include <linux/moduleparam.h>- Z8 @% @) N9 Q8 G7 k, F
- #include <linux/sysctl.h>
2 }% p/ d U7 `5 ?: f" } - #include <linux/mm.h>
8 Y, y& Z, {- q4 H' n. y - #include <linux/dma-mapping.h>) o" Q" r6 O, T9 D& H: l
- % e) ~" o7 s. s" O& A- x% y4 W- j
- #include <mach/memory.h>: ^- Y1 l6 ]8 y
- #include <mach/hardware.h>
( {( w @0 z w* n - #include <mach/irqs.h>
& j4 l! g+ F" G4 o2 z) {# C+ \3 a* _ - #include <asm/hardware/edma.h>
7 [* y7 v$ r, P) h - % E2 R. ~" e) Z
- #undef EDMA3_DEBUG
/ g) L3 a$ Q O& G* I+ I - /*#define EDMA3_DEBUG*/
+ i u) C- U {8 |' O h! d - 2 g1 d+ g% k% @. o# v$ i4 s: L
- #ifdef EDMA3_DEBUG) n' D9 Q' D2 ]/ x, B8 E, \" O
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
3 P$ C4 b! W, J1 V+ a - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
8 S) F( d8 U' [# ^$ J3 a1 j - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
) q+ N6 E$ r' g, ^! ]$ w - #else
9 ]3 B+ }2 j& `4 } V1 D, f+ | - #define DMA_PRINTK( x... )
# [( i. a- Q* }; y/ W* L - #define DMA_FN_IN( w, r- ?. g/ C$ n, t0 [2 G, c' @
- #define DMA_FN_OUT( A& y# N% N* T) Z1 B
- #endif
% u7 ~* P! G8 _+ q
& z( F3 E/ a; m) Y% U" \. t4 p- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
% j" C5 [1 k. w, U- S+ z - #define STATIC_SHIFT 3
. }8 h ~; p; r; ~# z: N - #define TCINTEN_SHIFT 20
3 {. K0 D1 r" h6 K8 c - #define ITCINTEN_SHIFT 21
4 ]- I- I. |! Q& v. g% p( z - #define TCCHEN_SHIFT 22
- x6 a U; Q- p/ A - #define ITCCHEN_SHIFT 23
$ x( H( H3 R6 D3 X( D- Z: E - 8 Y* z Z. i- G
- static volatile int irqraised1 = 0;
- o3 \! \; a/ ~( @ - static volatile int irqraised2 = 0;
# r& x( \7 w% A2 l9 o' V
' x8 ^- g$ `5 ?7 d% N& W8 Y4 M+ `' ~- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 b$ l% {# U2 e. [
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, X3 O, {) U0 {# {
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: q; T4 u U" P/ m8 \. B
: i0 d" h& f f4 J5 b6 C- dma_addr_t dmaphyssrc1 = 0;
4 f3 o' }& {; p P0 S D - dma_addr_t dmaphyssrc2 = 0;
- q$ e! B+ d9 l4 H' ^9 k+ ^ - dma_addr_t dmaphysdest1 = 0;- I/ I, G% n3 ]0 \5 E( _* `
- dma_addr_t dmaphysdest2 = 0;8 d2 P" o( b) [$ W" k
! L- p" |1 x+ m/ W& t- char *dmabufsrc1 = NULL;
' \! @6 @: B/ I6 \6 l' [" p8 F, U/ f - char *dmabufsrc2 = NULL;! @* M& p8 M, x8 O5 u
- char *dmabufdest1 = NULL;
0 T* ^( R$ m5 V8 k! K0 P D - char *dmabufdest2 = NULL;$ n( ?' r9 v5 O
- 0 d& F H5 K9 Z2 x- e1 s
- static int acnt = 512;7 K5 b% V r' X! }& Q1 A
- static int bcnt = 8;
4 O* D: Q. g3 q1 Y5 ? - static int ccnt = 8;
" U, \4 {$ j* `! |
; Y- n) m& `! a- O7 S d, C& w, n- module_param(acnt, int, S_IRUGO);
0 m$ y8 t1 S6 x+ K2 D - module_param(bcnt, int, S_IRUGO);$ z' ?# P- l% ?; |, Z. j# F
- module_param(ccnt, int, S_IRUGO);
复制代码 - m+ D4 P4 T" E. R8 u- s
8 r* [! W1 l f- L/ ~+ i
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ Z4 ?' I$ A. a. U" D% Qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" X* e2 d" _/ p) L
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 e& a' d/ E3 c5 |' Y; `. F( W$ B r3 v6 a
: ^1 E, p9 f% V9 C+ D% r |
|