|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : X+ K1 O% _8 ]) ]
- [code]EDMA sample test application t) N% y$ {# }/ V" M
- /*, p' z+ I! O2 t% u& h
- * edma_test.c
" u4 K$ N+ S5 H& c! c2 A - *
: ~8 I( s5 k; _5 T. r' v# t% ^ - * brief EDMA3 Test Application% g% ?' F5 D% v a
- *8 J/ w* x5 d' k; A
- * This file contains EDMA3 Test code.
" ?* t6 V9 k: w# H/ d% C+ F - *- l/ E0 r4 p i, [
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
3 c& |( i; E; y: @: S5 ]5 X - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ K/ Y" \. X1 _6 P1 p {! y) R
- * TO CHANGE.- J) e9 k! h! h' m3 C$ j
- */ u; P5 z! o( B7 \2 Q. K- l4 |$ g; i
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
3 m* }% N( ?9 F4 z& t" D: O - *& R6 Y. ^" H$ v' _) X" Q
- * This program is free software; you can redistribute it and/or0 Z, c0 S, d: V# |3 F7 y
- * modify it under the terms of the GNU General Public License as: S4 |3 K5 l4 c" [; }; R6 ?
- * published by the Free Software Foundation version 2.
5 Q, W: r" M0 o9 D0 x' R - *4 J' D7 A' c" i9 t) d
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any" X5 i. ?* Z+ k/ v
- * kind, whether express or implied; without even the implied warranty
2 F y4 U% d) p& @9 [! k - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
' c; M0 _5 N+ E) @6 o- r' a. I - * GNU General Public License for more details.+ A& \1 p- ~$ r& W. [1 k
- */
8 E5 ^+ j% E Q: O
( q/ E. |& ?! I n) o1 _- #include <linux/module.h>: Z% o) i0 z. L5 x
- #include <linux/init.h>* M; C9 W+ P5 l+ b+ m& O
- #include <linux/errno.h>
* q- m% _" } `$ @8 Y+ ?( v - #include <linux/types.h>+ b/ X3 { |3 M, O3 x& T3 G! K9 U$ U
- #include <linux/interrupt.h>
4 U, i0 G9 @8 O5 P' @$ x - #include <asm/io.h>
( V/ n/ t+ D/ i: H- E - #include <linux/moduleparam.h>7 h$ a2 I0 x8 \' U# J. ?$ n" A! _
- #include <linux/sysctl.h>
: a1 i, U2 r7 T1 b) b, H/ Y% P - #include <linux/mm.h>
( U) x5 q7 l; r% k8 W - #include <linux/dma-mapping.h>
: x9 p2 W4 D" z+ `/ x: O) p - 0 ?7 o9 U9 d+ m3 ]& \
- #include <mach/memory.h>0 _. |; c/ \4 D1 H3 |* a4 P0 U
- #include <mach/hardware.h>
8 z3 ?/ `, q0 g0 ~ - #include <mach/irqs.h>/ N5 _* Z0 ~* o" |; M+ k# e# V) P- ^
- #include <asm/hardware/edma.h>) q: A" i9 h l/ k
- 2 q% ^9 i, q @
- #undef EDMA3_DEBUG
1 O- e& Q3 D# A0 Y - /*#define EDMA3_DEBUG*/
9 ^) E5 D3 r$ U1 d# l
' N7 G2 J- s: y8 C- #ifdef EDMA3_DEBUG$ s5 ~2 Y; y! h5 r
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* I, b J p4 z) H
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( [! o! s0 i. z5 E H; ~
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- |$ _- D# U& H; W+ v: ~; X
- #else
8 H+ ?- O. M3 s4 k$ ]4 \- @* s - #define DMA_PRINTK( x... )
; T. Q& F9 Q7 m! J5 M# n8 g% J3 f4 f O - #define DMA_FN_IN- u0 ]; g: ?' |
- #define DMA_FN_OUT
: m2 ^* R" d. y# _: u - #endif
" V( w% d( U& l: V. b; z - & D# p1 O e% A3 [
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)* u: w& h1 O, u, V: @ \) Z- @
- #define STATIC_SHIFT 3 h7 ^, Z n2 V& c
- #define TCINTEN_SHIFT 20& B" O! u) w! v; F; ~' Y# R
- #define ITCINTEN_SHIFT 21
. O6 B0 j' c4 s- h q - #define TCCHEN_SHIFT 22
{/ ]1 _! ]1 w; |5 \- g0 c+ | - #define ITCCHEN_SHIFT 231 y+ i% P; I6 D! e5 j3 E) ?
7 L* T& Q3 g9 X# ~/ f- static volatile int irqraised1 = 0;. a4 w6 w3 F, z' x; |# }* J
- static volatile int irqraised2 = 0;- A$ j, E) u8 F$ C) H, G
0 S1 s* H. G _" ?* e% O! e- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( p8 Q, [5 |; B0 z8 d7 h2 q
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% ~6 u8 q* M5 |$ @ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( D x2 e5 k. _ c- _
$ ]* j! X8 z5 i' w- dma_addr_t dmaphyssrc1 = 0;
$ [8 ?. d" {3 g3 Y1 U$ t3 l4 Z - dma_addr_t dmaphyssrc2 = 0;
% c: l! l; ]6 ^2 R, I9 d, c# k - dma_addr_t dmaphysdest1 = 0;. Y4 G' j I; K o! p
- dma_addr_t dmaphysdest2 = 0;
# L; Z2 J+ ?( _/ j N
3 R# B0 V, T7 p; T+ k7 _- char *dmabufsrc1 = NULL;- _* E6 ^* s% `
- char *dmabufsrc2 = NULL;4 T( C. i( l& T9 i7 _8 r+ Q. ~/ f8 ^
- char *dmabufdest1 = NULL;% d+ u" E2 [( W" B, G1 [* g
- char *dmabufdest2 = NULL;
^; {* G/ w' H2 Y) ^ v - 5 Q# h2 }+ U' b" t& p" ?# W
- static int acnt = 512;4 U" K! E/ h# G& f6 {
- static int bcnt = 8;
! N+ ~5 H4 l( F$ N - static int ccnt = 8;! ~) Z" Q: ]- w/ U* h; N" ^# ]
- / q6 q3 S: I4 l) U3 f
- module_param(acnt, int, S_IRUGO);
8 G6 d! v3 Y, Q$ e& H - module_param(bcnt, int, S_IRUGO);
+ p. C# V7 N+ ] U5 w - module_param(ccnt, int, S_IRUGO);
复制代码
( H: A7 f: s0 P( H# _+ t
6 J5 M) I; T9 r9 c6 L/ r( k B' Y 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, Y4 i* n" v$ j% B2 N# G% Tarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& z9 J: f3 M7 N0 R5 Y
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! g [# {6 u X! e# e
. n# F$ m3 \7 ?( |, {5 F7 U$ N9 _( h& O
|
|