|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 W1 U3 g. Z" y5 i
- [code]EDMA sample test application
# E% l, H& ^' {/ l' T% A" x) L) } - /*6 B# g7 g% F7 M9 u% Y0 B
- * edma_test.c. K+ r, V7 p: F% P: a( A
- *
U8 z8 Q5 A. k' P8 u - * brief EDMA3 Test Application0 g! l' \5 p1 Y# d
- *
. d. T" j/ X' L6 [- l- | - * This file contains EDMA3 Test code.. n2 c1 N9 I/ Y+ m1 R& h
- *
" x4 z- t2 ^/ l2 d( | - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
$ [" a4 n6 y$ ~4 o- ?$ j& a7 A( ~ R - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
9 j% H, Y: {' b$ f# W& J - * TO CHANGE.
6 _; A4 {+ c: U( N" v0 [ - *
" C) l& Z8 \/ n% |0 x* c+ \ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
f- m/ f% w* H# }1 ` - */ z! I( P2 u+ Z- ^+ ]
- * This program is free software; you can redistribute it and/or$ }! \* r+ T2 g9 |
- * modify it under the terms of the GNU General Public License as
! f" N+ x6 w0 r - * published by the Free Software Foundation version 2.
/ L: t% K8 y5 M. S- n - *
9 \* d7 F) o! A - * This program is distributed "as is" WITHOUT ANY WARRANTY of any p2 o* b( n/ w: B9 l6 T% y
- * kind, whether express or implied; without even the implied warranty
; i2 |/ n) r! _3 r+ @ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- S- I! G3 a/ b' E, V6 u# K - * GNU General Public License for more details.
G2 t1 p j& S. z N2 t: l1 a - */: v5 F, O- e* s# D
- 0 l3 A; S3 M' H0 f) Z
- #include <linux/module.h>
. ]1 T1 x& I" y- n! Z - #include <linux/init.h>
! j' I3 d+ ^7 o - #include <linux/errno.h>
0 t8 F/ l' u( ]2 F - #include <linux/types.h>
! {6 S0 Y9 L6 Y) O% h - #include <linux/interrupt.h>
+ U; Y, e0 Q% T+ @& }# U- z! q - #include <asm/io.h>8 Z" \7 C" [! }* F! S7 ~# j; ?, W
- #include <linux/moduleparam.h>7 w+ Y8 Q4 ]) w( y$ t! v1 G5 _1 P. V
- #include <linux/sysctl.h>' T$ U. v% c% M6 @; W8 ^
- #include <linux/mm.h>7 k* H( n6 @5 ~; w$ o
- #include <linux/dma-mapping.h>
4 i/ L& P0 k# q. n8 u5 O& x
, c, e$ r' t0 v- Q( w- #include <mach/memory.h> L5 z) t1 {+ X+ X: E( E" |
- #include <mach/hardware.h>8 d( D+ a" G, @! B- x" \% z
- #include <mach/irqs.h>
s9 A5 @) T0 C' @ - #include <asm/hardware/edma.h>8 N: E3 U* N2 z* f/ {: V
3 v7 m) N# K0 R: A5 H) t& w- #undef EDMA3_DEBUG
$ {9 J+ W$ ]& s3 H: Z N - /*#define EDMA3_DEBUG*/; h' b3 k# x7 [
- + Q, Z7 z8 `1 p) I
- #ifdef EDMA3_DEBUG( V$ e/ l! s2 t( i- g
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), y" o) L+ ^8 l# \& Z- k
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
; W* S2 {' a/ C - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
2 ]) h' m) [) p* a# I5 e - #else
( i: C8 g. [ ?" b* X - #define DMA_PRINTK( x... )
. m T u* W7 o% c+ L - #define DMA_FN_IN$ y% ~! a$ i; u3 o" ]- c0 o: _
- #define DMA_FN_OUT
i/ q6 c+ M% u2 C- d, `: J - #endif
1 n2 F7 N/ h! W/ }7 K+ D7 e8 Y# H - * R; H2 X0 U2 W$ R3 Z
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)' l1 \' ]: ^! B
- #define STATIC_SHIFT 3/ F0 z; z# q, E$ o: A/ Z* |
- #define TCINTEN_SHIFT 20
- J* @9 F) V* z2 r - #define ITCINTEN_SHIFT 21
! l! c+ t" X# P - #define TCCHEN_SHIFT 22
- n7 L% ]3 S& {3 D( | - #define ITCCHEN_SHIFT 23+ o7 k& l# R& }9 i% @; U& @
$ t/ u. A( J; Z0 a- static volatile int irqraised1 = 0;
. y1 k/ S& o7 M8 m, M - static volatile int irqraised2 = 0;0 u% i5 R& k& c3 D' p) U! F
0 Q, R9 g2 O+ G3 C- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& k1 o! s; v8 }1 ]) p0 m. q - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# ?0 E5 [3 h" } - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; v9 k7 @- G+ o% h6 P7 b/ l
' R- q1 r; f4 Y5 V- dma_addr_t dmaphyssrc1 = 0;
" v) S& q1 |/ ?* N# F - dma_addr_t dmaphyssrc2 = 0;/ W5 O8 e4 A1 y7 N: ]
- dma_addr_t dmaphysdest1 = 0;. q* E; }% Y5 h# I3 y: @4 q' [
- dma_addr_t dmaphysdest2 = 0;
2 M" n0 O; f7 {5 n4 U - , b0 z& m$ V7 e' D. X7 U, @
- char *dmabufsrc1 = NULL;2 j( R' x/ z- i: t& H
- char *dmabufsrc2 = NULL;
* T/ g; O. M$ G) P8 N - char *dmabufdest1 = NULL;
; W4 C" o P! e - char *dmabufdest2 = NULL;8 m8 Z+ P0 U) I/ M. J
) x8 U5 }5 ?1 r" V% I: }- static int acnt = 512;
( a% z8 v, h" |2 v5 [6 d1 N - static int bcnt = 8;
; N; _- @' Z. ~: ^% t+ B - static int ccnt = 8;
' @6 G! }0 z+ O& H - ~( R0 _. }8 O# N
- module_param(acnt, int, S_IRUGO);
" ^- I' k# r: Z - module_param(bcnt, int, S_IRUGO);) s3 K: M- S+ S$ p
- module_param(ccnt, int, S_IRUGO);
复制代码
s; B: x1 f0 ^# \4 p2 r4 C/ a3 N y0 ^* {- Q, w. n* C
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 P/ r) _8 `8 Z& @0 N" F1 Karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& r! J3 |0 v: L% e& h 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 x: k3 i+ [ i, ?' T
! ~* ]9 l( }2 T; k# Q5 t
9 f+ T# J4 p2 L) }
|
|