|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ x! V3 a+ [1 j3 J$ A% W/ |5 o
- [code]EDMA sample test application
9 u7 s, J: l$ T4 a, N/ y - /*/ ~2 C# H+ c+ ^- v" p
- * edma_test.c
5 o$ _% f% f( Y9 H7 _) y - *
" A7 {; Q4 n6 B3 k+ l - * brief EDMA3 Test Application9 N( T3 V" E2 F; z# t
- *
, X% k# ^! T3 c' u- P - * This file contains EDMA3 Test code.: r: f+ T c s# g; F2 a
- *
' Z% x/ s( h* X - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
7 F- u* |3 G' \0 I - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
6 F7 U4 I" L! f - * TO CHANGE.+ V, D- x9 R% Z! z' H" S
- ** a a& o5 m1 F% }# k! _) d
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
) A3 l2 X) c3 V5 S3 E1 n3 l - ** T; z1 p) v9 {- z1 s2 d4 g
- * This program is free software; you can redistribute it and/or/ N O: G, U. T
- * modify it under the terms of the GNU General Public License as
5 P8 k$ R7 \ H! \: B - * published by the Free Software Foundation version 2.
* T4 }. J6 ^; e, X# i5 O - *" ?7 R& x9 d5 {. h
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any* K5 }/ i& x- b$ a6 F6 z
- * kind, whether express or implied; without even the implied warranty
; [& A6 o' [1 _6 z - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1 V% u; {. G' g7 A: F+ T% S r - * GNU General Public License for more details.2 _& u) o2 e9 q! k( c
- */
n0 l3 f. u. l- w" c9 S7 i& `$ e - & \( r1 a2 a; R
- #include <linux/module.h>6 ]% z- P! c0 q4 `
- #include <linux/init.h>0 z0 V& k3 o/ `, Q' t6 ^% c
- #include <linux/errno.h>( K5 \; F; j1 W# c& `5 B
- #include <linux/types.h>- u0 ?- C3 x1 G b2 X
- #include <linux/interrupt.h>
" c$ Q- g$ X3 K! p% ^$ | - #include <asm/io.h>
) e4 |! i0 h L3 L) |' r1 Z - #include <linux/moduleparam.h>$ Q1 U- R3 g' S; z+ y
- #include <linux/sysctl.h>
5 b6 u. q) p* c6 g- Y+ m - #include <linux/mm.h>
& E1 e. D! U1 o9 w3 g" I( Y/ W - #include <linux/dma-mapping.h>' Q' ~5 X6 W! N, S- n
- 2 ~9 ^/ r0 n b& V" p8 A, ^
- #include <mach/memory.h>
$ h+ K6 V/ H4 b9 f/ k4 H - #include <mach/hardware.h>; n; Z- t; W" t3 ` s7 u
- #include <mach/irqs.h>
4 [% l2 Q% g+ n* ]% b& U& t - #include <asm/hardware/edma.h> S. l+ b* }2 c, q% U
- $ \, t& |8 I/ z. T5 B
- #undef EDMA3_DEBUG
1 ^) l/ P: {0 U% [0 R - /*#define EDMA3_DEBUG*/
* B# j1 U" u6 S, }5 c' ^- V
/ a( p2 \- I T S# j" k8 O- #ifdef EDMA3_DEBUG
9 Y4 x+ Q/ n( |$ B( h: [ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
8 |! n9 Q% \- J, j6 z: w: {) ^7 | - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 K9 n1 A6 ~7 H' q: Z# @
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 E: ^4 e% ^; |5 M. r
- #else
6 w- W$ I. w+ ?& Z0 J - #define DMA_PRINTK( x... )+ @; m1 ?0 r* T' v& j; m
- #define DMA_FN_IN
5 `1 u7 t0 g8 T* O% J% J* H - #define DMA_FN_OUT
0 s1 f0 G9 L# z - #endif! l0 q" v* l% p' o
- 0 T1 L8 ^% o) k; ^& g
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)3 s' o% y2 \4 h D- K' s
- #define STATIC_SHIFT 3
9 A' [9 d8 w! v! D2 ^6 Y - #define TCINTEN_SHIFT 204 O8 Z1 _: F( k. d, f
- #define ITCINTEN_SHIFT 21( P- K! f+ ~7 k/ `9 U5 F# |
- #define TCCHEN_SHIFT 22
- S0 N* y( Q6 ^' d: _0 | - #define ITCCHEN_SHIFT 23, @( o' b8 }. H/ J. V6 {) ^, Z
- L+ K [- m- S5 i
- static volatile int irqraised1 = 0;
) ?" w5 K$ k% @- I! m - static volatile int irqraised2 = 0;8 a% S" O0 f1 d9 E) h
- 8 S6 @4 [6 U" k1 O3 }9 ]) h' R# X
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
L7 X2 R/ O: T0 L' r$ Q I Y - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 J+ [' ~: U: n7 \
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 x/ f# \5 n! l; `8 N* l, n) C5 z; q
- 1 G3 {0 o7 \, m, {6 e! a
- dma_addr_t dmaphyssrc1 = 0;
O7 _ x1 ?9 E5 G5 c0 u4 K - dma_addr_t dmaphyssrc2 = 0;
t$ k7 M7 F6 N5 W8 D: r - dma_addr_t dmaphysdest1 = 0;8 d |6 R1 H; E% u& C; V
- dma_addr_t dmaphysdest2 = 0;8 F" E4 | z6 K/ ?7 R- q$ x+ {
- 8 V" V* v9 A V" @7 Y- v2 G
- char *dmabufsrc1 = NULL;
/ X _2 r0 O% U) {, h+ B! R5 v$ N - char *dmabufsrc2 = NULL;
% `( Y" ]! P6 i - char *dmabufdest1 = NULL;. K) _9 c8 Z/ I8 @
- char *dmabufdest2 = NULL;
- e$ Z" J" `$ G J/ \6 H0 H, ~
2 p" T3 y+ v& {9 P: C- static int acnt = 512;0 v7 U! m& A0 T) I3 p) e
- static int bcnt = 8;
; v) j, u2 U8 j6 a7 W( \% k - static int ccnt = 8;
. c+ \: K/ ?: Q. V
$ p' n ~" Q3 Z0 l3 R- module_param(acnt, int, S_IRUGO);$ |& P" m2 x% d$ B
- module_param(bcnt, int, S_IRUGO);
% S* S |' q4 g @8 S - module_param(ccnt, int, S_IRUGO);
复制代码
2 B/ y+ q: s! K) J9 {$ j& d
5 C" l, f5 T% }8 i9 e! b 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! R" v9 A% R6 e, P+ D* 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
B9 R- i M, {7 y 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; Z; {0 R% U; u8 N0 H" s' M0 O$ z
8 X% ?2 H l( D7 N2 G; b, L, r8 q' G' e: [" h l* K
|
|