|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 L$ I v$ G5 ?. q, v- i q- g- [code]EDMA sample test application
3 k, f( k; w) h# }5 ~" O& b - /*+ d2 b4 m; Y, y7 i+ x, J `: n
- * edma_test.c& K( _! Z$ \ {% p: ~% Z
- *$ I4 R1 a7 q5 q8 s
- * brief EDMA3 Test Application" d/ k7 N, P" _& P
- *3 R3 k) {# l6 P2 }5 d8 m5 H
- * This file contains EDMA3 Test code.
; r6 Y' K2 J+ s- A3 a' W - *
7 I. h( I) S/ j7 `+ g - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
t, I: F5 R- V* R - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
- H! n, @" n; N2 ?7 v! T* v - * TO CHANGE.
4 x5 T' U* k$ T4 ~ - *
! Y3 Q. q8 B' D: f# S( X6 ~( S# j; U - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* B+ ?1 g7 m$ s }* ~
- *
6 B6 R& o* h' `8 e/ U - * This program is free software; you can redistribute it and/or
/ ]9 I+ r2 o0 b9 {( T# b; z0 V - * modify it under the terms of the GNU General Public License as
" G+ U k0 m: S9 ] - * published by the Free Software Foundation version 2.5 C: y1 g, n- q0 ~/ H
- *$ i% N. A. I3 I h
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
q- ?. g) U3 L" [ G - * kind, whether express or implied; without even the implied warranty7 F, }: I# G, \, m8 e/ G
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1 \) P2 J9 C5 k) F! \' ^ - * GNU General Public License for more details.4 B3 s% T. d* _, b- `
- */3 i; `! D% x) [ O9 [
( J- P5 u" @8 {" w- #include <linux/module.h>
6 |$ Z# W% E4 s' ` - #include <linux/init.h>$ U1 n/ }' z8 w) U2 l" O, R
- #include <linux/errno.h>
" F5 H, Z3 O+ r- B) f4 e - #include <linux/types.h>
( e* f' ?/ [* w4 x t0 u; M - #include <linux/interrupt.h>& L2 A$ N0 x. |8 x, Q! h& R
- #include <asm/io.h>3 V, g6 f. A: Q3 F# _
- #include <linux/moduleparam.h>3 `/ b/ Z6 n& H& C. U6 w
- #include <linux/sysctl.h>! x4 f8 x1 y( K! x4 t' M+ B# s
- #include <linux/mm.h>
, R: p% a" H% w - #include <linux/dma-mapping.h>2 A3 J' ?4 C x
* t5 m$ d; \$ l9 ^( g- #include <mach/memory.h>
$ S. _! I a9 Y$ C# I" W - #include <mach/hardware.h>) ` n; L+ j# w- b# d- A3 g2 P0 ~
- #include <mach/irqs.h>
- ^4 U/ V( I, D1 `/ U - #include <asm/hardware/edma.h>, w- v4 K: K$ K3 L9 H; B" Z
0 p" @ N( a+ E- #undef EDMA3_DEBUG
5 {5 s8 ]. u1 x/ r - /*#define EDMA3_DEBUG*/
* E7 t4 _* S0 ?( N$ v$ H
' [( S2 X8 y8 A$ q$ B6 o# ?- y- #ifdef EDMA3_DEBUG# p- }8 C* `1 h( ]7 {, g9 ]
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
: |# p) D: K/ o) g" v - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__) `1 F, f# p/ U8 W- }
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__) F& x" O& I7 t a; o4 |" }" M
- #else w# L7 S, A* X# y3 ?* m6 Q2 Q: N, a
- #define DMA_PRINTK( x... )
9 \+ f0 B2 ?$ j - #define DMA_FN_IN
/ V) h& \; ]4 i' g - #define DMA_FN_OUT
% w: B' f. {; T" {. F - #endif6 ]6 o( K; M7 S) @4 V" O) P T
- 6 A x o7 C) h& l6 A4 K% T
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)& Z. x2 B- o w/ ]+ o* g8 Z$ _
- #define STATIC_SHIFT 3
& c! N N' N" ?( ` - #define TCINTEN_SHIFT 20
' T4 m1 J/ _# {& \5 N( }1 E - #define ITCINTEN_SHIFT 21
" f- c) X7 x$ X+ Z" \7 O) c6 W - #define TCCHEN_SHIFT 22
2 E7 T Y" Z7 V& x$ F1 S, b - #define ITCCHEN_SHIFT 23
9 i6 r* J* P; n! U - 9 D8 [5 J) b7 h. N6 V4 q' D
- static volatile int irqraised1 = 0;3 a) n' q6 ]3 A+ [3 t7 K- t
- static volatile int irqraised2 = 0;
; D) }8 ^# n8 W P! }4 R' F( z - 3 S: R: J2 F; l2 X- z2 W4 n1 |5 B
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 v4 y. Q8 M8 Y& ^6 M
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* B* M( F. p' a) y+ L - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
N A$ v5 S3 O - 1 f9 b0 [& y; v0 U8 m# C' T
- dma_addr_t dmaphyssrc1 = 0;5 a! @! n% V% H# h! `$ @( s" p
- dma_addr_t dmaphyssrc2 = 0;6 v6 z+ n- K1 h, M; L% F2 X) D" r
- dma_addr_t dmaphysdest1 = 0;
2 K- T% F( x y/ k - dma_addr_t dmaphysdest2 = 0;* ^1 }* O: H: k5 X3 {
- , M" u. m7 B0 m( s, |4 y
- char *dmabufsrc1 = NULL;
/ t% d: I- p2 {6 Q - char *dmabufsrc2 = NULL;& ^5 ?* f# _9 C0 Y4 o
- char *dmabufdest1 = NULL;
6 S9 i5 ? b" \ - char *dmabufdest2 = NULL;2 G% `& K5 f% T) x6 k
- : F9 Y8 x& c. i, F; X
- static int acnt = 512;
P/ t; }9 \% e8 f1 i - static int bcnt = 8;
- I# u: ^# F2 ]7 c6 b - static int ccnt = 8;
1 h1 c. E0 f" k2 H
* Y5 y! i# W, B9 O- [+ a, m- module_param(acnt, int, S_IRUGO);5 a7 }3 t) N- T5 I7 A I
- module_param(bcnt, int, S_IRUGO);1 |9 n; A3 \4 r# ~9 U! {8 O5 N
- module_param(ccnt, int, S_IRUGO);
复制代码 % |* C' t" @9 c5 Y3 D
" Q& A$ o: m+ e6 U6 F- o9 Z3 s+ @8 g
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: Z& D9 ?( K5 \2 \
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, @( Z( N6 o) t
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 I5 y* G0 y4 {! g# q
2 T8 E8 `0 K7 y+ Z
7 L+ s/ t+ h5 ^5 q |
|