|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% o' m; v* E! e1 C8 w' P' ]- [code]EDMA sample test application" @ L8 L. }3 S; d1 n, v: h
- /*
0 @5 e+ X+ I0 _8 I- N" L - * edma_test.c
( q% F, p) R7 i$ L6 q - *& t9 R0 J/ K: C: g% U
- * brief EDMA3 Test Application$ z, w( G5 O- W
- *8 ?. u) P7 g+ d
- * This file contains EDMA3 Test code.7 y; L; I( ^; u+ L0 X, U
- *- `9 I0 }7 R2 X. b& z
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 }0 U. }, V; g1 S c' z2 O! W* L
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT c( u% o* k5 @ z* p4 _$ e
- * TO CHANGE.
2 X7 i0 E' e" k! f - *% O' l. x" n/ H+ F
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
/ J) v& J% i O6 I, { - *$ b# B) F" L6 \9 [0 c1 y3 O
- * This program is free software; you can redistribute it and/or/ s; _ t5 W k; W( N+ B9 w, O
- * modify it under the terms of the GNU General Public License as& M; g6 E1 F9 {$ ]4 z$ S8 P
- * published by the Free Software Foundation version 2.$ W6 n- I+ x" j
- *
" m1 @3 v# R" y; \ I - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
( o+ y& O- ^" _4 s* B3 g# ~& H5 L - * kind, whether express or implied; without even the implied warranty
- I4 @! [3 \. N* m# `- }4 X7 [% S - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the/ ^# T0 {& [$ O/ I
- * GNU General Public License for more details.
1 x0 s2 H H: k$ l - */1 T- J9 o1 p0 R* _& Q
6 U6 {9 [/ q; D- #include <linux/module.h>
3 B# C/ @( n C# i7 {$ f# P - #include <linux/init.h>
7 j0 p. z; G# H' K6 ]5 j0 F) A ^ - #include <linux/errno.h>
/ y/ |3 j2 F: M: A/ D - #include <linux/types.h>
5 M- G5 E- ~4 Q& ]: q& B - #include <linux/interrupt.h>
u6 y* g0 j, b+ U0 y" m. q - #include <asm/io.h># K6 x" p4 y" v, n, t0 _- [ Z
- #include <linux/moduleparam.h>
: r) `/ v% s/ q+ L - #include <linux/sysctl.h>( F1 g" ^- E4 j- R' _
- #include <linux/mm.h>
3 z1 \1 H/ ]8 _# v0 ? - #include <linux/dma-mapping.h>
8 Y5 `/ N' x4 T0 o* J5 e3 R0 {
# p& c8 d- G* I$ k) B7 K- #include <mach/memory.h>! n2 t. |1 P I8 I) K
- #include <mach/hardware.h>" Q4 X( J8 j/ z; S. ?" S2 K8 I4 @
- #include <mach/irqs.h>
* W4 [2 W" o+ j1 @ - #include <asm/hardware/edma.h>
# n) V+ v/ f0 T2 H - : r8 H5 ]8 \/ L9 H) N5 T+ D( w
- #undef EDMA3_DEBUG2 o' g5 Z. G0 }. r7 T
- /*#define EDMA3_DEBUG*/5 H# e' L( z6 L2 p! b( N
, d' K# y2 D1 r- #ifdef EDMA3_DEBUG. h: {& \( q5 b3 a1 c
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' I) h1 p# ^4 z
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
6 a# }! m( q/ E: Z - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( \6 v% @. G- Z/ f9 i- q
- #else, t- K% p% }0 y" a& v$ n
- #define DMA_PRINTK( x... )
! l% p2 y. ~+ E - #define DMA_FN_IN
" R1 h8 O: M1 [# L, ` - #define DMA_FN_OUT
: S3 d- G$ z$ ]7 v7 @2 ^$ C - #endif! D( {( Z6 s, ~
- . j9 P2 \3 _- |- L
- #define MAX_DMA_TRANSFER_IN_BYTES (32768); }, a& Y5 b2 }+ V/ N" B/ H; e
- #define STATIC_SHIFT 3
1 r6 Z; B4 J3 J" s - #define TCINTEN_SHIFT 20
+ x+ @- B8 n! D. a2 L- X* S% p - #define ITCINTEN_SHIFT 21# p5 {0 l% N9 |, t
- #define TCCHEN_SHIFT 22
0 N6 W6 k: c1 T% C6 |; f' \# n0 B - #define ITCCHEN_SHIFT 23
# c# [$ H% B. N! d
% I$ T) S8 n8 q, G$ U0 j, c- static volatile int irqraised1 = 0;
6 K; O& t, q6 w& ]' F, G% d - static volatile int irqraised2 = 0;
# w, O) X+ K h9 N, {7 w7 { - 2 ~* n0 [% X6 a' q+ ~
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 A; B, P2 G+ I j6 ^
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ X4 F8 @/ s- `! T% r' V" Z - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 p' I: I; e; u4 B! E$ y
- 4 O& K: E) j* d4 Y! R5 Q4 J
- dma_addr_t dmaphyssrc1 = 0;
; I0 h& E1 D+ `; N7 a - dma_addr_t dmaphyssrc2 = 0;: I$ ^4 o9 ?7 I; z/ v
- dma_addr_t dmaphysdest1 = 0;; ]9 n& p' f: w, }
- dma_addr_t dmaphysdest2 = 0;# }6 w- h3 q, H7 D" X5 j& K F
/ C$ u, c& a5 s- C- char *dmabufsrc1 = NULL;
2 m: F' \# A6 x* k3 j - char *dmabufsrc2 = NULL;$ P1 W' g, ^# Y. t+ _& A& N; \
- char *dmabufdest1 = NULL;/ y9 b% u9 @3 M' J3 _
- char *dmabufdest2 = NULL;" H k/ |+ A# |' b5 e& F
- . K0 [" c; N; t3 Y' X, `5 S
- static int acnt = 512;
+ r1 A+ m0 e* t8 ] - static int bcnt = 8;
: D' t1 O. ]0 ^ - static int ccnt = 8; M3 L) L$ m: u) E! P
- ( @* A7 K# v, Q; ^
- module_param(acnt, int, S_IRUGO);( F$ M/ ?+ P' o9 H( d
- module_param(bcnt, int, S_IRUGO);9 D( E8 _, R3 \5 D9 V6 a
- module_param(ccnt, int, S_IRUGO);
复制代码 Z% b( j8 J( Y: I) {
' X9 K' Y' k3 P+ p& j# m9 I 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ t" o3 W/ O3 G) I1 h8 x: Q* N
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( v/ O3 L$ L! @4 u 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: r6 Q, X. ~7 G/ N6 y# a7 {; p" u- i$ |! A ^
5 f% Y) W4 M+ R! f! D |
|