|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 C7 y0 k/ d( P5 h- [code]EDMA sample test application: w- v9 ]- q$ i0 D" y
- /*
& `7 ]1 `& Z# j, ?' F% j - * edma_test.c
9 K* S/ \& w4 e0 G/ s/ u& ^ - *2 y- I+ f( r C8 i& ~0 O
- * brief EDMA3 Test Application2 ^) x, d- D" e6 y
- *
" D; m. V0 }- x/ n - * This file contains EDMA3 Test code.' d' z8 o! K, V+ K# p0 X1 t/ U
- *3 z7 d7 B& E; C# [+ z. n9 U1 n
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* b& s0 l4 S" J' t+ B
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
5 p4 Q5 c/ w s' _; T' v9 d - * TO CHANGE.+ S. X* b8 {( Y" U% `( U z
- *) [6 v# t7 d+ f* C0 i5 g4 K
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
' K" P4 p# J Z# Q9 n- a3 z) h1 ]2 ? - *
& @ P5 V3 m/ b# y! U- L+ \& i, A - * This program is free software; you can redistribute it and/or
( d+ @- W( h- M2 H" _ - * modify it under the terms of the GNU General Public License as
% k7 i% }- j6 ?! x i0 `6 W - * published by the Free Software Foundation version 2.
, h m+ l( ^% q - *
& F8 z* |' a, g! y) a - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
) Z3 g& o0 k, H: R" T5 n - * kind, whether express or implied; without even the implied warranty
) @+ G1 ^, U9 i0 Z - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the% X+ [2 ?; h. _/ g! e; v
- * GNU General Public License for more details.
4 c- S+ T& v' w3 U - */ h% n" f1 x5 h7 }9 `3 V& F
2 I9 W0 k2 M& B) e! N# d: R* C- #include <linux/module.h>
3 \) Z' G% N z, k* v - #include <linux/init.h>
! H/ w; J7 Q0 h7 p5 v! g4 A - #include <linux/errno.h>
8 |. R3 v7 @+ ]5 D& [ - #include <linux/types.h>
1 c, {" X: R; B' g' h - #include <linux/interrupt.h>
& [4 d- [2 P1 j# }! m ^8 P - #include <asm/io.h>( W* d: B0 `5 \. _
- #include <linux/moduleparam.h>8 I# h8 x: L5 K
- #include <linux/sysctl.h>) Q) k7 _$ S" G: h: ?, m
- #include <linux/mm.h>
5 ^$ b# R' U1 { - #include <linux/dma-mapping.h>
1 Y3 ~ P6 }+ [" s/ _
; P" `7 {! Q- `- #include <mach/memory.h>
" A# t$ }4 x- e! i% H - #include <mach/hardware.h>( u8 u$ d& i* a: I n, H
- #include <mach/irqs.h>- n6 b# X7 O% l5 e9 f% p3 c
- #include <asm/hardware/edma.h>
8 N3 b% ^# U+ ]7 B3 I - , G, `' u9 A g. _! j8 j
- #undef EDMA3_DEBUG
" @, O0 u; J6 L - /*#define EDMA3_DEBUG*/
6 z, ]8 Z7 N* o( R; H
9 l* U9 C6 o5 i- #ifdef EDMA3_DEBUG7 S; @) R! k# p" w! ?% Y; x
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 U: g% R5 j! C! `
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
& Z1 Q: h: s j M. o" t - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
9 G. W2 D& g0 Z* T6 q. v) l8 y7 C - #else
# {2 h; |) B& j7 N+ `7 J - #define DMA_PRINTK( x... )% s) W u7 b1 g2 @( D/ ]$ Q
- #define DMA_FN_IN7 S/ k5 r7 j; e9 v* I
- #define DMA_FN_OUT; u' V$ y; o' c4 x# h$ u/ ^0 T/ `: C
- #endif! i& F/ L! s( z) n1 ^
- # N. z# R) n# B9 g0 v( X# V
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)2 k: W# o+ o- x9 u# b- j
- #define STATIC_SHIFT 3" \0 x/ Q+ c* l. p
- #define TCINTEN_SHIFT 209 x6 g- y: L9 [8 O0 [. `. Z. J2 a$ L
- #define ITCINTEN_SHIFT 21, @, k. H1 p! H' B& `+ p( d
- #define TCCHEN_SHIFT 22
3 D: t9 @, M2 q: x; f' P - #define ITCCHEN_SHIFT 23
" c# ~" j) ]$ s# n9 d5 d7 C+ t
2 \7 r) y& [. ]7 p; C- static volatile int irqraised1 = 0;
9 j4 O1 q5 [( d3 {( A. Y7 m - static volatile int irqraised2 = 0;
1 Q- v4 Y! d" G5 |* r' } - & U/ Q0 A1 R6 i7 ^
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# S; X' s3 S; T0 M - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! ?$ ]. ?+ w" C" H* R: B7 D# E U - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 a' K! {9 K8 G0 G- H2 J4 ^
- ( B8 z3 | h" r+ ?0 g Y0 H
- dma_addr_t dmaphyssrc1 = 0;, \1 o+ S; H. A( N3 ]/ z
- dma_addr_t dmaphyssrc2 = 0;
" j! E( E& \. X( j - dma_addr_t dmaphysdest1 = 0;* s* w2 P1 n& c/ H% y S
- dma_addr_t dmaphysdest2 = 0;
0 ]" C$ @8 T: g |
& d J* _( P9 |% D" i5 X" S- char *dmabufsrc1 = NULL;( U/ F- E' x8 y$ z
- char *dmabufsrc2 = NULL;# d7 T. x6 k5 m( h
- char *dmabufdest1 = NULL;
& B2 \0 |& S) V2 _# u. k6 F' Q9 | - char *dmabufdest2 = NULL;
$ ]4 Y9 l- e% D- ^6 z
$ G* i* G' z) S( a0 \6 d- static int acnt = 512;! T7 l% a7 W- _5 l# x. [( }
- static int bcnt = 8;
% \ b7 q" z3 E9 e9 Q - static int ccnt = 8;
}# ^" n: U1 H! L' ` n - + W/ r) h$ L! `) \
- module_param(acnt, int, S_IRUGO);
t( q; T+ h: n7 x- D - module_param(bcnt, int, S_IRUGO);8 [' ]' N: y i5 g
- module_param(ccnt, int, S_IRUGO);
复制代码 , p6 h+ r/ r3 B% T( ]4 d1 `
+ D9 X; D+ S6 J2 y+ C3 K8 ^
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 X: C3 F3 f# S9 g
arm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- k J) `0 |" i1 ~1 ]. W- s
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 K! y2 h* J$ R2 a- A$ U% w4 u2 A7 c$ Y% U. t+ j D
$ X0 |& a8 l& c/ V* u+ ?- o+ y: o1 Y
|
|