|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % L! d1 K" q2 q$ H
- [code]EDMA sample test application
4 _: F# z6 p' P - /*
+ [0 ]( }8 I w+ X2 ^: x& o - * edma_test.c
9 B7 e' o ]# Q8 `3 B. O - *
& B7 c# h: N) Y4 r5 C - * brief EDMA3 Test Application
5 O3 _- j' G3 A* I" c - *# W9 w" j* M! ?0 h
- * This file contains EDMA3 Test code.
0 J* P9 f! e1 G1 e, f. n - *- b9 V& j' r0 |9 R
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
( q2 g7 d a4 V2 L K6 Z/ G7 G - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
1 W# G) t! y5 X# y7 B+ | - * TO CHANGE.
2 a6 C5 d8 c1 X: L8 b+ e7 m - *4 x# |' j3 \3 d
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
2 W: {" y# ~+ v( Y( K2 a, f# t - *4 @, r0 A; b, h& J) P" M
- * This program is free software; you can redistribute it and/or& E) q7 O: \; |! g7 d8 ]4 m0 J
- * modify it under the terms of the GNU General Public License as
1 p" b; X3 N$ K8 P H; X+ L - * published by the Free Software Foundation version 2.
6 Z; i9 M5 `! ^2 T1 f$ [ - *+ c* [; i- W$ U5 I
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9 a) D/ m% b$ |) P+ r - * kind, whether express or implied; without even the implied warranty
$ E/ t9 ^" L: s, e' d$ i! i q - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the. O: }" G7 u1 ?9 ~% A: o5 O- y) T
- * GNU General Public License for more details.( m) { r8 ]1 N. F, H, A
- */
6 D8 S7 J" y5 L/ Q4 w% e' H( Y - , E! F L3 v% I3 @8 Z6 Z" B
- #include <linux/module.h>8 m# c; x& A0 N8 r$ ?2 |
- #include <linux/init.h>1 _& Z6 k1 B& ^# h& D2 G4 m6 v% f
- #include <linux/errno.h>
+ B* w7 R9 O% g2 ~ - #include <linux/types.h> x6 n7 |- `2 e/ L" N
- #include <linux/interrupt.h>
& q6 k4 u7 H0 r* H# L B6 {& l8 i - #include <asm/io.h>* P Y2 p' Z+ t0 ?% ]
- #include <linux/moduleparam.h>+ L6 [2 m1 _* [7 i& k
- #include <linux/sysctl.h>! x7 p7 P: x9 z. p. `) P
- #include <linux/mm.h>
3 I d) U Q/ a7 G" e2 N, |% s - #include <linux/dma-mapping.h>, [( p: d+ A G( |% I7 |' P5 S
- ! `" O& ~9 P0 x6 D% M+ k. u r" a
- #include <mach/memory.h>
; d+ V9 M) W3 ?' W4 F# J - #include <mach/hardware.h>; K+ { J$ N2 L$ f* A
- #include <mach/irqs.h>6 q- M* Q$ t# q: N, j, y
- #include <asm/hardware/edma.h>
' L2 n/ r9 W( Q" {6 A$ p
& [( r) Z. u# S& S/ w5 d* N* I- #undef EDMA3_DEBUG
; O5 G0 g; W) e' o7 t/ H - /*#define EDMA3_DEBUG*/% T( }) t% g1 Q/ F9 }4 z' S
* F% n) ?6 p, V4 n3 J: b7 v- #ifdef EDMA3_DEBUG" n% F: U1 X2 [8 y0 J
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- s ~3 \, f6 o/ {. Z& c& A- ^+ A
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) g$ b' @- @; _8 \" c2 U5 N
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
: g Q$ @: f+ V/ ?! h9 N - #else
]/ f2 E4 ~. M% e+ [ - #define DMA_PRINTK( x... )
! w, o0 N1 \7 r- a' S1 t - #define DMA_FN_IN
: v M3 q% y* F2 f - #define DMA_FN_OUT0 d, F! S& F* v* b+ v8 S) [" l( C
- #endif
5 _' M& i" h( B) s$ m7 c9 R0 q
* p4 [- H" h; f# x- ^, ?1 N3 x- #define MAX_DMA_TRANSFER_IN_BYTES (32768). b8 ^; M# y; l R
- #define STATIC_SHIFT 3
. Q _+ w- u5 t7 s1 Q - #define TCINTEN_SHIFT 20+ N0 V$ p# S% {+ l9 `& I# S. X! b) T
- #define ITCINTEN_SHIFT 210 M: J: h: y' e, {4 L. ]
- #define TCCHEN_SHIFT 22
8 H$ d9 o* v) r$ Q5 c) x - #define ITCCHEN_SHIFT 235 Q1 a- p, G3 {# v
. l5 f/ m1 Z* S/ W- static volatile int irqraised1 = 0;: x, w: M" ^/ X; w
- static volatile int irqraised2 = 0;
3 |' R! h$ a$ G: M
3 h. {. K q5 A! N. b# {- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: h: t, i/ g, I2 ^/ ^5 b
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) @; F ` u, {6 ~6 R8 e
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: ~" B3 ~; _; Y/ k& _5 p' L
- ! i, N7 w6 X$ z4 d' |* B4 I
- dma_addr_t dmaphyssrc1 = 0;+ t& l( G2 Y% o! Y) d
- dma_addr_t dmaphyssrc2 = 0;+ i; Z5 h( ]. |
- dma_addr_t dmaphysdest1 = 0;4 v1 n/ ^- G" B1 z, @2 G" G
- dma_addr_t dmaphysdest2 = 0;
8 L. y6 a- G2 C+ K3 o
2 O% X& Y) j, A; J, l# J- char *dmabufsrc1 = NULL;
, j- m. }7 @7 e8 ^9 z- V - char *dmabufsrc2 = NULL;
" ?* _ O7 q; A - char *dmabufdest1 = NULL;/ }) X8 o2 N# }/ D) o
- char *dmabufdest2 = NULL;; u- z- Q& A4 F) r) v1 [% ]1 ^
- v7 A7 b) f! ^4 C5 C- static int acnt = 512;. S( _ N1 B/ a3 z: o
- static int bcnt = 8;
* m1 T* t# |: p n* ?7 C' H. H - static int ccnt = 8;; y( Q- `" Z6 W' _& C6 H4 s
* }* V1 {7 X% y* {- module_param(acnt, int, S_IRUGO);+ A" [3 M4 d( ]8 ^' h
- module_param(bcnt, int, S_IRUGO);. {# k% T7 \1 d
- module_param(ccnt, int, S_IRUGO);
复制代码 ; |/ F2 i6 c! y7 P0 N
5 n, i, v9 N0 W8 U& n 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- l$ q$ q: h: L2 G. T( s: b: C5 Parm-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 [4 Y& m+ W) M6 g 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& `+ n! e* c1 T* U5 M4 v3 w
) g. u' R* I9 @) z# t
* d# ]: R% Z& Z5 X A3 _
|
|