|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" u- q$ A- S7 o1 F2 P- q- [code]EDMA sample test application
) |1 x9 b* z4 h6 U1 @ - /*5 l4 E! z- I2 g) J+ \
- * edma_test.c
0 |- k' R9 {2 y% } - *: a% ^/ p$ S; |+ ^% X
- * brief EDMA3 Test Application: Z9 a n' M- H5 ?
- *
! F/ g, y6 E! `* r; e - * This file contains EDMA3 Test code.
1 s" O$ Z$ J# }$ {5 E - *% i% Q1 Q# ?" m3 y
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
. Y4 ^) U# X1 D - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. U! o6 V& v; N& f$ q1 F, Y
- * TO CHANGE.
$ U) K; h5 y4 d E1 Z$ I - *
$ ?3 ]& _' F& z7 e6 A, `# u1 q - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 m6 S u6 M: R2 x' j
- *3 `$ v' a. }0 M8 Q: x! j1 y
- * This program is free software; you can redistribute it and/or6 ~+ d& H" I5 Q( \
- * modify it under the terms of the GNU General Public License as
! T/ Q1 y: Q4 N2 [& n5 c i/ X - * published by the Free Software Foundation version 2.. }. `9 V$ I" I; K% L
- *. ?: e! x* C' B0 s
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ ^$ p; E9 [4 j' O# X - * kind, whether express or implied; without even the implied warranty5 U V; s4 \( Q e, ]
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the. P. E% W' c7 H: g7 _/ ^
- * GNU General Public License for more details.
# U2 t. ~/ }; `% u# C5 B - */) H3 U" |# d! C" c8 X' P! U" i
- 3 }) P6 A4 }5 Z8 p( K7 s$ r6 a. e
- #include <linux/module.h>
& f- |: @6 Z6 [5 {4 I. Z$ i1 @. ~ - #include <linux/init.h>
( z* a4 m% T0 `7 n. M! j0 u - #include <linux/errno.h>
" b' f6 O# W& C% Y _0 L - #include <linux/types.h>
. h2 c; R* O& h+ t - #include <linux/interrupt.h>1 |* B' `/ R2 L9 v
- #include <asm/io.h>
/ a v" P( K0 E$ D4 G; _ - #include <linux/moduleparam.h>
M: b. l4 [+ t. U% M - #include <linux/sysctl.h>7 z2 L- h }, W* d2 o
- #include <linux/mm.h>
! \2 p9 E0 h$ d - #include <linux/dma-mapping.h>0 |% k2 h7 A8 `$ P; h' y* C1 v
* s3 ~' u' Z0 D L" p+ B Y" [! [5 S- #include <mach/memory.h>
0 ^6 l% p) t" I2 [% r2 h0 E - #include <mach/hardware.h>/ P1 r8 B. u8 C: }0 }' [
- #include <mach/irqs.h># d6 A. p* s4 m" |
- #include <asm/hardware/edma.h># c8 E1 f* u+ K- x: q, E4 ?5 z( G" W' [
/ a( f! A# N( o5 M9 n Y% Q2 F( A- #undef EDMA3_DEBUG
* o0 m/ F c" `7 D5 l7 _8 c7 N - /*#define EDMA3_DEBUG*/! r2 \3 O0 u0 h* N8 c( A
- " D( H4 e, J5 r+ s
- #ifdef EDMA3_DEBUG
5 P$ a y+ Q- Y% ^. ?- J - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
6 b3 H: i; W& L1 _8 Z, | - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
) Z' P( t% _/ u K) G) P - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& `$ e0 M% M; D# ^$ e* j4 j# ]
- #else
5 l/ i. T3 g& \7 ~$ q: U - #define DMA_PRINTK( x... )
5 b- M5 P1 {1 D( m' ^! P; H - #define DMA_FN_IN
1 M* P% w6 B0 z/ g% U2 C3 U - #define DMA_FN_OUT
0 ?6 b* ^0 p0 h* Z2 c$ ? - #endif6 b; p& A3 ^8 l6 l! C$ x1 L( J+ ~
- : p: U9 H, [8 Y
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
% z# t1 R* t( X - #define STATIC_SHIFT 36 m3 u1 N. `9 d
- #define TCINTEN_SHIFT 207 q4 Y& T" T. [: g2 B
- #define ITCINTEN_SHIFT 21, u' t& G1 c: W2 \
- #define TCCHEN_SHIFT 22
U+ {- Y1 G& i3 T; }9 \4 V& E - #define ITCCHEN_SHIFT 23/ z6 j4 n& \# d& }& `9 u( F
- ! t- u2 U3 F3 H, j/ W. K7 H( D6 {/ {
- static volatile int irqraised1 = 0;
9 J' y C( w- | - static volatile int irqraised2 = 0;/ y: Q) _) v, F7 ]/ D3 i6 J
- - z/ } S7 X5 J% j' ]% C
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 u( {: C I% g4 E/ |
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 v" T) {; w! E9 j* ~, T; \
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; g6 m7 M; I, l+ ^
U3 E. P- O$ y6 p- @. }2 r. ~2 c8 S6 \- dma_addr_t dmaphyssrc1 = 0;
& T( X* H, Q* k9 l( Z - dma_addr_t dmaphyssrc2 = 0;
! @/ ~3 Z# F" h& }& o$ { - dma_addr_t dmaphysdest1 = 0;, {4 p K" o/ I7 t) W
- dma_addr_t dmaphysdest2 = 0;
1 J* [: H4 N7 [/ [5 O
6 _( M" R! s" z- char *dmabufsrc1 = NULL;' v( A8 B- E; s/ L1 }+ F
- char *dmabufsrc2 = NULL;
1 V: R5 ?3 X. S- s' K - char *dmabufdest1 = NULL;
/ n' K U5 N7 I, Y - char *dmabufdest2 = NULL;7 \) P5 S q7 {7 i0 z( M9 X
- 3 [: z/ `, r# X
- static int acnt = 512;% l) w0 S$ _, Y5 X$ _, v% G
- static int bcnt = 8;
. {6 T$ O0 `( @& k- J" G - static int ccnt = 8;. z: H" r: D: P L, B
- 9 k* v8 H; _* A, }9 b
- module_param(acnt, int, S_IRUGO);4 a) S: W! m' V9 P! {# G
- module_param(bcnt, int, S_IRUGO);
' o7 m' s( L: Z* ], W2 D$ e - module_param(ccnt, int, S_IRUGO);
复制代码 ; z! I7 Y R" d3 T V: X1 s7 m
0 t9 p5 K; O# i( D- A/ p/ Z
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- a1 z U) U5 t9 P+ k) G/ O ^+ N% X. b
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
x- T( ^8 Y% u" I2 T 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ I# T3 q8 }0 F
7 y$ H9 ] X7 {- P! j0 r, j9 l# r) j7 J _, n' _
|
|