|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 o! M! j+ Y5 S
- [code]EDMA sample test application
4 y, M& ` W+ c* C: o - /*% G1 @# H# ^) S1 b, h
- * edma_test.c w3 w& H6 k2 L4 i5 h8 q
- *
( T, ?+ Y4 U; m9 V3 ~ - * brief EDMA3 Test Application
- I4 v2 D& W- C$ ^1 M - *
" U2 H( n# r# Q4 r$ l( {# k: s8 d! a - * This file contains EDMA3 Test code.
% Q$ ]" ]% \3 o9 L: z e/ D F7 j - *
' ]2 j: q3 I9 M( W2 p; Z - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 ~+ {. u) _7 c+ g6 t' n4 }
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# Z# H. F: `0 N% s- `* K' M
- * TO CHANGE.
$ X) u' h( [" C' W - *' s5 P+ s: h0 X
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
* R1 ]. Z* \1 ]3 P1 g0 Q) ?, r, \ - *7 l) ?6 ?+ h) e% h$ |# ?
- * This program is free software; you can redistribute it and/or
( J) t3 J7 e+ j6 `/ S5 _4 ^ - * modify it under the terms of the GNU General Public License as
( j c$ _& f& f6 v! `7 \: q' @ - * published by the Free Software Foundation version 2.
% y# g5 A5 X3 f; H7 { - *
2 |% O z5 m/ y, a - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
: f1 Q# P1 g! a - * kind, whether express or implied; without even the implied warranty
% I" l% f, |, V - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the V. X+ ~) @$ M/ {' }* L$ s0 |
- * GNU General Public License for more details.8 R/ F0 u: I7 D
- */
' Z% A$ B9 ?9 K* @6 q4 ^ - 5 N) V3 W4 Z% \; G# B
- #include <linux/module.h>
3 Q n# f+ b$ \+ i; F - #include <linux/init.h>0 v( }' t2 b+ M% U
- #include <linux/errno.h>
: O _) J, E) W7 l' O+ D8 K% N - #include <linux/types.h>
. F: a# c' N3 t$ z - #include <linux/interrupt.h>' E! _. V, J8 D1 P' ^8 }
- #include <asm/io.h>' O# Q* Y! q3 j5 I, ~
- #include <linux/moduleparam.h>8 o" Y+ q: z) I3 K& m8 [* {8 H
- #include <linux/sysctl.h>
! w- P& G; H. M4 C+ M3 ?6 x+ W- E# m - #include <linux/mm.h>& W+ g6 x' {* f C0 M8 X
- #include <linux/dma-mapping.h>, w8 ]9 _1 S6 j- G% E" i' X7 g* N+ M
- 8 P, z: x/ M6 X( u$ X5 M" z
- #include <mach/memory.h>
9 f$ v5 u0 C9 y - #include <mach/hardware.h>; W' `8 E+ G4 \; n' i2 u
- #include <mach/irqs.h>
4 ^5 `. X" | \" { - #include <asm/hardware/edma.h>0 k' D' G: n/ k6 q! v- q
I8 T3 O+ Z5 ]. o7 }- #undef EDMA3_DEBUG1 m( k7 D4 s: _/ i$ |: g) X
- /*#define EDMA3_DEBUG*/
- I! R4 c. d+ H, E1 t* r/ ~ - - {5 n D0 Q4 J" A9 x1 P: _; o! `, y
- #ifdef EDMA3_DEBUG5 m( U9 f( @; K
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
& ^' a& `+ A1 f0 a. z+ q - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 P( f# ^* S3 L+ r, ?% V
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
5 m- d" ]0 P' D% |- c- G; d! L - #else
, ^* O6 e& k- i4 z2 @, k - #define DMA_PRINTK( x... )9 Q* \) b% g# r- @8 O
- #define DMA_FN_IN
/ w5 C! P/ n* A% Y- ?. C - #define DMA_FN_OUT* n2 g! p* K2 g- s+ f- D9 }5 G9 j
- #endif
; B5 O1 c8 i* B1 q v
, T( W0 J1 ]0 Q" Q% t3 H- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
! N) M4 \/ s! g; e - #define STATIC_SHIFT 3
9 {, H) I8 |% W3 d - #define TCINTEN_SHIFT 20
' f3 I: f+ Z* X8 ~$ y$ y - #define ITCINTEN_SHIFT 21
( M8 g: h8 P4 r/ Y; B& ` - #define TCCHEN_SHIFT 22
4 a1 u# z4 M/ B/ V% u( Y - #define ITCCHEN_SHIFT 23
" E/ D( p6 d9 z; t' X) w* i - : ^( B1 w; ]2 X6 t& \( G; Y
- static volatile int irqraised1 = 0;" M l/ L4 D0 [* v
- static volatile int irqraised2 = 0;* d' b, G# u/ U% `9 T
- - K$ @2 _6 O( W% g( i. P1 I4 O* Z
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ L; u: T8 }9 h9 _; Q' Q0 Y - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 C. q% W) p1 W! u9 H
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* F4 I5 n$ e) k
, w8 j. y g0 j0 g2 F- dma_addr_t dmaphyssrc1 = 0;
* z. s/ ^# p% |) u p - dma_addr_t dmaphyssrc2 = 0;$ s& q8 j3 S5 _- J7 j
- dma_addr_t dmaphysdest1 = 0;
$ v0 Y' M; F1 G: s - dma_addr_t dmaphysdest2 = 0;
+ x* B+ @4 T* C - . {3 B, r4 [' G6 ~/ G2 z
- char *dmabufsrc1 = NULL;
* E# ?& f' H+ V! w. z+ L5 J% A6 S - char *dmabufsrc2 = NULL;
( c7 E) ]" ^+ B; H5 M' H - char *dmabufdest1 = NULL;
1 w: m- @% p4 v - char *dmabufdest2 = NULL;
t: x( Q& p, N$ u" S
7 a9 w1 _' L4 A# I4 V$ t- static int acnt = 512;$ m" ^, U8 k8 t/ [/ R9 ]& T. q
- static int bcnt = 8;
5 I3 Q2 L+ S1 r+ P5 S* R" Q - static int ccnt = 8;
( {! [- h+ k! }! O5 L# s, R; W
3 _! j, Y, x0 _/ _/ i% O" q+ u. Y- module_param(acnt, int, S_IRUGO);. K I8 c, ?/ [; q
- module_param(bcnt, int, S_IRUGO);
' `, x6 C" t7 R- T! |9 @, O - module_param(ccnt, int, S_IRUGO);
复制代码
w+ g' F8 ^7 x# p8 E
3 `/ t4 f( [' |% ?+ ?3 N6 B# } 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
~; j2 z) Z# @1 J+ oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( q% P* s, N N
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 w9 ^$ X: I! i5 H( t, _+ ]
5 z1 i2 k( Z$ w7 _$ k
/ U5 G. d5 s4 u |
|