|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 y: _+ W! w6 r- ^7 z! I7 v
- [code]EDMA sample test application0 \3 T6 X( \5 y6 m6 e6 n' b2 `
- /*
; b& x2 [" ]7 W8 D! l8 r0 e+ V# M- u - * edma_test.c
6 ]% d3 {; I; ]1 a: m - *
. Y- s3 m0 p w- w0 E - * brief EDMA3 Test Application
3 V2 n0 _" v7 T- }/ H8 N- b - *
! T: L. Q/ Y; [& }6 k: P u8 a - * This file contains EDMA3 Test code.
+ Y K. y7 _ n - *
q3 W% Z2 `7 g9 d - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
5 P# {+ g! I# A# u* p - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
/ u- P" ^" c/ v( }: I% x: G" q# w - * TO CHANGE.
{1 [1 p, h% a7 u3 i6 v% w - *
, U; y0 c+ M1 B8 k - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' H2 R+ v* G$ _ k4 K" ?) S; x+ v& ~8 Y
- *
6 F6 R3 L( g- n* d: { - * This program is free software; you can redistribute it and/or- z$ I7 j1 e& {! D$ f
- * modify it under the terms of the GNU General Public License as0 Y' K5 n6 s/ I0 X) h' V
- * published by the Free Software Foundation version 2." J9 |6 K$ m( U6 O% @7 \
- *
/ f9 V- |* S" ]1 Q3 v. i4 O - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
% v1 L7 X/ Z6 k' v% L- ^. { - * kind, whether express or implied; without even the implied warranty
6 u( B/ c6 c) [# N* e - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1 g* Z+ ?; C' u- f' H
- * GNU General Public License for more details.2 U2 L; W6 U: T1 B: t7 h7 p
- */
* _" O' w3 S0 T; B/ j, |2 `
7 X+ g6 N* T8 @$ O$ ?6 e5 {' ^) w- #include <linux/module.h>. U1 M1 B; a, p/ M) e% p
- #include <linux/init.h>) G! Q* L2 V( H a- r8 R
- #include <linux/errno.h>" a5 R& p- b+ Z. H4 v7 ~
- #include <linux/types.h>
5 N, O, B- G. ]8 D1 y+ A- o - #include <linux/interrupt.h>
% h) G* C& [& W4 g" |9 n! b7 Q - #include <asm/io.h>
+ y4 g: z1 E( H+ }4 C! i0 t: l - #include <linux/moduleparam.h>
* T- i2 P: J8 T7 {! U' P - #include <linux/sysctl.h>
6 P# N" p8 i# b c" w7 ~" J9 U - #include <linux/mm.h>
1 t- Q7 r+ A5 |6 N+ \ - #include <linux/dma-mapping.h>$ S4 H& S/ U4 \) S/ \
- 0 ?8 f. ^/ Y- U7 a
- #include <mach/memory.h>+ L: n, d& A: R. p: a
- #include <mach/hardware.h>! U1 \% h' q: D4 f T) P# d. J+ ]
- #include <mach/irqs.h>
/ }; ?8 G& }1 [ - #include <asm/hardware/edma.h>6 {) X: r4 o! J: g3 q3 M7 }" V
- ' `8 e3 {( d, k5 y2 R/ p9 m
- #undef EDMA3_DEBUG
. u2 A1 C7 F" q* F; I - /*#define EDMA3_DEBUG*/+ P/ v; Y6 K4 F$ o8 B
- , n" I! O4 t" z2 I8 e+ ?. r
- #ifdef EDMA3_DEBUG& I7 O2 G7 `8 M- l+ }9 }) R
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
1 T2 y. m$ b' o* p - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
9 O* `3 C8 B+ V, G - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
+ S) r! z3 ~9 e7 o9 D2 D' L( J - #else) b% V* a. C5 y+ J9 d1 o% r; [! D8 _
- #define DMA_PRINTK( x... )& Z/ w- V" d K. N
- #define DMA_FN_IN
. s9 [( T( Z) @- X- `8 u - #define DMA_FN_OUT3 a, K% S% q8 _+ |! J: ~/ d
- #endif
. f$ `5 w6 T+ k- \" S - / p/ D! V% a2 s$ l5 X
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
+ r6 R1 S( u" d - #define STATIC_SHIFT 3# X+ i ]3 A2 i, w2 ~" j$ `
- #define TCINTEN_SHIFT 20
$ @* v( P9 j# R - #define ITCINTEN_SHIFT 21
3 ]3 m: l# _; b3 `5 k8 g - #define TCCHEN_SHIFT 22
' O) z/ z! t, R - #define ITCCHEN_SHIFT 23
. }1 q0 G( [& k5 F6 w8 ^# u - 9 C/ `+ J- F! b4 @6 l8 o/ U7 f5 Y
- static volatile int irqraised1 = 0;1 k8 B* \5 { H2 x* g3 x
- static volatile int irqraised2 = 0;
+ M1 I' g9 |! A' Z2 D - : W, W, L5 w1 U- n5 d: X& c* D' D
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- p, S' o0 t9 A
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) r; D( F) \! z) K
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. a$ n# U( L* y2 z6 c
- 3 m3 a2 r- h9 c* T# N' r0 ~1 B
- dma_addr_t dmaphyssrc1 = 0;% ]5 w( P9 J2 x4 z6 h( R
- dma_addr_t dmaphyssrc2 = 0;, u$ J6 h" b, T1 F
- dma_addr_t dmaphysdest1 = 0;: u9 B( b# v- q- J8 A9 j
- dma_addr_t dmaphysdest2 = 0;0 W B" I% ]; @6 {5 x
- 7 s% M) y2 E1 G
- char *dmabufsrc1 = NULL;5 Z' R7 _8 g3 U- u
- char *dmabufsrc2 = NULL;
( X7 [: J. o; k# D) A+ P - char *dmabufdest1 = NULL;$ c0 l; x& M+ l- T+ @
- char *dmabufdest2 = NULL;
1 x6 P0 {# O# v - 3 J) r2 U M) }+ U
- static int acnt = 512;
; S S4 }. }9 c9 _. K/ j3 V - static int bcnt = 8;
9 D/ m) p. i+ ?8 \8 V- U - static int ccnt = 8;
& }; q' U3 R4 Z. U - , A# ^) D {* t/ `
- module_param(acnt, int, S_IRUGO);
6 k% ~: l' g$ ` - module_param(bcnt, int, S_IRUGO);; o" l- I4 C4 d* P f3 \5 v
- module_param(ccnt, int, S_IRUGO);
复制代码 $ a9 W8 Y, A& j
' Z' s, C: c5 \: _
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 R' d4 Z) J/ 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 a' f0 F3 H8 h0 Q' X" J0 P, Z# L
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 g, W5 ]/ N! O ]0 f0 ~; B* R
6 `" ^. ]2 Z- i J( S, U) S4 k6 Q4 R6 \
|
|