|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 R/ {/ Y( g; r3 @6 f) o' L2 S" q8 ^- [code]EDMA sample test application
( Q: z+ V4 z9 f6 m$ q* U& | - /*
8 t6 Z* N$ C4 R! W/ P0 W# Q - * edma_test.c
9 ~, i8 n7 j. J. c3 V - *5 c4 C5 i/ K( N0 z7 i: o
- * brief EDMA3 Test Application+ A8 e# v8 N0 B0 @3 m
- *
K6 S: l6 e0 b' l! K& |/ W' s - * This file contains EDMA3 Test code.
S: ?' z1 M4 x* c- q& A- c$ ? - *' n& s' u5 [( j& F! A j
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
9 ]; Z6 S& m% o% Z- D& k" b+ o0 o - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ @$ i! i( ^# A- U5 Y5 e
- * TO CHANGE.
: u+ {! N' d* x0 @7 b; ^ - *. X6 _/ W/ n( s8 n" a
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
" J6 S0 m/ L& z& Y - *
0 _) X/ X% l1 U* i6 t) Y* P" u- M9 g/ ^ - * This program is free software; you can redistribute it and/or9 R5 k2 i5 |$ ]# Y
- * modify it under the terms of the GNU General Public License as
0 ?8 T% W8 u1 P* y8 F* x - * published by the Free Software Foundation version 2.- \. k h( C, |2 X8 c
- *6 O+ q. a5 n; j8 O2 V
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
, ]$ M$ B; R3 v- b0 ~* \ - * kind, whether express or implied; without even the implied warranty
! n! K- _( c" K4 E - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the) y, K: T& {: r7 t/ o
- * GNU General Public License for more details.- a1 T2 r& a' r2 f- t W$ s# g
- */) H# v9 z7 b' L- _1 k
- % I' U* T. }) f2 y
- #include <linux/module.h>
* ] p1 ^) Z; @% |$ b# e - #include <linux/init.h>
$ ? m; r$ k; K' a& H - #include <linux/errno.h>
9 o* K+ T+ }6 y- u' P4 R - #include <linux/types.h>! o3 T8 G# Q% J- _7 D
- #include <linux/interrupt.h>7 N5 E- `9 {" Y8 _ _
- #include <asm/io.h>
/ T6 o6 c3 M" a& U3 H4 g Q, n - #include <linux/moduleparam.h>. H$ D. y, B+ ~5 I
- #include <linux/sysctl.h>
# Y2 l+ I, b% ~( ? H - #include <linux/mm.h>
: m, ?% o9 i* z% d F( O+ K+ R- J - #include <linux/dma-mapping.h>) `! J% I9 N% a8 J2 ~! ^ d
4 w$ U. |+ |. _0 ~- #include <mach/memory.h>
$ b4 t u9 J2 ~. X! y4 E - #include <mach/hardware.h>7 u; ~( H: z" x4 Y* B) B! _
- #include <mach/irqs.h>
) z. T% T4 |: x1 f6 h1 N - #include <asm/hardware/edma.h>) l. C S( s# j4 s0 ?
- ! \# Z- m {/ B9 l
- #undef EDMA3_DEBUG
2 f8 o+ W9 w3 p$ R - /*#define EDMA3_DEBUG*/* t3 c" `, c: u
' A9 R) W- e' K6 {- #ifdef EDMA3_DEBUG! i9 H& J2 A5 ]
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
0 V' ^2 w% A8 [8 D2 m - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) g" L0 t# _9 W; A
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
. u( s. L/ T- _' }% y M$ R& O - #else
9 E* n2 V0 t3 p/ A7 E3 N - #define DMA_PRINTK( x... )
$ d- |3 A. E# p7 b3 i$ f5 B7 L - #define DMA_FN_IN+ O+ L# B4 x+ A
- #define DMA_FN_OUT. c. T7 j1 z2 f, d# @. a$ y
- #endif
: v C% d1 j1 u4 w& Z9 I% W' w - * F3 t2 h4 a$ p. I6 J% X# z* b
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)% s6 d' Z+ Z3 j2 t2 T' v2 q
- #define STATIC_SHIFT 30 h" @) @ i+ K8 K" D% B- D% I
- #define TCINTEN_SHIFT 20
3 n7 J6 h4 j1 v - #define ITCINTEN_SHIFT 21+ T* e2 n$ n' g+ X
- #define TCCHEN_SHIFT 22
$ V0 B! G; B3 y' Q5 f# j - #define ITCCHEN_SHIFT 23
+ N9 `& A% f5 N4 Z- K% [' x - 9 g7 I$ K% X2 L7 j/ F" w
- static volatile int irqraised1 = 0;
n5 H' n, X3 d! i; p7 c - static volatile int irqraised2 = 0;4 `# H& @. ~0 H' r; {7 d
- ! i3 G6 C6 u+ ^2 ~4 \: g) J
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& X5 O8 M0 V2 b5 F; I0 V
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" G3 q1 X, H" x& C# S0 T - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% B1 [1 L: N# D4 E0 r - 3 @; Q% ? g3 h/ k& @0 [0 b/ h
- dma_addr_t dmaphyssrc1 = 0;
- [2 r/ e* \% M( @ - dma_addr_t dmaphyssrc2 = 0;
, L! K$ c( n' ^! D - dma_addr_t dmaphysdest1 = 0;
: A1 e( \1 j1 P5 _5 K - dma_addr_t dmaphysdest2 = 0;( U; G, a r. K8 z& `4 n
) i/ y5 r* F6 }6 ~2 [- R. W- char *dmabufsrc1 = NULL;/ ~7 P$ x+ H* t) e2 x4 F. y
- char *dmabufsrc2 = NULL;
# }9 f6 u* S" J9 q0 w) L - char *dmabufdest1 = NULL;# L/ s! u. m2 O
- char *dmabufdest2 = NULL;
4 \) G$ Z9 x8 t0 x$ v& i
. K$ }' g: h. x- static int acnt = 512;
9 ?4 ^/ |9 E# O - static int bcnt = 8;
+ `/ ^+ Z$ I. Q- o - static int ccnt = 8;/ Q- O1 E& K- j/ f3 V$ A% Q
6 m4 E1 Y5 N1 @* y, W- module_param(acnt, int, S_IRUGO);
# |4 L( p* H8 Z! H+ n7 e - module_param(bcnt, int, S_IRUGO);9 B& A8 a9 G- Q9 L& `: A4 o
- module_param(ccnt, int, S_IRUGO);
复制代码 ; ^, c+ Z* m/ U, z. e* T" U
+ \5 F+ u }) s6 ~$ w4 w: M 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ {7 M& M% F% q! E: `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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ g9 X" U9 W+ k' |+ i5 f1 T
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。 C+ `: ^$ S* ^3 w# c( F
* p: f1 _. S9 p) u. _9 |' x5 W# S
|
|