|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' Y9 f: G0 m @7 h3 T( q8 v# V
- [code]EDMA sample test application# s8 ~! a2 y7 q' r
- /*
: T3 w" |$ Z- S$ O5 E0 H9 m# t - * edma_test.c
: Q) p7 H c1 U, @+ b. _ - *
0 a- {2 w! Z/ e' \9 `: e - * brief EDMA3 Test Application% P: @! h( l) Z3 M6 m7 F
- *9 N$ [+ x8 D& w/ |
- * This file contains EDMA3 Test code.
( X0 ^9 m6 C x$ o7 X% X - *
. J ?( K) Z8 l& Z% J - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
8 k* V# `8 r4 }- I' R - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, h1 c7 y9 n, V# s, ]# E3 N/ l
- * TO CHANGE.
$ D, v9 _4 ] p) B - *
1 j! V3 `2 [- N Q& T - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; _2 D% r4 N: t
- *8 {( k. |' z; s: U5 t- H
- * This program is free software; you can redistribute it and/or
* e2 W9 j8 D. b. E" {; f - * modify it under the terms of the GNU General Public License as6 l& X4 F b# H1 v% Z) d
- * published by the Free Software Foundation version 2.
% o5 W8 b7 o' s4 }" r6 P5 _( \ - *! l, V1 Y' p+ j3 _: a+ s( P+ P
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
8 t, p. N9 {; J' t - * kind, whether express or implied; without even the implied warranty
& c6 L1 O7 ?) t - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the& U ~7 @, {; x
- * GNU General Public License for more details.
$ i: V. w: ^: F4 ~* V9 k - */+ I9 t% \! d- ~5 Z8 y7 `+ Z
k: ^8 U$ B/ \& t- #include <linux/module.h>2 G5 @$ A0 A& g
- #include <linux/init.h>
) e6 Q* Q+ h7 V6 G - #include <linux/errno.h>
( ~* P8 z' Q2 J# T - #include <linux/types.h>- z- a3 X% U6 V2 r
- #include <linux/interrupt.h>
+ f; U" ?# b$ F1 b - #include <asm/io.h>
. ]& }& g4 s, K6 P t% O3 q - #include <linux/moduleparam.h>
8 ?. D$ `/ E) _- J$ z4 S - #include <linux/sysctl.h>: F& b7 S% G6 E( G; z. Q
- #include <linux/mm.h>
; s J1 g& u" h Y. R% `4 S2 r - #include <linux/dma-mapping.h>
! J& \ c$ U# g, z( I
. ?# n8 U7 \$ j: c; w2 H! W+ ~% b% V: F- #include <mach/memory.h>
; K+ y; L2 x7 b1 S" Y! l - #include <mach/hardware.h>3 Y0 E, w3 y( _- m# ]
- #include <mach/irqs.h>
7 m4 Y# ~! u: i3 J' H* u; ^ - #include <asm/hardware/edma.h>
$ I" s9 | h) n! \; D" t8 {; V% i6 U
$ O1 g5 w S& j# x. T0 |7 H1 M- #undef EDMA3_DEBUG/ |4 g3 U( U) S$ r: J+ n
- /*#define EDMA3_DEBUG*/
0 L2 c; c6 N- K) E w4 J - ! l& e, @. w! z3 }$ k# v+ ~
- #ifdef EDMA3_DEBUG
2 Q. S, N$ A9 A' ~5 K - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- R& |9 O1 _9 ? q
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" F# y1 h4 Y) f' X# g
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), |# p4 o* i1 L7 J* `5 T
- #else" D# K- h. s$ V3 M2 u( d
- #define DMA_PRINTK( x... )
' B( b/ _' y5 n' Y- X - #define DMA_FN_IN
5 Z% ?; R5 C$ A% w3 P( d - #define DMA_FN_OUT
7 w" I1 H5 \5 j5 D1 b6 \2 u - #endif5 B& B! ~0 ^& g* H, |7 U
* w- Z5 @( r/ D2 B$ r- #define MAX_DMA_TRANSFER_IN_BYTES (32768)5 b# q7 X4 h6 _0 Q
- #define STATIC_SHIFT 33 B8 q& }6 ]; C7 d
- #define TCINTEN_SHIFT 20+ m( }4 w, F8 J! r
- #define ITCINTEN_SHIFT 219 X8 `1 Z% T( Q" e) q4 |
- #define TCCHEN_SHIFT 22
( ^* ~- l4 T0 ~& ]6 ~ - #define ITCCHEN_SHIFT 23+ Q% p' ^7 h6 ~- T5 d4 E
- - h6 M v Z* f- N* o9 i1 b# o6 v0 l
- static volatile int irqraised1 = 0;
# t* P, v7 L# Q! k/ |# i - static volatile int irqraised2 = 0;
( }+ U, O% p; e0 F( S0 R) ^
a* t7 ~; V! Y& }0 n f1 }- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) P) ^; |* B& H! E5 S' R
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 T$ `5 k2 G! W" n7 l% P t4 d - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( @4 @, w+ t) J1 c+ v" U
. f% I, K' q5 c, K* ]( y! {- dma_addr_t dmaphyssrc1 = 0;6 B1 q$ B' H. |! r3 Z, b
- dma_addr_t dmaphyssrc2 = 0;
, z: U: [' r, W# l( C) E2 v& c - dma_addr_t dmaphysdest1 = 0;
9 I2 U/ a7 m6 F% q; K( a! A - dma_addr_t dmaphysdest2 = 0;2 y4 R3 m' \" ]# t
" @" x8 U+ E% J6 p( W- char *dmabufsrc1 = NULL;: G4 f. L v/ K2 n( ?9 A, U
- char *dmabufsrc2 = NULL;
; j$ ?2 F! @- x7 z& a - char *dmabufdest1 = NULL;4 M) V: z5 F( N' b. R- Q* `. Y
- char *dmabufdest2 = NULL;4 p* t# p1 a3 K/ E
- ! m& a) d' l1 v& e% Z: m! `- O
- static int acnt = 512;
" d: k. d9 U6 [* _6 u( h" e - static int bcnt = 8;
6 _! O: v( Z+ P6 L8 ~+ A& \ - static int ccnt = 8;1 O. b; \/ I6 c
3 c2 i3 c. T0 q( \! Q( _- module_param(acnt, int, S_IRUGO);6 M' }* T, p( b) d- Q& m$ p
- module_param(bcnt, int, S_IRUGO);
, L) c0 ?. ? Y' l - module_param(ccnt, int, S_IRUGO);
复制代码 : b2 H& Y$ _" h2 h+ }$ w' b
7 n [4 @* h7 ]' L8 ?
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& _, K; {: c/ i; }# n2 |
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ T9 \2 M0 d# U; d 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( G) n% r( o* G8 F) q' z- i
! l/ Z, k$ Z0 _* O
+ j/ s; Y# A: X; w5 k+ s |
|