|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & j& \! s6 G2 S, @5 V, k, ~
- [code]EDMA sample test application3 J8 ~8 X5 K; v% p6 R, L9 n7 D
- /*7 x. H! D1 F8 r9 F4 u& g! K: m
- * edma_test.c
( a3 C2 [$ g% Q. D - *# P5 d9 E7 s [ E, H- H
- * brief EDMA3 Test Application
( P% q" u, A5 e# i c8 A [ - *8 R) r( S' B0 O: k- E
- * This file contains EDMA3 Test code.
I( h9 h) h* C& n2 ~ - *
( u4 l( j* L9 ^0 K - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# W9 b0 y& J: G7 d
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
+ V5 M% X$ V3 z+ B4 T4 L - * TO CHANGE.5 c( u2 E" W0 [ ]7 P. ]! s; p
- *
" j, Y) j t' m) \$ a - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 i9 k5 I. {5 ]4 E ^+ ~! M
- *1 Y( J1 i+ ? q0 [0 ]. y9 k
- * This program is free software; you can redistribute it and/or
' }' w: o5 E3 r4 n' b3 t% ~ - * modify it under the terms of the GNU General Public License as
0 l% a2 w% c' d8 |2 @" ~# S; {. y$ Z - * published by the Free Software Foundation version 2.9 d8 w' _8 `( ?
- *3 n6 h) U6 J/ _8 K( `0 z
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
: ?5 Z0 @9 j8 a' ] - * kind, whether express or implied; without even the implied warranty
8 I, D2 k" k" t5 k* S - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 o6 q! S) K6 Q+ R% U% i - * GNU General Public License for more details.6 W: f3 `: k/ A( R0 ~* D0 h
- */
+ A* T' ]0 h& |2 r1 f; ? |4 N
9 u# l* i, L" c! a/ z6 S$ f7 v- #include <linux/module.h>
+ ~8 a. o m2 x& V: f& b: _# b - #include <linux/init.h>
8 R. x$ J7 Q4 r2 X - #include <linux/errno.h>
% J1 K6 ]" Q, @, i, t% n; [7 o - #include <linux/types.h>
: J! P2 Z/ i& D, K/ m - #include <linux/interrupt.h>) h# ] T7 X. P# P9 A+ M
- #include <asm/io.h>
2 A! I: j2 P! d, J - #include <linux/moduleparam.h>! w7 Z) T7 r v. o
- #include <linux/sysctl.h># v/ n }9 l3 a3 Y
- #include <linux/mm.h># f! N9 x; V7 ]! }, n4 a7 T
- #include <linux/dma-mapping.h>
- M6 ?# `7 I5 w6 E4 Q
) B9 c8 t" M Z" k1 G6 Q5 W- #include <mach/memory.h>' u1 j# z- G1 k/ `) g6 V
- #include <mach/hardware.h>; Y6 T1 C0 y# `
- #include <mach/irqs.h>" z6 L, u! c+ J, ?) E# o% ]% ^( F
- #include <asm/hardware/edma.h>4 D! j: D* Q/ t4 p2 l6 Z
- 3 l9 @+ h! Z( D6 J
- #undef EDMA3_DEBUG
$ n$ E; l8 J/ x( q1 t - /*#define EDMA3_DEBUG*/
% S: O" F; W' |. T
; I& E; n: U6 ?$ c- #ifdef EDMA3_DEBUG, q, i- p4 B- h% \
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
; C6 E, k" B5 |& @1 I - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): g& U! ?1 ]% U/ [
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% O* U, J7 ^- P
- #else
( g* v2 \" }, S - #define DMA_PRINTK( x... )6 G9 N9 _+ S4 D" A9 H
- #define DMA_FN_IN
& K5 @% |/ C8 R! I3 D+ z8 ] - #define DMA_FN_OUT! Q% G5 u% q4 {; I4 `
- #endif6 c. _( B+ u# F' m: \
- / Y; w: ^. c3 N, C/ ^, S# o% p
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
! c5 V# R# ^6 c8 I1 J# a& U8 P - #define STATIC_SHIFT 3
2 D R$ W. Z- F b+ z1 A - #define TCINTEN_SHIFT 208 F) Q/ P2 H l) d2 C6 p( ]) A
- #define ITCINTEN_SHIFT 21+ J8 s6 d* h# c$ o* p: t/ R
- #define TCCHEN_SHIFT 22
4 v5 Y$ Z$ ~) j! @ - #define ITCCHEN_SHIFT 23/ o( M2 T- A/ r. S t
3 `' M" r( K8 ?4 i- static volatile int irqraised1 = 0;+ ]& `8 R5 q0 f( n- D0 G' s
- static volatile int irqraised2 = 0;
7 J0 ^. {. ?3 C9 R6 s v+ [0 {$ u
( z: a3 Z9 n u- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ l0 G) M4 w" X) O9 q8 T
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* A+ T/ A: J1 I# B' n& I; i/ @( I
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 C! J: y L! N& d7 z1 F
, Z" S/ u+ x- ^/ B- dma_addr_t dmaphyssrc1 = 0;' O3 k* p3 b7 o
- dma_addr_t dmaphyssrc2 = 0;
- T5 I4 l; S- z, B$ n8 C" v - dma_addr_t dmaphysdest1 = 0;
2 D$ M( O! C+ z! J - dma_addr_t dmaphysdest2 = 0;# Z- i6 b/ Y( O+ q0 |
1 z. y; F) C) ]5 ~ C+ {- [- char *dmabufsrc1 = NULL;
$ L! g. s, o9 f) p- j# q - char *dmabufsrc2 = NULL;
$ J7 v( T5 g9 c/ m; c4 ` - char *dmabufdest1 = NULL;9 b+ C$ g+ C9 k4 M) R" v
- char *dmabufdest2 = NULL;5 P( w7 V+ ?) y6 c/ V6 O8 l8 j; K" Z% Z+ z
; U, l( z: g9 o* f- static int acnt = 512;
2 }7 x+ B5 ]* }8 r" U$ I - static int bcnt = 8;1 w" r/ j# `" `" c; ? {( Y$ c
- static int ccnt = 8;2 [3 s r! R: o& k$ t9 j
9 H/ R+ Z/ }# x& K* H5 \" l, B- module_param(acnt, int, S_IRUGO);
6 s1 h) F) h6 D& t; R - module_param(bcnt, int, S_IRUGO);4 ]) N7 r8 r0 {8 Y% \
- module_param(ccnt, int, S_IRUGO);
复制代码 0 p( Z+ x% X9 Q0 H: C
1 V% i6 A: W' q" e6 L. a4 j0 |. p 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% x. i. l7 S! s( b* Q0 [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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ }" E- M8 r5 w9 G- v. ? 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ Z& \; ^. V9 o! O4 K- U3 Y7 O6 ]' C
3 [7 Q3 E/ ?2 u9 u& H, l/ C& c9 L9 [2 f% x2 Y; d/ V+ o( W. e6 m
|
|