|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; ^' m! b! [ r* N( v: {* X- [code]EDMA sample test application1 n- Q5 M& F6 X$ Z# p; q
- /*% n3 |: E5 H- L0 O! ]
- * edma_test.c2 o0 z* J' y+ \4 H6 H% T% X% a
- *3 \0 z& V B; |2 N
- * brief EDMA3 Test Application1 c- y: i* k9 |5 [
- *
% D7 s8 p# U, j g - * This file contains EDMA3 Test code.' Y0 ^6 [% @& q7 O. p
- *1 P% S4 Z% i$ q& R$ p
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" B& |3 o6 y- O) `
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
) i1 i& Q# o0 \/ v+ T - * TO CHANGE.
$ n) o5 x _, x6 X, u- x8 P - *2 l" F) Z6 N' K; C2 ]9 v" x
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' D4 z8 t5 j8 N0 o2 }9 S* u U
- *
( P) S2 ^" R4 Q/ X" I - * This program is free software; you can redistribute it and/or$ J; @( {7 h' p) A% b
- * modify it under the terms of the GNU General Public License as
: ~( P3 G* p% A9 N( E - * published by the Free Software Foundation version 2.
0 c" |8 n. s) Y5 Z" k - *! ]6 O Q0 t) C) F, ~8 V/ ^
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any. q. u6 A0 Q0 b, _- ^3 \
- * kind, whether express or implied; without even the implied warranty+ {( L% k4 O4 L$ L" E& a+ F# x2 t
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
`$ x4 z" c) a; l - * GNU General Public License for more details.5 T2 H/ `* X- Z; y( I
- */
8 E( }; t; t7 u$ N9 a5 Q% j E - 8 C3 _' J, S* t4 b' I
- #include <linux/module.h>
0 r8 [% n$ F0 b1 Q3 e. { s( r3 q - #include <linux/init.h>
5 V9 `: |5 F1 \ - #include <linux/errno.h>* |' M. | k% G; q1 Q
- #include <linux/types.h>
$ _) d) ]; t) o0 V5 _ - #include <linux/interrupt.h>
" R$ l# Z9 N F5 c0 L! @6 x - #include <asm/io.h>! H4 W# W- G8 r0 ?+ u% N7 b
- #include <linux/moduleparam.h>
, b0 P' o2 z8 Q5 M6 ~: t, m - #include <linux/sysctl.h> v+ ^7 f% `- n- }
- #include <linux/mm.h>
* V, j! U ]2 ?+ ? - #include <linux/dma-mapping.h>
% d$ J1 d S$ Y& G+ r' w
$ Q' S2 \' E( F0 L5 j9 {- #include <mach/memory.h>
+ _7 {# i! l, b. N0 t - #include <mach/hardware.h>2 h# {) Z) ?, P- ]* X
- #include <mach/irqs.h>- R9 ]* `$ n+ W. k0 a# Z
- #include <asm/hardware/edma.h>
" R/ i8 }5 j( f9 O5 ]
S7 [% M! ]/ A/ X0 Y0 X- #undef EDMA3_DEBUG
$ s/ B/ c1 N! W - /*#define EDMA3_DEBUG*/
( U5 g2 {6 W0 Q, c4 w" [6 {1 V - ' f/ n$ S" {1 P3 o8 G
- #ifdef EDMA3_DEBUG5 m& I" c8 e3 `7 s; L; [# \7 r
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); a1 D: J$ b H u8 k) o
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
0 M) E" q. _3 E5 M& m - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 M8 i7 \! ^) w
- #else0 v/ k7 {$ W6 T* t- J |
- #define DMA_PRINTK( x... )
0 u, y6 }' O; G. D - #define DMA_FN_IN# S6 M: e% ^' ^$ u7 l5 \
- #define DMA_FN_OUT* g. s1 s8 n/ q2 v+ ]
- #endif
9 A, F7 {4 x- T
- h3 {; N' [1 i% U( R* c0 Q1 M- h7 I" ~- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
, ?1 @+ q/ r" k) V, W# [+ d/ i& ?6 n - #define STATIC_SHIFT 3
1 F5 D$ i' H5 G. m) b - #define TCINTEN_SHIFT 20# I) G% Y0 g2 h8 V1 M
- #define ITCINTEN_SHIFT 21
d" R6 H6 v# ?1 o - #define TCCHEN_SHIFT 22% m( m- @7 S. _1 B: E2 X
- #define ITCCHEN_SHIFT 23+ G N3 B G. c* k, _! V7 V
- # N3 Z9 c( z: v; J, V
- static volatile int irqraised1 = 0;& h8 D# d0 M0 |* |* q/ x
- static volatile int irqraised2 = 0;
' |; b0 Z; U, O$ A0 ? m: F - $ i7 N2 m" V+ l8 x! s( x7 P) V
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' L8 H1 k' N1 t/ d8 _. X - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( C' u7 `& g" P - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ z: D l( f5 r6 K
& M8 S V2 s7 q6 |" B- dma_addr_t dmaphyssrc1 = 0;. A$ a, _/ O% K: v8 L/ Q
- dma_addr_t dmaphyssrc2 = 0;
& a$ c6 ?" e& M$ @5 R! K' ~ - dma_addr_t dmaphysdest1 = 0;
( e* K, ] V# u& U; P - dma_addr_t dmaphysdest2 = 0;
& ]# p6 {* [+ E s8 L - G N/ f2 p3 [, _& A
- char *dmabufsrc1 = NULL;
K j8 G0 o h* O - char *dmabufsrc2 = NULL;9 J# K' e R* u8 |
- char *dmabufdest1 = NULL;
& v, D/ E$ i( P# Z: p9 n0 F# X - char *dmabufdest2 = NULL;6 T4 w/ [5 z' g# ]* m# ^- Q0 z3 [% j1 K$ C
9 @0 w1 `; c# i) J- static int acnt = 512;4 C, R- D; P4 p; u. e4 T
- static int bcnt = 8;
- Y- z. C/ Z/ B8 a8 N! ]5 _, |, t; h - static int ccnt = 8;! W# e: e1 c+ Z, Y! E
- $ R) h# ?2 K, i0 p5 f6 w
- module_param(acnt, int, S_IRUGO);
3 ]8 g/ R( y, w - module_param(bcnt, int, S_IRUGO);& K- u6 e, b& H' g- d
- module_param(ccnt, int, S_IRUGO);
复制代码
0 R+ a- d: w- V; D2 d
& Q: C1 G; q0 m* q4 ^0 l 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- y# @0 F8 o- B- l3 ]6 W. z1 `1 narm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' m6 o# i# L8 y" q- n 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& i' ?" G* t; p3 A5 c! S& R. ~) q! X" N% n; r& `
. J; I% J& F* G: }; `; T1 }% v: v
|
|