|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 d0 y; v2 k t& J/ A' L! |- [code]EDMA sample test application1 B7 [' m4 ^ b, X8 o+ G) y+ u! {
- /*
# [+ c$ h2 h9 w ^# t5 g - * edma_test.c
5 P$ Y( E, K d: F/ j - *
2 I3 V+ S) h$ S8 H - * brief EDMA3 Test Application
, K$ {0 v* }3 ]# q - *
; h6 r: o4 e0 x. l7 H. d - * This file contains EDMA3 Test code.
: b( K0 t3 K6 ` - *
2 S; k; F0 e. G+ P# Q - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 x1 N# B Q) M. y+ \
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
u+ _# R" N8 W+ z, {5 s+ J - * TO CHANGE.2 V" [' P8 z z% t0 M f( F" {
- *
# k; t+ n" W- Z2 j+ h" h - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 h, L5 R) ?8 U
- *4 \& \4 z, b. F% ?% ]7 o% {) Y+ L
- * This program is free software; you can redistribute it and/or* |, v, h$ Y V4 x( a0 L. y6 o
- * modify it under the terms of the GNU General Public License as4 c0 L) _6 i7 ^8 c: R7 H8 Z7 q: q
- * published by the Free Software Foundation version 2.6 j% v( M, N' l
- *2 z5 w/ B5 O- G! v$ i
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 J* F1 J2 y3 i! B* e. w4 X
- * kind, whether express or implied; without even the implied warranty
8 b% c8 B% q" N5 I# m - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
( q$ i, H' ]3 O - * GNU General Public License for more details.
* w" j+ C8 @; x/ G8 @ - */
: d7 @5 Y/ E ^6 S4 |& u" g7 l - ) z$ Q- T+ x! z
- #include <linux/module.h>$ o3 X( R+ l% F" V
- #include <linux/init.h>
9 s f6 F- s4 m" D" b2 n+ L* \ - #include <linux/errno.h>
' _* q B, y4 L% k. I - #include <linux/types.h>7 y/ b% J9 | g$ X
- #include <linux/interrupt.h>/ Q. u0 C1 ^, D& \+ ]
- #include <asm/io.h> ^3 `, B8 u; y$ T
- #include <linux/moduleparam.h>! l: H5 r; Z9 p, G5 r$ [
- #include <linux/sysctl.h>
o! W* L/ E, w- I - #include <linux/mm.h>( J2 N0 }" C% j: ?% ^2 D0 {
- #include <linux/dma-mapping.h>
- F( X ^3 K4 c; f8 M$ k' B
* Y; w+ ^+ r2 S+ Y6 k8 k& \7 N- #include <mach/memory.h>
$ S. { v5 A+ e$ c* p - #include <mach/hardware.h>
% M7 j6 ]/ }" `* J' o$ f( W# ]" O2 I - #include <mach/irqs.h>
1 l$ c$ N2 K8 ^6 {8 U$ K4 Y2 c" g - #include <asm/hardware/edma.h>8 f* K- n# Y* M8 e0 T7 h4 P
- ) b# N, g' {6 p9 f0 D
- #undef EDMA3_DEBUG: h* A. M- n" s4 H, M1 B: X
- /*#define EDMA3_DEBUG*/
- B3 V. T. l, T0 F - + p0 w) [3 ~- b8 q+ A- \
- #ifdef EDMA3_DEBUG
# M; X. o8 j) @3 V' c1 v* t$ V9 n3 O - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 N' g$ |1 D/ P& |4 L5 }8 Z: l
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
4 W' f% w' |" p- w- h - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). y5 [3 Y* O4 m+ P- S7 O
- #else4 b6 X9 O" X- m3 g+ |
- #define DMA_PRINTK( x... )! v# O( `( k M/ _8 e9 G7 s
- #define DMA_FN_IN
: S* [% H' g2 g Z# m' r - #define DMA_FN_OUT
5 V2 k: `0 f6 c4 Z - #endif# v/ u [% `- P% P8 L
: }5 R3 X9 e; H. j/ u" j/ X- #define MAX_DMA_TRANSFER_IN_BYTES (32768)" \" f" s! J: U& G1 p" H8 F+ C
- #define STATIC_SHIFT 36 n1 A4 L2 {( k% V7 }. N: f1 u
- #define TCINTEN_SHIFT 205 o3 T* w' O1 d/ F, k/ W
- #define ITCINTEN_SHIFT 21
" r% @0 w1 p- u! D8 O - #define TCCHEN_SHIFT 22/ n$ O6 z! @& |* H1 @
- #define ITCCHEN_SHIFT 23# Z& M" G. t& [3 [4 v* f1 \% i
- 5 r. n' A) n3 @
- static volatile int irqraised1 = 0;6 \0 ? B0 a, w/ a- P
- static volatile int irqraised2 = 0;
) `9 i& z) j$ O2 @7 O, R- ?) ` - 0 B& c! _+ C9 `
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( |7 r: ^9 K$ E# h9 W4 i9 [/ D
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 k- x! e) z; a$ `
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* T# N. A8 e( ]2 `% e* B
6 Q" C, p, G: y. P' A- dma_addr_t dmaphyssrc1 = 0;
5 Z1 \* l, L; R% A - dma_addr_t dmaphyssrc2 = 0;6 {# j4 k, E1 g! n$ \9 a( P
- dma_addr_t dmaphysdest1 = 0;8 N* \& r; z& _8 \' P) O
- dma_addr_t dmaphysdest2 = 0;% ^+ }& P3 ^7 @( ?" W2 X: }
- 3 Q$ Y2 G/ h& \7 a6 T+ T
- char *dmabufsrc1 = NULL;
! ^, X0 t k$ \) ~5 O+ _6 ?% U - char *dmabufsrc2 = NULL;
9 y1 t. B% J3 y- r; o - char *dmabufdest1 = NULL;
2 h, h/ F* C; @5 t$ |5 k7 ^ - char *dmabufdest2 = NULL;
1 A( K6 t. h `3 N/ Q0 s0 _! Y
) l" L- N7 J3 y3 @9 p5 U- static int acnt = 512;
& X @/ O0 H4 @ - static int bcnt = 8; K, t: y# p$ Q0 h
- static int ccnt = 8;1 K# {5 r6 X5 C
- " E: @3 {8 S9 `# r0 o! ?' X9 D
- module_param(acnt, int, S_IRUGO);
4 M$ `) z2 T* A - module_param(bcnt, int, S_IRUGO);
0 Z' y9 E1 Q) w9 X4 T - module_param(ccnt, int, S_IRUGO);
复制代码 5 U0 A0 u6 C! N1 u- a! J' H( u9 ^7 u# ^5 Y
" E9 e1 q# T5 b
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: I- T2 U$ }* A; R5 Harm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& D9 M V/ U* d6 G i! M! n! t
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 k1 _6 V; n1 p4 @) C
. l3 P* i" R1 {9 j6 t: E2 `' `5 R* u5 p3 i6 ~; P' ]
|
|