|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- x( x% `9 o! G2 ~& E2 l- [code]EDMA sample test application
! V l6 k6 ?7 i5 q - /*/ ^; t+ H! C3 j9 w B( l
- * edma_test.c/ d4 k" @* g9 j( ?
- *: `* ]0 ^0 m( h' a
- * brief EDMA3 Test Application
) S) ]& N9 ~2 T2 u - *+ K, ^5 K( o. U6 k$ M
- * This file contains EDMA3 Test code.
( G4 P0 x# `; |- g/ w4 } S - *7 \# o* A" ]: w7 C3 A. q
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# ?3 a( r! m1 t. ]$ t
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! ^1 e W" a: j5 M6 b; d
- * TO CHANGE.: D5 n/ e* {! R5 x
- *
) `' k. R) Q7 @& E2 R* F - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
3 ?. V" R* }4 w C- Q - *+ `, }( j9 K0 ~- A, n. w- `
- * This program is free software; you can redistribute it and/or
7 v5 U8 \" c u! b+ }, Y - * modify it under the terms of the GNU General Public License as
) l) j' k) w% u0 r - * published by the Free Software Foundation version 2.9 B2 D" ?7 R2 l: D) T
- *
$ z, \: S: }, F- X ?( T* Y" L% F$ c5 j - * This program is distributed "as is" WITHOUT ANY WARRANTY of any. h: E2 R7 S% Y8 v( J
- * kind, whether express or implied; without even the implied warranty R6 y, J( D4 {$ {
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
( Z. u9 k- v/ g( `0 _0 g, p - * GNU General Public License for more details.
( ~5 b# O- e- N# q ?" @/ u - */
& Q' q! Y1 x$ B
- H/ J ?3 \) y4 B# y- #include <linux/module.h>7 L( U c% D K. U1 a! V
- #include <linux/init.h>. }+ P! M) I1 o& c! j. P
- #include <linux/errno.h>
A. x* R/ U# F R" b' W - #include <linux/types.h>$ l' K* n) q, B3 {
- #include <linux/interrupt.h>4 t! [8 }; h1 W; g: T
- #include <asm/io.h>* w9 `# q4 C" U
- #include <linux/moduleparam.h>
% O0 J% L& P! e; s- d - #include <linux/sysctl.h>
2 h2 u- t" J v# d& N z' m - #include <linux/mm.h>
# i% T! `4 ?$ o) U4 U0 ?+ P - #include <linux/dma-mapping.h> ]" ?, O2 `$ W5 \# _% w
7 C; y/ T. n. L6 k. U' K' N- #include <mach/memory.h>' k3 @" p: t% G2 O9 j5 j5 f( Q V
- #include <mach/hardware.h>5 P" U9 _4 a+ P* v: d! f7 s: Y% ]
- #include <mach/irqs.h>
, s9 l+ A6 i# N- v$ C - #include <asm/hardware/edma.h>
+ H- L- S: b7 W x' d- J' k+ N
6 x. j' e& F% W) f5 V% M- #undef EDMA3_DEBUG
/ |- ^) N7 i3 u9 }* d+ s - /*#define EDMA3_DEBUG*/
) B; \: q% g$ d+ S - & @7 N" m( c/ W. ? A8 ]: a
- #ifdef EDMA3_DEBUG% Y v, W6 n5 D3 r) @4 v
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( m" B2 \8 ?- q8 v) z
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
! K; |: Q% A0 _' `0 g - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); a' l0 W6 R% b" x
- #else
4 o( ^$ Y. q k$ V5 c/ [0 e - #define DMA_PRINTK( x... )9 g' V+ T! n" ]1 G3 u& ], r5 x
- #define DMA_FN_IN+ M7 H( j7 p# | m$ j% k# }
- #define DMA_FN_OUT
% l. @$ s1 J. k' N" s - #endif3 g: P: j4 c- V& b& }% B0 I: Q
- 3 _2 w( K+ {# H. b, X3 W7 \
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
4 t6 Z# R( x, k5 A% d. C/ z5 o2 m - #define STATIC_SHIFT 3
& E) ]+ d; G: [0 i6 c+ ]9 n - #define TCINTEN_SHIFT 20
( _" [' l& T5 {% x6 C8 U E - #define ITCINTEN_SHIFT 214 O2 s# Y7 z6 N& @) S
- #define TCCHEN_SHIFT 22
& l; Z3 |0 Q" {0 ` - #define ITCCHEN_SHIFT 23
/ w, n) k& a' Z5 G
" X. @+ e" Z! k" g0 J5 B' D: O4 H0 ?! O- static volatile int irqraised1 = 0;
7 M# `/ i" F* q: O - static volatile int irqraised2 = 0;
# {0 V) c8 | r; T/ R - " z- h2 D2 k6 \9 m
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: W7 H# {: ] b - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# G3 v: K; s) W6 j - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' Y/ U; O/ z2 A T - ; ~7 _) b3 x( k' V2 q# l# k
- dma_addr_t dmaphyssrc1 = 0;
+ g! @/ ~8 h+ F E* y& w - dma_addr_t dmaphyssrc2 = 0;
) I0 P7 W; `8 O3 X8 d8 S" _ - dma_addr_t dmaphysdest1 = 0;% U3 b W5 j( r; Q# o- T
- dma_addr_t dmaphysdest2 = 0;8 j& U; }3 f& E$ m7 w8 p
3 C$ I9 r" ]( v( k- I( i- char *dmabufsrc1 = NULL;
" E# h- t9 V$ T( X - char *dmabufsrc2 = NULL;1 o/ T2 R( x# W7 |
- char *dmabufdest1 = NULL;
: B. \# Y( L% j3 w& o" s - char *dmabufdest2 = NULL;% N. c2 ]5 d( P) B
- ; A8 ^( ^: T' d0 U
- static int acnt = 512;
, F$ @( {( c t( n4 a - static int bcnt = 8;4 |# D+ L5 o* t2 R
- static int ccnt = 8;
/ H1 K: [1 x6 r- P% t - / D7 c$ v+ e. n$ q2 I
- module_param(acnt, int, S_IRUGO);
' c9 I" W* _% Y( V) P9 n. M8 s - module_param(bcnt, int, S_IRUGO);
7 Y: |* t# U" t+ K' |0 f1 ^ - module_param(ccnt, int, S_IRUGO);
复制代码 & x- ?: k, b! k
7 Y1 U }' C" F# W8 d# t8 u 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 y1 K2 F1 f3 k* i+ Earm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 f, v4 h8 H- p( a- x, ^8 O; r 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 ^- ?- i1 Z. o7 Y2 k8 K
. M& C W) b) O. ^2 j. L2 u0 E, e/ N2 i" ^, Q
|
|