|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " q! p7 k: E- O% i/ j( w* K$ E
- [code]EDMA sample test application% {7 J" {% d$ ]
- /*; n: w! V8 l# |) A
- * edma_test.c7 s9 a W7 c( k& X4 ?: n+ V
- *
9 D+ H: D5 h0 O, ^" K8 ^ - * brief EDMA3 Test Application
: r+ L% U# }0 E1 o M& x" t4 i. l5 l - */ @* T2 Q* O/ @9 ]
- * This file contains EDMA3 Test code.# e7 ? l8 {5 L/ I- O0 G$ {$ r
- *
1 {5 m( B% t/ o; g7 y7 s - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
- s/ d: [. |: a W7 O3 d - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 c, L: ?' C6 B4 ~% f
- * TO CHANGE. \6 U0 ]$ L& Y |& v
- *
+ Z3 M& E. m4 B8 [% B# U) C - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
1 y8 S# [* n# D: [6 [ @9 P- b - *
6 t, Z/ A' _; d- \% v0 ~ - * This program is free software; you can redistribute it and/or' ~3 f8 m3 T+ Z+ C1 K' H0 `+ H
- * modify it under the terms of the GNU General Public License as) J, F% I4 P8 Y8 `- i% a
- * published by the Free Software Foundation version 2.
! B, m9 X: `$ w' a3 \! v4 K - *% V( q, ^: h: C, H" r
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 |5 d0 F9 N, }5 N G- i- x
- * kind, whether express or implied; without even the implied warranty
* E7 ]' s A+ Y4 `/ P - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the9 w2 n4 P5 b6 Z* ?: h
- * GNU General Public License for more details.
4 v' s( A/ L! L- ?1 d' K& R - */) I, d, c7 h, G0 j: z: D! _
- # j* p7 B3 ~: t* f q k6 q7 G' u
- #include <linux/module.h>' u% d: |1 o4 x
- #include <linux/init.h> a5 m8 L2 a8 O! ?# Q6 N# Y
- #include <linux/errno.h>+ T9 c! p; @/ X
- #include <linux/types.h>8 `, _7 D' k5 R
- #include <linux/interrupt.h>9 J6 `1 ?) p% t1 i7 e$ Y; t
- #include <asm/io.h>( ]; v& W$ d. S, s9 ]. G* @
- #include <linux/moduleparam.h>2 ?5 l! q# n1 H$ @' z5 w
- #include <linux/sysctl.h>
9 J0 N4 d( z J2 ?3 h+ d8 X - #include <linux/mm.h>
9 O, m3 K( K7 k/ s: @. I - #include <linux/dma-mapping.h>+ E- f# p% Z$ r$ Q( a
- ( T% }1 Y, Q" z" t9 L3 W
- #include <mach/memory.h>
( q2 L! w! V: }1 Q, v1 |2 R. G - #include <mach/hardware.h>
( t6 s+ g4 \% u) _ - #include <mach/irqs.h>8 N: e Y6 U8 } t9 J8 ]- J
- #include <asm/hardware/edma.h> i+ n4 l# f. p% F; r) ^
- 6 u, c: \- t/ A# R& F) i: C1 ~. e+ D
- #undef EDMA3_DEBUG
( g: b: U5 p1 x+ z5 r7 W6 w0 M - /*#define EDMA3_DEBUG*/
{+ [/ F/ z9 M) z
% \: ~9 B* ~, G5 _+ P; t1 H- G+ P& |- #ifdef EDMA3_DEBUG
3 n' \6 a5 E0 M' h3 S - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): T9 P. N# @' q* G1 ~5 q6 k3 L1 x
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
; l2 `: G; j% D+ _ Q - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
2 W; t$ o1 r/ n( [7 Z' a8 f* F - #else
& ^4 ~' C" A" G' I/ {4 ?3 w6 } - #define DMA_PRINTK( x... )
6 y. |% L8 A- H) A3 \5 w - #define DMA_FN_IN
9 s& p1 s8 o$ R: I6 d! \ - #define DMA_FN_OUT1 { _7 m" x% ^; U
- #endif
" s; i5 q4 G( ]! _* x5 o& H. Q8 T - 1 T; T- ^1 C! E( e! `
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)& i+ v M5 `; w! y
- #define STATIC_SHIFT 3
0 f6 e; n( N- c6 g& | - #define TCINTEN_SHIFT 209 D |% z( ?* b: S2 s) E* W
- #define ITCINTEN_SHIFT 21
( s5 d. k; N- Z2 k3 G7 n6 p/ T - #define TCCHEN_SHIFT 22
; F( L4 T2 h3 }5 s+ { - #define ITCCHEN_SHIFT 23
- @& i8 ?0 i8 N) B4 o+ L
4 _; W/ ^" }/ m8 j; H- static volatile int irqraised1 = 0;
/ O+ _5 V2 p( O5 I$ D5 P - static volatile int irqraised2 = 0;
( }) I ]8 O( w# Z& _ - $ B9 v$ r9 G. ]1 Y4 {0 y+ o
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ c( V1 Y1 L: n$ ?/ ~: O2 j - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ X; Q/ {! Z6 I& a7 } - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' r( s* w3 I. l/ r3 O1 _ c1 o/ N/ w5 n8 t
' q2 j2 A5 y0 i- dma_addr_t dmaphyssrc1 = 0; i A' d" r2 p: Q
- dma_addr_t dmaphyssrc2 = 0;: }4 ^; F* P6 w" x1 M; {
- dma_addr_t dmaphysdest1 = 0;
( X# l! x8 T5 F: D# p& z - dma_addr_t dmaphysdest2 = 0;
! V$ P. L( \: y1 P0 G2 h" c - 6 t) }2 G J2 t6 ~6 u
- char *dmabufsrc1 = NULL;
; S4 r; `0 `! v5 j& A; K& @ - char *dmabufsrc2 = NULL;
1 L& m0 b+ \2 [' m4 P - char *dmabufdest1 = NULL;
, E" x( _9 b/ |: e" v - char *dmabufdest2 = NULL;4 T% b$ S" h2 D, A$ u/ c
- / t1 G8 N C& k- l6 f F4 i7 z
- static int acnt = 512;
) S3 R' L, N( h: f6 O3 D* [ - static int bcnt = 8;
! @4 ^* {. F7 b7 [9 v, ~4 C$ {2 n5 ~ - static int ccnt = 8;
( k# y0 z( e0 U& z8 `, J' j
l( D+ P2 X- u! Z: r- module_param(acnt, int, S_IRUGO);
( s" A1 b% i8 s5 | - module_param(bcnt, int, S_IRUGO);# T2 Q& n4 W p! S9 `+ v
- module_param(ccnt, int, S_IRUGO);
复制代码 Q2 \. N- \ L4 e" l* X# \& e) Z
5 s, ~6 y7 z: f5 ?: \ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用 a% Y6 L/ y5 r: p
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' ?' F% M$ `3 c0 Q" I* W5 W
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( p: [- Z0 E/ Y& h, l) m1 ]
# E; S8 e5 L7 l/ c. c/ D
- G5 G1 N" U v5 g# c2 d4 A9 R0 c |
|