|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 O [0 l D/ ?6 M! w8 \; n- [code]EDMA sample test application
0 M- Z7 ?9 K# V' n k1 a) | - /*
- e/ W7 V1 e+ n' [7 m% a" S5 R - * edma_test.c% {% [, L7 E+ h" b+ N/ `" L5 k
- *$ Y! y! z/ q. [% ?) o. E2 a
- * brief EDMA3 Test Application4 C. {4 \1 [- \
- */ E9 A! O2 t" q& m9 i
- * This file contains EDMA3 Test code.
* T6 a5 S6 V! |2 a" w7 R( i - *& ]9 p2 f- \* l1 e- M1 n
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
' H' d7 B# p: N6 A: r8 {4 q2 D - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
) D/ c' D0 Z' K9 c; Q - * TO CHANGE.0 E7 x4 y0 ]' o
- *. F) {& F8 `: J
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
, T% T$ W0 ~+ v: }/ i - *1 v9 [5 F; r* @: n5 J' o
- * This program is free software; you can redistribute it and/or
5 }& c, u! |4 U! y& h - * modify it under the terms of the GNU General Public License as$ U5 p/ V) h' E; G
- * published by the Free Software Foundation version 2.
3 r6 s, i4 ^7 a - *
" F$ b' Y: A/ i2 n4 g' f - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
; h$ m9 K; u, v1 E3 g8 v' q - * kind, whether express or implied; without even the implied warranty5 ^( a0 u( r0 C" }
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the* J3 \. N2 T# A% B
- * GNU General Public License for more details.
7 p( G" r* F% @ - */
`- ?) C: ?" z3 |2 C, y
% I& w6 C8 w. G/ Z% k9 n; K- #include <linux/module.h>
& a" {. G! W- p* b' Z% ^ - #include <linux/init.h>
: C8 P# b3 W& V/ I' Q ]& j% B0 R - #include <linux/errno.h>
0 a* v- i Z2 {* H Z; h - #include <linux/types.h>6 a# P5 J- w" _: C/ D
- #include <linux/interrupt.h>1 c) g# w, \- y' Y$ q
- #include <asm/io.h>
6 v0 j d& _7 C5 N - #include <linux/moduleparam.h>
- q3 `' Y/ C0 }1 C* S* q0 Z& P - #include <linux/sysctl.h>0 ~2 Q* z$ c$ c- i d8 P7 |/ X
- #include <linux/mm.h> d+ P2 d6 r" N1 k2 H
- #include <linux/dma-mapping.h>$ `- k0 I9 x* z- T( J4 p6 U
' G6 K8 g) D% Y# C% K+ U' J. i- #include <mach/memory.h>
( I: s" z8 p7 U - #include <mach/hardware.h>
; d. z3 n7 c5 |' | - #include <mach/irqs.h>
G7 p( ~$ T8 O# u - #include <asm/hardware/edma.h>* K! A# F- \3 e* {5 `/ D5 L3 C
- A! A- L2 @) o: \: |- #undef EDMA3_DEBUG
+ ]: W" t2 l* P" W: W* Z - /*#define EDMA3_DEBUG*/
: x7 L3 s$ y w/ y% u - / O( W. O4 v# y/ z- \
- #ifdef EDMA3_DEBUG
" \1 |) \7 e0 a3 u4 [$ W4 q - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 l- @6 s4 K: z& X$ u9 K5 g
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
* k0 z) T8 c( {3 O - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). Q; r) S2 p2 t% c- J
- #else( Z1 n) }: S5 o# E
- #define DMA_PRINTK( x... )
0 u; d/ [5 p9 d0 T3 Q* H - #define DMA_FN_IN0 u& H% Q; D( o5 y( Q, D: {
- #define DMA_FN_OUT
- Y* I* f. | |% h2 f - #endif: b+ {) z6 C4 \% W9 x% Z
- ' R9 B- D6 T; K: S. _
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
) Z h7 O Q. u0 @ ]0 o; Y! I4 s - #define STATIC_SHIFT 3
: d) G# R9 w& l, T - #define TCINTEN_SHIFT 20
1 @2 H+ w6 W6 R3 t/ f - #define ITCINTEN_SHIFT 21- E, m: ^; l) g4 d* s
- #define TCCHEN_SHIFT 226 M* I# r# |+ }) w6 i) G$ L4 x
- #define ITCCHEN_SHIFT 23( K+ ~8 D$ }8 u1 P; y+ P/ {
; L/ Z* J# F) v6 Q9 f- d- static volatile int irqraised1 = 0;( a# D- F' V# ^6 T! y7 W# m0 A
- static volatile int irqraised2 = 0;& P5 |$ J s; E8 q0 m- Q- c, ^
' I d5 j5 e' S" g- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 F- c4 U8 K9 Q$ U: P - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: A: g: B' r! X, d' d
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# s. k. w! a+ @ E
- / w: z) u. M7 H" C
- dma_addr_t dmaphyssrc1 = 0;9 y3 b% E* V5 F& |- `0 f& e
- dma_addr_t dmaphyssrc2 = 0;5 o2 l# J" M% N. S F" x! a8 J$ j! x
- dma_addr_t dmaphysdest1 = 0;. L6 k3 P- v8 r7 ~& c# V4 a
- dma_addr_t dmaphysdest2 = 0;
8 B, K& p5 A1 U+ c% Y
) Z% b5 L* H& _0 S3 D- char *dmabufsrc1 = NULL;; j2 R1 ~2 A& G- q, t9 E
- char *dmabufsrc2 = NULL;' f5 L; D+ p. e/ r! d
- char *dmabufdest1 = NULL;
3 Q: T# w& `' y/ G - char *dmabufdest2 = NULL;
7 s& k4 Q/ }/ |( p$ o( [/ r
- T) @% D7 k ]7 E- static int acnt = 512;
6 L- d4 R4 A5 z4 e9 y - static int bcnt = 8;
# H- M( S; M$ j" s' X5 E3 d+ Q: l - static int ccnt = 8;+ E, }% @9 b0 C
4 `4 B( K1 m% E! e% Z4 t h: D- module_param(acnt, int, S_IRUGO);( O2 e1 j9 w! ?3 I% `. o# V4 s
- module_param(bcnt, int, S_IRUGO);
h' x3 [% w/ Y2 q q - module_param(ccnt, int, S_IRUGO);
复制代码 + A- }$ X# N$ ]/ Y! E
3 t7 ?2 j, d0 E1 ~' n
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 Q$ z3 F! F* ~. x$ m
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' ~) u+ ?; Y! k G& p9 k. N 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 a7 n% r/ z5 `" ?2 @$ F
3 ]2 n. h6 n1 G! Z
. f( ?, W- G7 ?% I |
|