|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ m" g' S1 @3 D [
- [code]EDMA sample test application
# u3 P* K( u V) u' R# l/ D: p - /*
" |" ]/ }% Z1 W6 O9 a - * edma_test.c
$ \/ L2 ~- D1 a/ l5 Z: o - ** y+ M4 j! c l
- * brief EDMA3 Test Application% A! u8 v4 z* |. X! G1 u S1 h: D
- *
% d. p' \$ b% r' H) T* a9 ` - * This file contains EDMA3 Test code.
' U' Z' w9 w$ @, W! Y - *
3 g7 d3 f# @2 y& O0 W( F+ ]0 K/ y - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 G1 z& j% ~' M6 [6 T4 l
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
3 ] p* C8 P2 f8 `, } X - * TO CHANGE.
k' b6 d, l; w6 K$ l; k' Y - * N! M. \# W4 M2 S
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
6 P1 T9 Y0 J( B& W* ~( a" L# ]9 e# K - *
: }* t- z: F! E: T" u - * This program is free software; you can redistribute it and/or C0 X% o2 K$ `7 Y4 @0 v
- * modify it under the terms of the GNU General Public License as4 r" \ g( H) p# u
- * published by the Free Software Foundation version 2. v+ d+ M' p, T1 _
- *
- b/ y) {# p! F, ]. \$ o - * This program is distributed "as is" WITHOUT ANY WARRANTY of any; b9 ~0 S, L6 M4 U) Z8 Z y
- * kind, whether express or implied; without even the implied warranty. w: C4 |7 p8 Y2 `0 ?" i* x# Z
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the. u8 g6 u* g$ W8 _
- * GNU General Public License for more details.
8 p) U' Z. E8 L; C - */
$ P3 b# [6 t0 C7 o - ' H2 ~ b; r% `' T% D" i
- #include <linux/module.h>
: b( z" m$ U0 i. S - #include <linux/init.h>' K0 q3 z! G- ~; g! \3 {! u; L
- #include <linux/errno.h>
0 ?. {7 ]; I9 B7 O - #include <linux/types.h>+ R* I2 G1 Q0 {& S j
- #include <linux/interrupt.h>
% U& K1 A% h) K$ ]/ y: x( S - #include <asm/io.h>; y% O" M# Q* k v% l
- #include <linux/moduleparam.h>
4 i5 [4 S. o3 O1 P ~$ U - #include <linux/sysctl.h>
$ f% N" ^% J, m$ S: L4 t - #include <linux/mm.h>& Z% {: V" }" U+ n8 ]8 p: p6 F
- #include <linux/dma-mapping.h># m# o4 \0 }. ~
- 9 t& S0 U- ~4 |! A, D$ Q
- #include <mach/memory.h>
4 m* t% O5 L. B! J! W/ ` - #include <mach/hardware.h>7 W4 }7 T- s! j- Z4 {4 ^
- #include <mach/irqs.h>
9 B$ @) L; v# G8 m: x% e& ^: n - #include <asm/hardware/edma.h>. I6 d! V$ T3 R0 E1 S$ o
: Z n% R$ V0 Q- #undef EDMA3_DEBUG7 ]3 W3 ?5 e/ W
- /*#define EDMA3_DEBUG*// t& y8 q$ n- p5 O8 g
8 l: z2 M! B: H) F5 J- #ifdef EDMA3_DEBUG
4 l& M& b8 m1 y$ z* D6 [ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ W' U1 O' @: p+ @% k' g' \
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ u% @- ]- F+ S+ |
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 Q3 [5 o3 o, M7 {) o
- #else/ \+ {+ x7 j2 U u/ A8 l) X: `( L
- #define DMA_PRINTK( x... ). @# y7 s, S$ U. m3 e
- #define DMA_FN_IN
2 v" F0 i: a5 `. m/ V - #define DMA_FN_OUT
9 E) n. v8 _) n' s - #endif
/ A( V0 o7 O! ?: ~0 W - 4 h3 k: t1 Z" V6 b
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)& }* X% {9 v' ?1 @6 G6 c4 D4 |
- #define STATIC_SHIFT 3
v$ d( k2 v9 [8 ^3 L# a, O - #define TCINTEN_SHIFT 20
; J/ G) J9 N9 G q+ O. } - #define ITCINTEN_SHIFT 21
% \7 @8 F j+ a& f9 E v - #define TCCHEN_SHIFT 22
# o; _! F9 e i- s! T - #define ITCCHEN_SHIFT 235 r3 X5 |6 }9 K/ `9 Q
- 7 }: {3 o3 @+ ^6 e& h6 _
- static volatile int irqraised1 = 0;
; A/ ~3 @: D2 y* W G, C - static volatile int irqraised2 = 0;! {( q9 _/ @* W
- / b' @" J @" k
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 p: Q# _+ M, m5 J - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! a- b4 H- \ {( R3 k9 H/ Z* f
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# i$ G$ e$ }1 O- [6 h - ; P( }% o+ F; a0 D* o! D6 `) n
- dma_addr_t dmaphyssrc1 = 0;
4 M6 I8 G) F4 M* T a5 s" x - dma_addr_t dmaphyssrc2 = 0;
$ D3 g+ R" K7 B8 m# w - dma_addr_t dmaphysdest1 = 0;
( f3 b! E1 t+ R; G' ~1 q - dma_addr_t dmaphysdest2 = 0;" |7 z7 p/ P# p7 F; d% V
- 9 B1 s' c! d' @( ~# ~+ o
- char *dmabufsrc1 = NULL;
# P/ c; H* z7 \) g2 N - char *dmabufsrc2 = NULL;
9 C* S0 j/ X2 T1 ~! ^( f! F - char *dmabufdest1 = NULL;
1 n0 o$ T. ^0 |, H+ ? - char *dmabufdest2 = NULL;; l7 @1 ^5 A& R% z7 y- c. Y' J
: i% D2 S. i- I: x+ h8 v- static int acnt = 512;+ N+ u( M' N8 B. X
- static int bcnt = 8;
; |0 n. D9 X$ R0 x - static int ccnt = 8;4 F$ t- W" ^: S$ {" b
! U( z6 I/ ~( K; ]9 g7 D) z* P* b8 n- module_param(acnt, int, S_IRUGO);$ `; ~ N$ D5 [& F7 ^ Q& X; R
- module_param(bcnt, int, S_IRUGO);
) |' P. Y3 y( l. `4 J - module_param(ccnt, int, S_IRUGO);
复制代码 0 U. Y# c! a+ B/ v
2 ^# S W# g- L; | V! n7 s2 L3 s, J8 B 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% x/ O1 \" b. _9 Iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ A. P9 C3 p$ `5 d 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% K$ E [9 N8 l& h5 N, z2 g
4 B" j5 Q1 X. U7 q- b: s2 f# N# M7 g# f6 ^% y: h! r" F
|
|