|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * n3 A' L! r' h$ M# R. Z, h
- [code]EDMA sample test application
1 {: @% [1 @3 ]+ H5 ^( o7 F - /*8 p+ C I" {4 Y- P: i/ y
- * edma_test.c
: Z. ?% r/ P" T) P% ~ - *
2 W) l) c5 m4 ~2 v i* t3 T- b - * brief EDMA3 Test Application, r$ _& i) q8 K. a9 M4 ~5 P
- *
- T8 G6 o) }6 L+ T3 k - * This file contains EDMA3 Test code. B# G- r3 F& h4 y! C1 U! Y7 Y8 V
- */ B( L( O1 q3 T4 F1 @
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ S6 e. Z0 P4 U$ g7 }
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
9 i7 O% P2 ^ V2 L: c& T8 s9 Y - * TO CHANGE.
9 t9 a, b0 O" a% J6 L8 G# B, z - *7 i0 c9 Q& q8 r: ]5 q+ T
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
f" K& @3 ]2 @4 N4 m - *
: O5 F' i: T+ u y, `9 G6 f: J - * This program is free software; you can redistribute it and/or
+ R5 _7 y' l2 F - * modify it under the terms of the GNU General Public License as$ H) k3 z; E( l, f+ W
- * published by the Free Software Foundation version 2.
6 P9 ^0 a: @7 }% `4 F - *
$ d* s& }! ]; }% L4 s - * This program is distributed "as is" WITHOUT ANY WARRANTY of any% f) @. K3 I- _2 O
- * kind, whether express or implied; without even the implied warranty5 b4 L* q$ }% g
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
( ^5 ~& x) \4 L - * GNU General Public License for more details.5 q* Z& R' q8 A8 u
- */9 [1 m3 Q6 r8 ~5 O8 l9 Q
- + ~; s; F8 K$ W2 d+ n6 ^$ k/ ^
- #include <linux/module.h>1 g6 A+ g0 q+ s! R3 p
- #include <linux/init.h>
! C% g, Y; f: B# u/ x - #include <linux/errno.h># h; _% \& G( R. q7 m e
- #include <linux/types.h>/ w4 z2 k) j% x' R9 |+ G
- #include <linux/interrupt.h>
- B3 O- l( u8 s) K - #include <asm/io.h>
' S+ u. _ ]3 P$ w - #include <linux/moduleparam.h>
* ?: \! V9 I4 x/ e# k - #include <linux/sysctl.h>
. q) e' [/ K* X/ R' g, G. e7 p: l* |: a - #include <linux/mm.h>6 p9 Z! B( O c. c
- #include <linux/dma-mapping.h>
* l7 T4 B+ H) U2 Q* P - $ u6 |0 m0 j9 z
- #include <mach/memory.h>
8 }" O: I2 J2 w/ X - #include <mach/hardware.h>6 \: C" @3 r7 L W1 `/ a3 H0 P1 [! K
- #include <mach/irqs.h>4 W+ Z: a# ]9 ?' B) a
- #include <asm/hardware/edma.h>+ J7 Y' e) v, N5 X
- % G. i) M& B9 n+ d+ T! F/ {2 E
- #undef EDMA3_DEBUG+ D' E7 v: Y" Q, w9 E, H6 B8 ]5 B
- /*#define EDMA3_DEBUG*/
. j% b9 R8 A! w. z0 _# v* ^# X0 p/ T - Z' ]& R. }* G6 x* K( R: [
- #ifdef EDMA3_DEBUG' c" _4 \7 r4 Q2 f
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); Y0 u- @: i7 C* T% m
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ U, ^0 G: K% Z; ?& C
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- `7 {& y8 _+ |8 E$ D# ]
- #else) C5 |9 d3 k) g) z' t1 e
- #define DMA_PRINTK( x... )! V8 Q) V( C) T% v4 }: c$ m* M
- #define DMA_FN_IN
9 h. y2 |& L- P" {3 Z6 Y - #define DMA_FN_OUT6 L/ \7 u9 \% y4 X
- #endif- z' C+ B! N& }! Z
! J3 E3 ? z/ C; P0 U) p- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
- O1 C) M1 o) E9 z - #define STATIC_SHIFT 3! Z( v7 b6 \, d- a
- #define TCINTEN_SHIFT 206 K+ M( _+ K- C& t
- #define ITCINTEN_SHIFT 217 q1 p: N, d' A0 n
- #define TCCHEN_SHIFT 22' N, @1 h$ H: t7 c- C( R
- #define ITCCHEN_SHIFT 230 q- R1 L! D' y ?8 c1 ~
- % m1 q# t. [) I2 F l9 T* G3 M1 a
- static volatile int irqraised1 = 0;
0 R3 J5 i( d2 i4 N' d2 {" _ - static volatile int irqraised2 = 0;) ?! Z! M- v. v$ N- _/ T; c
- 3 n8 s5 b' Z" v* X) p) d, q
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' @2 H) q9 c2 |( c4 p$ d
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" F' x1 B- Q+ [$ J2 ?3 t& x - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 q' ]. C D6 b7 N# e$ ~* i - 8 R" O H* w/ }3 K! t' ^
- dma_addr_t dmaphyssrc1 = 0;
/ f" _6 T3 @( l) s# f - dma_addr_t dmaphyssrc2 = 0;
+ k; J: R6 q" l - dma_addr_t dmaphysdest1 = 0;) E, P4 S2 I- O. b7 w; q
- dma_addr_t dmaphysdest2 = 0;) s' x+ V6 \0 k7 q6 ?
- ; X! l9 r4 I$ L2 y/ C& h
- char *dmabufsrc1 = NULL;! Z* a2 ?7 M5 H9 O) M* S
- char *dmabufsrc2 = NULL;
* Z, k/ {8 |) o" i& n - char *dmabufdest1 = NULL;
7 G$ @5 j3 E" J9 g1 e - char *dmabufdest2 = NULL;2 E d* B2 S4 j2 K( C0 L
- - w, |* O* m( g4 E S
- static int acnt = 512;; h0 p6 e4 ?/ y" {( u* B: [! B& z
- static int bcnt = 8;
9 G6 q4 ^$ u! x- n9 l9 G# [ - static int ccnt = 8;! n6 y! W1 r8 K" V; o
% c* F3 Y0 n' r3 [$ H) Z1 O7 _- module_param(acnt, int, S_IRUGO);2 U3 K3 D4 u% [) | @, D
- module_param(bcnt, int, S_IRUGO);7 W- g- d. M5 w" ^8 U' A6 o3 i
- module_param(ccnt, int, S_IRUGO);
复制代码
7 b2 L: @2 w, g% R2 Q( A
7 q7 F% V6 M# C 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 J1 M* l) |1 z# r. E6 _
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 l+ u3 @) h5 |5 c8 N- q" m
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; a- j9 ]. |" F/ b
& L0 E/ j# C Y4 ~9 t
5 ^+ B T( T& u) h |
|