|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 T; n8 h" }+ B8 f- [code]EDMA sample test application; ?! I- i g, p8 l5 I, X; N
- /*
0 M, ~8 J$ Z) r1 M4 N - * edma_test.c
4 c7 P: n( u& @ }8 P! [* `/ R - *0 T# b" T( P& T# S. h4 o
- * brief EDMA3 Test Application- X" w3 P: n7 i O
- *
$ u+ W5 M$ Y z, g+ |$ ^; ^ e - * This file contains EDMA3 Test code.! H i! j$ ~& @& {2 \5 X( z
- *8 @8 {4 N. x8 {6 I
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
# K. S) [+ |5 n6 D) Y. ` - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 a1 t: A+ o4 Y. j
- * TO CHANGE.
5 N- H( e) C% \5 ]* `" V I - *
/ k0 A2 P" N8 v' W. R7 H( w# J" Y - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
3 H S6 X% f+ b/ ~+ f) w5 G - *( D- G/ @2 k! K' E5 r
- * This program is free software; you can redistribute it and/or+ x( ~4 z2 d: B \7 u# R5 X
- * modify it under the terms of the GNU General Public License as9 h$ j# C9 D+ B- c
- * published by the Free Software Foundation version 2.$ z7 B- \: v7 `# T! |0 [
- *
2 P8 a! z) z9 g - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
1 U( A. i) a$ w2 \! ?% C - * kind, whether express or implied; without even the implied warranty3 ?$ o$ z( s1 g# \* e& T) {
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ h( j% z. B& d( c8 w; P1 }0 | - * GNU General Public License for more details.* z% T0 A; w7 R% t. l
- */" d* v/ u( q* B( E9 J( R; Q. I, U
- 7 P% T# z* W/ a9 \2 W
- #include <linux/module.h>
- x/ R8 o6 |1 q( O2 k: @. `7 t - #include <linux/init.h>% S( H) L' U/ J. E, C! [8 j3 t
- #include <linux/errno.h>8 N& z: ~. q2 u% a
- #include <linux/types.h>
! `5 P" r7 y7 ~, f2 N% p - #include <linux/interrupt.h>. a' G( M1 P& {8 J0 a7 V
- #include <asm/io.h>9 m3 E2 p9 D0 K5 a" u
- #include <linux/moduleparam.h>, o$ K& v6 q4 K( E& j+ [
- #include <linux/sysctl.h>
6 Z4 H' n: o8 Q1 U$ D! g' k5 ] - #include <linux/mm.h>% T# \4 q, J6 s0 C# l0 H. R& Z6 i
- #include <linux/dma-mapping.h>
5 _/ s# E! s9 e6 h3 t - 1 u9 a& h3 D; \
- #include <mach/memory.h>$ y3 c" K. E; K1 R9 N
- #include <mach/hardware.h>
3 ^ I& y7 f. v1 J4 M7 V# W - #include <mach/irqs.h>
4 F7 h# r' m; f, u) p - #include <asm/hardware/edma.h>) T6 [1 o( n! e. B O
- # h0 c' A# v. C" O* c
- #undef EDMA3_DEBUG
5 h6 T: z& f& [% V5 Q' ]+ } - /*#define EDMA3_DEBUG*/7 a* o2 y/ q }8 g
8 W1 O' h$ |9 s) Y& n' d- #ifdef EDMA3_DEBUG
2 Y% m. v0 E2 A# N - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 l0 w- ?2 F: N7 l8 t
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! F4 l' P- ^( j/ b" Z
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
' C1 y# t, A/ B4 T7 x: r - #else7 I0 A- e" Z6 S1 I' ~; K1 p
- #define DMA_PRINTK( x... )
) m- V4 _) b6 }2 o& z - #define DMA_FN_IN
7 U! Z" {/ i% a" u1 P; K1 A- x - #define DMA_FN_OUT
( @* D/ S- B: M( s [ - #endif6 |& h% j+ T6 n* A
" i/ f% [: q1 {7 E- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
8 ], B3 q) t w, [) ?% S - #define STATIC_SHIFT 3" z3 U' @+ @4 f% l
- #define TCINTEN_SHIFT 20* x0 q7 d6 t4 k
- #define ITCINTEN_SHIFT 21 ?1 l3 a( o$ _) \7 c3 q- z
- #define TCCHEN_SHIFT 22" u" R3 a7 R5 i% w w# `4 G
- #define ITCCHEN_SHIFT 23
* M5 P$ F3 m2 Q, w+ Z0 h
4 b- @) E/ S; f8 }: `4 c- static volatile int irqraised1 = 0;7 p* u3 q( v" b e
- static volatile int irqraised2 = 0;0 O/ u8 r1 O3 {
! _8 j$ r$ C# ]5 d3 a' b( Q' H6 M* H- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' A2 |8 Y3 T5 S1 L3 V4 e8 I& r - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- i( f6 E# S1 O# F - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ J) A" ]9 t" h5 w- W& n1 Y - 7 j5 h1 p; m$ S9 T6 o7 S' I, R
- dma_addr_t dmaphyssrc1 = 0;
; I- y) b. k1 n, q* a - dma_addr_t dmaphyssrc2 = 0;9 n7 l; E1 k( c
- dma_addr_t dmaphysdest1 = 0;
! Y( h4 Y; v" q' C4 M - dma_addr_t dmaphysdest2 = 0;
: G0 |! T* M+ i8 ]. t* Z( ^ - & e: M' U2 ?7 E$ z3 \, N a) h6 V
- char *dmabufsrc1 = NULL;
4 T7 t, R' j2 b; W3 k* e0 u% ]6 x8 n - char *dmabufsrc2 = NULL;
4 `7 G0 T" F: [. ?* X( D' Y - char *dmabufdest1 = NULL;' u8 l& ?; r* O8 I/ ~- P! k8 i2 L
- char *dmabufdest2 = NULL;
8 p* A6 E# {+ d. X - ) [9 Y+ W7 h9 }& C
- static int acnt = 512;
$ ^9 l+ T# T% n Q, E) Y7 j0 R - static int bcnt = 8;
" m0 D8 n6 S; t- t2 g7 O* a - static int ccnt = 8;; R: q, h# u" k" X: N
- # o; _, V G3 k
- module_param(acnt, int, S_IRUGO);2 M; v! g! b& }* ]
- module_param(bcnt, int, S_IRUGO);/ z V' d5 D I0 h0 F& H6 m
- module_param(ccnt, int, S_IRUGO);
复制代码
: O8 f/ H, N0 B' A5 p, B2 p+ w7 I; v( M1 m; _" J6 s* E
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: v# c. c! c$ t( z) Uarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* } L( b; t# `# W% _
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* j/ H8 _ q/ p" q W. L
; e8 [" { t6 n* ?" C3 h- a7 I( z3 v" `: y( W
|
|