|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. q& O8 ~9 H5 g! U1 ]. n- [code]EDMA sample test application
0 a2 r/ E' M; {( T' ^# R; l - /*+ F8 W5 R1 ^% ?* B8 K
- * edma_test.c( \7 r2 z" O/ u8 W- T3 O
- *7 O9 q4 b4 ~, L; M. n: [
- * brief EDMA3 Test Application6 F- k) f `& N5 z' f0 ?$ m7 o s
- *1 W8 J# g" F3 A( X6 J, e& _4 V
- * This file contains EDMA3 Test code.8 j3 Y7 r* @1 F' o* F+ K
- *
6 @ M5 A. m0 u3 @ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 T& \1 R0 v L+ ]% L3 G* r
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
+ n7 k/ e* ~9 M j* b3 u/ r - * TO CHANGE.
8 L, O, ]6 }: a5 r. P7 W - *
, d- ~5 @+ |1 P$ [" _, e - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// C8 @, Y" Q# x1 K
- *. {# {9 X/ z( e2 L; e
- * This program is free software; you can redistribute it and/or1 {6 ~( I$ x* [4 |+ P0 ] k
- * modify it under the terms of the GNU General Public License as
9 G8 a3 I) B! e - * published by the Free Software Foundation version 2." j6 i. _8 E* D1 l5 j/ Q, Z
- *, V5 C+ w$ |( o) a; B/ l
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
, k2 {% x4 _$ W& E - * kind, whether express or implied; without even the implied warranty
2 y5 Z M6 I5 z6 S: X2 [5 j% q& ] - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the8 R" H5 @/ f1 D4 I
- * GNU General Public License for more details.
) r$ O9 i8 [" o+ A2 ]9 s - */
8 i, N1 ]8 D+ a7 n$ Y9 C - . D; d H7 Y, ^* z# t y' u
- #include <linux/module.h>
, {5 u6 {% T5 ~& m0 b - #include <linux/init.h>
) Y7 \0 s$ l5 W. i3 } - #include <linux/errno.h>" }1 w, N9 _- o& r! A' S+ C
- #include <linux/types.h>
+ J0 s) x; _9 \: ?* v - #include <linux/interrupt.h>
7 r; k' Q8 x% f7 M$ ` - #include <asm/io.h>
! b5 v: H. F8 T- d - #include <linux/moduleparam.h>
* z4 M4 }6 ^% G5 | - #include <linux/sysctl.h>
$ F B9 M* C4 d" D$ P - #include <linux/mm.h>- J5 \3 U; h0 s8 E% C( g# x$ v
- #include <linux/dma-mapping.h>* d3 E# w! I6 p' ^' M
- ( I! I2 N7 u& o
- #include <mach/memory.h>9 l4 {) z" h" I% `5 l
- #include <mach/hardware.h>
$ ^7 {. t0 M* S6 h( L" Y - #include <mach/irqs.h>
3 q5 h) K* t2 K# { - #include <asm/hardware/edma.h>( n) w' U8 Q0 L, C3 R+ q4 l2 F
- N" e6 X- [" t" H/ P1 Z, U- #undef EDMA3_DEBUG( L! c* N5 ^; t7 z: \& s
- /*#define EDMA3_DEBUG*/
8 Q1 ~9 X7 ~1 \" }) t - $ `" H8 O% Q/ ^& o J: f. d
- #ifdef EDMA3_DEBUG" _6 t$ A+ Y5 B2 ~9 q& O6 d% V. r. A
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
7 g7 R$ R* V" Q# _ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
! M7 I% h7 o( k, P3 ] ` - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 o3 P: Z* G, k* S
- #else
1 t1 r$ y; v/ `$ ?% D - #define DMA_PRINTK( x... )
8 ~1 b! J. [- f5 \ - #define DMA_FN_IN
* X# n6 B1 l. w+ G w) Z - #define DMA_FN_OUT
3 }- {! v* I* w; ~# K% A7 [ - #endif5 A6 b- G& T" _4 X% Q
- / u, G& W2 q$ k: G4 Q8 x
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)! ^/ j1 ?+ |4 W: W' `- [+ S6 i6 r0 Q
- #define STATIC_SHIFT 3- C; }$ Q6 ?$ c& F. u _
- #define TCINTEN_SHIFT 20$ n: z4 o4 k* E j& i0 u9 A4 x8 y& q& X
- #define ITCINTEN_SHIFT 215 h1 ]$ F* a" F) ?' q& N# a
- #define TCCHEN_SHIFT 22
" e4 `) Q& ^: C/ k3 i: ]1 R - #define ITCCHEN_SHIFT 23$ w r: O2 [5 f$ j% ~7 m5 e
- $ X" s" \, O! r9 T
- static volatile int irqraised1 = 0;
1 J4 T/ |8 n) Q2 f ~3 F: C - static volatile int irqraised2 = 0;$ v; P/ b9 e$ E" B/ Q0 f9 L* [
- 1 z& d2 ?8 f" \' x$ t2 Y# l8 }' b# j
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 j7 g; D2 |1 ^ C
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 t$ u( {" W+ M. m, D% t" [
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& N Y! V, w( k - : v3 s* O1 n9 |
- dma_addr_t dmaphyssrc1 = 0;: s5 V$ o G8 ?
- dma_addr_t dmaphyssrc2 = 0;# X: ]/ e2 m* `9 u
- dma_addr_t dmaphysdest1 = 0;1 D p; v& L4 x8 E6 G3 c+ B
- dma_addr_t dmaphysdest2 = 0;
: b! V' S% N- _4 ^ - 6 `: a+ l* K, H! I g( ^3 @
- char *dmabufsrc1 = NULL;, y A d. u- |+ Q: S
- char *dmabufsrc2 = NULL;
8 `% L* d7 ^0 B; c: l# V; e - char *dmabufdest1 = NULL;
: f8 ]$ i. i+ T5 ^; x" ?& N/ [/ U - char *dmabufdest2 = NULL;
% o; x4 c& O& I7 x+ v4 o& Q
A1 B A7 y: h- static int acnt = 512;0 [* Q) @' v4 L
- static int bcnt = 8;8 {' G7 y9 j' F8 }1 ]0 w
- static int ccnt = 8;$ e+ w, I/ E# r
; C& q, p# C8 W& k) z$ K- module_param(acnt, int, S_IRUGO);9 }; N" `" N% Q6 c2 v
- module_param(bcnt, int, S_IRUGO);7 t) l$ H* J" B) E( b9 `% Y0 U8 X
- module_param(ccnt, int, S_IRUGO);
复制代码
. P) T5 u' E' W1 i% L# ^. I+ N
7 C6 z/ c' _2 q1 ]" M- G" k 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 W. w; K6 @* _5 y s4 S) O- karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& U+ X" k8 T/ E; W: D9 A9 O
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ `) ~" {4 P3 G0 ?
, L8 q8 r, s# _) b9 a6 @+ {3 q' q
8 a% N5 M3 D, e7 Q0 ]. j- D, i |
|