|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " Z2 k) A! A- c8 b
- [code]EDMA sample test application
) o+ X) M# s$ O& d1 r - /*
+ q; E& E$ C1 q9 y, s - * edma_test.c( P9 U7 \- ~! k" s* ?4 y3 l b
- *
, ]9 ]% w7 o D- G% R$ D; V - * brief EDMA3 Test Application2 f& R9 a5 G7 {; `4 M
- * a9 t% ?. L* ]# Y, K' Q& N; i* s3 r
- * This file contains EDMA3 Test code.1 i7 U4 G! n) M5 r$ h
- *1 D8 n# X3 t5 G& ?" C
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ \7 t2 s2 U' q# c1 `# _' ^ e
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; x5 x- @0 h, f2 y8 n
- * TO CHANGE.
( ]# i8 t9 R( L& E1 V) W; M7 u5 U - *
$ W# `& H7 B9 N( ^& u - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
$ s. Z; o( u' }( Q ]; G h - ** B7 l# L% c( v: U( u/ l
- * This program is free software; you can redistribute it and/or2 M. c3 d, e3 x, g/ F
- * modify it under the terms of the GNU General Public License as
; C) Y) O, H$ Y( q4 i7 P - * published by the Free Software Foundation version 2., ~$ U4 D% Y# x, h4 @
- *2 z7 I, U* g4 {, P# f; E3 }7 G' h+ `
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
/ j$ B/ y4 ]3 y& Y. P6 S* x - * kind, whether express or implied; without even the implied warranty9 x1 d- v7 w0 R& A% T
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
. Z1 o0 M6 a+ S, Y3 ` - * GNU General Public License for more details.
0 G; l! _4 |1 C$ J- T - */# {! e! V# z, a0 s6 U
- ) Q% [4 E1 `( C
- #include <linux/module.h>* l4 F* b* a; V, \5 u& b1 ~4 }
- #include <linux/init.h>6 L7 E) V/ W; {# o
- #include <linux/errno.h>
4 f3 T4 y& [* N& ~+ R - #include <linux/types.h>
1 ?3 a8 a6 I# M; a: |' \" Q - #include <linux/interrupt.h>
+ V4 e- C! I& @) s8 ] - #include <asm/io.h>
$ x1 y4 x9 Z# _6 w9 U+ P - #include <linux/moduleparam.h>
. U& Y# I& I7 Y V+ r4 w - #include <linux/sysctl.h>0 T* S7 j# J% |$ k
- #include <linux/mm.h>
+ {) o# E# O3 x0 Z - #include <linux/dma-mapping.h>
$ t% x" O% I$ a3 r - 3 R: d+ `" g( w! [7 G4 t3 u k# P
- #include <mach/memory.h>+ b; g, Q8 z9 e& ?
- #include <mach/hardware.h>$ _9 L+ L$ ^, k
- #include <mach/irqs.h>4 g+ }3 g+ h \1 Q- c1 u
- #include <asm/hardware/edma.h>
! Z1 Q! u/ m( Y% j8 J6 X9 K - 7 K+ Y, D1 u; u* z' N$ ` e$ B) E8 a
- #undef EDMA3_DEBUG5 ~* j8 [$ O7 x: W* q+ X
- /*#define EDMA3_DEBUG*/
1 ]/ r5 ~/ a+ z' ], x- w* V - ) l4 V1 n. L" ^1 X0 O6 u" j
- #ifdef EDMA3_DEBUG' o4 e0 j/ w, C$ N
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 p$ C2 f5 b/ d7 Z1 R1 r2 T& c6 c
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
2 \8 D( f6 V1 ? - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
3 p& B- f4 B! R5 X - #else3 P) @; f( l7 [0 h3 |: v, l5 F
- #define DMA_PRINTK( x... )5 G2 {" n. @7 d/ H1 p/ v) _
- #define DMA_FN_IN! |$ I" D" R) f0 `( o" L
- #define DMA_FN_OUT2 H0 o; a! Y9 g3 [9 I* B
- #endif
3 s5 C2 h- D& h7 a& x - # p& ]: n) K1 ^1 o0 B! t
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)+ P- \ ?' ]3 a9 g
- #define STATIC_SHIFT 3" V5 E% i a) \5 Z4 x. Q! k
- #define TCINTEN_SHIFT 202 i$ b; w: a+ O8 O4 W6 L
- #define ITCINTEN_SHIFT 21( s+ e4 k. R8 I5 D- {1 ?
- #define TCCHEN_SHIFT 22
, Z+ O s' X4 |8 I; D - #define ITCCHEN_SHIFT 23
, s3 ?# t1 ^7 u6 c ?( j
/ h# V" T( _2 `- static volatile int irqraised1 = 0;4 s. h' k# @( y6 M
- static volatile int irqraised2 = 0;
" k$ e. I( t' K. _
, I$ c) e6 v" a9 r- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' b" j' [* J/ a
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: R( h+ Q8 T4 X8 Y - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 ~- O# d" V. l( X - & }* x' y& w* g. E; j6 A( A
- dma_addr_t dmaphyssrc1 = 0;
1 q5 T. _$ |: T0 o6 [ - dma_addr_t dmaphyssrc2 = 0; ]$ t- L+ ?* V B: r2 X$ i* u
- dma_addr_t dmaphysdest1 = 0;
% e8 X2 Z+ n7 w5 [ - dma_addr_t dmaphysdest2 = 0;5 {7 _$ _9 V: a' K m( y8 ^
$ B9 U0 p5 P2 Y: Z$ L$ `- char *dmabufsrc1 = NULL;% h: f. F% \" i1 w. a' k* m% H2 [
- char *dmabufsrc2 = NULL;- Z5 c) Z+ P) L, O: H0 ^5 t# d; e
- char *dmabufdest1 = NULL;2 Y, J! l+ X. f6 v( z/ W: H4 ?3 Y4 W
- char *dmabufdest2 = NULL;# a' n N2 q/ X3 k% m
- 6 Z7 k5 w8 n% z
- static int acnt = 512;
3 [: R5 \5 W9 {; B+ y - static int bcnt = 8;; T) {* k; \2 v. u
- static int ccnt = 8;1 f6 J" g) @% v
- * f' H% V/ k6 R. d8 ?5 f7 Z# R
- module_param(acnt, int, S_IRUGO);1 B$ [- \% Z& j1 d# O: \# X$ s$ d
- module_param(bcnt, int, S_IRUGO);) \, T; J& G: y5 Z* _- h
- module_param(ccnt, int, S_IRUGO);
复制代码 5 F0 I% C n2 G
$ ~6 ^7 p3 ^6 O3 o- I
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! d7 Y. _: G) H& Uarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ |4 }& Y- E' H, u) Z, Q) t0 K
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. s$ |/ d0 s' e, t4 o
; |" b, F s x0 x/ m6 _- Q* U: ?3 n4 y, n j& T
|
|