|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: T! M8 Z* e+ p$ s, J: v- [code]EDMA sample test application7 Q g7 F7 ^2 l
- /*6 r/ Z1 u0 @ H5 C9 F
- * edma_test.c9 j. Y6 N4 M/ S/ x# d7 ?6 o
- *8 N* l; d/ ^2 A- m
- * brief EDMA3 Test Application
3 Z- M4 I- R' |$ A3 W - *
; e: `" Z2 c% p4 I: u& }% ] - * This file contains EDMA3 Test code.) k7 c, A: c0 Z/ {$ a( q b
- ** m+ Z, b$ x. x, E9 X% V) _3 J) ~
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
! @) @- i4 p+ [# k - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
6 e2 i) j7 t; w - * TO CHANGE.
- K2 I3 B R' g/ Q0 z - *2 B: w5 T+ M/ \7 ]4 H
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! q, ?6 o6 W) c
- *
+ L4 i# c/ H% y# N# e$ J - * This program is free software; you can redistribute it and/or! k# w$ R0 {! R
- * modify it under the terms of the GNU General Public License as
- Q7 t1 s4 C2 `; D - * published by the Free Software Foundation version 2.- k. `2 a- T0 s3 B" A+ q
- *' {1 r. ?% ^& E; B4 Y
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
$ T# Z& |1 \' V+ U1 N7 y9 }1 e - * kind, whether express or implied; without even the implied warranty, ]" ^( k5 V+ _( ?7 Q6 H ^3 e
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ Z5 g' l2 Y4 h h
- * GNU General Public License for more details.* x0 b: Z' w. r( J
- */2 K( q- Q- W3 h' p+ r% F5 m
7 P# C' W2 L) ^4 w9 M- #include <linux/module.h>% R2 o3 H9 M" h/ e
- #include <linux/init.h>
0 |- G# F# T2 U2 E* w* a. s - #include <linux/errno.h>
; ?. t" v, U1 G - #include <linux/types.h>
; L% \( W# H& f( } - #include <linux/interrupt.h>
: ?1 A! k' k- E# y - #include <asm/io.h>
. g( n& B- `$ X) ` - #include <linux/moduleparam.h>: ^. y& e- a( p6 b* Q
- #include <linux/sysctl.h>0 ]1 I& p q; V9 ^- Y
- #include <linux/mm.h>* I/ d4 }" ]9 z c6 ^
- #include <linux/dma-mapping.h>7 d: k# h+ I/ ]: b
- ' Y9 Z; F9 ^% {
- #include <mach/memory.h>
" F: |$ K/ U3 y# r C; u# d& } - #include <mach/hardware.h>
) a3 U7 G' r( B: ?+ ?1 j6 R - #include <mach/irqs.h>
# k2 d& b* h5 D: L' O# E - #include <asm/hardware/edma.h>4 I" M& q3 _& G l9 v( `% q6 d
- 5 \7 r! W8 h G6 I
- #undef EDMA3_DEBUG
6 \, s% V5 }1 }% u - /*#define EDMA3_DEBUG*/( u5 E& I2 [% M9 z- v
9 Y6 O0 X- w4 X3 s( i6 @+ s- #ifdef EDMA3_DEBUG. o; E' y* c8 h3 s% \5 V+ P
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
1 n- R) {- X% w! z0 \/ V" [9 K - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% K. N! P5 d5 l8 h6 T' v
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
' F3 K0 W) f+ h' R8 k! x( A D- z( s - #else
; v6 q, g) Z) U4 [: C - #define DMA_PRINTK( x... )
- L% G( u) Z& i& X - #define DMA_FN_IN
! a% X; J4 m4 C ~/ s - #define DMA_FN_OUT
0 F! g# h; Q/ k# V, P9 h+ b$ F2 b8 R - #endif: b% r4 a: _) h" O3 t" i, c
H( D8 J% Z$ Y# P8 A+ k- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
1 s9 \4 c' q, @0 l - #define STATIC_SHIFT 3
1 w s z9 f2 r' s - #define TCINTEN_SHIFT 203 p9 Y# e z5 O7 {- h
- #define ITCINTEN_SHIFT 21
2 \3 U. F8 o% O1 W4 r% E, L3 h2 @ - #define TCCHEN_SHIFT 222 n( A+ R0 y9 m% l' ]' O
- #define ITCCHEN_SHIFT 230 T5 e0 {5 a( L
/ Q% b6 g5 M. F) q0 P! r- static volatile int irqraised1 = 0;6 p5 \1 V6 o- S$ f1 @( \( w9 o; b% ?
- static volatile int irqraised2 = 0;
! A: a% f: N/ u - # ~1 [6 l, h8 u
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; ~7 n1 Y6 ~2 }) L" H* h+ E - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) I, b' r% S" z. y
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" P/ i7 w( f5 q
& B! c- {! ]' p0 M# g! L' s# w- dma_addr_t dmaphyssrc1 = 0;
8 Y( g7 B s! S* Y; l - dma_addr_t dmaphyssrc2 = 0;
9 C0 J/ Q* h. D/ S! n" o - dma_addr_t dmaphysdest1 = 0;4 ]) D- R; Y6 N& o1 O5 O
- dma_addr_t dmaphysdest2 = 0;
$ i% V) l: O, C! M4 t' r8 p4 D2 a% r - 8 m c+ I% ~1 y; T
- char *dmabufsrc1 = NULL;
8 R) H" W I( Q - char *dmabufsrc2 = NULL;
6 Q# s: @' ]- e+ W! z' p- ~ - char *dmabufdest1 = NULL;. d" U$ A; s! u: Q5 |- F
- char *dmabufdest2 = NULL;
6 e/ ^/ B9 P/ f! D# a. q& e
% b. b( [/ ?9 Z0 b- static int acnt = 512;
% f+ O6 \9 z3 w1 u' T - static int bcnt = 8;3 S# E: b) O( { o* \; | l
- static int ccnt = 8;
5 G$ o/ Y5 R) i. _
# M+ _8 \- G8 w& J/ K0 }- module_param(acnt, int, S_IRUGO);. n1 m# K' S- k
- module_param(bcnt, int, S_IRUGO);! [0 ?( t# Z* H4 C
- module_param(ccnt, int, S_IRUGO);
复制代码
, I1 U$ h9 w! |+ j: K/ u$ I# l% `0 R! d/ c9 p
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- ^; P6 }3 a! f1 A9 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 E4 p( B" [) S( R$ y 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 U4 [0 a! b V5 G1 t' Q( s4 P
9 t$ b# i( ?6 q# N7 m. b
$ |/ L1 V$ E: c4 p+ `9 b9 ~: {- J |
|