|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' |6 v) V! r6 v" p; s7 N& b# i# ]- [code]EDMA sample test application
% z" t* `% a9 S - /*7 X- z0 ?+ v9 y+ Y4 Z
- * edma_test.c
1 C, p- a3 ]/ s - *
. u5 X0 D) T' B9 T% q! u1 r - * brief EDMA3 Test Application+ y6 q2 t4 }: n) o+ a9 z4 S& y0 B
- *
$ `& }# V3 A/ l6 O6 E- _ - * This file contains EDMA3 Test code.
* I7 C }1 E+ S. g# V - *# D7 E* B, ~' O3 A+ f
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 a* g- j- L% b' b$ _
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
! |% r. ]; I m# U, z - * TO CHANGE., X; V: C: @5 o5 G' t. w
- *$ m9 _. i: W5 R: J5 f7 _, w
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
9 m4 V. V- G( t' }) e. A, \ - *
+ v5 d" X# s4 ~% D - * This program is free software; you can redistribute it and/or H7 O4 e( `3 ?# K. O3 k
- * modify it under the terms of the GNU General Public License as
. l( }, k6 _9 d# L/ B3 v - * published by the Free Software Foundation version 2.
' i8 F0 j+ o6 `4 E/ q7 h - *+ N- O6 W; M$ `* d) k/ T3 K
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
; g8 V/ C2 Y0 U - * kind, whether express or implied; without even the implied warranty# _# S6 T& H. B+ U- L- W( H
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
' e! E6 g/ \7 d8 z/ F( v+ N - * GNU General Public License for more details.: t i* f3 N9 g( Q/ m
- */
' G& F6 B, ?" E1 G" g4 S- S - 7 ^5 y1 v3 U. y( N
- #include <linux/module.h>! P+ H, H6 V& A' Q' x2 l
- #include <linux/init.h>* ]- A, g3 S) t3 A) B
- #include <linux/errno.h>
7 ~* G- V" D9 w. G" o - #include <linux/types.h>
+ K- @, X/ V9 `$ w- t - #include <linux/interrupt.h>6 T3 {8 X# z: h. S/ W
- #include <asm/io.h>
4 ^( K( Q$ s( g( k' y- f - #include <linux/moduleparam.h>
, |) {7 d8 f; ?- ?- g3 u - #include <linux/sysctl.h>/ f& f6 z2 M" p4 X; V) o- f
- #include <linux/mm.h>1 }9 G: F' r- L6 E# H$ z
- #include <linux/dma-mapping.h>
" F% f- _+ F6 _; |: F - 7 s! y6 U7 \/ S
- #include <mach/memory.h>
9 L* S( W2 l0 M* b, z - #include <mach/hardware.h>& G, E3 U5 X, F9 @
- #include <mach/irqs.h>
j# P6 w, e9 y0 D - #include <asm/hardware/edma.h>
0 l# |1 a1 N, H6 G3 Y - ) q8 D7 e3 f( N8 i9 W
- #undef EDMA3_DEBUG
" M4 x2 U& B+ Y* T( f7 L7 r- s! n - /*#define EDMA3_DEBUG*/
; l/ t$ y# j1 |, }/ | - & v0 O* G; n+ e; z/ M) z- G. i
- #ifdef EDMA3_DEBUG
) R# O; V6 j' V- k$ j3 h - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
+ F+ I2 b- @& x: k; L" V7 s6 @3 d - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ O/ b. h3 G& i3 T* H9 g" K
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
+ O o( R {' f; l) B) M( \ k - #else7 |/ O$ b1 r9 @7 D' O4 r
- #define DMA_PRINTK( x... )
# j2 }! c) ^# H" _" ?+ I0 I - #define DMA_FN_IN
0 M: H) o# Q3 l& C5 M, \9 V3 X - #define DMA_FN_OUT8 d5 m! ~! Z# U4 M- { N. N" u
- #endif* u2 w' }! d' ~" \3 ^6 E& E
- ( | Z$ |9 c" u+ `" Y4 Q' [2 f, t
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
/ i# b$ y+ R/ q( Q' w; w( G. B - #define STATIC_SHIFT 3
+ z0 Y) B' M3 N7 Q - #define TCINTEN_SHIFT 20. Y5 t, G( X* O/ ]0 k: M- G0 F2 Z, v
- #define ITCINTEN_SHIFT 21$ u( a% \8 @$ }$ l$ W
- #define TCCHEN_SHIFT 22. } u# R% u- [# Q* I" ^* D; X# B% Y
- #define ITCCHEN_SHIFT 23: C f. S; S- a }- k" a. {9 S
- & f2 {9 x _! b# W0 {8 _( Q
- static volatile int irqraised1 = 0;
9 A8 v+ a5 I7 f# a8 S - static volatile int irqraised2 = 0;9 \1 B j0 O. I9 a/ i8 y8 |+ _
5 M* |! G" i8 z5 H! \- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( Y% v/ t' f9 h# S, y* k
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 t- R8 r5 @# K5 F" b9 ~) u5 p
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' T& w9 a b; F, I% X
- ( T* a3 X" E- J3 h
- dma_addr_t dmaphyssrc1 = 0;: U* M. w( S2 G1 \, P% Z1 `0 e
- dma_addr_t dmaphyssrc2 = 0;' {# l& C0 x( d% Z* g
- dma_addr_t dmaphysdest1 = 0;* O% B5 N* @7 u& _0 p/ M8 Y) ?
- dma_addr_t dmaphysdest2 = 0;8 c) o7 D' T' Q6 P0 ]2 y
- 3 u" j# y! d& N2 t; e
- char *dmabufsrc1 = NULL;2 l& V, R* v* k8 i2 F0 z& s& j* q
- char *dmabufsrc2 = NULL;
/ r) F: Z6 O4 M$ l% b f. t - char *dmabufdest1 = NULL;5 u6 |* R0 S- y0 w& C# v( u; E, Y# I
- char *dmabufdest2 = NULL;1 Y2 L1 n4 G# J& |( N- e; D
2 Z5 H; v. Q# v( D- static int acnt = 512;' w) m' v3 j2 O- U# V' I% \+ s
- static int bcnt = 8;
( ?9 N/ ]; k Y - static int ccnt = 8;9 Z( O4 k" O7 o Y0 A5 F
# t8 V4 N1 Z o/ h N- U' N- module_param(acnt, int, S_IRUGO);5 M# X, u8 C5 w u/ s+ P0 e2 f
- module_param(bcnt, int, S_IRUGO);& t: f0 b, r" }8 c! G
- module_param(ccnt, int, S_IRUGO);
复制代码 5 I! g3 u, }6 j. \# M3 f W" G
0 ^& q9 Z8 }% k5 M% F' c2 L! L
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. j4 j" r; d) h' w. Yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 q. f+ D8 J: B m! S/ ] 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( B; U% e. g5 o0 W( g% u
B- \% G& Q$ [
+ C, u j4 ^; _8 I |
|