|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 @+ }/ K& c" O
- [code]EDMA sample test application
$ Z7 |) x0 R5 r2 W( h- O - /*) x3 `! j" Z' @7 f9 c) ~+ A9 E8 }( t
- * edma_test.c
% @ p t( O h! ^/ b - */ {, ?9 n" W+ [, U
- * brief EDMA3 Test Application1 a/ ~( @; A% e# z. s0 i
- *0 U5 \4 f: }8 @% _; ~, D2 x
- * This file contains EDMA3 Test code.
5 _8 E( J) L6 ] S7 y2 S - *
! @! \! a' i ~5 P$ I0 |* S: ` - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
$ j* q4 O4 n8 o% X - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
% F+ o& m2 c% n7 L7 T2 }- }6 ^ } - * TO CHANGE.! i6 \- d4 _3 D8 i
- *2 p+ `: P5 g0 f/ e
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* [' t4 b; t+ d# L+ J6 \7 j
- *
/ {# M9 I L; C$ e8 l4 e; I - * This program is free software; you can redistribute it and/or4 x5 ]! K7 T" C2 o: O- ^0 j
- * modify it under the terms of the GNU General Public License as
3 q7 w4 L9 y7 W5 ^. J3 E; m - * published by the Free Software Foundation version 2.! W+ g L0 O2 t
- *
9 _3 C- i5 b+ x; v, O - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
( U3 @; t: L1 a6 N# H - * kind, whether express or implied; without even the implied warranty
7 M% `0 {5 ^( _) T3 j( v1 ` - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the. J) S, w3 E' b; s7 Z4 T" Q g
- * GNU General Public License for more details.$ _& b. v* [" I: w/ ^% Q5 a/ O$ ~
- */
3 e: N3 @' y2 I
& ]# M, G, K8 g8 v- #include <linux/module.h>
* `5 _. E1 r/ U. E - #include <linux/init.h>
& z- s6 t, c. X( x# h - #include <linux/errno.h>
6 J+ K6 U* A3 a( k" a+ C3 o - #include <linux/types.h>
& E: ^6 S9 W [! | - #include <linux/interrupt.h>
# P( R( R, Z, D/ w - #include <asm/io.h>: m+ \$ O# T# B9 @
- #include <linux/moduleparam.h>7 E" f5 N' J# E( j
- #include <linux/sysctl.h>4 |4 m# v9 B) e, C8 J( Y$ S
- #include <linux/mm.h>. A0 H. a2 n' N/ {" q+ g
- #include <linux/dma-mapping.h>" c$ \3 n( `! ^: A4 {
. H9 b. n+ U g$ f+ c; H) u% t4 ~) m L- #include <mach/memory.h>
+ c8 e2 D( q1 T' Y/ E! u9 J# i' R4 w - #include <mach/hardware.h>0 O, M7 |3 M' T( D/ V
- #include <mach/irqs.h>1 |% s' P; e8 O. t! d
- #include <asm/hardware/edma.h>5 T/ h; p, n) F3 ~: Q
- W, F$ W5 {4 \. D
- #undef EDMA3_DEBUG
: ~2 e1 \5 ?3 y" R+ A - /*#define EDMA3_DEBUG*/5 U5 N, }5 [5 \& H# w; x2 I
- # z- t! R' r! Q K' V( M+ O! w% R6 t
- #ifdef EDMA3_DEBUG
- ~. Y% g3 m$ t2 m3 R6 K - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" g5 Q; l8 p8 O
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" D, P5 T- c' J K4 O5 y7 m6 l/ _' T
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
! c# y: P! M2 J Z$ q8 k4 Q- [) X/ ?8 F - #else
7 _$ z& J; [2 n4 A0 T o8 m - #define DMA_PRINTK( x... )8 h7 q5 s/ o8 E" t% `3 V
- #define DMA_FN_IN. F% R1 J3 t" k# o6 y0 D
- #define DMA_FN_OUT
3 u! N4 l4 H* |# v - #endif. q( Z7 u6 r# Y$ |7 b
- 8 C9 O2 [( Y/ n$ _; x1 G
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)0 q! c8 f) H8 q9 I. b5 m/ `
- #define STATIC_SHIFT 3
Y+ [; A8 k0 g1 L7 n e - #define TCINTEN_SHIFT 20
& _, v& k- P+ P' o% e$ t - #define ITCINTEN_SHIFT 21* b. I- y F# X7 i& h# _# N
- #define TCCHEN_SHIFT 22
: A# C: I* y p$ f% b - #define ITCCHEN_SHIFT 23/ l# u- C& w# r- Y
- 6 @) t6 d8 {$ J7 Q! I: m
- static volatile int irqraised1 = 0;
2 @$ \& e7 x$ u1 Y# X5 @* Z' J - static volatile int irqraised2 = 0;
, W+ @5 B, ~# E% L0 @2 q( X3 Y
- L; n+ ?! L5 {; ~, g+ p- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ H1 ]. r2 z* C
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 L0 V' \) ~4 {6 G9 r
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 N6 P* f/ Y) v - " s4 [2 ]3 ]2 Y% ~
- dma_addr_t dmaphyssrc1 = 0;
( i+ F4 D! ?3 I* M# ^3 B% ? - dma_addr_t dmaphyssrc2 = 0;
2 c" q7 ?$ \$ k( e - dma_addr_t dmaphysdest1 = 0;2 K( l7 _: e0 C% s
- dma_addr_t dmaphysdest2 = 0;# B6 g9 L* p2 ^0 D/ o
- 9 I9 ^- I1 F# C% Q' v
- char *dmabufsrc1 = NULL;
( t% [+ v+ d/ \. {# ?& \: O - char *dmabufsrc2 = NULL;
8 _) B4 J' h# ]( j. s - char *dmabufdest1 = NULL;
( x7 s7 H$ ~: q0 S" S - char *dmabufdest2 = NULL;; j3 |; k) d+ ?
- ; e. S' B0 l8 ^* `& g. P
- static int acnt = 512;$ C! n( H/ G( i& y6 R# w5 w! s- s0 K
- static int bcnt = 8;
( }# `2 U: M# v" S - static int ccnt = 8;9 `0 R. E$ f2 ]. F
: b8 V& c% U; \% Q5 ~2 q8 j$ x! F- module_param(acnt, int, S_IRUGO);% y( k! w, d; W3 O, h
- module_param(bcnt, int, S_IRUGO);7 y# M6 I" R$ k0 }7 q) ]5 d
- module_param(ccnt, int, S_IRUGO);
复制代码
: `% D% B+ A% Z) h* y: n# ? t7 m1 L; F, e$ B# T
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: I( n: D3 Q# `0 M( ~2 |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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# Y" e0 H+ z6 L' C- ~+ j% G5 Z
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ t2 }* l# t( i( q1 ~ Y
0 U; ~) {6 d7 ]2 w" b
; b. t! T* g( j" I" ~ |
|