|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % T- Z' F' P$ i5 ?2 h. g
- [code]EDMA sample test application
; g' C3 n/ {: g% A- A - /*- G( ?& e1 `$ ?8 S
- * edma_test.c
+ U' d* J5 w; U7 ?( W u: p, v. K - *
3 w5 a' Y- E5 k - * brief EDMA3 Test Application: A& W- p9 f- P( k0 V
- *
+ w2 s e1 S4 y% ]; H" {' } - * This file contains EDMA3 Test code.
2 u- k* y, W( q# ^. S - *
7 T3 B _% t \ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
! h+ F3 e- J6 x# ^! |4 m - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 |4 L" u( @' c
- * TO CHANGE.5 X7 {% ^. Y3 m" H: s& L
- *+ h4 U: z! [+ M& i" \; n$ b
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
7 |/ \2 I' S; t( H1 S - *. s( B& _2 a" M% F2 g3 r# b& P' k
- * This program is free software; you can redistribute it and/or
. u! Q" l" t: S& f9 }* i* L' a- K4 M - * modify it under the terms of the GNU General Public License as
+ A4 K4 ~2 `, { - * published by the Free Software Foundation version 2.
& n6 S" H! F8 W5 C - *4 h: e5 u9 M3 _: v* i2 a
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
! l0 D4 x2 b6 x3 f - * kind, whether express or implied; without even the implied warranty
0 @9 |8 D" Z" {- p: Z - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the9 @4 w5 Q( {& y* Q! {
- * GNU General Public License for more details.
% e$ Q6 H8 d, m - */. i# @( O. {. j' c
- - { R& i/ L. ~2 m9 C8 _
- #include <linux/module.h>* @0 s9 ?- F1 k. ^; n6 I
- #include <linux/init.h>
. Q8 Y6 l: l. k - #include <linux/errno.h>) a$ p" E5 t% `4 _3 {; T4 Q4 h
- #include <linux/types.h>) D/ l! v1 |8 G- X3 g# C7 r
- #include <linux/interrupt.h>
1 F, ^) d8 C% G$ | - #include <asm/io.h>$ F! m9 z9 Z" {' A1 x7 {9 t. a# }
- #include <linux/moduleparam.h>
$ v2 |( ~! g; X3 O0 F* U4 U - #include <linux/sysctl.h>+ o8 X3 Q9 p+ a
- #include <linux/mm.h>2 Y! _1 F* t: w6 ^/ ^
- #include <linux/dma-mapping.h>
6 y! m6 T: T( d
" v2 O0 u$ ~/ w- #include <mach/memory.h>+ }, ]$ p6 I8 R9 q# M2 k& L
- #include <mach/hardware.h># V# N. i! g3 Z5 _; T1 X9 _
- #include <mach/irqs.h>
, c" [9 G3 d; k' |1 N0 [ - #include <asm/hardware/edma.h>( y' e! W R4 M4 F8 Y+ j- A
$ S: D: e/ l4 p7 N- #undef EDMA3_DEBUG
8 D4 m# _" f% W# X$ Z, U4 W - /*#define EDMA3_DEBUG*/
K i: _0 o2 [# e) ~: M - , d8 l6 u. ^$ [
- #ifdef EDMA3_DEBUG% v5 T# d) w( ~) n
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
8 [2 k O5 ~- f4 t0 H* S( Z0 ]4 |, ? - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
3 H3 j. h. s$ w$ s - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
$ M/ W+ ~8 y& R0 ^6 o - #else3 X; I! ^, Z3 b
- #define DMA_PRINTK( x... )+ A& N4 }% V3 w
- #define DMA_FN_IN
) J4 @0 b) k K6 X' d+ H1 z - #define DMA_FN_OUT6 k3 D% `" _' V1 }& O9 J/ H- X
- #endif/ t: N* D p, ]% X1 y4 z2 m2 Q1 `2 M
6 U# U1 t4 N: G- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
6 s) o& t: M9 a- M" l - #define STATIC_SHIFT 3
! N S, E& @2 K - #define TCINTEN_SHIFT 20: C6 K0 \( I; |; k; _
- #define ITCINTEN_SHIFT 213 ?; G1 v- d/ \( S% ?
- #define TCCHEN_SHIFT 22, U6 B+ h# w/ x* m; Z
- #define ITCCHEN_SHIFT 23
- f# Z3 s2 u5 r
/ n8 H4 p! V2 [5 m7 C- static volatile int irqraised1 = 0;
. i3 g& \7 K) o2 Q+ U - static volatile int irqraised2 = 0;6 a1 U# N* o- v) N9 a
: S" a0 F/ ^4 @, O$ j E* b5 H- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* b. [: C" y9 y0 S
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 f9 i$ ?# U5 v: U - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' R% L+ Q4 r0 s7 g - * M2 D8 W" d; h% J
- dma_addr_t dmaphyssrc1 = 0;* m4 V. A4 P7 k& J
- dma_addr_t dmaphyssrc2 = 0;
, y' r5 x7 a0 z: {, x0 T: ? - dma_addr_t dmaphysdest1 = 0;1 g' U6 M! T4 f5 D _ k5 O
- dma_addr_t dmaphysdest2 = 0;7 s- E$ a+ x. u. J5 _5 i* w
- 8 o5 A$ V& O2 N
- char *dmabufsrc1 = NULL;( d3 k! ~2 {4 V+ M, Z
- char *dmabufsrc2 = NULL;; a$ k/ b$ i4 @) n3 b6 t, k$ b# t+ @% w
- char *dmabufdest1 = NULL;
" I3 `* B& T* C! D9 H - char *dmabufdest2 = NULL;- Q% r! J( }( ~% Q& |5 k5 t# i% Q0 ]
: l/ `2 ^" ^+ U* q6 u# c, O+ I- static int acnt = 512;0 {9 n: p# Q d1 ]
- static int bcnt = 8;
1 F6 T, N: Z3 q% G - static int ccnt = 8;
" `0 ~! I$ ]$ O) y; C" m7 W9 e - + M; T9 ^8 f8 }0 M) @+ _
- module_param(acnt, int, S_IRUGO);
0 Q" g/ g& S3 Y - module_param(bcnt, int, S_IRUGO);) B9 p5 w% K2 l8 g/ w
- module_param(ccnt, int, S_IRUGO);
复制代码 & a/ y x( S" w# }
' I* B- S B/ ^8 |" L! D9 w
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 X! [5 w3 O$ X6 farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! `( v6 a$ s! C: ]9 q
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" g4 N" u2 ^! f& G u! i, v
+ A7 r9 r, M+ n1 E
! h. Q) b& d' Z" q2 E; ?; e
|
|