|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& \& [. X t& Q2 Q) G4 K- [code]EDMA sample test application
( y- `. V* J7 J; f( ?8 u& m" b - /*
* {9 g1 T( a9 ]$ x - * edma_test.c
# ]- j4 S4 P+ V, u( G - *
3 ^+ E9 i. \1 D* j' { - * brief EDMA3 Test Application
% J( v" \# F& ^2 Q. O5 s - *
9 B0 }+ m6 }7 ^- a) F' ^7 i - * This file contains EDMA3 Test code.
. Z' L' j0 A/ E4 b0 c - *
/ C4 u2 _( B7 w! j8 i$ U - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE q3 \- R. e- Y. U T: A; Z
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& r1 i y$ S, C- k
- * TO CHANGE.
' I4 z9 w9 p9 Y: p - *' ~# e$ \: B. h" n7 p! d# E6 |
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// u Y$ c' v$ o
- *1 M1 ^% ]+ A; Z3 r$ d6 D# l
- * This program is free software; you can redistribute it and/or% {& B; j; O) S* U1 q5 s
- * modify it under the terms of the GNU General Public License as2 H! O! E' U4 h# F
- * published by the Free Software Foundation version 2.' B( o, T/ a" ~( i- O( ]
- *7 G1 N- A7 [5 H7 ~9 p. z/ t/ |
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
* y. `5 i5 l+ w1 ~4 K - * kind, whether express or implied; without even the implied warranty* ^/ C) c- w6 w O& H
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the6 B4 \7 B y/ T4 B! N
- * GNU General Public License for more details.; t7 E! C7 V3 `( g5 d" M, O3 x
- */
/ s( O( W9 [2 U - ( H1 I" [: b" n1 Q5 I2 F* @. u3 U5 t: x- `
- #include <linux/module.h>
+ |' ?$ w0 W3 Q& ~+ I: a - #include <linux/init.h>
+ W) n$ m0 f2 q - #include <linux/errno.h>
6 W, ?* f8 `; s" @! j0 Z - #include <linux/types.h>
8 X& o+ K: A/ P& e4 ~6 z1 } - #include <linux/interrupt.h>
4 x3 X" D& a3 `# H - #include <asm/io.h>
2 o- z" b1 ?% p4 t) H# a* T) w - #include <linux/moduleparam.h>: z- k4 Z3 t, X
- #include <linux/sysctl.h>) ?: [" u2 d6 W3 G% }% i; t
- #include <linux/mm.h>1 b0 V8 m7 ]# x& ~. g9 R& r
- #include <linux/dma-mapping.h>2 c9 b, D/ e+ J( O# v
- v9 L6 |/ Y2 j
- #include <mach/memory.h>
; B v# { M, l0 {, `9 ]1 O - #include <mach/hardware.h>
3 n( r0 [/ a6 D) ^ - #include <mach/irqs.h>+ D9 E4 _, M3 \' U8 y
- #include <asm/hardware/edma.h>0 ~) e' e8 e& m- Q3 I
- ( y3 V' B8 d3 O$ B" a- l9 g V
- #undef EDMA3_DEBUG/ h. B) m* e1 t2 h
- /*#define EDMA3_DEBUG*/
- k3 N6 x$ Z8 x; x! i
' `- K8 G- y# N+ O$ [( x- #ifdef EDMA3_DEBUG+ ~4 m% g+ G( u+ F
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
0 K) d8 X1 z. A0 J/ F2 {; b3 u - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
& ` Z5 }5 W1 ]8 K6 c6 v - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
$ K( a' X$ T# l3 b0 w - #else
. F9 F8 x1 I: f& i$ S( O% n% |6 x# g - #define DMA_PRINTK( x... )
5 S: R6 H, D" F& {6 j& A - #define DMA_FN_IN$ J; q$ L8 V! E( F
- #define DMA_FN_OUT, U- {5 L0 Y/ n3 I7 c
- #endif
& l7 Z+ M! x. J2 Y3 b, J% C - 1 I4 R" T# f: u* J W f6 s
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
% G5 R+ ^$ G9 ]8 r9 Y7 g! A# P - #define STATIC_SHIFT 3
_6 L2 i* Z; [+ j7 L O - #define TCINTEN_SHIFT 20& N1 g3 |3 x# J% ~+ i+ _% Y
- #define ITCINTEN_SHIFT 21" p/ ^. c8 d, O+ j
- #define TCCHEN_SHIFT 225 B6 P3 t* n @9 A1 v' f
- #define ITCCHEN_SHIFT 23
! C" Y& E0 [, [, G* { - 5 I+ D+ o" v6 A/ G
- static volatile int irqraised1 = 0;
/ B: k3 l* t, g# m1 D - static volatile int irqraised2 = 0;. P! J* y* S4 X/ q( C7 z$ |
- ( p: D0 _2 _! E% O
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 a" C& H" y4 Y( f( ` T) { - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ Q( @( h, M) S% B& ~( W
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! [9 r6 A5 L! ]4 d - ' S- ^" p; F( l8 U% M- g
- dma_addr_t dmaphyssrc1 = 0;
: x5 y6 _- p5 R* T$ K - dma_addr_t dmaphyssrc2 = 0;2 W n. o8 t. }9 K$ J6 _" N4 Q
- dma_addr_t dmaphysdest1 = 0;; ?) X5 {8 Q- n& {/ m9 V3 V
- dma_addr_t dmaphysdest2 = 0;0 k( Q( J; }) k# E
% r0 c. P. W+ }# C- o- {& c- char *dmabufsrc1 = NULL;
- s- ^9 b7 U# w; b# Z; s - char *dmabufsrc2 = NULL;
0 v9 b, N7 n9 W0 {) _ - char *dmabufdest1 = NULL;
$ N. B6 O B8 y3 K# Z! g - char *dmabufdest2 = NULL;$ A) P. C5 U; O
- ( z7 I# ?6 E' G8 V1 A8 w
- static int acnt = 512;2 p& \8 R% r0 _) d# q( D
- static int bcnt = 8; W( D. n5 Z3 Q* ~
- static int ccnt = 8;
! y3 a( j+ j: p+ j* `& i! U% L6 B* F5 f
, ^/ y* ^% U& a- module_param(acnt, int, S_IRUGO);
) e8 y) M: X% y% I- b8 y - module_param(bcnt, int, S_IRUGO);% o" o$ t6 X* c) v
- module_param(ccnt, int, S_IRUGO);
复制代码 * j8 E m4 ?3 x0 ?" h% m. V7 V" k
5 W2 o; g/ X/ l! g! I/ s, P' e) b+ f 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 N5 B) A8 G: @1 ], k
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& ~$ {! [: K$ m6 K2 ? 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% U, m& P d; ~
5 W' O- s9 G* k! B' L* Z2 u1 s
) `! [ ~+ S% X0 u
|
|