|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 s8 j2 q$ X5 ]% O; L- [code]EDMA sample test application& R4 h& Y5 J" k' j% K+ x
- /*9 U, p/ y+ v! R% @2 X9 h
- * edma_test.c; ^) z) h. {- F5 w
- *+ A) s9 I2 u3 ^+ C
- * brief EDMA3 Test Application
! ^; N" @- V8 Q$ H+ @, K - *- n% o% ~& b* C4 D, O# d0 H' i
- * This file contains EDMA3 Test code.
3 N+ L- L U* B- ^ - *
$ f, ]) ]2 Z0 r' F - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
1 N H4 Y: N& F+ f: ] - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
! g& @6 \. A C- ?) q: ^1 ~ - * TO CHANGE.+ ]8 s {, P" c/ o3 ~+ ]3 P
- *7 W% ]; g" m0 T( T& T
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
4 z/ P1 j0 s; J: x - *) l8 x1 N* P7 C
- * This program is free software; you can redistribute it and/or8 ]; S* w! J% L3 }0 \( E, R: Y
- * modify it under the terms of the GNU General Public License as
% S+ d S4 E9 T# F! C+ F4 s5 h - * published by the Free Software Foundation version 2.7 j4 x2 f6 ^8 T9 R
- *6 Q- c: t5 g* R0 r/ f
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
& X5 s% E* m# m0 X" j4 W" C# C9 R - * kind, whether express or implied; without even the implied warranty) H! W0 _* D4 O+ Z/ v
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the2 A6 l* K: A- j/ w% x; U
- * GNU General Public License for more details.
& p& R# I2 X9 G: I; ], f$ G& r+ l - */& ~. y1 v2 d X. j2 O: g, M
4 g6 p+ l8 b8 b$ Y2 }' b; j/ t) [- f- #include <linux/module.h>% _ T/ A+ R0 y, A
- #include <linux/init.h>
) L" t9 N- w1 U, O - #include <linux/errno.h>- H7 T A. ~; B3 h6 m# |& c7 Z, e9 Q
- #include <linux/types.h>4 L) Z# ~7 A. ?8 ^7 W0 R) _' q
- #include <linux/interrupt.h>0 u" |5 c; X& D" k/ w( j
- #include <asm/io.h>
; f& q; l) j) d - #include <linux/moduleparam.h>
# n W' _9 i! o - #include <linux/sysctl.h>
. y. B" h: K8 L' W. k - #include <linux/mm.h>
# F ]# G& z. b+ r5 F p - #include <linux/dma-mapping.h>& S" [ L5 f) R& q9 n- l. Y
, r: w1 V1 s5 t' Z& `% I6 L- #include <mach/memory.h>5 V( w4 j& k% _3 Y
- #include <mach/hardware.h>4 C; U7 Y# \; A7 {; A" d& x7 A
- #include <mach/irqs.h>
4 Q$ F! H7 Q! b' i% g4 P- ? - #include <asm/hardware/edma.h>
8 U% q6 i6 G; U; X# b6 f& _ - 9 R: j5 ?% p6 X, |
- #undef EDMA3_DEBUG7 _* z0 {/ ?9 Q' [4 O I! o
- /*#define EDMA3_DEBUG*/9 d* e( o3 P: P5 C! P* V) E7 Y0 @" t
- " e6 _% d* [6 Y; M
- #ifdef EDMA3_DEBUG) a4 t/ i/ l0 Y; \+ K6 ^- j
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
^2 _. z3 v O# i9 ]' l - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 f: z: k8 O6 l% u
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) n; L; c8 |6 U- z$ g
- #else
5 O. e A9 W& a: ~" g8 Z - #define DMA_PRINTK( x... )
2 n5 ^6 _& _2 U8 y( S/ y# s, ? - #define DMA_FN_IN
) B2 |0 ~5 V3 H; l. h+ D& k4 M6 o - #define DMA_FN_OUT
& G y. j, S/ D - #endif& W2 `/ Z j, i. y
- - n" u6 W% n1 H) k" y2 j
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
3 r f' W4 x Z/ G$ | - #define STATIC_SHIFT 3! s% u0 B) y. D, \' o
- #define TCINTEN_SHIFT 20
$ I! u) c; ^& q# C8 m' O - #define ITCINTEN_SHIFT 21
; I0 @& a8 m+ A - #define TCCHEN_SHIFT 22
2 O1 q/ }8 [/ n2 f% n* k+ ]' X6 v - #define ITCCHEN_SHIFT 232 r/ p* T+ Q F- W! K
- , J2 z& I) z2 y' U7 B1 @
- static volatile int irqraised1 = 0;
8 `. s: d5 ~- t1 ]* ~; \ - static volatile int irqraised2 = 0;
! c, Q$ i7 K" {" Y# Q5 F- [; t
, s7 G8 z# p0 |- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) x# Y. e0 B0 A( T8 n* x
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& ?# A1 j, d0 h- i - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# C6 S% @3 O# N$ l
. A& G) t! s/ S1 v8 b% O Q$ Z- dma_addr_t dmaphyssrc1 = 0;! s% ?! k3 d- { w
- dma_addr_t dmaphyssrc2 = 0;& z) a+ m! Y: K1 |
- dma_addr_t dmaphysdest1 = 0;. G4 @: }0 x3 i! t& I
- dma_addr_t dmaphysdest2 = 0;
8 T" M+ w& z8 f+ `8 A- ^ - : d/ h( r$ Y7 _6 ^9 c/ f
- char *dmabufsrc1 = NULL;- I6 V- ~. A8 s. U, m) Y
- char *dmabufsrc2 = NULL;
9 T& D# [# ?3 _/ X& s: w/ L3 W - char *dmabufdest1 = NULL;" O% K5 Y, f3 ~, e+ Y& g8 P9 z; F
- char *dmabufdest2 = NULL;
+ B: A6 [; u% ^$ F& ]
4 k$ ]5 ^5 i( l1 m& ]4 D- static int acnt = 512;1 w& n0 Q3 u* i( K; F- e$ I, ?
- static int bcnt = 8;
4 k& I& j; B m) R4 O - static int ccnt = 8;
" E& r) D2 l6 h3 {! _' H - 5 Y& [5 n6 ]0 v0 O
- module_param(acnt, int, S_IRUGO);# e& |1 o( L) a# O
- module_param(bcnt, int, S_IRUGO);; n: `( X, \+ A" g* ^4 R+ r: z
- module_param(ccnt, int, S_IRUGO);
复制代码
K6 t; ]9 P; a4 _& \ Q3 ?6 r! P& C9 w8 o& ?1 I; s& Z) S; U
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
O- `! n' ^9 Iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 o0 Y( a9 M* }" u 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
L c$ R% X8 B- O& j
8 n: J/ Z- c6 ?8 e" a" I! P* g5 J- p
|
|