|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & H8 r, c# y4 E9 q
- [code]EDMA sample test application
) x ~! E: U2 V" X/ @4 @ - /*, _! W4 E8 x7 s6 F! X- c
- * edma_test.c" t9 @; Z0 A; c8 J
- * u& O" V r+ g& ^# k: k% M, K
- * brief EDMA3 Test Application
/ E2 V) D1 w% c2 C" Z - *
, F% Q+ a: F" T' F4 t" i$ p4 j( }5 P - * This file contains EDMA3 Test code.( G; `, z: s' a: V% V$ F. Z
- *8 ]: a; c1 F/ v4 C2 {8 h
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
8 k. |5 O1 N+ h% ]2 O0 m7 Z8 a - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 w0 Q1 V' R& h% I, y
- * TO CHANGE.; v, N" r! J5 v( B+ n6 ?
- *
( W; T1 _, g0 G# i* A, u! T - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: B+ j$ ^9 `: C! @4 u
- *
# M/ D \, q/ i9 r; h, a - * This program is free software; you can redistribute it and/or! H. G% c2 i$ t
- * modify it under the terms of the GNU General Public License as
, s' u, n; ]# c3 \- U/ D0 | - * published by the Free Software Foundation version 2.
* c& t7 M, N) A. }* y( g - *: w4 W" H5 m- u. q
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
! @5 g) Y! `( h8 i - * kind, whether express or implied; without even the implied warranty5 ^- {) c, U- e0 @/ e9 O7 |7 c
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the6 Z( j$ E L+ H3 a+ ~0 C4 e5 W
- * GNU General Public License for more details.% |4 X# V! \) L: H! e/ V# G+ X, p
- */2 w1 ?8 r% M+ \
- 8 G; ~/ U7 Z1 \% K+ a, g
- #include <linux/module.h>3 ^- m$ i. m" U
- #include <linux/init.h>8 L) ^5 ~4 @5 m% p5 w
- #include <linux/errno.h>
% K5 T3 I! U) P0 g5 {3 n - #include <linux/types.h>
. G' ^' ]) d: k' N# s - #include <linux/interrupt.h>
2 P, C1 B1 ^( L8 i - #include <asm/io.h>
4 V0 Q& ?2 p& Z/ M" Z - #include <linux/moduleparam.h>
3 ]* f: w. h8 }% ?( ]7 k$ t2 N - #include <linux/sysctl.h>8 j) ]2 E1 h- I# |% Y
- #include <linux/mm.h> a1 K8 S' V9 K0 K/ a
- #include <linux/dma-mapping.h>& Z2 o. j) v( D4 v Y
* E2 z5 D9 C- Q$ V' e R- #include <mach/memory.h>
/ ?2 B/ D6 n. y+ m* t - #include <mach/hardware.h>5 |5 w. Y* ^. u; L
- #include <mach/irqs.h>
! W! \% h8 D7 H( _6 D - #include <asm/hardware/edma.h>
. B) m1 Z. H7 X - ' X2 w) U" N3 U1 e7 ]
- #undef EDMA3_DEBUG' L" H' {) l3 C3 n" e
- /*#define EDMA3_DEBUG*/0 U; D5 K1 ~+ j0 _+ g4 R
- / C' H, Q" {1 M: ]* Y) S2 }, d2 l
- #ifdef EDMA3_DEBUG
! h' n$ r5 Y+ O. ~2 B" n - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). u6 q' f9 w8 Y/ u6 i0 n
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
5 T1 `9 `/ X, m( P7 b8 R* _ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
) ^8 n! Z# D5 a - #else& G# X) B" c0 u/ V- a a, y/ t
- #define DMA_PRINTK( x... ): _& c1 O% x: P! r5 a c. D4 V7 ]
- #define DMA_FN_IN! N1 ~% r! U9 K2 d' S+ {
- #define DMA_FN_OUT
! D; N2 T u8 a3 R% d X. o0 {) m - #endif
/ Z1 l* c( R7 R2 m: k4 R
% P; ]- u/ w/ J& d( Y& c- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
. q# A _7 @0 g7 k( R - #define STATIC_SHIFT 30 F0 o# D! \% @
- #define TCINTEN_SHIFT 20, c. P& u5 i, K9 E' K
- #define ITCINTEN_SHIFT 21
9 s- X* A; R5 F O$ Q, M& R; P7 b' N - #define TCCHEN_SHIFT 22
6 Z, `6 g( _1 ~- i5 e# h- o+ ~9 q - #define ITCCHEN_SHIFT 23
L1 P3 w d# Z' d* f3 P6 ^3 T4 y
4 \, `1 f' ]' ]7 K0 O- static volatile int irqraised1 = 0;( c$ z) `0 P6 S8 n) w8 X
- static volatile int irqraised2 = 0;
) A' z6 Z& p9 i( h6 @$ u+ u, z
- x6 @: o, N, w' T, V% H- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ ]% y0 D2 j- m7 W6 j2 y' p9 A
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
j2 t8 n% B1 j, h1 J - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" U/ W$ p$ M" b) o, {, W
- ' c! ]4 r& q0 }% ]; }1 @
- dma_addr_t dmaphyssrc1 = 0;
4 S5 m4 K$ ^; D: I0 v4 D$ | - dma_addr_t dmaphyssrc2 = 0;1 Z" D0 K2 {! B2 a, S$ C
- dma_addr_t dmaphysdest1 = 0;5 {: i f* f4 W% p# @/ H: ^
- dma_addr_t dmaphysdest2 = 0;" Y+ r. z. m* p1 S# j3 Q/ }$ f0 f: r5 L
- 6 @$ b& I' t% B. j
- char *dmabufsrc1 = NULL;
5 b5 g' b8 L! E [$ Z! n! R! D& {, [ - char *dmabufsrc2 = NULL;$ q9 w- E/ Z) F+ p+ H
- char *dmabufdest1 = NULL;
0 e6 V j0 d$ D4 g- h - char *dmabufdest2 = NULL;
3 Y- B M5 K; L/ j5 U% i
; {- [5 @1 g& y5 F8 U- static int acnt = 512;
4 @! h3 v* F0 V$ Z3 o - static int bcnt = 8;3 b5 Y4 U a( G" S
- static int ccnt = 8;' Z) V) D4 T9 Z/ B* U+ U
- * ], T; z, H# Q/ l, D+ o
- module_param(acnt, int, S_IRUGO);
* t+ y6 h9 k/ t" B/ j U5 ^ - module_param(bcnt, int, S_IRUGO);
; p: S! O9 D, t2 N( ? - module_param(ccnt, int, S_IRUGO);
复制代码
4 m" Q. z: P8 @) O+ {
7 b: Q8 `3 o' K' {$ O3 ~ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ ^5 D; m7 P J) V( darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- `- b* v) s9 R! b$ g 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! L- G; |. @* o
( K/ R/ Z7 _2 C7 F8 c) R
- s/ p" U0 Q$ v1 @( s' c4 O |
|