|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* u j" R- Y" J6 k- [code]EDMA sample test application9 v( c* \, L. w& |
- /*
' R" V6 X1 w+ a. c+ q - * edma_test.c2 @' D: \% p# j0 |4 V& t9 O
- *
8 D8 H: s1 G5 [. M9 Z* |1 c - * brief EDMA3 Test Application
. s$ e3 f t5 E6 p/ D& n - *; Y" O3 W1 P4 j
- * This file contains EDMA3 Test code.% m" i3 q' I6 G9 ?9 Z+ t
- *
1 E# ^! h0 S& t( s - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ G0 V7 k: [8 G6 n- ^
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 G: P0 d" a0 n+ ~
- * TO CHANGE.6 c# A! f' z' j: V! n+ m
- *
~, r/ t5 l+ @( |0 v+ F - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. X- R! u$ I( _! _2 G5 T
- *1 |& f& z. u% [7 A
- * This program is free software; you can redistribute it and/or% j! L9 h# P. e: ^$ b" H
- * modify it under the terms of the GNU General Public License as4 a+ h" `0 Y: p% f1 [. u3 N1 C
- * published by the Free Software Foundation version 2.; C. o! V9 W) a0 I- X
- ** D" X3 j3 F0 T+ |3 E6 \; p9 s
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 A6 p0 L/ O# y5 [* ^1 ]
- * kind, whether express or implied; without even the implied warranty* j/ e; v# d% X8 ?$ p6 e
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4 A6 a' N" k5 a" l& Q - * GNU General Public License for more details.9 O5 i* A- j- f4 B4 X3 A
- */
4 i" A: [& k8 J a - , }3 y3 b& d( E0 P; E
- #include <linux/module.h>5 Y) }' C9 [% X
- #include <linux/init.h>+ `6 n' t6 Q d
- #include <linux/errno.h>
7 h' i" [0 B# r9 B - #include <linux/types.h>
% r4 I4 H2 a$ A2 k( ^: \/ v - #include <linux/interrupt.h>
% }: K B; V8 ^ |: z - #include <asm/io.h>% }# R8 G) j' U$ k2 ], s
- #include <linux/moduleparam.h>
! ]! T- W! D2 X0 g" U - #include <linux/sysctl.h>% C) C8 O4 h X* G' U
- #include <linux/mm.h>8 m4 Y8 a" [4 Q: q$ N2 n# W7 h, l
- #include <linux/dma-mapping.h> Z4 `( o: y2 k R1 d# j8 |: ?
- / v) N6 r9 f* R( j
- #include <mach/memory.h>
# ~6 c' a. o: N) w( {- a$ D7 H - #include <mach/hardware.h> c V* R* `7 R, ?1 Q. k6 L
- #include <mach/irqs.h>
4 A B7 a' _7 w' F3 s- E; h - #include <asm/hardware/edma.h>3 Q* r! d3 x5 u- B1 I5 Y
4 B7 M, k8 `4 A9 m% m- #undef EDMA3_DEBUG
5 Z1 q. g! Q# E! p5 r% p9 B - /*#define EDMA3_DEBUG*/
; E" F( `# K$ |) L7 Z$ F! s - + {7 }9 v% d+ M: k
- #ifdef EDMA3_DEBUG
% G, ]% r* G4 j - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ S W, H& u$ p' e" D5 W! D2 ^
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
U, V% D* {( n( D) ? - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
% X' p( R- m$ O! o r1 o) Y - #else7 Z8 h% K7 I- j. E
- #define DMA_PRINTK( x... )
- F3 Z6 {& ?) L - #define DMA_FN_IN
9 m; W* G% d, Z" m' H+ d" M - #define DMA_FN_OUT0 H0 h7 \: z6 J$ h- ^' J( f
- #endif
& I# n7 T. }7 F, X! { - 5 Z; \; Y8 @$ E6 h
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
" t* h4 X* O* ?8 p% a1 D6 M: Z - #define STATIC_SHIFT 3
4 e( a% f6 |# r2 J- H - #define TCINTEN_SHIFT 20! z5 f# t& p8 @& a0 M
- #define ITCINTEN_SHIFT 21
" P) S$ i, P2 p/ y - #define TCCHEN_SHIFT 228 S: j( S$ ~: U3 W
- #define ITCCHEN_SHIFT 234 V% |0 j6 h, h$ ^5 h
: t* h4 J. @9 g. H1 h- static volatile int irqraised1 = 0;/ f- H) `0 M) U* v. K# c$ r
- static volatile int irqraised2 = 0;
|, j; k. m4 S' {: C4 j; a8 |; N: H
3 k& j: F! J, E- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, L1 i- b/ }" Y6 z* | - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* z; k0 [' n( O( Q- S' X# B
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 q( g2 e$ C" B! }3 a: Y - 7 u0 W$ R) {7 Y6 r
- dma_addr_t dmaphyssrc1 = 0;
5 v5 V; A% k x, L& c0 Z5 a - dma_addr_t dmaphyssrc2 = 0;- [6 U' R3 ^4 e
- dma_addr_t dmaphysdest1 = 0;7 Q @ r# A! {9 K
- dma_addr_t dmaphysdest2 = 0;8 m+ W" o( }- I: {
! Q' I k9 e: Q, p1 J- char *dmabufsrc1 = NULL;
* }) `0 u+ Z- `: G - char *dmabufsrc2 = NULL;0 K6 w) l5 l G. ^+ c0 l
- char *dmabufdest1 = NULL;* q4 C# v1 W9 z& R- x
- char *dmabufdest2 = NULL;
2 g M3 [5 P* `: [ - ' ?: l3 ?3 V1 v2 T9 |
- static int acnt = 512;; o) w) h$ A7 `4 E$ D" S
- static int bcnt = 8;
- F! Q8 ~6 r# @% i - static int ccnt = 8;
; p% K2 a2 w- T1 K* b# s
. l9 x( s, D. s& J/ z7 ]- module_param(acnt, int, S_IRUGO);
. U2 A/ }6 \; A; B' m - module_param(bcnt, int, S_IRUGO);
% p9 R: i; H5 `5 d) O" P& D0 m' V - module_param(ccnt, int, S_IRUGO);
复制代码 8 n" D L0 L: |
9 n7 m: S/ Y4 C$ F* ]; d# @ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- r9 D2 I& Y6 s ]" |/ _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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( N9 d8 q7 t) j/ C2 I0 s
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
Z* n& O5 u$ z! f. D0 F6 g
! R2 b4 v, P9 t+ c3 b
) F! m% V2 q, H6 M1 K |
|