|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) K, R9 ]8 f% T7 |5 N* \7 g0 j0 S- [code]EDMA sample test application
" D6 {1 J" [9 Q* C - /*
7 G2 C9 l" f6 q; P1 p, S! | - * edma_test.c
. M) J" C8 ^& K; q; B - *; M, Y& a; v5 ]- x
- * brief EDMA3 Test Application
$ J& e, y4 l! C6 W. F - *, b# P8 o: J# C9 R5 @, `
- * This file contains EDMA3 Test code.
% D6 d& A! R+ B5 f+ w - ** Y. e$ N1 k" {4 ]
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
; C) l$ [6 i/ T - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
. l. v/ `& [( x5 x3 @6 v: N9 K - * TO CHANGE., P2 v5 z( U2 m
- *
1 u7 f1 f' G! g/ l - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
' Y1 n7 t' H/ d m. T0 o1 M - *7 f/ ~) ?5 G5 T3 N' ?% u0 {
- * This program is free software; you can redistribute it and/or: R/ H/ L4 J7 r2 d- a
- * modify it under the terms of the GNU General Public License as6 i: N# n$ i0 t3 P5 c' K
- * published by the Free Software Foundation version 2.. S; p) D+ J. D* N% W3 Y6 u0 s
- *
5 y) I: \7 D0 p, |' w - * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 c; @$ D1 ~- g9 H; s, _9 S
- * kind, whether express or implied; without even the implied warranty+ P4 d9 S( V+ S' X1 @
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the* v# c* i* N! `6 A" B
- * GNU General Public License for more details.
2 t- X4 g) A- K; m& u - */
+ j; t( S& T: D( p1 w) _4 ?
0 ^' P1 z8 {/ O! i$ m6 _; m- #include <linux/module.h>
0 v" j- J7 T3 b& ]- y - #include <linux/init.h>
% n: K3 ~$ P& I4 {3 a$ e( A8 A - #include <linux/errno.h>
8 I& a. A+ {- u5 n3 P# n - #include <linux/types.h>6 |! y, ]7 d7 b
- #include <linux/interrupt.h>
- k5 l$ u7 A( k5 g - #include <asm/io.h>
! d, ]+ y, @7 A9 P' `2 r1 { - #include <linux/moduleparam.h>3 w( y' f5 F7 E' J( W/ {/ n
- #include <linux/sysctl.h>
[9 v V1 G5 {& } - #include <linux/mm.h>
% y; h3 L& m' k; J( e' v: @ - #include <linux/dma-mapping.h>
$ M! }# A1 D+ |- l+ x - - L) g' x- d. J" l! b E; @
- #include <mach/memory.h>
+ b* p0 ^$ R7 c+ g2 p; h6 F0 u" M; r - #include <mach/hardware.h>, u% d' N8 O# O
- #include <mach/irqs.h>( c( I! H. H4 ^& B- h9 I
- #include <asm/hardware/edma.h>
) @. h8 p [' w. m - 8 a: o1 z: z% w
- #undef EDMA3_DEBUG
" [: y) W" A1 M8 m - /*#define EDMA3_DEBUG*/$ \$ a- J* M) z# `% D$ n. o
0 o+ t% p) t, ?- a- Z1 r" p3 ?- #ifdef EDMA3_DEBUG( @7 O& o% f6 v( T6 M
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) y* j- Y) L* d
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" d3 n0 z! B2 s2 h- H* z" `
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
; N% X) Z7 a$ I - #else
+ u! t! |! |% {# G) t; { - #define DMA_PRINTK( x... )( t+ D. v; T; C5 m0 ^
- #define DMA_FN_IN- E" t5 K9 N( G5 v0 s) Q6 L
- #define DMA_FN_OUT
6 n; A5 ?- ?6 g# r- j: q- j4 R - #endif3 U8 B. Q* j# l2 N7 @7 a
; {( N0 V0 d( n3 ~% o- #define MAX_DMA_TRANSFER_IN_BYTES (32768)3 z6 R, ]4 Y+ d% w6 M% {
- #define STATIC_SHIFT 31 c( a9 n# c0 H- ]0 \
- #define TCINTEN_SHIFT 20
3 m" a5 G% o7 f, h( z$ p' k - #define ITCINTEN_SHIFT 21
) l8 F" K1 B' S0 K# d" W! k- b - #define TCCHEN_SHIFT 22
5 ]* h8 Z4 T5 z- i - #define ITCCHEN_SHIFT 23
9 }3 M3 s" H4 ^# v
+ W# K& N) n. e/ M5 b3 L( B8 L- static volatile int irqraised1 = 0;
* @* {, c! E% B) u0 }% y3 _- M" y - static volatile int irqraised2 = 0;
$ P3 v3 t7 b/ {( \
) g, u1 t; P$ R' R+ x3 s/ u- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; F- Y5 f2 `8 x& L - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 x) H, p8 k8 s# v0 ? - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 j4 t' l( U, H; D2 ~
- & }2 h$ U, x# s9 a9 P+ ?
- dma_addr_t dmaphyssrc1 = 0;
" @7 X- W: t, ` - dma_addr_t dmaphyssrc2 = 0;
5 j2 x" S: x+ R- h& g - dma_addr_t dmaphysdest1 = 0;
* U# H2 h: e1 o2 U - dma_addr_t dmaphysdest2 = 0;
! n( r) _. k/ e I2 @( H8 m - ; Y M5 N7 P/ \, o, p5 p
- char *dmabufsrc1 = NULL; O: U" _7 o; u/ i
- char *dmabufsrc2 = NULL;
: b0 V+ g3 |5 h8 E3 D - char *dmabufdest1 = NULL;
( \0 Q2 F# Z# J" I: n' y& p' ] - char *dmabufdest2 = NULL;. X* v3 D( l& b9 q5 C2 @! R
- 1 G3 m. j4 i4 h, T# N7 `! X' D
- static int acnt = 512;
7 c: v. p8 `2 g/ z. t* y5 p. b - static int bcnt = 8;& ]6 z" _4 g. P4 H, h. g0 S
- static int ccnt = 8;1 n3 l1 d1 y+ f& I& F6 ?
- ) ~) }* Z1 k' Q* f. d1 v+ D
- module_param(acnt, int, S_IRUGO);, W* I2 ~# U6 B }) M
- module_param(bcnt, int, S_IRUGO);
9 H$ ^0 v3 L& @9 \! n* A" E - module_param(ccnt, int, S_IRUGO);
复制代码 " D7 K3 f- H$ e- D
9 c& k/ i. a6 F4 \$ v" _) Z6 Z
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' S) k0 q7 K+ Qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# x+ c8 F. h- K; _( Q8 c% d$ M
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' ]6 k$ R7 \& v8 W$ h/ [# T' z t0 b# @: \( `1 [
J* J# Y8 S. ?: U0 ?
|
|