|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, E$ p5 s# j2 T: C! d- [code]EDMA sample test application
# B4 ]" J) O. Z5 p - /*
6 }% z# t4 H* j3 R4 }/ a - * edma_test.c/ t- F% w& P6 H0 o0 P5 X L; Y M9 p E
- *. {" M2 q! s9 D- I
- * brief EDMA3 Test Application/ z+ w; q8 k( {2 E% n v. J/ b
- * M7 M1 V9 F. ~8 h( v3 [0 x8 N& U
- * This file contains EDMA3 Test code.
5 J# }7 v/ y% y - *: j5 I3 m; j ~$ U3 Z( t/ s2 v+ K; Z
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
9 U! |) \' w' v+ ?# m4 y; ~. f( g - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
4 k% D' `8 D! Z) S9 m4 ~( u - * TO CHANGE./ V, d- C7 v+ n' {5 A( h
- *
. R& H$ {% {& p; [, V" K - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( n4 z' z# V/ G2 r) X/ Q f& t, h
- *
. V1 ^) d8 A. A+ q - * This program is free software; you can redistribute it and/or; T ~8 T# B% u% T5 K% c
- * modify it under the terms of the GNU General Public License as
" h( S$ z& u% `4 K5 y - * published by the Free Software Foundation version 2.
4 h5 E9 Z3 \- h$ Q# T2 c# l - *
9 r8 y3 u _. G# e2 L - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
/ P. a4 q% Z: Z* @% p; X& Z$ ` - * kind, whether express or implied; without even the implied warranty- |. P. F- ]2 V% T8 v
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
, T5 F( ~' C) T, L* ~9 p$ J9 B - * GNU General Public License for more details.
' c( Y# K @' P* y$ c6 S/ f Z - */0 Q! s) o, a1 i/ p, r% h
( ^3 ^9 O+ o6 l$ ?- #include <linux/module.h>* a* V0 v4 N5 e9 v5 I
- #include <linux/init.h>
0 r" |* H' S) [) F - #include <linux/errno.h>) N# f: ?8 Q3 q. A" D* d
- #include <linux/types.h>0 U0 R0 i8 [1 h2 ?
- #include <linux/interrupt.h>5 q' b' j0 p: Q& q7 X
- #include <asm/io.h>8 Y# t7 @6 p8 u% r7 h
- #include <linux/moduleparam.h>
# B0 u% x' {. o3 w) R6 ?) h - #include <linux/sysctl.h>0 t. e1 C% y2 N# X) J8 [! a
- #include <linux/mm.h>) H: V2 ^- B2 ]4 _1 r2 L. \5 f
- #include <linux/dma-mapping.h> _5 l3 e: ?/ f/ M# G6 R
+ z/ |, P# R e- #include <mach/memory.h>
2 ]" r( N; T5 @& _$ O' w4 ] - #include <mach/hardware.h>
! I0 m7 `1 T- g4 j( ~ - #include <mach/irqs.h>
( k+ J- b h9 a8 a& ?& b B - #include <asm/hardware/edma.h>5 _7 w. B/ X- p% @% Q
/ T- F8 K4 F+ E- g2 E- #undef EDMA3_DEBUG
- X5 L9 Q0 x3 y, R - /*#define EDMA3_DEBUG*/0 r/ ]2 _0 \2 a# H
- " q. K+ V% ]' {# ^
- #ifdef EDMA3_DEBUG
/ _, j' N3 T0 p% M1 y - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 n/ P( ]$ r& b( \ C5 l
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
3 E! h0 }0 m# ^8 V/ M) M$ [& p - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! c( O# ?( n) u3 J5 l
- #else
: `5 Z' D0 ]* b0 C7 e( p - #define DMA_PRINTK( x... )/ h/ C: ~5 N# M4 }# ?
- #define DMA_FN_IN
7 J, c- t- ?- s: ^) k* }3 R - #define DMA_FN_OUT
" j& U; o& Y/ R- [! v! t' [ K# `. h - #endif7 H' o' j2 E- d; z$ N3 G
- : z$ h- k) G% K3 }( z; G
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
) P+ \5 z5 R0 s - #define STATIC_SHIFT 3
5 \+ S; T) ~- @6 z3 u - #define TCINTEN_SHIFT 20
" a" h8 O; T5 I$ i - #define ITCINTEN_SHIFT 21
+ ^0 k7 B8 l6 g$ m3 ]5 I& Q - #define TCCHEN_SHIFT 22) x/ t% p- C* u0 S2 k: E+ y2 p; j
- #define ITCCHEN_SHIFT 23
3 G: K7 h4 |$ O( d/ {. C
1 o8 T* O1 j1 Q, S! q" w# R/ b- static volatile int irqraised1 = 0;" X/ ]9 _1 T& M l! r/ B
- static volatile int irqraised2 = 0;( n: L& e0 g* _( ?% b- Y: D
- 6 }3 m* u* j6 d$ G- \' S
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ K* [# N: ?' ~( y0 m+ f9 j3 u
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ V, j) x0 O: l; t - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 l; F0 A# u% J, N
- & M1 M) ?9 R& |: I# ]; G q
- dma_addr_t dmaphyssrc1 = 0;
) F! T- ?. n" t& I& R - dma_addr_t dmaphyssrc2 = 0;6 z$ ?" X0 ]7 M2 w' p) k* ~, K
- dma_addr_t dmaphysdest1 = 0;
" S4 Z& j$ f% b! A7 R - dma_addr_t dmaphysdest2 = 0;5 w( ]6 B6 ?$ t) Y; ~
/ M% {. n4 \& u# w- char *dmabufsrc1 = NULL;
2 ]$ r2 i, e$ w& V% O8 y - char *dmabufsrc2 = NULL;0 s. P4 ^& ~2 @
- char *dmabufdest1 = NULL;
4 l; d6 a" G3 q6 a - char *dmabufdest2 = NULL;
% f( z( ^# V$ s" k - . }$ m( D, z2 a0 b6 H
- static int acnt = 512;
- P+ x7 a! x& A! P$ k - static int bcnt = 8;# f+ t2 {9 u2 _" b3 ?
- static int ccnt = 8;
+ f+ G0 s/ S7 u/ v6 f
! X. ^5 k4 z5 H- module_param(acnt, int, S_IRUGO);
& c4 N g. S, P! B, d' C - module_param(bcnt, int, S_IRUGO);
; R- q3 b1 `0 f; a+ q& u& l+ N/ ] - module_param(ccnt, int, S_IRUGO);
复制代码
5 {+ j# l: ]3 d: W- Q! F
( w+ X; |1 A# }( f+ A5 F# {; J 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 @: d/ q6 J l
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ [6 T/ c( F. h: b0 g 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
s& [' l- h, C$ Y D. i. o; d$ k& c4 ~2 h, C
7 d' q# G1 K( z$ @1 I+ O: W' B/ W
|
|