|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 I. U9 T0 D' t, R9 d9 t! P
- [code]EDMA sample test application2 @- E: T0 m/ Y/ ~; e5 @+ {$ p; x
- /*
' ?5 Y6 U. R7 j$ B2 M8 r - * edma_test.c! }. n) c$ H. r' ^
- *& W0 k2 {/ {+ q3 l7 h
- * brief EDMA3 Test Application
9 Y7 Y- i) v9 B* N& ~, t2 L7 z3 H - *
2 u2 l4 g% p( c" c/ h# l1 h - * This file contains EDMA3 Test code.
) l2 O6 T: T' V - *' V0 _# d& z+ Z6 K; k
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- \% D; b. d0 G* b% m& I% x
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 K S1 N4 A" f& J$ E7 H
- * TO CHANGE.
$ T! w% l! [' C1 b9 x: h9 c7 p& @, G - *
" w" Z6 H" r, ]% N8 Y8 K& D - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
( v, `4 k( ?4 v; F& w# O ] - *- i6 [ _* ]; x) z ?* W- a) y
- * This program is free software; you can redistribute it and/or
$ n9 Q( W: Q( l; ? - * modify it under the terms of the GNU General Public License as& z0 p. O% `/ U/ [
- * published by the Free Software Foundation version 2.
: o& `! E* ?& @2 N# p - *
$ p( p# Y; n- Q* O - * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 N% `& n- ]# X. s; i6 P5 P7 c' F
- * kind, whether express or implied; without even the implied warranty" _$ @( k! X1 b- `" B6 B
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the& w5 O$ U* e( ]4 {8 l" z
- * GNU General Public License for more details.
# W% R. G' t, q0 ?4 h - */
- k3 x& L+ r4 S3 L6 p. r6 V0 U8 S8 {9 } - 8 j, O0 ^6 m# y* Q, w |- s
- #include <linux/module.h>4 J2 G1 T$ i: f1 H5 X
- #include <linux/init.h>
6 e4 [. P% l# p( }( h6 u' T+ ? - #include <linux/errno.h>" }/ m! D3 d8 a; L3 Z- S. K
- #include <linux/types.h>
8 ]8 y, h) H9 @2 K/ _ - #include <linux/interrupt.h>
- |) b* }5 A$ o% q; l - #include <asm/io.h>5 W6 S5 |$ E/ q5 t' h$ A
- #include <linux/moduleparam.h>
2 M9 ^, j1 \2 O d3 ? v( a3 ]6 B/ [' E: x - #include <linux/sysctl.h>( s8 ^: X7 Y. }. F" ?0 c/ x1 y% p
- #include <linux/mm.h>
# J' _' u) | c/ j& D - #include <linux/dma-mapping.h>
8 S' a; ?! f) p+ Q' |& f0 N% `
$ N4 \( }- g8 ~- e- #include <mach/memory.h>
- G3 A6 A" q& t7 o) h ? - #include <mach/hardware.h>- P' f) a. x: T4 v
- #include <mach/irqs.h>7 [" u* {$ H V4 Y; F5 ^0 n
- #include <asm/hardware/edma.h>
0 }. r) R3 u2 `+ E! u5 C: Z* d
7 |+ C% g1 O/ m- #undef EDMA3_DEBUG2 G1 F. |8 M9 o
- /*#define EDMA3_DEBUG*/' w- H/ c5 H4 e( T j4 R4 m
- 9 a: u' H3 e4 h2 R
- #ifdef EDMA3_DEBUG
7 j7 P3 F/ s! \* s$ o - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 Q; ?- n8 z; {7 s3 u' J
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
' }5 n9 Y/ P& H( g) F8 A - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), j. l3 D3 R8 a( L
- #else
0 Q! d8 H+ B" C5 J6 q, }* r - #define DMA_PRINTK( x... )0 b" z# O# j% U* c# C" z
- #define DMA_FN_IN
. M6 N% d$ B4 h - #define DMA_FN_OUT
5 U% _1 ?+ c6 w. Z7 O1 z - #endif
4 F1 |$ _: U5 R& A4 ]. T$ S - 1 r- }" {1 C3 J! k
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
' U; M2 v% r' e - #define STATIC_SHIFT 3
9 V' x9 J' S) L+ V% G y - #define TCINTEN_SHIFT 20
3 Y* F+ k4 A+ H( O& U - #define ITCINTEN_SHIFT 21/ C% Z$ Q r, s
- #define TCCHEN_SHIFT 220 n8 S3 V+ L8 s* _' g2 r
- #define ITCCHEN_SHIFT 23; |. H' c2 {+ R, u. r
- # A& ~0 ~4 n' T" L) l
- static volatile int irqraised1 = 0;
! l% F: |! ]1 H3 Q- V - static volatile int irqraised2 = 0;- z% Q8 Q8 Q6 U3 \1 M' E/ u& n
, N1 I- t" C, U1 S" S ?% t- _# X/ o- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- B4 ~. j" s7 m' x6 A& u
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 ~! L( u: f+ v) ]% H' K - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 X! g* ~0 U7 s: x* L
- , k& z3 R' w" e5 f( N W2 E6 c
- dma_addr_t dmaphyssrc1 = 0;
; v" g7 L! w1 n' N - dma_addr_t dmaphyssrc2 = 0;& o4 w2 S: _ K
- dma_addr_t dmaphysdest1 = 0;- R+ l+ I1 i+ U$ _
- dma_addr_t dmaphysdest2 = 0;
' t1 ?# l& E0 q; T. P; H) y - ' Y: v2 f9 X& H: T0 ^/ _/ u5 ]5 z
- char *dmabufsrc1 = NULL;
9 g3 Z4 I6 Y- |) Y* K - char *dmabufsrc2 = NULL;% S8 A' R' K$ a1 V
- char *dmabufdest1 = NULL;: W7 m: Q5 n) t0 X$ H
- char *dmabufdest2 = NULL;
% a% P0 k4 |. J3 C( S: d
9 x- z9 A& t9 q$ o& X% i& P- static int acnt = 512;
7 R8 ~7 y8 ?! B6 Y! n - static int bcnt = 8;
# R- g/ O5 a7 j8 `# v* B' N9 a+ [ - static int ccnt = 8;% H- w3 u; Z* i! N; d+ r
% F: G1 s! |# O7 c- module_param(acnt, int, S_IRUGO);
( o8 S' U2 y" t. ?( c - module_param(bcnt, int, S_IRUGO);
7 O0 A! x7 H* a% n1 I - module_param(ccnt, int, S_IRUGO);
复制代码
; h Y6 Z' U9 D; j8 D* A' r" }
- Y$ M: C/ a' _6 T. ] 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 U3 z! B% @' V3 F8 e- Z Harm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 C/ C- P. k* \4 _( N 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, `; O. k- j0 \2 \( E1 ]' C" B1 s# ]- ^4 D0 h7 Y
4 I/ |! r q8 A, y |
|