|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 v+ a: u5 L! t( I" U: _2 }9 A- [code]EDMA sample test application
& }0 ]! B+ W: D$ ?9 i8 [# n - /*
4 q N6 }) S5 @0 \! ^8 h6 B - * edma_test.c9 E6 m; M! x9 P N% H
- *
+ h8 W: j6 P" I+ a0 e4 U; t - * brief EDMA3 Test Application' S5 H" o0 p, F4 S; `9 @& p" ]" I
- *
: r3 D* h8 g2 M9 [( M - * This file contains EDMA3 Test code.
$ n* u$ C% d# v) A% P - *
6 D/ `" d% F8 B, H7 B' i - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
' M9 B* ^3 L X. i8 q; w: r. v' E - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
$ a L* q: Q- U1 B+ ]8 V - * TO CHANGE.
+ f q4 S, Z5 A% K% D. ` - */ g# Z! ]- X5 k6 }
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
2 ~6 ^* b. K8 }. w- B! g9 _( t - *, B) @3 P% C5 i0 U. F! z6 k* m
- * This program is free software; you can redistribute it and/or# |( O [$ ?* r3 ]3 |
- * modify it under the terms of the GNU General Public License as9 D' A% i. c o; U6 [
- * published by the Free Software Foundation version 2.
8 Q/ r1 _5 F0 d- `( j - *& i) j J, ]; ~# n' \& r
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
5 K- _* O9 x0 N" x _% g, R5 @0 e - * kind, whether express or implied; without even the implied warranty( P% m3 {' ~) V! a4 d
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the8 u5 ^6 `- h( j
- * GNU General Public License for more details.( h R0 c1 ?( o) u& c) u
- */ g/ _ R5 G4 F' j* N
- % M5 ~4 G: i. R. e- H# t
- #include <linux/module.h>
+ a z4 \; K2 i- |5 Q - #include <linux/init.h>0 c& |9 z* Q: L6 {3 e1 V+ p
- #include <linux/errno.h>( t+ S' A' R6 T; T7 K
- #include <linux/types.h>
# l% y$ @( E1 \7 G3 S8 B! `1 D - #include <linux/interrupt.h>. s* h1 a* V9 I1 G6 G
- #include <asm/io.h>* c6 B/ n5 R. R& O$ i* Y2 Y& L- S
- #include <linux/moduleparam.h>
7 V1 Z: D9 d* b& C+ k+ X - #include <linux/sysctl.h>* g, E% D! p* I! l% B) [8 r
- #include <linux/mm.h>' l! K5 k8 b% ]1 _" j9 g
- #include <linux/dma-mapping.h>/ v0 P5 V5 V8 W" o$ w0 ]
- + o1 R5 q, B9 ~0 H; a
- #include <mach/memory.h>
( y% w2 O# F$ g, E/ N2 c% I - #include <mach/hardware.h>7 u2 h; d+ b. O/ m) Q6 @* D
- #include <mach/irqs.h>+ w( e" B8 h( m
- #include <asm/hardware/edma.h>
J6 s- |; Y4 A/ a+ X; s
/ f' @2 E# S( S# y( K- #undef EDMA3_DEBUG. {9 {* S( d7 r$ S
- /*#define EDMA3_DEBUG*/
/ k0 {/ d6 C9 r; K1 P* L2 } - - [8 D$ u6 [, W4 v$ P! E2 e; F
- #ifdef EDMA3_DEBUG
* \, d5 t, f& l' H' } - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
5 ^+ T' }" n: H f - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
6 `) B. V9 o; R, N1 q8 M, c - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
$ N, h [, Z8 p; _ k - #else
]: r5 g0 p3 d - #define DMA_PRINTK( x... )( Q7 p* J0 T) L3 g# s/ Y: M
- #define DMA_FN_IN
/ l9 p% g8 H& i - #define DMA_FN_OUT
' T# W3 O r0 ]8 T3 y - #endif8 N$ [' L6 ?2 q9 n; o, R
- % ]7 u# ?( w1 B5 a( A
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
6 c( \) X3 V2 h: q# b; I - #define STATIC_SHIFT 3
! t' U1 l" l" o9 f6 m - #define TCINTEN_SHIFT 204 s: H8 k: y/ A
- #define ITCINTEN_SHIFT 21) u; c4 w s9 i! d K# y0 b+ I, o
- #define TCCHEN_SHIFT 22+ @7 ~6 v6 @$ n' j h0 Q3 e* P @
- #define ITCCHEN_SHIFT 23
. v/ p/ G% g9 @ b& i! s, j
5 _* [: Q( f9 O4 E" ?% ?; o- static volatile int irqraised1 = 0;' E9 Y+ U9 R/ I; ^, D
- static volatile int irqraised2 = 0;
8 b4 |& O i4 w- K1 z/ o. E& G
9 g5 u9 k9 O9 g- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# D- d1 g2 @3 j0 P6 F - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 ?$ ~- z5 O9 L) \9 y - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 P" o+ g5 s a$ |' a
- X9 e1 D& C$ \9 a: h- dma_addr_t dmaphyssrc1 = 0;
* j' ? n0 W* T0 h - dma_addr_t dmaphyssrc2 = 0;; H+ I4 K: |- M: u; G. \. Y( e
- dma_addr_t dmaphysdest1 = 0;
* ?9 z8 o; W/ d - dma_addr_t dmaphysdest2 = 0; s' H; }/ x! b& ^
2 r9 C) _" B/ e0 y# V! ?- char *dmabufsrc1 = NULL;
# e6 s+ H7 n" T6 F; Z - char *dmabufsrc2 = NULL;5 Z# x e1 \6 l) [ A; I; d* L& h
- char *dmabufdest1 = NULL;
0 J/ ?/ Z% b) c3 V! C r* j - char *dmabufdest2 = NULL;
' |, M/ C/ Y8 p; s! f/ x( e* X - C3 X- p7 G# q2 r
- static int acnt = 512;
! ]2 j* H6 i. _4 t - static int bcnt = 8;" X S: v* y: ~: c1 M; R m3 M
- static int ccnt = 8;( ?5 i4 M; _# x8 R
& t( m5 f M5 V* |) E$ t- module_param(acnt, int, S_IRUGO);0 t2 B; u& _' Y- ]3 L8 C
- module_param(bcnt, int, S_IRUGO);
2 l6 `6 q/ Z' ^4 o( g - module_param(ccnt, int, S_IRUGO);
复制代码 & a/ q! { A# D1 z. O' T) [0 v
; m7 B7 Z" l7 }+ ^* M
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 w7 ~( m9 K1 W. ?9 C
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 T r+ O; g7 O: ~! p$ N! @- j 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! g/ i& O( z% u/ m
: D% u$ _( W( R3 D
' j# C$ g8 U9 ^. i) T9 { |
|