|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ l: w$ F/ R- s/ g4 v- [code]EDMA sample test application' c/ ?0 I3 B: Z
- /*- U9 N o, ?! A' `
- * edma_test.c
: o6 k# F3 W2 d - *
5 |! x9 j$ @3 K - * brief EDMA3 Test Application6 m$ G; L' T* a
- *
- ]$ ~9 H" E4 e3 V7 ^4 b - * This file contains EDMA3 Test code.% M9 J% r. o5 `* B( D" x7 ~- w
- *7 y( K/ s0 m/ @6 \& M: A9 B
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; O# X- m4 \" [) _2 @+ m7 K) W
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
* |$ S y2 z6 s& T" Y+ v, { - * TO CHANGE." [, E8 ?+ s% O( M
- *- ]2 S, [7 M. @% o7 L$ |- \ ?- \
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ a# |* I3 |0 j S
- *
6 T. ]$ x" I& G5 o* s& B" g7 V* T - * This program is free software; you can redistribute it and/or
' u% s( c1 t% Q! Z0 {/ O - * modify it under the terms of the GNU General Public License as% b- s2 y/ p* Y. F
- * published by the Free Software Foundation version 2.
6 [) E& {9 B! X3 I - *0 {+ i y. j9 H# j" e6 P9 }
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any, w0 h3 d: q# \6 B: L
- * kind, whether express or implied; without even the implied warranty$ i9 c) V" \2 X* Y
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/ Y: o. }/ |' y6 v - * GNU General Public License for more details.) `& \3 C" J4 Q* ^ S* j% i* b8 d* X
- */
+ j% M' `6 g) o) l% E - ! V, Z8 o0 U# I
- #include <linux/module.h>
' I3 a% W) m2 K - #include <linux/init.h>
+ b5 A1 g! |8 j, ?* r+ L - #include <linux/errno.h>
; [. [5 e. @4 J( C- x* N - #include <linux/types.h>
2 g) h7 p. ~+ l7 q9 }! i - #include <linux/interrupt.h>/ P/ G1 U8 \: c6 U- l' y
- #include <asm/io.h>6 o" j: u0 X/ Q8 p
- #include <linux/moduleparam.h>' k, m/ Z2 B9 R8 X- G
- #include <linux/sysctl.h>$ @+ s1 G$ C5 {( V: [
- #include <linux/mm.h>
; h* R1 M% B* r7 h - #include <linux/dma-mapping.h>+ l! H$ D: k- X
- ; f; ]/ R/ X' k |) {1 Z3 N% z! y
- #include <mach/memory.h>4 U( Y1 [+ I, C4 J0 [
- #include <mach/hardware.h>* T7 f; R- u. V) ]0 A7 Y
- #include <mach/irqs.h>
" v1 C& p" _- j& g* |/ J1 M& E - #include <asm/hardware/edma.h>
8 z: A( B* p, G+ w7 X - - ^0 x ^* I2 f
- #undef EDMA3_DEBUG
' [( |/ ]& w' v, _2 K+ i - /*#define EDMA3_DEBUG*/" }* |% o( L8 g! G; b7 t- Q$ u
- * e3 v$ e5 D8 t
- #ifdef EDMA3_DEBUG
, l# P P: M9 Q, L3 O* }9 x0 }1 V- C - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 b; z6 s$ [0 d
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
8 N, c4 F+ y! s1 R - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ T( J) I# z4 S" E, U6 }1 }# z! R
- #else
4 {; u; s& J0 m7 [" }1 {0 V - #define DMA_PRINTK( x... )
1 r4 A, o5 T3 _6 i" M - #define DMA_FN_IN
5 z! P$ p, i2 q - #define DMA_FN_OUT" x4 a. ] r2 W3 f0 e
- #endif2 G4 `. v% G( P3 r
: b; d1 j1 F* ~5 s) n( e- #define MAX_DMA_TRANSFER_IN_BYTES (32768)6 N* F! G" q: A, g
- #define STATIC_SHIFT 3" h3 f3 r9 U3 l: S, y4 a# p/ b
- #define TCINTEN_SHIFT 20) w. B0 a; l) _9 p' V
- #define ITCINTEN_SHIFT 21& G0 ~0 V* E8 Q, R
- #define TCCHEN_SHIFT 22
* v L9 w2 j! d* v1 H - #define ITCCHEN_SHIFT 23( V. @6 J5 x/ S1 |
! I" \6 [$ @; i+ a- static volatile int irqraised1 = 0;" M' p' f* q, X5 b6 k
- static volatile int irqraised2 = 0;1 J, A f$ n8 g
7 x! O; e' j6 X0 V- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 y5 V1 U3 c4 S; C - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 _- y. w' }0 _% D# N7 t
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. b! Z5 s$ ~7 _% o: y. f; g - ' B7 U8 Z+ h2 Y/ ~
- dma_addr_t dmaphyssrc1 = 0;4 r) W4 r" G# R* I
- dma_addr_t dmaphyssrc2 = 0;
& q; o1 l- @. v& y0 @- X - dma_addr_t dmaphysdest1 = 0;
, K: x. X0 z1 P4 M: Q - dma_addr_t dmaphysdest2 = 0;
1 O0 M+ H R- Q9 d. Y - $ s: b5 t e9 U; z8 O( J9 ]; v* {" ^
- char *dmabufsrc1 = NULL;
% C) _$ c5 W7 V1 M) ]7 g5 s! d - char *dmabufsrc2 = NULL;3 G( H! u6 d: }: @1 D! V9 B% D
- char *dmabufdest1 = NULL;2 ]- v+ k: O0 V
- char *dmabufdest2 = NULL;
% L6 e# H: f( K2 C- \ - 1 _; Z6 k9 H4 \; S- a; M
- static int acnt = 512;
# B( J, Q' o$ m0 t - static int bcnt = 8;
9 M4 R. I2 B6 r5 H2 g - static int ccnt = 8;
' l- ?9 V. r: |9 B' j, b8 S0 Q6 [ - ) u4 c0 L. x5 G
- module_param(acnt, int, S_IRUGO);( o. M+ L: G4 K. X0 `5 @
- module_param(bcnt, int, S_IRUGO);
8 T* p; ]7 q( L, \( e6 B9 c# m6 f - module_param(ccnt, int, S_IRUGO);
复制代码 : t6 ~5 A/ x+ |
$ I" {; e5 ~% z5 i4 w3 U+ L 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' N* W) Q- x- F8 b# e# y5 N o* Iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* M% P9 o. G: u$ D% @% C* `' U9 _& G ^ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 I' J+ b! v5 r6 j$ g/ Z7 Q+ s# n. Y
& o* S5 k# t$ P7 a; @5 Y# W2 c# W7 B1 J, @
|
|