|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ @$ c1 d3 B+ [1 K( l5 x- [code]EDMA sample test application
& P) ^# v5 m" r4 M - /*
' Y# F( _( W& h - * edma_test.c
6 |, u2 }0 c. Z7 } x% e7 R! S - *
9 K: h' J$ m! `7 ?) A, M - * brief EDMA3 Test Application5 I# A; ]/ |- P
- *
& w+ G4 D0 l) W7 w8 m* }' G - * This file contains EDMA3 Test code.; Q9 }/ i/ }! t/ v. l) q+ J5 r: I! X
- *. }* {. \. g/ ]: L
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' d* d% B2 @) `+ v
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
% A7 ]- b7 N# m; C* N - * TO CHANGE.% \7 |. e( X [/ A5 e) ~# W! J1 y
- *
# }) m" v0 D, u - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ x' E. t, b' F b, I
- *- A4 H) J. r0 T2 o( J
- * This program is free software; you can redistribute it and/or+ m: O- k) R: }8 J) O$ U
- * modify it under the terms of the GNU General Public License as5 V' N: S) W, G' s6 ~, V
- * published by the Free Software Foundation version 2., d, N1 |% ]) g$ c' A6 A: X6 S
- *0 M4 C6 v# P4 a8 p6 E m
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
, d. x k" c( I2 ~/ q! I - * kind, whether express or implied; without even the implied warranty/ ]; R$ C& `4 {6 t' Z' j" i
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the0 j) y+ t. l9 ]7 v: P9 p, `$ B
- * GNU General Public License for more details.
, o# o6 n( b5 G - */8 x7 o# k3 l9 t
1 E$ i P( H0 O% [0 h- #include <linux/module.h>
' O; M6 M% f! p) [ _ - #include <linux/init.h>
' \# ^) y5 {, P8 v - #include <linux/errno.h>
* y6 A3 M7 w; T) ?6 B3 Q - #include <linux/types.h>
8 O- S6 T% `5 k - #include <linux/interrupt.h>
6 o( S/ v J9 L7 s - #include <asm/io.h>
$ w* I+ K; i! {. B, d - #include <linux/moduleparam.h>, z% \) A! H- v" E
- #include <linux/sysctl.h>
2 Q; ?3 [6 J- e4 m$ z5 e m+ m8 g( U - #include <linux/mm.h>* X3 `# T4 a7 @: C1 ~( Z
- #include <linux/dma-mapping.h>
9 y; ^: t Z1 y- N) n7 Q
4 \. C* H8 X% e4 Y% e) l; q- #include <mach/memory.h>
0 a+ C$ F% Q1 s2 A/ c - #include <mach/hardware.h>( F3 Q, v# G1 \9 ^0 W
- #include <mach/irqs.h>
+ [8 u; D2 q+ j3 v& }# P - #include <asm/hardware/edma.h>
. H* r) x( x' t7 u$ I
- n; O4 {( S9 O0 S, N( X- x- _- #undef EDMA3_DEBUG1 ?" Z) B5 v, q0 N& v) F ~
- /*#define EDMA3_DEBUG*/. ?# R; V2 A5 b8 ~( V
- x9 _: f8 z& X# n- v+ F" }9 ]4 u- #ifdef EDMA3_DEBUG, x5 @' n& G: R3 S/ {. s
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 C9 `8 J( f1 l. G9 g9 P& a
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
6 V' ^0 P% W: H. [* q' Z4 C& q - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__) b7 O' R i0 ]/ d0 M8 G l
- #else0 O N) r) E f9 |( t! U3 k8 k0 u
- #define DMA_PRINTK( x... )
$ {, Q; o4 j5 k1 A - #define DMA_FN_IN% v. V# `: T/ X1 D) F: ~
- #define DMA_FN_OUT% T" z' e. w0 s1 i' m4 U& K: l1 a5 ^
- #endif
3 y$ E# Y2 G5 e* P' b+ @% G
4 m+ {9 ]4 M; C$ w+ [7 }% t* I- O- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
$ w+ v: j8 z0 v: Q - #define STATIC_SHIFT 3* v+ {9 J N& X$ \ N
- #define TCINTEN_SHIFT 20 O4 t8 z6 ~- ]1 W/ u* r3 W M
- #define ITCINTEN_SHIFT 21
. j8 F1 u: u; `. g N1 Q6 L - #define TCCHEN_SHIFT 22; E, n6 ~. r0 _/ }
- #define ITCCHEN_SHIFT 23' ~: ]& g- A" ?' V0 n1 l
, L9 d& Z% v& J2 v+ _- static volatile int irqraised1 = 0;
, p; N1 g( K& p7 U" `) _) A& @ - static volatile int irqraised2 = 0;
' b2 S0 t0 X n5 G5 g5 p
E4 Y6 P& `) \4 A1 Z: G" Q/ H- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 Q* F9 K( N0 g" ]* ` - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ ^8 ~1 G0 x. t* @" e - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* m. ?2 z$ L. o+ u' I
, {0 K7 o8 V6 x5 P1 i8 E: t- dma_addr_t dmaphyssrc1 = 0;) b1 Z+ d; ]; H
- dma_addr_t dmaphyssrc2 = 0;* F* [$ U9 k, s9 G4 U) g% J4 K
- dma_addr_t dmaphysdest1 = 0;
) d/ Y4 |" x2 f( o' J( X1 Y - dma_addr_t dmaphysdest2 = 0;+ B A' b3 g+ R' [. E3 e
- ' |9 R& X9 m! N: w, n% V
- char *dmabufsrc1 = NULL;9 N4 V; q6 g7 S1 K5 G
- char *dmabufsrc2 = NULL;
7 C) M) r. C1 e - char *dmabufdest1 = NULL;2 w/ n/ @8 x. j. c
- char *dmabufdest2 = NULL;
& B! k- x3 P* C) x6 x - - D. w8 n n, W3 k" \
- static int acnt = 512;
" t5 l1 p0 B: ?* D& O2 A - static int bcnt = 8;$ P% h3 p" s( v
- static int ccnt = 8;4 w8 J) _% `' ]* \
- * a+ N9 i5 k$ m# q. d* v
- module_param(acnt, int, S_IRUGO);
" X0 y8 W7 U* M- o - module_param(bcnt, int, S_IRUGO);* a5 M* ^8 r' x4 I* c" u0 q5 e1 E
- module_param(ccnt, int, S_IRUGO);
复制代码
# u6 `5 c; V% M0 t9 A! P7 l1 z" z
( r$ Z5 ~3 D2 { 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 b& A! C2 J+ A* R2 r+ {3 V N
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* s( r& Q2 e% k! f+ o 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* E! T/ }+ }0 ?; |
1 L1 Z$ v& i% U- I
" W1 f( \; o* E' x- |+ p( K& `
|
|