|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% M; q1 m! { Z; v5 N7 }0 a- [code]EDMA sample test application6 J6 n P3 L) F5 x
- /*3 H5 m; G# D' A
- * edma_test.c# _" G* F( D' b& [, }! s
- *
, w+ ^+ e$ g3 K2 B, Z9 o( ? - * brief EDMA3 Test Application
6 c4 D) q* B- p- k6 k( i! @ - */ ~& ]) @$ |6 t) J5 } C. A9 X
- * This file contains EDMA3 Test code.% d5 B2 |6 U' y3 a1 ? c
- *
5 p4 Q i |3 y0 ]9 ~ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; P, `( J- v* A+ K$ u
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
( f4 F" P. r" @: C( Z: B - * TO CHANGE.
6 U/ \( x+ o/ s! r# F# ^ - *1 y, G5 S0 `# B+ [9 \
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 n7 w @( u* X$ R
- *
* W' f& I" Y" M" D - * This program is free software; you can redistribute it and/or
. q7 G/ k$ }$ e" y. X+ S - * modify it under the terms of the GNU General Public License as
Y( j" Z! f% f7 n9 q0 c+ e8 [ - * published by the Free Software Foundation version 2.4 r+ p0 Y+ `; _0 {8 V- L$ j* H/ Z
- *
6 K2 u7 o! w5 J2 C. \+ D - * This program is distributed "as is" WITHOUT ANY WARRANTY of any* X4 A* u' D$ i# Z5 y
- * kind, whether express or implied; without even the implied warranty. m, D5 n% y3 A- m: F% h
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
( _2 f, m1 F' i - * GNU General Public License for more details.
5 n) u" ?* o: c5 A1 e+ _) @6 G - */
3 e3 n+ B8 w4 B+ V$ C% L4 Q% l - ( r$ d9 b$ p, _: Z9 t% L, f5 T
- #include <linux/module.h>
) |' B) h- |+ j1 ^ \' i - #include <linux/init.h>
; v6 S0 k2 M- `' j) R+ Y" U6 h) i - #include <linux/errno.h>6 q, [0 X% |/ y: D/ F
- #include <linux/types.h>$ ?) [* h) m! c: w6 Z
- #include <linux/interrupt.h># ~( G# y5 Z! @3 L
- #include <asm/io.h>; r3 s( b( n$ c) `' R' L' `
- #include <linux/moduleparam.h>
T+ `- ^5 i2 @" U: W - #include <linux/sysctl.h>) D G; _5 E# [6 d2 V
- #include <linux/mm.h>" @. G0 G# f& ]. W7 r" _6 r
- #include <linux/dma-mapping.h>9 u. j. k H$ z4 d$ q
- A) k j$ V. K5 S, v+ \! P+ x- #include <mach/memory.h>
& @8 P* I5 P( n' K$ J4 [+ s - #include <mach/hardware.h>; Z' B- B) c4 d$ _
- #include <mach/irqs.h>
. y8 t5 `) u! g0 ] - #include <asm/hardware/edma.h>
! P+ j# i/ s$ U& n: R4 [ - 1 V/ K& R- ]" M! W8 E
- #undef EDMA3_DEBUG
; @' w8 L' v4 T, N( C - /*#define EDMA3_DEBUG*/# s7 w! D( J$ w" K3 r, d# f5 l
5 Z4 g3 F B0 n7 Z( E( j8 O% z- #ifdef EDMA3_DEBUG
5 U x% c. [( l b- q& G - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ F" `7 l: ~- P9 f
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% Y2 T1 ~3 E* P' g8 C$ F ]* F
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
& e; w1 k7 f# @9 ?$ _. Q - #else
( B4 ?0 C0 I Y( n9 L - #define DMA_PRINTK( x... )
* ^! z# I9 T' U5 G - #define DMA_FN_IN, X9 ?6 s6 e; f, ]$ q
- #define DMA_FN_OUT
+ t9 |8 O: [" j [8 \% E% ^ - #endif* y& W: V5 P- T$ d2 p
- . Z0 k6 ?9 S# g9 d' O
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)* c2 v" _' D7 V% [4 N! E k- |
- #define STATIC_SHIFT 3) \ E- t2 Y) o2 T% A3 V
- #define TCINTEN_SHIFT 20
* f2 X7 L% |, A m4 r9 g/ B/ U - #define ITCINTEN_SHIFT 217 F6 w. I- T, o" v2 K" e; L) U
- #define TCCHEN_SHIFT 22
: k* R5 l! }. e% @: | - #define ITCCHEN_SHIFT 23! ^: T+ x/ Q+ d
; j e$ c% ^8 X x- static volatile int irqraised1 = 0;, [2 o) g" \5 }& L, A
- static volatile int irqraised2 = 0;: m) q- a8 z9 T" s
5 N9 l0 q' G& l: N) D" E; |- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% @2 }# J$ K- {; f4 q; |
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- ]$ c1 I2 H8 `. L - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- T) l6 }9 |3 V& f
# ]& e( e5 H1 f4 D! `- dma_addr_t dmaphyssrc1 = 0;
& G" ]" s, V/ `" J2 h# q( Y - dma_addr_t dmaphyssrc2 = 0;/ f9 M0 V5 ?. _% G% j0 I' |
- dma_addr_t dmaphysdest1 = 0;
. \( q7 P# R7 K a: r o - dma_addr_t dmaphysdest2 = 0;
$ c/ K1 m& x0 A# e9 ~% @
& ^" N0 @; f( F7 `4 N$ U2 b- char *dmabufsrc1 = NULL;
" ]9 T6 ~& Y% @+ ^$ i$ q2 Q - char *dmabufsrc2 = NULL;( Z8 l* C( M$ [# S
- char *dmabufdest1 = NULL;/ [, p9 |+ j: B/ x. c- `
- char *dmabufdest2 = NULL;
# A4 f0 w) G4 j% F) j: Z, v0 o2 U0 @ - 0 b0 [8 M: s Y2 i6 S$ G6 I S j2 R
- static int acnt = 512;( I0 p( t0 z% N8 L% n: Z8 z
- static int bcnt = 8;- q4 J8 j4 O8 T2 J7 _ X+ b/ D
- static int ccnt = 8;
( ^9 R' V6 c! k9 a K) O - $ I& k% A' e7 R9 t* D w
- module_param(acnt, int, S_IRUGO);
$ L5 U1 O7 z" _7 U% P8 t - module_param(bcnt, int, S_IRUGO);
; r, U7 y2 n. q) E- w* H; j2 p9 R' U - module_param(ccnt, int, S_IRUGO);
复制代码
% S+ s' a) B0 y7 m: f* v" O' T/ ^; T3 t4 |& G8 D& M
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' p) ]: w6 T" p& Q+ ]
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 \ g9 p( y/ ^3 g) R) h" O
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# e) [" R) d. r: R
' `, p/ M: l9 q* `" o" U! G
0 I5 b4 p" o. t3 e
|
|