|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 ?& }; ?0 D( X- F- j3 M
- [code]EDMA sample test application/ r2 J P( j% b+ g5 ~+ S
- /*# S7 y' k* q3 y8 T% T, S2 B; A
- * edma_test.c @: W# f3 k) P
- *
, a( |9 H5 r; r1 m+ O# e0 t - * brief EDMA3 Test Application
/ q7 i3 j Y1 j3 E, i - *9 X) O% ]& e& }6 |
- * This file contains EDMA3 Test code.' h* ]/ S) a- T9 G7 x# \1 @, ^
- *
* ~& @$ {- [( N& |' t - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& K4 D- o1 j# T0 h/ X5 [" ^
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 I) P3 k- p/ w( T8 [+ `
- * TO CHANGE., a2 G% v1 ^( F, v) A( c
- *: q, h" s7 ~$ s* ^% L4 r; |
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 x; l; r% l: Y% g4 ]# Z6 s- i
- *
9 \0 d- t- ]' A: u A - * This program is free software; you can redistribute it and/or& z0 p! Q/ R8 U/ R7 X
- * modify it under the terms of the GNU General Public License as
" W+ i, m. f4 `) h# C. U l - * published by the Free Software Foundation version 2.
8 f! v9 a4 x0 v - *
) ^8 _- ?7 s2 f9 K - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9 Z8 \+ |" H0 E3 f- T3 X - * kind, whether express or implied; without even the implied warranty
: M1 ~- A: d' [: q - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0 ^2 [7 P/ W' @3 Q2 _/ c) e7 q - * GNU General Public License for more details.
, d+ `: N2 m/ @: l7 f ^ u/ s+ D5 @ - */7 K+ L0 g+ v$ n8 I" g& ^1 F
! {" @% M; M+ X) J3 P% O- #include <linux/module.h>
8 Q; N7 Q$ a5 `$ h - #include <linux/init.h>
) g# s# x; S0 r; U# x A% Z0 U+ d! r - #include <linux/errno.h>" j+ j# g0 L' H# g( R" f
- #include <linux/types.h>5 v0 g& W2 C: \0 H
- #include <linux/interrupt.h>$ d8 k, v3 x0 i" M3 P
- #include <asm/io.h>) m; J. d0 ?5 R1 z5 `& u" \' n6 g
- #include <linux/moduleparam.h>' [3 m7 p2 N9 j" H5 n
- #include <linux/sysctl.h>6 `$ R) X4 m- N) L
- #include <linux/mm.h>
* p1 E5 u; f; r- w" i - #include <linux/dma-mapping.h>: F1 R. H6 _$ G* T2 Z: R1 B/ m
- 2 B7 b8 C; s: \
- #include <mach/memory.h>( Z$ k; ]& |5 ?
- #include <mach/hardware.h>9 U; d# u" l0 P K" |" I
- #include <mach/irqs.h>
0 z5 P/ i* Z( i' l' g8 I - #include <asm/hardware/edma.h>
/ {% F4 N1 P# l l. B3 g - 4 D3 C/ s+ p# I5 J
- #undef EDMA3_DEBUG
' E0 _1 d# b2 v n+ { - /*#define EDMA3_DEBUG*/' g; c! X8 \9 g
- ) g9 z* u: w: X- a7 l
- #ifdef EDMA3_DEBUG
0 R1 _" y" E- C - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) f8 ]) G3 z, t1 y* i4 \
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 S4 m# U4 w! l
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
, S; X9 }( ~9 p - #else
' W# [" k. X# L" R: T - #define DMA_PRINTK( x... ), g1 m0 e- q/ _! Q' y8 ~
- #define DMA_FN_IN
) ]" T4 S+ R5 @ - #define DMA_FN_OUT
& u& d1 o" N5 R6 k. l' H - #endif
5 U' U+ v4 P1 D2 ^9 z# s1 d. V
4 \1 p7 E* ]8 b3 M/ P8 d. e- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
- q) k z# ?5 | - #define STATIC_SHIFT 3
6 h* u7 F5 `7 ~) q - #define TCINTEN_SHIFT 20
; _4 ^) a3 d- J- H8 F0 {: W: y - #define ITCINTEN_SHIFT 218 Z8 h. l* N: a$ L
- #define TCCHEN_SHIFT 22
/ F* Z! N |0 e% }' o8 } - #define ITCCHEN_SHIFT 23
4 b- B5 X+ P: u - ; T. d7 k8 m! w* h0 F& ?
- static volatile int irqraised1 = 0;
! Y1 @1 i0 W- ?% x ] - static volatile int irqraised2 = 0;8 \; U. O, N) a- c6 A1 a
. N2 T7 s+ y( C1 u! G* d- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 n/ ^" E( x! O8 k
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% `/ v; R9 M7 q
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. p4 F: g8 k. J8 f, F' }) u; T
- 5 o J8 \: Q, `2 ^( ]3 |
- dma_addr_t dmaphyssrc1 = 0;0 i' d2 J& m* w% j* _
- dma_addr_t dmaphyssrc2 = 0;+ v, y9 n) @" E5 g
- dma_addr_t dmaphysdest1 = 0;6 t; @8 J u$ r7 x4 \
- dma_addr_t dmaphysdest2 = 0;2 q: G( y/ W: i8 A' `
2 B$ C2 _- t* C4 i2 p. x* P- char *dmabufsrc1 = NULL;
: C, a$ A! [" j4 u9 O! y - char *dmabufsrc2 = NULL;) v$ N3 A# x d
- char *dmabufdest1 = NULL;
2 n/ y( |1 q4 X- j t" A' }- K0 L* F - char *dmabufdest2 = NULL;! ^7 u3 J0 s3 F. n
- + U6 B2 Z' S! V5 L4 e
- static int acnt = 512;5 N/ m7 L# h3 C' k
- static int bcnt = 8;/ {( R9 W- C7 w
- static int ccnt = 8;
% j+ t. O" O8 [ b
w& J9 S O2 o- module_param(acnt, int, S_IRUGO);
8 V' e6 S5 v7 |, O+ q+ q8 }7 q - module_param(bcnt, int, S_IRUGO);
Q) o; H8 c: ]: H8 { - module_param(ccnt, int, S_IRUGO);
复制代码 5 I* B( W! `: I
8 @, o& z1 Z" ?4 X
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 `' w4 `, [0 t5 G6 |5 _
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 b# b2 c. d: y 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。 f: p! i2 E' x& ~
# S8 M5 b4 @- ^& V' ~# G3 [0 W. s
# i2 z% U% d# U# W
|
|