|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - _8 w$ n5 P, a7 _4 I4 \0 a. D9 U
- [code]EDMA sample test application
u, e% e# i+ U, d, o - /*/ f% N2 r4 d) n0 A" O8 b9 q
- * edma_test.c% z$ m" a9 L$ Y: ~9 `: b. F
- *
, e# ]$ K! @* g( w* m( B - * brief EDMA3 Test Application
" L) J B+ ^, d8 Y: U8 a* P% | - *
! H* M6 b4 t) u" u* N9 p - * This file contains EDMA3 Test code.
( g3 C& x, }6 Y+ s0 p( Y7 P - *
9 k$ d/ I4 D/ \3 V: r+ ^" \" r! {. _- E - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ a" b" p2 O0 ~8 m
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 p; Q D* J+ Y# g( t
- * TO CHANGE.
' m' L" u. |. K$ A, K - *4 A7 W- c5 s/ T5 i8 \! ^
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& N& Q) ^& M/ m3 {- U
- *
, Y* p* D( p$ U3 j4 Z# k. q* G - * This program is free software; you can redistribute it and/or9 X' Q( t8 z8 |2 M5 G/ x8 |. J
- * modify it under the terms of the GNU General Public License as
) l! v6 q- B) N R: u7 O' @ - * published by the Free Software Foundation version 2.) s. [9 |; H( f; n5 y3 |
- *8 Q0 J" v8 s2 G k
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
: g7 Z8 R6 N2 ?7 M: a - * kind, whether express or implied; without even the implied warranty/ y+ w# b0 B* `
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% r3 ^' H* H# [, ~) I - * GNU General Public License for more details.
* p; w) _1 { I2 t" x* A. o - */: ]! O7 E2 o; J8 Y* \2 w
5 Z9 U: Q' G7 o1 g2 f6 @- #include <linux/module.h>2 O' s% l# \* G. l5 ^
- #include <linux/init.h>5 C) ~, a9 ^* y T) S0 H* x4 W
- #include <linux/errno.h>+ t) C+ l& Y/ i1 f4 K3 t% m/ B
- #include <linux/types.h>. Y! m0 u8 i3 s7 V
- #include <linux/interrupt.h>( z( e6 ^8 L4 t! n7 P9 w
- #include <asm/io.h>" T; E' v$ {7 b. T+ r; m
- #include <linux/moduleparam.h>
3 U7 r" W- u( Z" [7 p; Z - #include <linux/sysctl.h>
) e) K* l6 \1 C$ f& e - #include <linux/mm.h>: L: C! B% { A( b) B5 n
- #include <linux/dma-mapping.h>
+ K8 E4 @+ d' ^+ w# ?: a - - {3 {& f V% b& s
- #include <mach/memory.h>
) F. i8 v+ s: B7 b1 v - #include <mach/hardware.h>% U6 j# f8 g# P% D6 e; q- L
- #include <mach/irqs.h>
* j7 } s& ]8 P: u - #include <asm/hardware/edma.h>+ U/ n/ s; P$ }- F
- : ]% Y) w8 N. \) i7 X9 }$ ^) I3 o
- #undef EDMA3_DEBUG
6 v6 F7 r0 D9 \ - /*#define EDMA3_DEBUG*/* E4 u. e5 B: Y, i1 [$ w
- 1 G* _. h: ?8 Y3 w
- #ifdef EDMA3_DEBUG
2 i5 m- D4 F% }5 Q8 H( r - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
3 Z1 ^6 w9 A6 l3 B - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). F4 l" H9 ~* T
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 Z! E. u& r- D/ t: X: e2 s7 ?
- #else4 g9 Q/ z8 Y3 @$ r0 Y2 N- I' l! w! w6 ]
- #define DMA_PRINTK( x... )
8 B5 Q" U$ I! l5 G' Z% ^3 r% } - #define DMA_FN_IN
+ V8 h4 g' `) @; N& H7 O - #define DMA_FN_OUT. f$ M o- c" w! X# F+ K5 K
- #endif" ^3 Q! Q& u" r5 u
5 Q( w( _0 p0 a0 k: ^- #define MAX_DMA_TRANSFER_IN_BYTES (32768)' E; Z/ S7 I. e# W: t
- #define STATIC_SHIFT 3
( s( S8 c; [, t5 D+ P+ ^- w - #define TCINTEN_SHIFT 20
) u0 ~& O' ]2 y' [: v+ [2 ~4 h - #define ITCINTEN_SHIFT 21! t) T, @" J/ K* \6 n
- #define TCCHEN_SHIFT 223 X7 l4 ?8 `/ p" e. i7 a% F
- #define ITCCHEN_SHIFT 23% M& r' ?6 y" \8 L* ^9 N& |$ X
. s( t) A: P, c: G! G; z4 g- static volatile int irqraised1 = 0;
; u9 Y4 ^# r" j, M - static volatile int irqraised2 = 0;
) t4 Y7 g m* @* R4 g& a
, j' B. G* P" l5 U) i- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: V# H P: F( A1 D! X+ I+ O5 x6 s - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 n) F5 q$ W. e6 L+ t, N- b
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' b" J+ N* l% N0 [ - 0 K( r- |% h, L4 R* D/ _9 Q; v$ i' j3 Q5 \
- dma_addr_t dmaphyssrc1 = 0;
" ]5 H8 i- o- t% g! u* ] - dma_addr_t dmaphyssrc2 = 0;) v; ]: }# C& T6 b
- dma_addr_t dmaphysdest1 = 0;9 U, @$ t/ x, B
- dma_addr_t dmaphysdest2 = 0;
- @# B7 Y/ ]' l5 Q0 v' L, j
0 s$ f6 ?; H) U6 Q: R- char *dmabufsrc1 = NULL;
f0 B: K: }# J - char *dmabufsrc2 = NULL;5 I4 L# ^$ y2 Y9 {0 g( D
- char *dmabufdest1 = NULL;
0 H# K8 x2 g! ? ^0 ]8 f; l2 w - char *dmabufdest2 = NULL;
0 F5 M. U( P" t( \1 ^0 v$ @' D. h - # T+ ^+ i0 s0 C
- static int acnt = 512;2 s# M) d$ J4 {; T: T
- static int bcnt = 8;, R2 a+ G6 @& o+ [
- static int ccnt = 8;
) x# a& }6 B+ q - 5 {, O+ i) ~5 }! @5 _
- module_param(acnt, int, S_IRUGO);+ }4 d% }% m. A$ l
- module_param(bcnt, int, S_IRUGO);
5 G n) s: y( Y1 M0 [ - module_param(ccnt, int, S_IRUGO);
复制代码 % Y9 G; z2 s& [( Q9 Y
4 I/ w& f8 J7 v7 _/ }0 \- t
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& A, s8 s$ \( j1 V
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# K2 t& F$ z q0 p. x 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 ^( U7 T) ~" {* V& n) V" M
0 h7 ~* A3 e1 I m w5 {
8 R# L$ \# N t, a) i% `% N" G |
|