|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / V. L, j1 j0 b w( M' v, f
- [code]EDMA sample test application
2 K4 G( T. p3 B- h7 p! P" m - /*
+ L; g7 |' I# B0 Q* x0 v% Q! P4 t# L - * edma_test.c6 y e9 |7 O5 w ^
- *8 e1 U; P. {+ }
- * brief EDMA3 Test Application* x6 S/ @; A4 u
- *! ]9 R1 X6 U% }0 h" b6 f
- * This file contains EDMA3 Test code.0 v* m/ {8 m% E" r1 [+ B$ y- { ~' S$ o
- *. C7 ]8 m) M! V! ~" t2 p1 P
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
, C, a: R& {- }1 w# X/ j% Z( t+ a - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
( D7 }. \# ?8 g) a7 X1 @9 J4 N - * TO CHANGE.
9 p& O4 O6 B! O* C! _0 |4 | - *
& B2 h& m* R: W2 H - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( ?: w. R. X [6 r9 P
- *
9 |5 f! k) y. O! s - * This program is free software; you can redistribute it and/or
9 S; S) a b% S1 X+ y1 M3 B3 u0 v - * modify it under the terms of the GNU General Public License as: _0 p$ a4 x1 R7 v; d
- * published by the Free Software Foundation version 2.! Z. u4 l* q; @3 a8 \2 }* i& s
- */ z a/ L. C" `, z1 U
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
- {% R! E. N# f8 f - * kind, whether express or implied; without even the implied warranty
" Z6 @' h; @# H - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the7 x+ ^- t" _/ Z8 h
- * GNU General Public License for more details.2 A( E% }% a, s& x" {5 Q
- */" B" i! T# L+ E$ ]2 G; |. E
5 P1 I; c [$ t ]+ m9 [- #include <linux/module.h>
% E" o& w5 d. N# r/ u1 _ - #include <linux/init.h>
0 i7 z- a7 [& S! s1 ? e0 l; h4 f - #include <linux/errno.h>
. M! y- D$ x+ _ J - #include <linux/types.h> W% H, _' B; }3 e: V4 m" Y, r+ I' `
- #include <linux/interrupt.h>& P$ m: ~9 S. x1 n, [
- #include <asm/io.h>+ r9 R+ F9 c- z, P8 K" B& V! E
- #include <linux/moduleparam.h>6 Z& O, Q2 V, k& B5 o- }
- #include <linux/sysctl.h>% T2 s9 e& d G, ^) U- k
- #include <linux/mm.h>) v3 g: \# d' H( `% @. v
- #include <linux/dma-mapping.h>
; z2 o9 C6 \! H3 R% X6 P- R
# ^& H8 F; j6 Y6 P+ {- #include <mach/memory.h>
. N* j- z$ {2 i' [8 T/ k0 r3 ` - #include <mach/hardware.h>6 L- D/ r! ]2 q; `, I& E' F% O
- #include <mach/irqs.h>
: `% b5 f. T! _% N) g7 g - #include <asm/hardware/edma.h>4 g) ^' ^! {* {, N, y5 {
5 @# Y; x* { T+ O- #undef EDMA3_DEBUG! j7 i$ y+ t0 E
- /*#define EDMA3_DEBUG*/0 @) w- I; L! p8 C2 Z# W9 e1 l
- V& n- X9 N9 x- @2 v- #ifdef EDMA3_DEBUG
4 X2 v. C- A3 M0 |& a3 r - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
- b6 Y9 [& f) s+ d, A) O - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 g* Q' O9 I9 a; ~3 O. g
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! u7 E! P7 b. m- b
- #else
% U* ? h1 g; S3 G5 D - #define DMA_PRINTK( x... )
- T0 D& n/ _' J+ V - #define DMA_FN_IN
7 R( L3 m2 P& J6 I! a - #define DMA_FN_OUT
" [2 q; w @3 g: i/ v. w4 c - #endif
3 E' p# g u2 U7 v/ h
) ]# R& `& D6 \1 _- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
2 v3 A: C; m( L& C - #define STATIC_SHIFT 3
/ \. K7 c; } [# | - #define TCINTEN_SHIFT 20; [0 I7 b% N! @0 r; P9 [
- #define ITCINTEN_SHIFT 21: y( j* ]& x$ A0 I6 q" X7 |. C9 t
- #define TCCHEN_SHIFT 22* U: S7 y' [9 ?4 \- i: F$ M
- #define ITCCHEN_SHIFT 23% m* a; b! R1 R8 D
/ L W$ _6 q1 E! M, G$ q; [5 m- static volatile int irqraised1 = 0;4 Q" V3 g- B5 u, @% J
- static volatile int irqraised2 = 0;
4 u0 L) }: G) W0 Y4 E$ W- C - . M# U' D0 F+ H/ L) S
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 l) p9 w8 v! Y, l& ` - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( @5 J; t3 e" b2 J. T& w - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 D, V+ I7 J. D8 A( x# R* I6 w
- ! X( k1 d2 S v) H
- dma_addr_t dmaphyssrc1 = 0;% R- O8 f. B; {9 c
- dma_addr_t dmaphyssrc2 = 0;
. ^8 m8 x r$ k w! R9 N6 Q - dma_addr_t dmaphysdest1 = 0;
; y; I) h! r1 g& w- _ t( [ - dma_addr_t dmaphysdest2 = 0;" ` z& g% _% i( G- o
$ E: y- ?1 z1 K5 P y) {- char *dmabufsrc1 = NULL;
l' [* Y9 y/ V - char *dmabufsrc2 = NULL;
; O% @+ |7 u5 f' Y7 U. c - char *dmabufdest1 = NULL;, @3 F4 O. [* Q" F" N
- char *dmabufdest2 = NULL;& M$ u2 e9 e/ b I6 F
0 A& t8 _1 n( @4 L- static int acnt = 512;! c& s" q9 x) A6 A8 A8 P' v
- static int bcnt = 8;4 F3 h, T2 [6 I0 y* j( P
- static int ccnt = 8;
: ]+ h0 X' P" O - 3 k( {! j6 c3 t+ `0 n
- module_param(acnt, int, S_IRUGO);
+ c5 G. \' r* U& h - module_param(bcnt, int, S_IRUGO);
% I i/ V1 ]( O g9 Y - module_param(ccnt, int, S_IRUGO);
复制代码
" r# p( W& D6 `9 R, H' g
# k0 \7 F4 Y/ C b5 W9 T 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ t5 R; n: b1 O7 K
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 U! j F) w* h& o, K$ C; n. N 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; L4 @) S4 n6 m+ P: _) L8 g; y9 f) z8 L P4 c2 r
8 z& O L) `/ h; R: Q
|
|