|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 P0 c4 b) }' i; @2 l, B+ U2 X- [code]EDMA sample test application7 q, v" n6 [8 l0 R) w- `
- /*4 H1 V( T5 Y8 Z* j, _7 ]
- * edma_test.c
5 M4 R8 a" E; [5 [ - *, p1 _, X: H I: k1 s; ~# E. S6 X
- * brief EDMA3 Test Application4 u* a4 E/ W. a$ F
- *- f9 L# z/ W6 H( O$ b
- * This file contains EDMA3 Test code.
% y& E0 {, i8 T& k - *
; v# v" s- ~6 k3 Z* N' n - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
! Q2 C) a8 |% |1 N - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! d5 e; s, E9 N4 \. a! p, t- e
- * TO CHANGE.% w: l' `: `9 z# A/ ^
- *
6 } [7 }$ Q, k+ w - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 M9 ^: Y# W' u. E$ g* w5 a6 o
- *
. l6 Q/ Q4 Q$ F3 V% U3 o/ l - * This program is free software; you can redistribute it and/or) P8 e4 Y* J4 H0 [+ ?# s
- * modify it under the terms of the GNU General Public License as
4 q/ {1 `5 D$ U7 m8 Z' G - * published by the Free Software Foundation version 2.
% ]" d7 _4 @) e4 G5 M4 R' Q - ** ]' M- |! E% L& A. y1 X7 U* M
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
j" j. }# o+ u- F$ W# d - * kind, whether express or implied; without even the implied warranty6 o* |( o- P9 c: Y M8 s! Q
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the4 O* k( l- N1 o4 O' Q. H5 t( W
- * GNU General Public License for more details.
/ ]$ m7 e% l* R2 B& d* G/ c - */
( |! y+ {* y* t4 h# M; G8 ] k
+ h$ R7 t9 t" r2 N- #include <linux/module.h>
! a% s: u! N8 a8 q1 F$ X - #include <linux/init.h>
' q+ a5 T0 u9 B/ t& j - #include <linux/errno.h>' u0 }2 V$ A5 q4 k
- #include <linux/types.h>
; s8 g! Y/ K. ^2 q - #include <linux/interrupt.h>
1 `4 R* B( r$ S6 ~( A O - #include <asm/io.h># Z" g( h" p8 T! D) _, W
- #include <linux/moduleparam.h>" _& x4 J9 n1 v( y+ v
- #include <linux/sysctl.h>
( ^7 ^. P, m' t9 T - #include <linux/mm.h>
. _, U' o4 D6 t' U) u - #include <linux/dma-mapping.h>3 L% {6 U2 A# M
q0 I/ r3 Z% |2 K% R- #include <mach/memory.h>
; B; F! s0 e0 S - #include <mach/hardware.h>
0 ?' R& ?8 Z( s - #include <mach/irqs.h>
/ H( p" X2 g m7 u4 _ - #include <asm/hardware/edma.h>7 r! }$ h) |) t( O( s; z; Q
- # `( v" L# f. Q8 n
- #undef EDMA3_DEBUG
- A7 l7 k& O) b7 f N) d6 R9 c0 I - /*#define EDMA3_DEBUG*/
2 u% w: f& c N. n1 { i3 @8 b* f, X2 P - 1 f7 B/ i* }) A( B' D
- #ifdef EDMA3_DEBUG
4 G5 I/ Q' o. T+ l8 t/ ? - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 X4 K8 W9 w# y: [: w5 z8 t. K4 Y
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
. j Q- c1 J& w# Z" X0 v - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" E L( P# P) L2 C& D
- #else
7 [. O# y# Q# D - #define DMA_PRINTK( x... )
7 a6 l) ]/ W0 c" _7 O6 j7 E, Z - #define DMA_FN_IN
2 b* d" q. U, `4 @# { - #define DMA_FN_OUT
8 X: N4 A3 x2 Z. A/ J! I2 G - #endif' |. H3 E% {6 q1 g3 t/ ]
- " A9 p8 c" r: ]
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)$ {3 e6 a0 u) b9 r
- #define STATIC_SHIFT 39 d( p' o* f- n( P5 J6 O: D
- #define TCINTEN_SHIFT 20
4 K% ?2 J9 Q' \* h8 d2 P$ g - #define ITCINTEN_SHIFT 21: a! P0 {# t3 G
- #define TCCHEN_SHIFT 22
* p$ u3 a& C& [% E5 Z2 z - #define ITCCHEN_SHIFT 23 X7 L; P) w0 K
% V7 J0 L2 E0 P+ N# I- static volatile int irqraised1 = 0; E! l: V* k4 m( M$ M/ j
- static volatile int irqraised2 = 0;8 q4 @) P. m0 M. S% X
' N3 E7 p- b! h- e( J9 F- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, h& k, u6 O- D9 g" c4 {2 Y
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) O2 Q1 F* h! `" ~2 G6 ]5 ?) v% y
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* e ]( s4 y7 ~7 `1 P) x
- 6 m) w* Y( A; ?0 G# Z5 K
- dma_addr_t dmaphyssrc1 = 0;* {$ R! y3 l! }6 B
- dma_addr_t dmaphyssrc2 = 0;) |$ e/ l; U" S5 M
- dma_addr_t dmaphysdest1 = 0;% \' H" h' X& J3 x' @* e
- dma_addr_t dmaphysdest2 = 0;; z3 Q- f' y: [8 I5 [1 D$ x
5 |$ } ^8 A: q* V) d$ N4 J# ~" G" k' G- char *dmabufsrc1 = NULL;. M4 r/ X$ V @' l( L
- char *dmabufsrc2 = NULL;
1 z9 T3 [! Q' P" b - char *dmabufdest1 = NULL;$ d- ~ a: Q, `
- char *dmabufdest2 = NULL;
. J: w# s5 B0 @5 D% a, `0 G - / r; g; Z7 o _% P, m- Y0 V8 z5 y) |
- static int acnt = 512;
/ g6 @" q$ X( u8 M6 V p2 e3 b - static int bcnt = 8;
0 f6 Z" w& `6 J E2 M' N - static int ccnt = 8;
* @$ t* l8 ^& L4 j3 [% O - ) G1 G# T- c& K0 i' v
- module_param(acnt, int, S_IRUGO);
6 T$ S8 L) y8 s: J/ L( R, I, x# S ^ - module_param(bcnt, int, S_IRUGO);
; o3 T: y; a) b! [6 c - module_param(ccnt, int, S_IRUGO);
复制代码 $ c( a* _8 E3 q% f3 O8 Y$ H% ^
9 z- O. X, P$ {/ e2 `" Y- f 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( ~; {5 q, m4 R# O
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
p" T, X/ O/ R/ ^ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 G" F2 w8 {3 r, i9 x) h1 u- y. W0 F/ O! @) C+ ^# V. R
6 N* a0 } A" X% ?7 B- ~1 F- C |
|