|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 O- X( I$ ~1 m- [code]EDMA sample test application0 A0 M4 C1 j# J; k
- /*, c) l; ]: y. F$ {
- * edma_test.c
9 Y0 j0 p3 X- n; T$ f% s7 Z f - *0 X D) n7 [( t- n) S
- * brief EDMA3 Test Application/ i* n5 e# x G! l
- *8 M9 E. @: w# P6 @+ u0 F
- * This file contains EDMA3 Test code.
3 |# Q. W1 U, r3 s. @9 q - *
6 ~4 [' K/ G9 o! O9 O. A: x - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
! z9 b* l! X" x - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
* [0 p- J9 Z. s2 L" U& R - * TO CHANGE.
% G4 |- F: u/ U/ j4 W* j! [$ N - *0 q5 n; j% j6 b
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
6 w& x: g0 K% S% ~# U2 Q7 E - *5 d% n! v6 [ R, _+ G9 G" C+ w4 s
- * This program is free software; you can redistribute it and/or
: f. h3 X* g) ^( b - * modify it under the terms of the GNU General Public License as
! Q3 P+ R$ _) S+ [" v' _6 o - * published by the Free Software Foundation version 2.3 Z* f5 v3 V5 }8 o
- *( V# H% a4 g! h7 j' |
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 R' U1 t! ^# e$ W" J
- * kind, whether express or implied; without even the implied warranty
( g; z$ Y V( }# J - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the3 g; I0 U- f3 u' R6 E% {9 |
- * GNU General Public License for more details.: C3 z; g1 T* @/ ]* d& {
- */- e5 F, a+ H4 W! [7 @! K' y
/ q) A" f, i, M! ?% H0 u$ O- #include <linux/module.h>
H7 O9 Q1 z7 G5 ~( y - #include <linux/init.h>
* B3 R& A/ v# L+ |' B* {6 h - #include <linux/errno.h>
6 g4 ~8 ~1 A; G9 Q& r; p - #include <linux/types.h> k+ U- S z8 t- ~/ L8 Z- m$ ?: a* [
- #include <linux/interrupt.h>- W# O3 u8 b- \9 t9 b& Y Y
- #include <asm/io.h>) g$ r1 P! P. K
- #include <linux/moduleparam.h>
! u+ F# K8 W$ l8 G - #include <linux/sysctl.h>
* c' a3 n. S9 Q# d3 V - #include <linux/mm.h>9 ` e( c5 v, X+ H% ~2 l
- #include <linux/dma-mapping.h>
7 C* A, ]# d& r2 m - 4 s7 l" M% {) U0 l7 D, ^
- #include <mach/memory.h>, L* K1 e" w5 Q9 L+ n3 @8 z$ |
- #include <mach/hardware.h>/ z, \1 q2 l7 Y& U3 y
- #include <mach/irqs.h> s: K! [% Q# G% X. i/ \
- #include <asm/hardware/edma.h>4 S& L; Z2 x- `- S( n
; z( X/ \' ] F2 W. p/ w- #undef EDMA3_DEBUG
% D, _5 s' V% [. R: r - /*#define EDMA3_DEBUG*/1 [( z& C/ q6 b5 [4 h |& a
- # u. x7 X. B3 I3 @6 a' {
- #ifdef EDMA3_DEBUG( J. u- o! R% Q# P1 i# D' u) ^
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 t) N n1 Y1 }/ E) h( d
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 {4 [. s9 ^; Z8 T% |: i/ k. n3 g
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
) x. p$ @8 g8 d6 `7 X s# B8 J - #else" d% E9 X3 m& i3 d
- #define DMA_PRINTK( x... )0 _& [. G7 L8 j
- #define DMA_FN_IN
3 s1 I5 r# [: v7 F# l: d7 \& T - #define DMA_FN_OUT. {$ M+ e$ e* h" Q8 O6 x7 e
- #endif
9 S9 N1 r6 }/ S% B* O) O0 t4 ?
# R$ c* g+ @* Z, b; D, C* o' {$ ~. s- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
$ T4 m y9 E, ~, z - #define STATIC_SHIFT 3/ E8 `4 \$ m0 V) D N9 i
- #define TCINTEN_SHIFT 20
6 Z" G* B( p+ ] - #define ITCINTEN_SHIFT 21
5 ?* s- B2 X5 @, |; W( B - #define TCCHEN_SHIFT 228 V. K' l7 o* r; a* k
- #define ITCCHEN_SHIFT 23# x3 o) q4 p4 ?, ]% @
- 7 _- {' a( X2 ?3 e* W
- static volatile int irqraised1 = 0;
# p3 E6 k$ T! S' b' @7 p6 m* J+ T - static volatile int irqraised2 = 0;
- L5 ^. q7 }8 S$ \ - 3 I7 o& V4 o" b
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 p9 b! h2 k" p9 L5 l5 P* A: e4 f - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* y0 V* q) W w* h# q4 g3 |. M) o8 Z - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 h; H+ {6 z1 H9 B2 R, E5 L
- - O. R5 {* @) a7 h* Q( E; S
- dma_addr_t dmaphyssrc1 = 0;
* W) |5 k" J |( I1 J - dma_addr_t dmaphyssrc2 = 0;. N( {( L. k7 {0 ]/ g) |
- dma_addr_t dmaphysdest1 = 0;
/ r8 d, u& h* s$ Q - dma_addr_t dmaphysdest2 = 0;
8 `, X4 ^/ g( H: ` - ! _! Z; H, ]( P" d" u
- char *dmabufsrc1 = NULL;# Z+ `6 C6 }0 G* w( _! s
- char *dmabufsrc2 = NULL;5 N }. F6 _5 F. A$ r& Y8 A
- char *dmabufdest1 = NULL;
. b# G7 G$ A0 L, k9 p4 A) P2 X - char *dmabufdest2 = NULL;
8 P" ^7 |: r$ W) @ - % X1 |- E( \( h' t1 h
- static int acnt = 512;8 [( l& ^+ H4 ?) x
- static int bcnt = 8;* k' U- B K: k6 }: N' k. r9 M# ]
- static int ccnt = 8;8 L; a- ]# ^% O
i: D; Z* `' a! f- module_param(acnt, int, S_IRUGO);
. i" |* \5 t+ p7 ]9 Y" O- ] - module_param(bcnt, int, S_IRUGO);
" s6 I4 I3 c( E. n - module_param(ccnt, int, S_IRUGO);
复制代码 ) P1 B" y5 [3 c9 M7 i
% R( c9 [: L# k' h* E 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) p' |! I8 U5 G# U1 darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; V0 h2 }9 _( f- V 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& @8 ~* R9 B. L' l
6 C8 b, i' q. g# _# d8 ]6 A# d$ h, Y3 _
|
|