|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " y# V& t. b6 O6 g9 s2 q
- [code]EDMA sample test application
B8 D2 y8 v$ c) e0 a - /*
$ A/ X9 T! s: C+ q+ p9 U; i - * edma_test.c8 M% @" T8 u p. C' l$ w4 c
- *
9 R6 \, J+ Q# d8 I- @) t' e3 n - * brief EDMA3 Test Application
9 I! |- n; `- \2 ^ - *
0 f4 [) C0 T" t - * This file contains EDMA3 Test code.
( S. U( Y# c! A - *$ ]( P# {; o% O" j" X
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; v+ J& F1 k/ m4 y3 z, B" m; |
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; P* }. S+ t. [+ J+ _
- * TO CHANGE.
9 L, O: J1 Y; m2 l7 m q; \ - *
( F" u! u. d' S9 j - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, V; O0 k2 I! s. q& J
- *+ F! E! h! H6 g5 M
- * This program is free software; you can redistribute it and/or
9 U; r+ \% }2 A7 v* q) x# j - * modify it under the terms of the GNU General Public License as0 \- p+ p2 E U* o+ c& |7 E
- * published by the Free Software Foundation version 2.% Q3 S1 V/ Z% ? [/ `1 t" K
- *
5 H1 L% g% {1 U H5 I0 @+ L - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
" i8 ~( T" d8 E* D0 b( a' e - * kind, whether express or implied; without even the implied warranty
) \3 r- K/ S/ E% q. U0 c2 u - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the9 o. D1 G, Y2 |' i% U: X
- * GNU General Public License for more details.
3 }2 }/ B% {% R- U! l9 S0 z - */
& g d' S1 r" S# e
8 S# Y( s i2 Q, s, S; d- #include <linux/module.h>8 R# F9 ^7 [8 `6 m; ]
- #include <linux/init.h>
: e& g5 V4 q+ V1 | _ - #include <linux/errno.h>4 ^/ k M% u( E2 K0 Z& k
- #include <linux/types.h>
F2 b% G( R5 S$ d, ? - #include <linux/interrupt.h>9 e1 Y; k" \; b, x
- #include <asm/io.h>7 U* A( L; A% D1 u
- #include <linux/moduleparam.h>! j1 Z6 x4 [7 M# u
- #include <linux/sysctl.h>
( v, M N. }- m' ~# v' U1 {% e) v, R - #include <linux/mm.h>
6 X6 i/ w! |0 i g# @* c! h - #include <linux/dma-mapping.h>! S8 o: u2 N: U9 r( D) A2 Z! N
- * I$ B2 n+ g' O
- #include <mach/memory.h>: f: B) y1 W$ I+ k7 O5 M7 s; I
- #include <mach/hardware.h>
+ S( {8 V8 P, K) M$ N; u+ b/ X - #include <mach/irqs.h>
K1 N0 q! _/ z. U% d1 O1 H v2 N - #include <asm/hardware/edma.h>
4 l1 \6 Z" Q" O1 ]1 l - : A7 I1 @2 L- y& d+ P+ n; k
- #undef EDMA3_DEBUG
* y8 I. ^7 Y0 S! B0 e2 P4 j - /*#define EDMA3_DEBUG*/* d6 }/ Q5 g/ [3 l7 |
! Z7 i8 D$ z. C2 N7 Q- #ifdef EDMA3_DEBUG
. s, ?6 d+ v* f0 y - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 j% O0 v$ K, H- S5 L, n
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' x4 j- K- \0 f2 K ^, U- W& l B
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* I8 z$ c( W5 H/ u( D- l
- #else1 }/ V( m2 k1 M0 t5 e" l2 [
- #define DMA_PRINTK( x... )* p' ?4 F( n" _- X- H
- #define DMA_FN_IN
, w9 g6 \ O+ N. p - #define DMA_FN_OUT+ f2 A1 n5 A- V3 c" e
- #endif
; N$ A% O( `* [- p: i - 3 [3 i) B8 V2 T' K
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)) f! e1 g/ ~# u
- #define STATIC_SHIFT 3% d0 p0 | w! y; \8 b
- #define TCINTEN_SHIFT 20
. T; ^7 r: G0 w$ s: p4 _ - #define ITCINTEN_SHIFT 21
0 I! k N7 J; x; B' G$ }7 T - #define TCCHEN_SHIFT 22
* ?3 O' F0 [6 Y9 C! p# ^( m! v, ~ - #define ITCCHEN_SHIFT 23
$ f% ~4 v! P' V) @- }
% {9 _0 l- \, y. G" O& \ X4 H- static volatile int irqraised1 = 0;7 Z" k9 [, |. |# {
- static volatile int irqraised2 = 0;
4 k, p" ]+ E- j- E0 |
+ ?1 T4 I ?4 ^* w, X2 P0 f- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! p, F3 c5 z' ^) d; m5 y - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 f: f7 T& \& _& S5 |" M" {
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 j: I$ v% b7 ]2 j0 p; c
. \0 Z: j3 N# O, J$ E7 x0 d/ Y- dma_addr_t dmaphyssrc1 = 0;
! d8 i6 V; ^# {, ?- u - dma_addr_t dmaphyssrc2 = 0;
$ J. f5 u# c/ c1 ~ - dma_addr_t dmaphysdest1 = 0;/ n" i# J- O$ W j' O/ ^# I; m* g: W
- dma_addr_t dmaphysdest2 = 0;
O l& `' P: h4 Q - ) O! s; e9 g% }. x4 o
- char *dmabufsrc1 = NULL; r5 c1 S/ |/ }% x& f+ }, y
- char *dmabufsrc2 = NULL;
! H% \5 A1 z* z$ ?2 e; l9 U - char *dmabufdest1 = NULL;
6 g8 f8 g5 `* {" O2 I: C - char *dmabufdest2 = NULL;8 b# v7 b" e4 X! x7 ^) J8 h6 B2 q
- ; V7 w) Y: T! W& x
- static int acnt = 512;
9 k+ }4 G. u9 H1 r - static int bcnt = 8;; j) B0 [( r) X8 t" V
- static int ccnt = 8;
( r5 N( d) R2 o+ F6 ?6 c% u! ~
' C* ^( b4 \) D/ E: a- module_param(acnt, int, S_IRUGO);1 r- s' o/ B% @! B E- g! x
- module_param(bcnt, int, S_IRUGO);2 d. L4 z' i" h0 t. @
- module_param(ccnt, int, S_IRUGO);
复制代码 . O+ B' q/ y4 O0 r
7 q0 }/ \) A4 _) p2 T! H
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! V4 ]2 K ^: z& o& q7 U3 W _$ \0 J. l
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 ?! L; |8 m8 ^7 G- `! r7 O" U 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。 {5 E" J8 j4 x: @" w- D
. y$ q( I5 r' i _/ f; l
0 g5 T, W& o* n+ w0 n$ L- A( A6 i
|
|