|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 L2 ?) h! l/ s4 S4 x2 j- [code]EDMA sample test application
4 C3 \, R6 g+ G5 ]: K H - /*
$ h0 n1 q& v4 o# d6 P% c - * edma_test.c
7 z/ z0 ~; D& R5 Z) H% ` - *( K4 O, R2 H) L U' h
- * brief EDMA3 Test Application
0 T, ?6 J. \& x3 g' ?* [5 W: a4 k - *
8 u2 x3 R' H+ N1 I5 ^ - * This file contains EDMA3 Test code.
" C( o1 z# Y; n1 q4 ?0 } - *+ h5 W, ^5 p, C( ^% _: X
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
/ O, F/ k* b' D" ^/ ~ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
. ]0 q9 E. N% K5 a$ M. ~ - * TO CHANGE.
# L" _& w+ W1 a- ^* X - *
3 v* @- C5 ^; B1 I - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
' R+ Z I5 c) x- |$ I - *
# }3 w$ g% _3 m/ R1 b# M - * This program is free software; you can redistribute it and/or" \, \6 y p- [" Q* B
- * modify it under the terms of the GNU General Public License as
2 \; U! m$ V2 L7 B, }/ ?! n - * published by the Free Software Foundation version 2.
) V, R' ?8 C4 h - *
( [0 K0 r9 Z2 T/ Z/ X& {/ J y% x - * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 w4 A7 w0 b, _# r2 Z. o
- * kind, whether express or implied; without even the implied warranty
# c- I' L% v* |2 F& {" Y - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ E5 ~# S; r/ ~! @- u
- * GNU General Public License for more details.3 X7 _4 a4 N7 t3 p
- */
8 r, u }- x# U2 ~ - * J. [6 s% U Q& j' M& D9 m
- #include <linux/module.h>+ `! G; }2 U& H) r! H# ?1 w
- #include <linux/init.h>
) U& D) {" k7 O* H0 [7 W- _ - #include <linux/errno.h>
7 S8 A7 [+ c( l$ d, n - #include <linux/types.h>- b' ^+ o* h* t, Z! ]
- #include <linux/interrupt.h>- ~ [% U7 Z# Q8 j$ u
- #include <asm/io.h>+ \5 c. t. I" [! T+ n9 y( z
- #include <linux/moduleparam.h>; l) S8 O" Y& v( D$ L& I5 A
- #include <linux/sysctl.h># h9 f& T! P& C9 U* V: b2 d
- #include <linux/mm.h>
" S- G) A: Z1 f+ ^( c6 y! x - #include <linux/dma-mapping.h>5 r! W: p+ V. V9 _% r( W
9 C# \$ P& o5 W6 b. w- #include <mach/memory.h>. z% Z! K- J+ L- \5 [3 t
- #include <mach/hardware.h>" ]( _ r2 ~7 N$ t- d# o
- #include <mach/irqs.h># L3 Q% y" c% H9 s1 C5 k
- #include <asm/hardware/edma.h>
7 f. P$ y1 }5 r- K- ~. T
2 u# e% Q, @6 _9 k, |$ ?, d- #undef EDMA3_DEBUG
/ @, p- Q) E* `. T/ V: `4 W3 Z - /*#define EDMA3_DEBUG*/; ?0 z; E4 U. ?) H
+ P+ h. _- H. X. l- #ifdef EDMA3_DEBUG
- E5 F( |* d% Z0 Q2 k* b% C& G A - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
3 W( p" N' O5 s" n+ r7 R4 k - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
' a; G3 k! [$ Q- ?0 y - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
; W& @% H9 f* [5 b - #else: V8 `) v5 m/ `. M* _
- #define DMA_PRINTK( x... )
: E) p4 m; J9 Z% P2 Y0 `9 N - #define DMA_FN_IN
7 @ n& G# E/ A3 Z - #define DMA_FN_OUT
% E. j+ i, i7 {" V - #endif
4 f$ ~- v- ~; s2 W+ Y# }/ i/ S) y
& \8 w& j8 h6 m# E! _) P/ x3 x; j1 @- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
7 y2 m: |$ t& S3 u4 v; `+ Z0 b5 E - #define STATIC_SHIFT 3
( n. T& f3 I9 w9 }3 @ - #define TCINTEN_SHIFT 20
9 @4 q9 q6 S: X - #define ITCINTEN_SHIFT 21: w1 W; [; l9 `& @6 {8 _
- #define TCCHEN_SHIFT 22
5 k1 W8 v/ i& o. h) \0 t0 I# U - #define ITCCHEN_SHIFT 230 y3 {$ T+ r4 H% d
- 0 n, b$ I8 O6 z6 W( ]+ y
- static volatile int irqraised1 = 0;
/ W) W( V' b, X K0 L - static volatile int irqraised2 = 0;
8 S8 t9 ^+ `7 ]
9 N# M' X9 ?5 z# L7 f$ _( s. x- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 b3 Y) I: R1 ^( \: m( ?5 g3 n - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 ?5 N3 S$ f) _5 @ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 a6 ~. s0 a! [7 T$ x$ E/ q6 g+ d - # z3 k9 K! d6 p7 z1 e4 `5 @
- dma_addr_t dmaphyssrc1 = 0;; x. m5 a; N9 E- U; N: L' C
- dma_addr_t dmaphyssrc2 = 0;
9 L' \8 z9 M) v; [ - dma_addr_t dmaphysdest1 = 0;+ b# E1 q1 p* n2 P1 k! p
- dma_addr_t dmaphysdest2 = 0;: {. g. ~0 b8 O6 r* v
8 [ I7 r/ O7 ?& t. }- P- char *dmabufsrc1 = NULL;+ c' P! Y! q0 E; Z4 n% R. ^
- char *dmabufsrc2 = NULL;
9 X( w& |: {) c" k A6 P - char *dmabufdest1 = NULL;
& ^8 N" Z( f2 O2 G9 Q4 D( a" c: i. F - char *dmabufdest2 = NULL;
5 v8 u/ B- d5 }: ~; t: e! @ - , K9 s! N5 V" E) b7 L
- static int acnt = 512;
3 Z) J5 e8 M+ E( {7 Y* z5 D - static int bcnt = 8;. l# y! ]4 w# t/ N$ t- j, k
- static int ccnt = 8;, x, {# b; x$ @3 z
% Y1 P9 M, t& H, T- module_param(acnt, int, S_IRUGO);5 Q3 e! y% b. G4 t. i1 L+ R
- module_param(bcnt, int, S_IRUGO);
! }* B6 l% _, q& _2 P' p% i - module_param(ccnt, int, S_IRUGO);
复制代码 ) ?( t/ H* f2 J: s, S, K! _- \- H
, G) [ h; h0 a( h1 L% ^- ? 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# M% p" ?* h! J; \0 b
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# H+ T5 g$ q: `9 e, p2 r 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 A) N; y5 @0 k
/ R7 A* C% X) T# Q" k) o! a( j8 G! C& S0 R: q* U; O/ H/ D& D( f& T
|
|