|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! v1 L; T0 x: o" I& ^+ y
- [code]EDMA sample test application
9 p# T. `2 q9 @" `8 \ - /*
3 ^8 U" @, A7 ~6 Z( M G. Y - * edma_test.c
, \: J! O* Y8 S" r k" ? - *
7 L. ?, ?+ z. j3 Q! J - * brief EDMA3 Test Application5 o1 L$ o' z$ D+ |1 D4 p
- *# x2 C: m$ t; f9 ^+ K
- * This file contains EDMA3 Test code.; _5 j3 P4 \( m1 y6 K. T
- *1 i q; X4 @0 Q) @# f: `/ d- [
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
; u5 t' h! [5 s5 V2 s$ k - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
" Z! Q2 A8 C7 ?7 J5 h; l - * TO CHANGE.. x- Y# q6 h% K& s0 q8 K2 L% C
- *, r- L U8 ?" \3 O
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
4 t( M9 }$ |. q2 `" n7 R9 D& F) h$ n - *
# O* \# A8 q- x - * This program is free software; you can redistribute it and/or* r- T: x# w( M' D4 ~
- * modify it under the terms of the GNU General Public License as. i( I" U" P# V& i1 W( ^
- * published by the Free Software Foundation version 2." E. R. o6 R }% w, C8 m. r' _3 p
- *
5 N& Q: x8 a' ?) O - * This program is distributed "as is" WITHOUT ANY WARRANTY of any. s! m# N$ \0 P' {
- * kind, whether express or implied; without even the implied warranty8 @, c. }& F" M7 d5 }' \+ ~9 n
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the( g4 C0 e$ H$ c/ n {
- * GNU General Public License for more details.
; m! v5 T- g& R2 c$ B0 w J - */
% i+ L; ]# {) ]* u8 L# z d: M
, @( v# a1 v. W5 _2 }5 m- #include <linux/module.h>9 X7 b0 V7 ?- U5 \, V) O
- #include <linux/init.h> U* v- _* y+ b K2 Z
- #include <linux/errno.h>
' S3 |5 I0 E5 W0 h, h+ w - #include <linux/types.h>
1 J( ~; D/ X. q8 ^5 a - #include <linux/interrupt.h>
2 M" L# S% m, a6 a3 n) Q+ n" i, b- ^/ ?2 g - #include <asm/io.h>9 Q! B9 a& F1 L. n4 z: N5 F
- #include <linux/moduleparam.h>6 J1 n! R0 K# @- E" S8 K) D4 }
- #include <linux/sysctl.h>
% u. q2 H; C* L5 ^1 i! B - #include <linux/mm.h>
! ^8 \# b- @% E$ ` d1 O/ s - #include <linux/dma-mapping.h>
1 f5 ^6 R" k( @5 c* @
. _6 m/ P1 N. f# l# c( X: {* d- #include <mach/memory.h>* Y7 m( ~4 E- {# r& P" ]
- #include <mach/hardware.h>
/ i/ K/ k3 o5 x( C9 S. R - #include <mach/irqs.h>6 X/ p6 {+ m9 Q
- #include <asm/hardware/edma.h>9 D* Z9 C2 G* a. L4 Z& {3 `/ I
- - y( k) S* [! `$ ~% I3 u
- #undef EDMA3_DEBUG( D* }, z k- ~) u: ^; F! D
- /*#define EDMA3_DEBUG*/4 _4 a1 h& p5 B9 H. o
7 S2 e- p% { O0 O5 F5 a- #ifdef EDMA3_DEBUG
# s% n( R! F" l% |# J8 z - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
3 p% h# p% v1 D& J1 \9 j - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
. n9 k4 S3 P- X - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 |6 V$ Y8 y' c/ S
- #else, n7 u0 t7 |# q& d# N2 N
- #define DMA_PRINTK( x... )" K* k- m9 a, D+ X5 p
- #define DMA_FN_IN
/ `6 I( _- i- I& X4 [4 V - #define DMA_FN_OUT& Q/ U' Q0 N5 n9 [& W4 X
- #endif
6 C9 r0 G# _ I# H - 6 ~7 K" s. p7 Y* K1 n
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
" G: R: j% w' k' E; a# |3 [ - #define STATIC_SHIFT 3: V" R& @7 N* x; g, C5 W
- #define TCINTEN_SHIFT 20
, c! ?: U* [1 H8 U - #define ITCINTEN_SHIFT 21& @# ?; T: x1 R+ m- L( ?
- #define TCCHEN_SHIFT 225 C9 P7 C6 |* w" x1 p) N( k
- #define ITCCHEN_SHIFT 23- `7 a& Z( C( Y8 F* x
- ) q. P: b8 f5 l4 P" H$ @
- static volatile int irqraised1 = 0;
3 D0 R% M& W# U3 x5 c+ D - static volatile int irqraised2 = 0;
* e1 m0 k( E5 h {* g" E$ F
: i$ k5 G7 ~& v" |6 O- h- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- T5 G! Q: R6 _5 } F+ U, Z - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% T k9 d" V9 ^0 ?) z; A - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 { {: ]+ |* Y: Y$ ]& w+ T) F
- w. C- H; t2 K& g! N
- dma_addr_t dmaphyssrc1 = 0;+ {& p3 ?% N$ N8 S
- dma_addr_t dmaphyssrc2 = 0;8 l0 F1 `( Z9 d0 ~& v9 s! H! }
- dma_addr_t dmaphysdest1 = 0;1 V/ \- H+ e/ d, X* s
- dma_addr_t dmaphysdest2 = 0;
( l* k# U) {) e) f
m" U0 H' T1 {7 \* H4 P4 G. y- char *dmabufsrc1 = NULL;" Y& }0 U( n7 ^! _, N- f
- char *dmabufsrc2 = NULL;7 l% ~0 }0 F/ \7 S% p" X+ H
- char *dmabufdest1 = NULL;
2 s/ i6 g0 A& y: } - char *dmabufdest2 = NULL;, Z, O$ j5 S/ |; |% W! D
- 0 s1 i9 G6 c m
- static int acnt = 512;
% ] `8 d. k2 G, j m/ Z - static int bcnt = 8;4 s* T2 ` z2 i; L, T
- static int ccnt = 8;% `7 j M* a" O1 ] V( s$ e
- ! |: ?9 G" j/ U3 H! N+ K
- module_param(acnt, int, S_IRUGO);% S6 x) S/ P+ v- I6 D$ P0 z L/ s
- module_param(bcnt, int, S_IRUGO);" x- {0 G, k9 L8 A8 \- J
- module_param(ccnt, int, S_IRUGO);
复制代码
0 O) u7 M3 |5 J7 h' t
* W) s" M& o% f* n 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% s; J- w: f- I! A5 z! f
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 K {2 I! S$ k8 M8 a# U% c# S
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 n: o- g% z B# L# W2 p* `+ p
2 L0 b) ~" K# {; ^9 ^
9 a: @* q' B; `7 m. I |
|