|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 O7 S; h0 U! t* P; N/ M- [code]EDMA sample test application
& {) {7 D3 H) @: y" S - /*7 V/ \! c6 r( t3 |/ o
- * edma_test.c: P0 D9 r1 f1 }: X
- *" n( [- c/ P8 w- i( {2 L. N( K4 D
- * brief EDMA3 Test Application
) f8 e' g: |7 B8 c. [ - *0 m1 u; r. E1 ?. v h; A2 v3 Q& B
- * This file contains EDMA3 Test code.$ I3 p) L5 ^- M( c7 L/ c
- *# x5 X$ i/ ~8 k7 {: ~: R$ |* ?
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
$ k' u! T$ g' V# W; M5 z {& b - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
f4 a! d% J0 a, P - * TO CHANGE.
/ O8 t" p& [; X1 g6 J - *
+ {) J* d7 R9 n2 Y* \+ [+ z& E - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
* [) j0 g( {+ y$ m( Q2 ^ - *5 O) [# C$ {! c& }2 _
- * This program is free software; you can redistribute it and/or
3 p$ t+ e, Z0 J* ^5 r" o9 O - * modify it under the terms of the GNU General Public License as
+ o; q$ G6 S0 M2 t+ I - * published by the Free Software Foundation version 2.
# V2 F$ M- E$ Z+ w' @( S( V. _ - *
' g$ M, @0 e( @, M, M - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
8 k2 q. R0 f1 Z. Y - * kind, whether express or implied; without even the implied warranty
& g1 L `; a2 B1 f" D2 C - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 z% M3 S: `$ i4 o, ]5 f - * GNU General Public License for more details.# B: ]6 L% N) G8 y
- */
; r/ m) z; n2 K0 I$ Y - + C7 j1 X, W6 k2 I3 ]9 t
- #include <linux/module.h>
4 y9 W9 K6 E& a6 G+ R9 {+ @ - #include <linux/init.h>
% x/ P/ E- ?0 T" V7 o - #include <linux/errno.h>+ n+ ?" y0 ?2 Y$ ?% n
- #include <linux/types.h>7 ~1 K1 L- {! P# O/ E; K
- #include <linux/interrupt.h>4 R5 a3 d. C2 S3 e9 J
- #include <asm/io.h>
7 Y$ @% A$ j* D - #include <linux/moduleparam.h>1 _ M; _# U+ N T
- #include <linux/sysctl.h>; Q5 y y& E# I' o `( Z
- #include <linux/mm.h> ?5 C) D t8 W+ q
- #include <linux/dma-mapping.h> [: f) P, S q1 s! [7 K5 ?$ `
- + F$ |* E) t; v
- #include <mach/memory.h>% ]# [; w1 b3 F8 A+ [8 a- l+ [
- #include <mach/hardware.h>; F, D' F. e3 i4 e* Z7 m
- #include <mach/irqs.h>* B8 ? y" D0 ~) M1 @
- #include <asm/hardware/edma.h>
0 {) S2 s+ |+ l+ L: e' j" U0 x - 7 ~3 F# s( n9 z; [9 b3 |
- #undef EDMA3_DEBUG
: k1 l# U# b/ C6 P- c - /*#define EDMA3_DEBUG*/0 R. D+ z, _; Q' t+ K, M
- 7 H, r: k( m: J3 [
- #ifdef EDMA3_DEBUG
4 {( o4 @4 |( c ~* j' Z5 E6 D4 E% R - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
' z# b& ~; ]& v - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
2 s! ~+ U6 S; T' I O0 B, @+ O' } - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
* |: ` V5 l: w1 m8 ` - #else
5 o+ h9 B6 n- o K - #define DMA_PRINTK( x... )
; Q% F! @* R$ \' J - #define DMA_FN_IN: G2 \( D4 a2 u: Q) m b$ J. n
- #define DMA_FN_OUT
; |' B5 ^$ Y, E& B - #endif& L' U8 Z9 }2 J. c
% A! p- {4 }1 U- #define MAX_DMA_TRANSFER_IN_BYTES (32768)8 j- H! H4 ]0 D3 {
- #define STATIC_SHIFT 3
' Z) i5 w( F3 N5 W6 j$ ~# S% W& E - #define TCINTEN_SHIFT 20/ o6 k- e& u2 L4 N7 E: c
- #define ITCINTEN_SHIFT 21. y$ ?/ \+ _$ d* U
- #define TCCHEN_SHIFT 223 s* ]* n; z1 F, g' r' B1 m2 Y& p' @
- #define ITCCHEN_SHIFT 23
+ ?* u/ n- }% ^' O) B% F2 Y
5 v% g" E* i3 }/ a7 i& V- static volatile int irqraised1 = 0;
! _& d/ Y4 k; |4 n - static volatile int irqraised2 = 0;
, O A' F+ Z" J# \- @5 ]1 b# t - 6 |2 G5 j# r- W( j
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- \& O& \7 }3 I3 G+ D$ }' X' E
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 D. C/ ^& Z) u$ e: K# F7 e
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 o* G- Z" W( C. P( L B5 K$ ]
- 7 q; a+ |( b+ m: m
- dma_addr_t dmaphyssrc1 = 0;# c" E6 L* z* Q' s0 f7 e
- dma_addr_t dmaphyssrc2 = 0;8 v4 @& Y+ W0 H" k# b" B5 G* c
- dma_addr_t dmaphysdest1 = 0;2 D" r2 m$ ?! X; T& l( c
- dma_addr_t dmaphysdest2 = 0;
: `2 G/ V$ ?3 w0 w0 E - # e0 P: Q8 v# `- P! A
- char *dmabufsrc1 = NULL;; O% o/ \ x6 B+ C# \ ]2 o2 `
- char *dmabufsrc2 = NULL;; u% ?- M; L2 k% K) Q
- char *dmabufdest1 = NULL;
' _1 F8 c. U3 ^6 _9 V Q - char *dmabufdest2 = NULL;
, [) s4 V, S- H$ j) i: N
) c: Q) O% T) U( O8 \2 c0 w8 G7 J- B- static int acnt = 512;6 T7 v4 E+ g. B: r, _
- static int bcnt = 8;1 ?, a3 D' |7 f1 @1 n" C
- static int ccnt = 8;8 L$ ~8 g8 V% w( o8 P) P- ?1 G
1 M* }* q0 C3 \) c+ \6 i- module_param(acnt, int, S_IRUGO);, @; D3 D0 a1 Z1 `- {
- module_param(bcnt, int, S_IRUGO);; p& F N8 M9 w8 b! ~
- module_param(ccnt, int, S_IRUGO);
复制代码 % G$ \8 Z8 t4 E, d+ m6 N, ^
& `3 O( Y9 G/ ^3 R+ L6 g
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% |& ]) w; c; u5 E- U) Q1 M
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 p5 Q5 w0 t$ h: ]
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 K+ g: S- K* W0 b- g! p: |. u Q: s8 G$ L7 M" r
0 y' V& U8 b7 o- r7 x0 T/ D9 T |
|