|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , j$ N, t& M' i4 M
- [code]EDMA sample test application4 K( \' r6 @& ^) R( J
- /*
$ L- @. F# n4 w- h6 ?1 q+ ` - * edma_test.c, ?/ n2 O4 g) {% E. P) T
- *# r1 i2 b9 q& p( E. j; ?
- * brief EDMA3 Test Application
- g/ ^2 W7 I x$ ~2 m; V - *
7 {/ {% k" c t! N8 Y. @ - * This file contains EDMA3 Test code.
- N; L% x/ ]9 C; l, }0 u - *
- X7 g5 @; Y* q& O4 j2 ?2 |" b* G - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
! \2 a) v, }* l* ]+ Q0 `, o/ ]9 p - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 e+ A3 W0 k' V' ~/ B
- * TO CHANGE.% @+ }6 ~4 l, F w7 W9 I
- *
5 Q" N: L8 ^/ N$ Z/ i- A# |& v) _ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) t: r& X& o5 W7 ^* _" s
- *
+ l# n7 T) e9 y( e3 D' \4 u - * This program is free software; you can redistribute it and/or4 E9 N" e8 Z7 _" g! W5 l5 r
- * modify it under the terms of the GNU General Public License as( v, d, J7 j, l" Y
- * published by the Free Software Foundation version 2.- [$ _, ~8 `% O; l) F
- * a' J- K [! t% N* O1 N0 a
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
0 \/ Y* u4 F* a" H; Y5 X - * kind, whether express or implied; without even the implied warranty
$ ~; z$ t3 w0 n. e% q- o - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the* V% ]& O' h& u" Z: {6 R- J
- * GNU General Public License for more details.
" Z t8 N1 V$ c$ A0 K1 U; g - */
* }. n2 S: T* ?# k3 Q - 6 o9 H/ F! C0 ]' Y' |
- #include <linux/module.h>9 ?& O# Y/ q4 |- e; Q* h
- #include <linux/init.h>8 P$ O3 J) v* `* ~
- #include <linux/errno.h>. }- r, g6 T* B3 u1 W) ~8 C
- #include <linux/types.h>: P$ b6 E. A# z w9 M8 }( f
- #include <linux/interrupt.h>) @/ D: D0 }+ M% F4 ~
- #include <asm/io.h>0 O8 I5 x5 s8 \: [* O1 e
- #include <linux/moduleparam.h>: p. n O) q& a$ Y' d+ u" s
- #include <linux/sysctl.h>
d$ O' ?! o1 t - #include <linux/mm.h>
1 {) y# f; \+ y3 X& k" j9 C - #include <linux/dma-mapping.h>
8 q p. C& W e! i. V# D/ Q
! p5 F- B- C* y H- #include <mach/memory.h>
) g1 N! h! ]1 _3 C6 b - #include <mach/hardware.h>6 I8 Q" \% W0 { C6 @" m6 _+ X
- #include <mach/irqs.h>9 j/ K! P# b/ T$ j# u4 p6 Z
- #include <asm/hardware/edma.h>4 D- g& i, }0 q( N; z3 W0 g
4 Y3 {, @6 q( f3 p9 j$ Z- c- #undef EDMA3_DEBUG- i$ [7 R# ~# K9 `2 J s; U" k7 K
- /*#define EDMA3_DEBUG*/
+ G+ `7 z, x1 i/ Y' ^
' A& Z ?4 d1 p& L( G) |+ b- #ifdef EDMA3_DEBUG
+ G# t' _" m& `+ }- d! q* H9 U - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
3 y+ {4 e% S7 D9 Z j9 I# r* O - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- @/ t* r7 b" k3 ^/ P9 S
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
* [7 M7 P, {5 D9 E% d - #else
* b, ^; I$ l# r) A, s8 r - #define DMA_PRINTK( x... )$ l9 }5 Q4 X& V" Q5 r2 j* L5 O
- #define DMA_FN_IN
# ?9 A* U; y5 p& W+ d - #define DMA_FN_OUT: k5 C$ t* J+ B) B. Z$ B- @
- #endif. X& o% }- Q- J; i0 d: d# k
2 Z6 r# M1 k* q, ^6 @- #define MAX_DMA_TRANSFER_IN_BYTES (32768), t! O* E, o P: E7 B; H- @. X
- #define STATIC_SHIFT 3
4 d: {' r+ ~! j' R0 W/ q. R+ F - #define TCINTEN_SHIFT 202 ~5 y) b* @9 c' c4 F# ~$ X1 C( z
- #define ITCINTEN_SHIFT 21
2 a2 v3 K0 Z) w - #define TCCHEN_SHIFT 22, [; |" S/ q7 b+ R
- #define ITCCHEN_SHIFT 23, J+ l# X) e* m
- ; n5 ?7 |9 o4 l; q, L' e
- static volatile int irqraised1 = 0;
9 B) O9 g! ?# J7 o) j. x - static volatile int irqraised2 = 0;
4 p1 Z$ Z+ D) [) N3 ]7 r - 2 B8 e! C* R# p; |) U
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. U7 {4 g Y2 s! R - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; V! F7 i5 j: I/ m; t - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 \+ ?9 a: K! S7 v
- ) `7 g6 Q3 m# S* S
- dma_addr_t dmaphyssrc1 = 0;3 f, x8 ]2 a, {8 ^
- dma_addr_t dmaphyssrc2 = 0;6 p3 p2 u. G5 d' z
- dma_addr_t dmaphysdest1 = 0;
: _2 H0 q- e+ i - dma_addr_t dmaphysdest2 = 0;
" l5 {1 x& }! W* R
, e( U9 k! J+ k- char *dmabufsrc1 = NULL;3 L5 {9 \# c* }! n* E& q! R
- char *dmabufsrc2 = NULL;9 Q( }' _6 p! G t7 K
- char *dmabufdest1 = NULL;3 q7 f1 h/ w8 y0 q6 c. \8 \% I6 s
- char *dmabufdest2 = NULL;
3 H: I7 ?8 a9 p2 H
& l6 ]6 k- j' i( Y- static int acnt = 512;
8 v% w& ?$ _' }( r - static int bcnt = 8;
# j' H1 Q+ y* a& V- B) } - static int ccnt = 8;
" e0 z& ?6 x7 x- F1 x
( G8 \1 \7 E9 N1 i- module_param(acnt, int, S_IRUGO);+ x- c2 f4 i1 ~& _( Z, h
- module_param(bcnt, int, S_IRUGO);: p i: B* v2 W! L* j
- module_param(ccnt, int, S_IRUGO);
复制代码 . i2 K6 g5 P' m% |8 c* z! W& _
8 |$ l0 I3 T- t* y/ p% g
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" a4 u5 [2 {9 r$ ^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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& a, M8 }% ]# v0 @9 e% z# ^ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ X! r6 M* q0 R, w$ X# U- s) m" ]$ r0 K9 ?! ~" o: v
% p2 \+ k$ h6 Z7 x
|
|