|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , o H* k8 k+ f5 Y
- [code]EDMA sample test application
/ x0 Z3 d! [8 z1 C0 N, z5 I - /*
' |: P& s+ P; V% c6 c5 c - * edma_test.c
# X/ i, W* N! H9 l - *! z. H, L9 V: y$ y0 n* I
- * brief EDMA3 Test Application, Q% S$ u0 `! z" Z: W, d
- *
. a7 J) I3 Y3 X* u( ?2 D/ u+ {9 W - * This file contains EDMA3 Test code.
% f& ^) a+ O/ r! ], Z5 D - *
( I. Q( F2 E- U& g. { - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& q. h# v& J! ]& S! p' T/ H3 L
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
& K: n% { S) `' u7 d - * TO CHANGE.
! A* Q2 L. H; ^' p7 R( Q$ a0 N - *
1 d* y' z" N s" m+ ^- N2 C9 L - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 y% s+ E$ d1 C2 G1 Q
- *
& B H9 K4 g- b$ G - * This program is free software; you can redistribute it and/or
9 @9 z4 s8 Q/ a7 S; a - * modify it under the terms of the GNU General Public License as
9 {2 q& s ?$ ?; o - * published by the Free Software Foundation version 2.
6 Y6 _" W& o& W+ \7 v5 B - *6 X6 T9 Y d* `% ]+ b
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any% T4 N& T4 v+ y" R+ U/ W
- * kind, whether express or implied; without even the implied warranty
8 M; B0 c3 X) F! T e: e" e - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* f6 L1 [. W& B8 c) R8 K V - * GNU General Public License for more details.: ~. Z. ?1 R4 ~9 S9 t
- */
0 U/ {3 G$ V$ y8 ]) t/ S - . O" D5 G, N6 Y5 P: m8 g/ p
- #include <linux/module.h>
7 t' e2 x: C& Q7 V - #include <linux/init.h>" P* e' S0 r! g& S5 ^( g0 e
- #include <linux/errno.h>
$ ]* d0 `; e" t$ C% }5 \& t' s - #include <linux/types.h>
% ^9 t9 x1 X/ w/ h2 ] - #include <linux/interrupt.h>4 Y* L3 D! _1 ?4 S( D0 X B
- #include <asm/io.h>( g+ x0 L6 A. M; m
- #include <linux/moduleparam.h># h9 f) Q3 D" R2 j
- #include <linux/sysctl.h>
* d2 G- a8 \; v3 R3 f @$ r9 | - #include <linux/mm.h>
) j# C1 ^/ R% {+ A% \4 ^* C \7 ]) K5 v - #include <linux/dma-mapping.h>$ Y: [! D% p7 Q7 K( ?5 B0 I4 N9 u
! g, g- \: _3 K! g6 K1 _' K0 q- #include <mach/memory.h>6 i0 s9 L0 |7 N) V/ p
- #include <mach/hardware.h>/ @3 `; m' q( l6 g1 n
- #include <mach/irqs.h>
8 p# o+ q1 J" { - #include <asm/hardware/edma.h>* ~0 X" t- ]& j: `" S
- ) d* P9 j# N3 T9 e4 i. W: b
- #undef EDMA3_DEBUG
$ H) c) ]+ Q; I" U0 O9 e - /*#define EDMA3_DEBUG*/
2 ?$ T. I! L( B; h+ n+ j
M, ^/ `* H2 a7 {) E6 e- B5 G- #ifdef EDMA3_DEBUG
! `6 a: f9 C! {! o5 S$ P j2 H - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); t" j; G! U* M
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
8 u0 l2 j- c. L* a7 B& v4 q) s' k; K - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
& E/ ?( s! q' v$ O; X7 r/ Z - #else
# \' ]3 v8 r& n: h0 O2 n2 ` - #define DMA_PRINTK( x... )6 ?) W$ H7 r* n2 l r, u9 M
- #define DMA_FN_IN
& Z- B ^0 t3 I - #define DMA_FN_OUT K. ?6 t' G; B; E% X& p
- #endif
( W+ |( L m" F) n& B/ n1 Q$ o
. w! z' w- k1 c- #define MAX_DMA_TRANSFER_IN_BYTES (32768)/ T' W V' x7 ?+ V9 F5 r
- #define STATIC_SHIFT 39 n# P8 G" K. c
- #define TCINTEN_SHIFT 20
! ?, C3 G8 r Y9 S - #define ITCINTEN_SHIFT 21" l% I9 {4 }) ?* w0 v
- #define TCCHEN_SHIFT 22
; m* w7 Q9 U# r' l - #define ITCCHEN_SHIFT 23
* @% v L. g o! V4 ~& r9 c" m$ V
9 S7 Y2 W$ L5 G( c% S- static volatile int irqraised1 = 0;* |+ h" U _8 q
- static volatile int irqraised2 = 0;
: |& ]) d7 _4 S - 8 a+ d5 E- m. |, a
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ _9 B6 P4 \/ f% ~ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 W% {" `/ O/ j |2 n! v# \9 s5 U
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 k4 u9 |# E7 j Z' O
. ~* _* S/ i0 O* y9 K- dma_addr_t dmaphyssrc1 = 0;
% L% W' ^' g* m6 C - dma_addr_t dmaphyssrc2 = 0;3 a9 m, j+ F& v; P- {
- dma_addr_t dmaphysdest1 = 0;
3 b" | m+ D$ e' o& D - dma_addr_t dmaphysdest2 = 0;
# d) S! y# v- X; b - % r5 h, K/ j5 u% M5 { b
- char *dmabufsrc1 = NULL; E! `2 @. R& ^ j0 I$ d! s; L3 x
- char *dmabufsrc2 = NULL;
. s( V9 U j. t3 ?+ E4 u! T9 i5 F - char *dmabufdest1 = NULL;3 C) O/ `0 e( ?" K8 c; b' Z
- char *dmabufdest2 = NULL;
/ Q) S0 B# N' I- B
3 k; ?8 z. [4 }2 g( a" C; G5 p- static int acnt = 512;5 [7 h8 P% m2 [8 y( |4 S7 i
- static int bcnt = 8;" F9 C$ T. _4 d
- static int ccnt = 8;
( w+ Z, S. X( z
$ O. p% c# F( `: }- module_param(acnt, int, S_IRUGO);, l2 l: A, e5 Z/ Y
- module_param(bcnt, int, S_IRUGO);
! e6 M5 ?2 Z* N" M - module_param(ccnt, int, S_IRUGO);
复制代码 ( t- {0 x# E2 O
' \. h. w) b ~7 b2 @ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 B# {+ R- n3 \: S: F* i
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 U: r- L$ ^+ C' q2 \ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 r3 w& P. ]0 P! V% J; c/ b" t
* `3 ?# g& w% P$ C
' l. a" X+ O" O% ?
|
|