|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 p4 _/ n/ d& J, @! A- [code]EDMA sample test application4 u( k% ?# F5 J& A6 [6 s
- /*
5 w6 ~: u. j! |' ` k5 j5 H3 c - * edma_test.c
) W4 z! I6 {9 {0 z - *
: O7 Y% _. w8 G5 o% w* Q - * brief EDMA3 Test Application1 X! m4 B7 G; V
- *: H a1 _% ]- n+ V% a* P
- * This file contains EDMA3 Test code.
7 f' q k' g2 f; w9 C - *
& r0 H( g8 z+ V2 b& j) @. Q - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& X' d/ V9 \4 t* Z2 Z
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# O" [: |+ ~3 V. W- Q. p% G
- * TO CHANGE.6 G: e- h) M0 t. Q) w- d# g. Q/ Z0 p/ L
- *
; @) S( T p- I% {$ A, ^ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( \& A/ x" G; b1 u9 b1 d. G
- *
5 P9 n% F- B' T1 ^- D+ v - * This program is free software; you can redistribute it and/or* E2 p- Z- a) j
- * modify it under the terms of the GNU General Public License as' ?+ N) p2 W$ @
- * published by the Free Software Foundation version 2.$ U, i& A! N3 P3 I x; m% p
- *
* B M: x+ k3 I( H" s - * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 N( [3 J' B9 T6 Q7 S" T
- * kind, whether express or implied; without even the implied warranty
( |' g2 r1 Y. \& a( f - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; h# D: d w1 O% b- Y! z* | - * GNU General Public License for more details.
# [! A) v7 D5 _0 ~ - */
% K7 c# u$ z1 t$ Z [3 B6 {( o - . G7 Z% s" }. H2 n3 E
- #include <linux/module.h>2 ~) N _9 W$ u
- #include <linux/init.h>; I9 N6 v+ d* N% s
- #include <linux/errno.h>
+ J4 T+ N. S# O" ?* q6 W4 ]7 R - #include <linux/types.h>+ F/ |5 r; u6 D
- #include <linux/interrupt.h>
0 o( N: w; _" g7 `. G - #include <asm/io.h>
( x* w0 n! O* o - #include <linux/moduleparam.h>) { Z- v. l' u
- #include <linux/sysctl.h>
|6 y4 q. h5 W! x4 A - #include <linux/mm.h>
# P' y5 R' a" D/ C! D& l: Z - #include <linux/dma-mapping.h>) p7 L, G3 P8 t3 ?5 Z
- 2 s! [$ X0 S7 q. @2 }
- #include <mach/memory.h>8 ~5 j2 q+ t: w# b4 G. y* L& M) c
- #include <mach/hardware.h>
7 q8 M% S; I1 w4 \' v - #include <mach/irqs.h>
5 |, b& Q: w b7 \ - #include <asm/hardware/edma.h>
L: Z( M2 r; u' @2 L1 G - # Q" t. r, b6 N& G
- #undef EDMA3_DEBUG, z9 p' `! x) J9 H" _( g/ F
- /*#define EDMA3_DEBUG*/# I' L0 N) H0 I
" T( r, V5 d4 Y6 k8 l- #ifdef EDMA3_DEBUG
8 z" w: P* u; {' ^, F# I - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
, y0 S/ U" S9 o5 e - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
; j* R. ~' n6 k5 e- ]2 F% U# f. { - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 m5 m$ t A4 m1 p+ ]9 l. r" x
- #else$ Q# |( k6 J1 k* @3 G3 J! Y/ o
- #define DMA_PRINTK( x... )
% Y- A! t/ x$ z* j" f, `, }( ` - #define DMA_FN_IN
5 b# _" w. n& b/ q - #define DMA_FN_OUT* D/ n, Y" b f6 H6 r9 a ]
- #endif9 X0 _2 w" @0 I% g/ @
& t( y8 x2 Z& p* L3 Q4 p" h- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
! w" U1 h9 T) q- {# e! g - #define STATIC_SHIFT 3
( z2 [# @1 }3 r! h - #define TCINTEN_SHIFT 20
! \5 j8 S& m/ y* f, R - #define ITCINTEN_SHIFT 21# x9 W1 {( |" Q0 U
- #define TCCHEN_SHIFT 22
8 k. W3 b1 @3 W; i9 ^ - #define ITCCHEN_SHIFT 23
( ]+ C0 |6 b. p/ W
" N8 P! R- b" J# q# q3 ~- static volatile int irqraised1 = 0;: d! E R0 B2 ]# [" [
- static volatile int irqraised2 = 0;
; b% r/ K! A; G. D) }1 F
2 Q4 \9 Z3 p* i! ]4 v- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; P4 J$ Z! Y; v1 v: l- R - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 {1 }+ B/ V: R6 [
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 m7 c* i8 D5 ^) U O: E* f
) y i1 Z9 w3 a& i! ]: s- dma_addr_t dmaphyssrc1 = 0;
; w" R. Z; C$ ~5 @/ r% x - dma_addr_t dmaphyssrc2 = 0;$ j! z" d- _' P" l9 x9 o& ]8 ^
- dma_addr_t dmaphysdest1 = 0;
0 }9 v) g+ U! ], E6 Z - dma_addr_t dmaphysdest2 = 0; C- K3 r2 C, k
- : c- ]* l% ]- X& R& k1 ~
- char *dmabufsrc1 = NULL; W5 V. ~+ C* ^8 H7 h, _. I
- char *dmabufsrc2 = NULL;
2 Y u3 ?2 z. ~7 K! c - char *dmabufdest1 = NULL;
/ j5 J* w, k" F" l* ^( B, j - char *dmabufdest2 = NULL;
4 @) E5 ]# a8 S2 M: d' }: l o
0 L: C; k! l3 n4 ]8 |- static int acnt = 512; a% G/ _, z; ?% _. X& w
- static int bcnt = 8;
* N& N9 B' k( b3 {7 @' q4 D7 X4 M - static int ccnt = 8;
5 G4 a$ w8 d% G% ? - ' w, x* _9 C; r4 F' J3 O; l. i
- module_param(acnt, int, S_IRUGO);: q& i! T6 ^+ D
- module_param(bcnt, int, S_IRUGO);4 z8 @. d% g0 H! B# q% U4 p
- module_param(ccnt, int, S_IRUGO);
复制代码 . k4 Z0 l# R) c" o7 F& O) O
1 y" C5 f1 r/ q: W 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 r8 Z9 Q9 p& Z( P& ^& Q1 N
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 V1 `8 X/ j; ^1 S! n, F 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ y; z1 s% I2 X
; A6 s$ y8 e5 s# O, N. k. |! O6 p7 w- p
|
|