|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " ]* ^- i; b8 v' d
- [code]EDMA sample test application
. S$ ]- S- T" X" q% S4 o8 V - /*6 O4 O% D$ ?, s5 ~- B" y/ k* y
- * edma_test.c
) A* [9 W1 I9 j8 ~, M) L - *
& t% T& s7 n! G' o+ ]* ~ - * brief EDMA3 Test Application
7 M1 j* }( b' g$ w3 d$ \) Z1 V - *
1 k% ?4 E h; Z& k9 o4 l - * This file contains EDMA3 Test code.
* s0 U$ S4 S, {, i - *
6 v6 f, B, x4 z7 ^ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: M5 l3 a1 c) ^1 s' k. n- | d5 _
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" F* I8 O& c% C# [& f1 C
- * TO CHANGE.
9 p5 _, q0 [2 D - *
+ F- X- P8 |& n- w7 V( M* s - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 a# ~6 x+ v- |* j. L
- *+ e) I4 h2 j0 `# s
- * This program is free software; you can redistribute it and/or
; Q/ k9 |0 p/ i; b* c - * modify it under the terms of the GNU General Public License as9 L7 p# A( t7 u0 l+ A. ?
- * published by the Free Software Foundation version 2.
3 |. d$ j; h2 I+ J0 ?5 d1 K - *
/ D2 m0 ^1 d: p+ V - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
7 {' p0 E' T, O3 U4 U+ H - * kind, whether express or implied; without even the implied warranty
4 i; k8 m4 M% x% q1 b. s4 q - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the0 S3 K7 f) |' B6 K
- * GNU General Public License for more details.2 W1 @2 Q9 ?% r* v& Y" _+ d0 w
- */
& V! h, Q$ X V* b3 n - 5 H" l1 ~( ~7 E" I* U9 R
- #include <linux/module.h>
4 Y; o+ z& R0 H7 J' b - #include <linux/init.h>
5 J+ p6 S$ t* ~# r* X - #include <linux/errno.h>
; w7 `7 u; R3 r9 o - #include <linux/types.h># p$ U( c& |# M8 |7 L" n Q. ~ e
- #include <linux/interrupt.h>
: F# n2 P) D7 p3 y! r4 I; F - #include <asm/io.h>
& Z6 w1 Y4 W3 [/ h6 q% Y3 J! [ - #include <linux/moduleparam.h>$ c2 g! ?$ g" f ]+ y
- #include <linux/sysctl.h>- q* f B3 @7 P+ ]2 V7 K/ J
- #include <linux/mm.h>
; Z3 t W; H8 L5 {* X% R; s8 K# w$ m - #include <linux/dma-mapping.h>0 A9 G8 `" U$ E2 Z& d' ^+ R
" m& @. w& O' e" o" I8 g* F- #include <mach/memory.h>0 w5 ~; ?: D, Y5 x! ~
- #include <mach/hardware.h>
/ Q0 m& n" h0 i! }9 W5 N/ V6 c1 } - #include <mach/irqs.h>; o' W4 ]6 @" l# P% K6 l6 L
- #include <asm/hardware/edma.h>
: v# N& J \4 I4 { - ( X/ J: ~5 O( ~; Y0 ^& G, F
- #undef EDMA3_DEBUG; {. ~5 X$ G5 s3 |% R9 [ R6 o
- /*#define EDMA3_DEBUG*/
" \; a, `- d/ X6 u- i0 o: o2 J
0 ~4 \" B9 Z, o6 @- #ifdef EDMA3_DEBUG
1 d) \. H* T' W) r1 O; R - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
$ }) l; }2 v1 T1 |8 m& E9 J w/ j - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 N9 S& \: J* x6 |+ A7 G' X& N
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
$ T3 p! _3 b: b2 Z/ p3 [+ \" J+ h( | - #else4 e5 u1 F4 o3 O9 v: Z T! v
- #define DMA_PRINTK( x... )7 i; x! m2 b5 l/ s- P A
- #define DMA_FN_IN" U& e& }+ E2 y
- #define DMA_FN_OUT
$ |7 x- U4 P' K - #endif
t& k. J' U6 r- g3 N3 T - $ j$ k) D y& ~1 a/ Q% n
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)4 [* s6 x% i1 p" X+ z( B& K
- #define STATIC_SHIFT 3
8 ~# y# E* E& ^2 X3 q - #define TCINTEN_SHIFT 20
: x" S* ^7 X4 }1 I% x: h% s - #define ITCINTEN_SHIFT 21
: f' ?8 e* C1 K6 I% ]$ R# Z - #define TCCHEN_SHIFT 22
* i+ k1 k; T5 z6 t+ E) [% c+ ~6 e - #define ITCCHEN_SHIFT 231 \. C3 x- R1 K/ E2 I5 a- P3 F7 @
8 {) d! @$ m7 Q: |* U" R- static volatile int irqraised1 = 0;( _( O0 R0 n/ y# B* O# O
- static volatile int irqraised2 = 0;
) d1 x" O3 V$ m1 h2 M - 1 o( ?, d' R+ c4 A' f: w
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; I( }0 I- }* u; w; c9 l5 j) c - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ r% b2 X! y6 J' H/ Y% U# S2 I
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% k2 N5 S" R+ T8 ]2 ?9 ^
# k: P7 `% v: B" A+ I7 r' S) u- dma_addr_t dmaphyssrc1 = 0;
' D; c% e& E5 X5 I- J - dma_addr_t dmaphyssrc2 = 0;; T. Z- S5 C, B; C ~
- dma_addr_t dmaphysdest1 = 0;
: |% X B0 Y: V& T1 ?# i& m) O; j - dma_addr_t dmaphysdest2 = 0;
" c+ ^+ { J; y3 u$ H+ E$ }9 a6 @ - 2 @9 a$ ~( w6 c) ]
- char *dmabufsrc1 = NULL;
' a* N9 S2 S0 [ a' {+ g/ y% @ - char *dmabufsrc2 = NULL;2 G7 Q0 A6 }( _4 C3 \
- char *dmabufdest1 = NULL;6 a! p' d( }- z# b2 ?2 ^
- char *dmabufdest2 = NULL;
" w. A6 f; K6 V2 H4 K: j5 L1 k
- c( [! k, K% c$ m- static int acnt = 512;8 S* P4 y# b* s0 h/ o% w3 ^
- static int bcnt = 8;
* p1 z- \& V( x8 N0 G3 | - static int ccnt = 8;/ z/ h0 h# g5 M. d
7 L/ \/ E3 r( ^; @+ G% v- module_param(acnt, int, S_IRUGO);) `& N ?# h& \3 d
- module_param(bcnt, int, S_IRUGO);' ^( z2 B$ i. m$ Z
- module_param(ccnt, int, S_IRUGO);
复制代码
; E4 w" Z+ A7 z- s& T, u9 t( l2 R
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' R% g& f3 U, n" F- `9 V
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ L' I" h; _5 p 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, o/ x# R( y: ]
: K/ O0 z) B2 G: N0 h/ Q/ l# k @; ~% z& g0 ^
|
|