|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( i, ?8 I) W4 ]* o3 _
- [code]EDMA sample test application
, ]& H" O: o/ P2 a - /*
- z/ f( }6 L4 _8 v - * edma_test.c
" ]2 P! K& h3 R6 q - *
8 F4 ^1 N9 h/ S( g% X2 |- Q: U/ A - * brief EDMA3 Test Application* c7 V+ N0 }# y2 j* |$ J
- *
}3 V, N: m, M - * This file contains EDMA3 Test code.
, U3 H9 K' B& J& n: O - *
$ o9 s, ^9 _5 s$ [3 B0 v - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
K- e$ F( q! }# E5 s - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT X' N* S( `- Y/ N! r0 h
- * TO CHANGE.
) R' `% G; K6 W5 {% d* j - *; R& }2 r+ q2 A9 ]7 |
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* [% r8 T8 o; Z# ^8 s6 J( B! @
- *9 b- F# y; `# ]1 `
- * This program is free software; you can redistribute it and/or, Y' f: E4 }) e( J+ H2 W" d
- * modify it under the terms of the GNU General Public License as5 w% O: s ^) |9 X( l( u2 l% T' X: }
- * published by the Free Software Foundation version 2.
' e- p" @: a0 i8 M+ g: k& t+ n - *& q9 K. r# l) I- a
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
( @1 F& k! O& ] F' P( T - * kind, whether express or implied; without even the implied warranty% O8 I: }" i8 |7 F1 I' d
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 o% s$ p' F: Y9 t* ~0 C! ? - * GNU General Public License for more details.
; T; A0 ^8 u4 c2 {; Y7 Y; r - */) j+ d1 E% t. i9 D. {7 @# o+ T1 b
8 H9 k, l/ v/ N* a% B7 p- #include <linux/module.h>
P4 n9 U# L. k6 }0 Q - #include <linux/init.h>0 X$ j0 \/ b3 K6 v
- #include <linux/errno.h>) Y# I$ S7 _9 }/ \
- #include <linux/types.h>
0 r2 ?0 L3 Z7 s - #include <linux/interrupt.h>4 P9 k8 w: D9 b' n
- #include <asm/io.h>; D6 z; M, u- p K0 o
- #include <linux/moduleparam.h>+ _% B9 N! s+ J1 E$ q/ d
- #include <linux/sysctl.h>6 l9 Z, j- ?& {5 T9 ^
- #include <linux/mm.h>
5 _" M; L' o3 z) g7 E9 N - #include <linux/dma-mapping.h>8 d3 A7 T4 Y# i. U: ?- @8 j
& d7 }! k- w5 ~4 n9 E& J% S/ t5 m- #include <mach/memory.h>; O+ {/ V. t f. ^$ ~/ c8 T1 Y
- #include <mach/hardware.h>
/ T, R( o6 a5 {' n- f. v - #include <mach/irqs.h>
r T# R0 S1 H. c5 i7 S8 _& u - #include <asm/hardware/edma.h>
# y2 |) z# k, w; C, U8 C( A c+ V
5 v) U- `+ p# r- #undef EDMA3_DEBUG
+ r' g- s% F2 K' _- | - /*#define EDMA3_DEBUG*/
. U' e! {* }, s1 @! ^! w9 t4 Q - 8 |9 K8 J" G* D. D( K
- #ifdef EDMA3_DEBUG
7 e( H1 {. N7 Y, P6 I - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ {; N2 }: F) `2 K7 c* {
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
# P8 X3 m/ X; M" a8 n. M - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
/ p! J0 V9 L& w - #else2 \9 q! I0 r9 d7 S
- #define DMA_PRINTK( x... )
B' N+ H3 E6 I" W* k: R( E, S - #define DMA_FN_IN
5 Y" a2 T @' e/ W - #define DMA_FN_OUT
* o/ D+ b% ^) K# A3 G T$ T - #endif8 o$ ]- M0 k0 t8 j1 T# S
+ P5 ^/ g; l! E( e" L& k$ |' I% y' H- #define MAX_DMA_TRANSFER_IN_BYTES (32768)" k; l7 h& Z5 T) K/ h7 {: Z4 `
- #define STATIC_SHIFT 3
( P! ~" x1 ? p o2 P. z9 I8 F - #define TCINTEN_SHIFT 200 z4 r6 J" x! q
- #define ITCINTEN_SHIFT 21
3 d5 y# e5 f6 J - #define TCCHEN_SHIFT 22
( Q2 F& ^' D+ P5 G( e - #define ITCCHEN_SHIFT 231 x4 t3 O- R9 x* y
- 8 O( l! Y# b9 b# [2 h
- static volatile int irqraised1 = 0;: l( p* ~ f7 O7 T
- static volatile int irqraised2 = 0;# g( `; r& X, `6 Q* H2 `
- * F. V. F4 Z% t% U* h, T
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( c; P2 N! {! }2 p b
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- ^0 M3 y' P* p; E- s# O! k) w; o
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: b% {& J1 S& [
- ! g! o; Z: K T
- dma_addr_t dmaphyssrc1 = 0;
9 L# t6 u/ O' _5 M% [ - dma_addr_t dmaphyssrc2 = 0;
" ~/ W9 j' v' K w - dma_addr_t dmaphysdest1 = 0;& a5 O9 X! g; Y, N
- dma_addr_t dmaphysdest2 = 0;& H7 L3 j0 c) r; E2 v3 O
- 0 [: }7 v5 D" U0 ^$ S( ]3 U& I0 H
- char *dmabufsrc1 = NULL;
" h) u6 i+ {) x0 n# e; Y7 Y b% Y - char *dmabufsrc2 = NULL;' u# j4 O. f$ }
- char *dmabufdest1 = NULL;
* [/ W5 T0 q6 h! p, x5 Q - char *dmabufdest2 = NULL;
& `8 ^/ m2 [# ~
- h5 s8 v- h1 G/ V& z/ w4 n! ^- static int acnt = 512;
) Q+ j, N: ]8 E9 a; C" ~ - static int bcnt = 8;$ V! }% j0 @0 z" i# c& Z
- static int ccnt = 8;
$ b3 D o& d$ V* a9 F; I - d3 B! c1 n9 m1 o) K
- module_param(acnt, int, S_IRUGO);2 D8 \7 D3 C. @ l
- module_param(bcnt, int, S_IRUGO);. a: ~3 G" g1 ~) {
- module_param(ccnt, int, S_IRUGO);
复制代码 + y& f; K3 m q- l _2 r
4 M3 l6 Y& G$ c0 @5 } 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 B$ a! o6 L: O Z( Q8 p" {
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。 k7 G# ~. h% ~. t# R8 r, X
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ e2 W. i; B! K# }# s Q5 Q& R
+ M Q' z5 E" S6 F. b" k7 c4 U9 z' F2 m1 U: E* j+ {
|
|