|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : ?4 P7 W9 Z, j6 M. N {! |( Y& z- W; n
- [code]EDMA sample test application. R+ v0 K: ]! c9 f7 a
- /*, |0 ?6 V- w- a) }/ ^ w
- * edma_test.c7 e* s% p% t6 v, y' k6 L
- *' R: j0 B; q1 Z6 E! `3 E
- * brief EDMA3 Test Application
4 U: n' l( {& y; u5 e! d- B+ K. [" | - *
m! q/ u& l) V% l' e8 l; X" c - * This file contains EDMA3 Test code.
* Z& V/ i+ u) z' `& ^ - *) U5 p/ Z0 C* M/ j# u0 }& q0 Q7 q. f8 w
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
5 Z* Q N2 X8 j$ T. U( h. ?3 f - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
* f& Q2 S$ |9 m4 ^0 N - * TO CHANGE.
4 ?1 u; c/ E3 R6 s/ Y5 w - *
* c- o9 H4 y, E - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 z3 Y1 H* u, g9 u5 m
- *& O/ v) I: H7 z# q
- * This program is free software; you can redistribute it and/or
% A6 ?7 v) }# e0 @! { - * modify it under the terms of the GNU General Public License as
" q8 w( O9 i O - * published by the Free Software Foundation version 2.9 N0 S5 K6 I, K: c; m, D
- *
( k3 v, t( D0 W3 }& u - * This program is distributed "as is" WITHOUT ANY WARRANTY of any& n; Y* w5 E7 j* O1 t
- * kind, whether express or implied; without even the implied warranty
# i+ f+ K3 |( r" h, |! |5 J - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the8 F3 r+ ^+ F# n, W5 b' Y/ ^! Y
- * GNU General Public License for more details.
$ t$ e9 Q0 Z! q - */% }# ^ f, \5 w: I: y6 m
- 2 f5 W8 d$ E* h+ M0 x* P5 ~
- #include <linux/module.h>- P# S, ~' k# C
- #include <linux/init.h>
9 l$ @ d/ s8 _5 ?2 ~8 q# Y - #include <linux/errno.h># h7 M. |2 c1 Z2 ~! m+ T
- #include <linux/types.h> r( K/ A+ g6 K$ _* N
- #include <linux/interrupt.h>
+ J, S1 a* i! `/ o' n - #include <asm/io.h>4 Q) q3 t6 ^9 s! o. p- R j
- #include <linux/moduleparam.h>
5 P5 c: ?5 A8 X/ s; A - #include <linux/sysctl.h>
% g# h6 P- w) i" n4 ]# d o - #include <linux/mm.h>: J" z( E2 B8 J
- #include <linux/dma-mapping.h>6 |" h& Y5 w! O4 `% E: K
- + S! n3 e0 p+ K$ n0 G, o7 e% Q. w
- #include <mach/memory.h>
1 c: `2 J7 X8 x3 c$ ^& R; k3 X; l - #include <mach/hardware.h>
1 g3 r7 U/ X8 i- [' v9 Z* } - #include <mach/irqs.h>5 a D: f( h4 n+ T! R
- #include <asm/hardware/edma.h>
. s, z0 A/ {8 t1 k
% J1 {9 H: \2 V4 `- #undef EDMA3_DEBUG$ u3 D: k1 [* O3 N
- /*#define EDMA3_DEBUG*/
0 A6 \7 i0 Z+ f( x0 v0 p' f
9 Q8 J" P4 w/ H) L- #ifdef EDMA3_DEBUG2 n. s5 e8 z' G: l5 `: o
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
$ c4 u! S' U, L; v* }+ `( [ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 o; t$ n- y2 V7 ~% @$ X
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 {4 {* |9 }! P7 |* N( a4 P- d! N5 B
- #else4 k& d4 L5 ]- f2 V$ V4 V
- #define DMA_PRINTK( x... )
3 i8 q& |( x# R7 F4 L - #define DMA_FN_IN
, u/ N: k" W8 c - #define DMA_FN_OUT8 `: O% `& y( z+ J
- #endif/ ^. y# p, u2 ]
- 6 d7 I6 m0 u" r. K+ X/ _
- #define MAX_DMA_TRANSFER_IN_BYTES (32768), E: e! B8 `4 i. v8 Z# S
- #define STATIC_SHIFT 3- o4 n* V1 A' u7 C2 i' v- N% A8 b0 H
- #define TCINTEN_SHIFT 20& _6 i1 }& i) C) W( P. L
- #define ITCINTEN_SHIFT 21
( {6 e! F6 T9 b3 R; g1 k - #define TCCHEN_SHIFT 22: ^! ^6 |& O0 @% s; k7 q
- #define ITCCHEN_SHIFT 23" T8 [7 c: U6 @. s1 s2 U7 m
- % y$ G" ^* Y* j
- static volatile int irqraised1 = 0;
& |% ]- O& R0 m6 _6 f% @ - static volatile int irqraised2 = 0;3 _2 Y& N/ k; H$ F8 X9 ?$ {7 g
6 i+ `( I5 M$ C/ ?- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* s3 W% {! B6 s2 D" n! O7 T - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- }) j$ x' v8 G7 n* y& Q5 B
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 i* J6 w0 j$ a9 d- N" W - $ [' d8 T3 ?9 Y2 F. X
- dma_addr_t dmaphyssrc1 = 0;$ P4 ] P" T- }8 S% N4 E7 ]
- dma_addr_t dmaphyssrc2 = 0;
! _4 [/ |! s5 T& X9 i - dma_addr_t dmaphysdest1 = 0;7 e( Y" p4 v! Z: a' E
- dma_addr_t dmaphysdest2 = 0;
/ p& Z9 A, @; s1 h4 F+ ^/ J0 z C
8 G) Y2 }4 L0 [% i, S) ~- char *dmabufsrc1 = NULL;
$ ~" {& n) T9 F - char *dmabufsrc2 = NULL;
' r2 A, S" i$ J7 J; }% j2 G - char *dmabufdest1 = NULL;, L0 S$ T0 a8 }1 d
- char *dmabufdest2 = NULL;
4 `% X, V, U" F t! n- A Q
( \3 m6 |% j8 z% R9 v- static int acnt = 512;: _9 U4 ^6 O+ a6 H0 u6 g% I8 z$ J
- static int bcnt = 8;0 `5 z. H# Z( q# c# ~4 H) D
- static int ccnt = 8;' a2 w ]) m* U2 _: _7 C" e& b+ n
2 H G0 E% Z v/ I+ W6 ]0 s- module_param(acnt, int, S_IRUGO);' ~+ R+ Z @7 G; i: Z
- module_param(bcnt, int, S_IRUGO);0 P! _* u1 a! H1 M- ~
- module_param(ccnt, int, S_IRUGO);
复制代码
9 [9 X) P) M6 e4 b/ r2 r1 T
& e: Z, r5 J8 ^8 \. g 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" W5 L' K0 ]% C% |# O( P9 Parm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 b; Q/ Y9 _8 V( m
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 j$ U% B7 i' A" D
# J0 [8 h4 q# f0 @* F
, B( L+ _2 i6 _$ R |
|