|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- R3 @3 _. {) u; p( n- [code]EDMA sample test application) Y5 `! N/ D* ^# V m9 S
- /*
5 u( k$ e& ?. A# J) B3 @ g - * edma_test.c1 `- T7 Q/ }3 W0 o& c
- *4 |9 Q5 u% @' f) w% c0 R
- * brief EDMA3 Test Application5 I7 B* J5 n* J6 l) ^4 Q
- *
- g# l6 d, U0 I3 Y - * This file contains EDMA3 Test code.( D( w, Y/ Y- U) \" J( ]) J2 j
- *. M- o9 }/ r% r
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, t+ M/ f0 Y) E% s( `! S8 ~/ I! s
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
% `. `3 k" j: j' O* ` - * TO CHANGE.
+ t. s$ D) [# P% [1 @ - *
' V9 N( M4 A/ ]( `$ `. o" { - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
4 M' Z4 E5 G/ h/ v6 m' ?* V - *
& C, V; f4 q- b- |1 l3 f) l - * This program is free software; you can redistribute it and/or- u1 v6 R5 R8 X5 y; J3 I* D8 N; {8 o
- * modify it under the terms of the GNU General Public License as
2 l; s3 l2 Z6 k2 k. p& f+ ]8 k - * published by the Free Software Foundation version 2.1 ?2 H& K5 s! B% x& s5 p0 k, ?
- *# P5 j% n, x/ h- Z5 l4 Y, j% U
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any. s* r" K; X0 y2 m4 b1 z
- * kind, whether express or implied; without even the implied warranty& Q1 E5 }0 F. }( z B% k5 C
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the' u. L/ ^3 o% ~; O& a( a' p
- * GNU General Public License for more details.7 |, s! _+ J, @! T- x8 O
- */" s2 f' m* M4 t w
- " X G/ w( `! C; G
- #include <linux/module.h>0 ?' u- t6 u! P5 e4 w" O5 o
- #include <linux/init.h>
$ @9 s9 @5 y' Z0 C3 U$ Z - #include <linux/errno.h># |0 V' K+ v9 x" l, W0 O
- #include <linux/types.h>* g4 O; E5 {. U, A' {1 e
- #include <linux/interrupt.h>5 |8 k5 T" e/ e' g" i
- #include <asm/io.h>
( M, V; |5 c9 @ - #include <linux/moduleparam.h>7 \% r; ^4 P; ]) O; V9 ~" \
- #include <linux/sysctl.h>
$ [# w0 r! o i8 e/ Y1 R - #include <linux/mm.h>% V F* _5 p; v* D& z+ Y
- #include <linux/dma-mapping.h>
2 K! C9 J: b6 k U$ u) s0 Z
7 t$ A Z" g& ~# A6 f! T- #include <mach/memory.h>* i$ A3 |" }! ]2 T+ D1 {9 C
- #include <mach/hardware.h>
: X5 z1 Z! K h2 H - #include <mach/irqs.h>
: }: |% Z9 o9 s; E - #include <asm/hardware/edma.h>
" D& A# F& \* D' t" E9 C/ J - 0 f# v) e' s% s- t( x! b+ ^
- #undef EDMA3_DEBUG
5 U/ [! @: c$ ^; t; r9 ]! n - /*#define EDMA3_DEBUG*/) x+ O6 f8 W4 V. d
9 _4 @- o7 R* W# ~- #ifdef EDMA3_DEBUG
+ O4 _, Q o( m( k3 q1 r9 z' n - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* J8 l4 J4 k& E( j
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
+ c! L1 M( m# w2 p - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! `8 h$ A' U- }+ e
- #else
7 C, _* [% v; {+ Y$ y. q - #define DMA_PRINTK( x... )
5 X O& }: y. B4 A. z6 _- C2 T, n - #define DMA_FN_IN/ P+ E- Y6 G, D
- #define DMA_FN_OUT
2 \2 A6 d+ m# Y) F - #endif3 Q' r, Q3 I3 [7 P7 A% P7 ?
. D& j; s; L% u4 x, A. a% S0 f- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
5 P$ I; g! P9 g: Z9 C( k - #define STATIC_SHIFT 3
9 d: b+ K8 y3 C- v- F* k0 L - #define TCINTEN_SHIFT 20
+ V0 ~5 r9 g1 |7 [" d3 Z - #define ITCINTEN_SHIFT 21
; A( Y m* |: Y: A1 E4 ^ - #define TCCHEN_SHIFT 220 F7 j$ h' A, y& j+ \
- #define ITCCHEN_SHIFT 23
8 f7 _8 r4 I, \! I
, f% v- l! y% Q" d- L# U" ^2 q- static volatile int irqraised1 = 0;: d0 t. e d0 t4 y3 d2 t
- static volatile int irqraised2 = 0;3 \* ] c. G4 \4 `4 ]
- * X* @( p6 a d$ d0 a) V
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" A+ j3 @( @. q* z/ X' C - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# _. D% Y: C I9 d' E4 [ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% b8 Z9 }( E y M - $ R' ], m2 N/ J; s
- dma_addr_t dmaphyssrc1 = 0;' ~+ s' O, H& a
- dma_addr_t dmaphyssrc2 = 0;
% ?! R4 ?) ` k1 x! I3 ~$ p# |7 T - dma_addr_t dmaphysdest1 = 0;2 O4 h* o) S" t( f+ l' i
- dma_addr_t dmaphysdest2 = 0;) ?7 ?; Y9 Q" L- e
- # k0 W3 J8 d& Q; M/ ?1 r
- char *dmabufsrc1 = NULL;( X( i. B6 y8 ~ O
- char *dmabufsrc2 = NULL;4 A4 X$ O5 u. W- z
- char *dmabufdest1 = NULL;
+ R% X1 b+ c" p! E" {" U3 y5 N - char *dmabufdest2 = NULL;2 M: b$ R1 ^# m0 x4 \
- 8 f7 G! p( r5 {* Y' i* C) d, ]
- static int acnt = 512;, H/ f+ J/ u& j) |; H
- static int bcnt = 8;
6 _; J! a0 N4 m2 W! E; l. S$ F" D - static int ccnt = 8;; c: k. Q( R7 V( a1 h, m9 m
- 9 }% s# J2 f/ h5 ^$ v! E, l& j( n3 ^& q
- module_param(acnt, int, S_IRUGO);+ n* H% V- Z0 B3 q2 a" X( Z9 K
- module_param(bcnt, int, S_IRUGO);! P0 U$ F9 M* x
- module_param(ccnt, int, S_IRUGO);
复制代码
4 |% P" i# U: X; z# `! ~! L8 I
4 J j) B- ^) C 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& r0 F, @8 z4 q, w- l+ u
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. o |' f5 Q- E$ w! l
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: L- k$ G8 ?( Q: ^* A+ Q' X
# C8 P1 [9 S5 }; C( ^8 _6 W
- d; j/ c4 K( M6 m: N# G
|
|