|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% d' d5 w1 D9 r& V% ^- [code]EDMA sample test application
8 Q/ J5 U6 l* @# p' w8 L/ k - /*4 ~' P4 V! U8 W) x! k* R5 J
- * edma_test.c, d& S0 k7 _( C
- *# j, o4 B! _" h
- * brief EDMA3 Test Application' ^3 x( q* @( n. } p
- ** O4 b" g1 Z. h6 V5 f7 U$ f, F+ I
- * This file contains EDMA3 Test code.
" U N0 x1 y3 }/ ~& G1 s1 l$ e' N - *$ y* O: z% ~1 |
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; }; ^* N" i# P1 j4 M
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) a) M% @9 `3 `/ _; |$ D2 ?' W
- * TO CHANGE.
/ b, G8 S1 R1 l: f - *) I- j$ c8 Y! E. ~! q, Q6 Y1 _
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 n" K0 H2 B( L( d# @8 V. E
- *
' e( v2 R4 |; B2 d" V - * This program is free software; you can redistribute it and/or
! J! H( A$ A3 a3 u' b5 E - * modify it under the terms of the GNU General Public License as3 w# d; t4 @2 v% T8 ]) I
- * published by the Free Software Foundation version 2.
+ r: d1 K* B+ F/ S) u& l$ Q. n% N - *
0 |6 x/ ~7 k# ~' q! T - * This program is distributed "as is" WITHOUT ANY WARRANTY of any! ~4 y' t7 R5 L9 p
- * kind, whether express or implied; without even the implied warranty5 I5 _0 k$ l8 ~% X0 u6 a0 _, q4 ]
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the9 `3 N- k9 |' h7 z% m" i
- * GNU General Public License for more details.% ?7 K2 p8 G/ ?) ?$ Q
- */7 H) G: K- w: w4 q' w/ Q$ H
- # z4 s' Y- X7 K5 \2 t. c
- #include <linux/module.h>
# }; I" F n& p8 f" W1 d - #include <linux/init.h>; _0 N5 ]2 m0 q7 T) o3 F
- #include <linux/errno.h>
7 l& ~; e$ H1 x) _1 |( R% h& v* h - #include <linux/types.h>) h' R5 ? z/ k2 C9 ~
- #include <linux/interrupt.h>
" J1 f# _ Z5 d4 ^! D$ ? - #include <asm/io.h>0 M4 k8 A' F& B" E
- #include <linux/moduleparam.h>9 y* p* r( k4 _# j; ^
- #include <linux/sysctl.h>
; F2 W- ~; @3 `( Y' i1 P% m - #include <linux/mm.h>
. t- l3 x' m I8 M/ g, W - #include <linux/dma-mapping.h>, l+ {) c; }% W
- 5 T/ p3 `) e8 J! G& D8 e
- #include <mach/memory.h>
! ?/ ~- r; ^& u0 j! H6 w, L - #include <mach/hardware.h>! z) s" E2 b# Z% w# D9 S
- #include <mach/irqs.h>
9 S6 ~8 {' H& d, e! F; ^1 g$ e - #include <asm/hardware/edma.h>4 ]3 s \ D- H: q- J4 _. v8 Q
- 5 U" T5 k7 z( w9 r
- #undef EDMA3_DEBUG
2 f+ d3 D+ Q$ G* O. J+ [, I - /*#define EDMA3_DEBUG*/& p) {* s& b) }& }; P# m
( `) s Q! i1 P, M3 }, h- #ifdef EDMA3_DEBUG
% M5 v2 L3 l3 V7 i. d - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
+ A+ U- x& I( ~7 _4 ~ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" H' a8 h& W9 @, v+ v
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
; K+ M9 P$ \# q - #else; e$ p! K; q# b, |! I V8 q- e7 g3 V0 [
- #define DMA_PRINTK( x... )( s5 V5 ]) }9 F$ q* r
- #define DMA_FN_IN7 I4 O+ Y" @% \# Z
- #define DMA_FN_OUT
7 i \7 r9 L! H- N% d& R, P, a+ U - #endif
1 r9 e: q- q3 ?" M9 ~$ O, T
" G1 e) b( R+ O5 k' z2 c4 L- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
! e( S$ k9 ]2 v, `9 x2 J - #define STATIC_SHIFT 3. a* q. Z5 n9 [% F/ A E
- #define TCINTEN_SHIFT 20, ` j* m1 M, }1 X& l0 ~
- #define ITCINTEN_SHIFT 21% H. \3 R3 u1 i1 |! E! s# \4 G8 A
- #define TCCHEN_SHIFT 22
% K6 O3 h+ T, T0 N - #define ITCCHEN_SHIFT 23* q3 P" G. B- {! ^: j
2 m3 e& ^5 ^9 q1 M3 G* v9 S" m- static volatile int irqraised1 = 0;8 M# G9 I- Z' Q! b e! j0 k" x$ w8 k
- static volatile int irqraised2 = 0;$ N# a3 c. z* S' U/ A, N& D% ?
- 0 }/ k; ?7 e3 ]
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: [$ C5 I0 R. ^* v2 J% s( l3 y - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ ]6 Q8 Y- {! o; e& f7 |
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ x/ M7 O' n' f: [; I* G: k0 F
9 I0 W6 J$ z# J- dma_addr_t dmaphyssrc1 = 0;
* e8 ?$ x/ I7 P, z1 @ - dma_addr_t dmaphyssrc2 = 0;* e, Z; f- o, U* v8 C
- dma_addr_t dmaphysdest1 = 0;
& F2 ~9 x r* n' Y+ }- N - dma_addr_t dmaphysdest2 = 0;
7 ~9 P) d# y; B5 D" x7 G
1 P! N) \! b# I/ y1 A4 W, U- char *dmabufsrc1 = NULL;
9 m1 R! z) b$ q - char *dmabufsrc2 = NULL;
( X% ^, y. \7 [; Z - char *dmabufdest1 = NULL;
@9 h$ Z" C6 {+ i - char *dmabufdest2 = NULL;6 G; A# s- g$ H4 a/ U5 C& P
7 i* _& P( [( K3 @- static int acnt = 512;
7 n: {+ R2 Z) E) N$ } - static int bcnt = 8;+ Y. v7 X! i) M+ h, }$ U" P
- static int ccnt = 8;6 j4 H) \* g6 M6 W
- 3 M' r' }- v9 j# B
- module_param(acnt, int, S_IRUGO);
. E8 O5 x( `' t3 O; M: k' X - module_param(bcnt, int, S_IRUGO);
3 J3 i; N% v4 Q( F5 _8 F0 u - module_param(ccnt, int, S_IRUGO);
复制代码 / z0 m. ^5 M( v
3 x4 c) D* `& \6 ?
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, }4 L U+ }& w q) @4 C+ I: X
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ }3 j4 G- K N5 k 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ `+ ~' T' [6 F/ s! k, N6 b; a
; u( Y% R% d! r7 H4 I
6 L3 A8 x1 j* k |
|