|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 j, k4 A8 h+ `# H. _5 j) f- [code]EDMA sample test application6 x7 A4 [( A) k5 ?
- /*
6 K5 d8 D, A# O5 I$ D) E% [; n - * edma_test.c& j9 ^& a- _; K, Z
- *
# f8 _. p# O' \# M L/ Z - * brief EDMA3 Test Application
/ X5 i' W5 l" i: M- c7 V - *8 T& Z% v; L# }- M
- * This file contains EDMA3 Test code.
* j/ x3 J" b' u. ~' i - *0 C9 |3 ^% B$ E# Q" p
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! D1 k0 v: O% u4 b. L8 ^ R
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
! D7 U/ x& `" I& q+ j8 A# K$ t+ F - * TO CHANGE.
. g/ |% J( F/ F - *6 O) m! y9 S1 C' l
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
$ w d3 Z+ v/ {( N9 B, N! J! \ - *
3 B7 Y0 h" [% H( z" X - * This program is free software; you can redistribute it and/or- f' |( ~. t" s; |
- * modify it under the terms of the GNU General Public License as
- ` @: W% _1 a, ~4 i+ d5 n - * published by the Free Software Foundation version 2.; Y- N9 L0 l3 v( H9 Z4 o2 h
- *
% \" ?0 R( @3 ]+ v' X! L3 ?1 r: o% A - * This program is distributed "as is" WITHOUT ANY WARRANTY of any, {6 o6 G, ]6 G: v: B# J
- * kind, whether express or implied; without even the implied warranty8 j/ o( k- g) H8 q- E
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4 d* ^4 u# a$ F8 O - * GNU General Public License for more details.
3 [# B" @7 y$ `7 R' j3 {1 k - */
( T H2 C" m4 D: `) ?
- j4 m9 ]* K4 G3 O1 A- r- #include <linux/module.h>
6 L* J4 j& A% g0 R3 U4 |+ ~0 X$ R$ j - #include <linux/init.h>4 _9 s7 K+ ^# ? q: D7 ^: p" d% O
- #include <linux/errno.h>- b$ U0 {# |' T( @ H
- #include <linux/types.h>0 [& I9 \5 \( V+ V( W& _# G
- #include <linux/interrupt.h>
* z6 k0 L/ i- T/ u5 ^' ] - #include <asm/io.h>1 `$ N; S* X4 U
- #include <linux/moduleparam.h>
+ z( y* Q, i- l2 Y% `4 Y) Q- ? - #include <linux/sysctl.h>
0 O# y8 ^+ G0 I - #include <linux/mm.h>
6 R1 T( X2 I* `' P7 }" H - #include <linux/dma-mapping.h># u8 d* R) u. X4 ]# ]8 d
' H# p4 |3 @0 [6 J$ }- P+ A- #include <mach/memory.h>
& c8 N! \; b- s - #include <mach/hardware.h>
) d5 y; P1 j$ R. X1 f - #include <mach/irqs.h>( g) Q i$ l, _" k1 F0 n
- #include <asm/hardware/edma.h>" L: ~$ w: C9 `& `2 g C/ c
- ( X" r4 ~: U- C
- #undef EDMA3_DEBUG7 e7 H t( Q$ g( \: h/ r! Q( ]6 \
- /*#define EDMA3_DEBUG*/% Q1 A) I; x2 B5 D
- : T! F; ^' C# C/ b
- #ifdef EDMA3_DEBUG
9 E% W. ]. J% {) }: u0 O - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
1 [' q) v0 X# U8 k4 x2 ]# _: r - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 V% n' p1 h7 g; \" v
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
8 d* Q" A3 m- r6 {; x' a - #else4 ~: T" \# t% f
- #define DMA_PRINTK( x... )
. {; h2 P. x/ K) q9 U - #define DMA_FN_IN4 I$ `, J* X1 P
- #define DMA_FN_OUT
y) J$ z4 o: J( P - #endif6 b, b# \7 U- W* [! W* C
. M2 N+ Y7 T. ?' ^5 m# p3 ^- #define MAX_DMA_TRANSFER_IN_BYTES (32768)/ k' ^' p# O: F' I- [
- #define STATIC_SHIFT 3
. k6 n* g5 _1 O T7 e3 f - #define TCINTEN_SHIFT 20
' F& @9 X+ c% l' ~$ [8 Q. [ - #define ITCINTEN_SHIFT 216 K: I% X) {: r
- #define TCCHEN_SHIFT 22* J; a5 U1 R' e8 E/ }1 z6 ?4 e
- #define ITCCHEN_SHIFT 23
/ x5 x2 v- _, \3 P: H! V* Y - ' R+ j7 j+ O( h w" d: X
- static volatile int irqraised1 = 0;1 [. N8 \. K: q! _* C
- static volatile int irqraised2 = 0;
& @$ H f, x3 B& I4 E9 y/ S - 6 u+ g6 _) G$ c& y" g( k; H
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ j! E- M7 s9 }" f- M, f/ e - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 q2 W" a. F) `! n. l - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ R _9 v1 ?9 C i: B* Z; K7 |6 j
- 7 L( x; l- A, S- }$ t+ s% q
- dma_addr_t dmaphyssrc1 = 0;' M, t' j- ~6 j1 ^
- dma_addr_t dmaphyssrc2 = 0;( E2 T! h- E3 {1 c/ D; Z* d! n
- dma_addr_t dmaphysdest1 = 0;+ \: E* V0 D: w1 z! E$ Z! G5 [
- dma_addr_t dmaphysdest2 = 0;
6 v, S7 W& [* D8 j- G4 \ - 2 K$ W3 y3 J4 j; x, ]+ {
- char *dmabufsrc1 = NULL;
4 w8 g( m" [: [; c - char *dmabufsrc2 = NULL;
" ~) W9 }+ ~' q9 \* B! ]& X, S - char *dmabufdest1 = NULL;
# l" K1 M2 Y! D2 @- E3 l9 ]0 E - char *dmabufdest2 = NULL;5 |0 q7 @! l: x1 I
5 X; a; s% f! O u5 y1 t! x- static int acnt = 512;
- n; v) Y* F* v8 ~ - static int bcnt = 8;
! i3 |% j3 \9 I2 a1 _" r n - static int ccnt = 8;
: t/ }/ V8 E3 @" ?4 A& I
( |, A# H, h) R- f5 ]8 d8 @6 k6 ] N' |) l- module_param(acnt, int, S_IRUGO);
; _9 J( q1 ?$ i! _" } - module_param(bcnt, int, S_IRUGO);
$ p: @3 m$ a1 ] - module_param(ccnt, int, S_IRUGO);
复制代码 8 l0 T8 W* \6 n4 A6 o9 t% o& t
9 B% Q7 W5 I3 k 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( d8 ^6 t( A: C0 ]7 u/ ]& Marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 m$ K2 c! d. T1 u; X" N& }9 ~ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 U- J! b) l. I1 M$ J4 }
9 w) o4 P2 o& |4 k6 M
2 [$ `: y- M# p# g" A
|
|