|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
e- T: l4 _; a' q' u! ?* ~9 t' [- [code]EDMA sample test application# `4 i" }/ |, v5 Y2 a
- /*! L5 l) v2 w4 G* ?) j
- * edma_test.c4 o4 x: ~+ A- F
- *
; p2 J5 Q5 N2 o6 }! R5 K9 O' R - * brief EDMA3 Test Application
0 N! A' {3 x: Z - *
& J& g: l5 E( h ~8 ^; N( b - * This file contains EDMA3 Test code., }" I7 ?6 q1 t# k& e
- *: o9 ]) A( R7 c' |
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
2 G3 c3 R) Q/ | - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
1 T8 `+ O! B/ P6 [! a% u f# C/ d$ h - * TO CHANGE.
, p; j/ s: P" S( H0 d/ n - *
& a4 j2 Q4 q% I: A5 N5 ] - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
! ~* N k7 i' g8 w - *
/ N. u; K8 I+ B. o0 }2 t8 T4 ^ - * This program is free software; you can redistribute it and/or
$ S9 D0 g+ q- ~# V" b. C - * modify it under the terms of the GNU General Public License as! }4 M( p9 F0 ?& k8 H8 u
- * published by the Free Software Foundation version 2.
( k2 g9 }. s# V5 G - *
: p' v1 E% \# _% N3 \ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
8 @! Z# b( w) @. q5 q9 _0 P( S - * kind, whether express or implied; without even the implied warranty
8 L, d r7 \) `1 | - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the9 `" n- p0 I* G0 P4 b+ h0 B
- * GNU General Public License for more details.
% `5 t& x" A7 q0 U - */
8 i) h# E% w( i7 y - + z! a+ _2 \4 K/ S
- #include <linux/module.h>
( {+ ]- M V* E! E - #include <linux/init.h>+ c! M" E1 k+ b. {0 [$ T# V- a
- #include <linux/errno.h>
+ l- G( ]2 m$ b; @% v B - #include <linux/types.h>/ B+ D% a: [( x0 G1 y, x: h. Q
- #include <linux/interrupt.h>
, n- P9 W2 z: L3 t - #include <asm/io.h>5 q8 ]. Q ~1 H |/ O. _3 f$ o9 }
- #include <linux/moduleparam.h>
6 `3 p9 T2 C8 j$ d - #include <linux/sysctl.h>
& d& }) ~" W- C! E$ c7 z - #include <linux/mm.h>
! g4 e) k; b/ e$ _ - #include <linux/dma-mapping.h>/ ^# C" L; l* t" X' V
- ! d; g( T1 j2 A0 p8 |
- #include <mach/memory.h>$ S s0 z* b% o# L& k8 R# O
- #include <mach/hardware.h>, v% U% Z7 B# g3 C
- #include <mach/irqs.h>
2 H8 b6 `5 q, Y! ] p/ H. E - #include <asm/hardware/edma.h>
. n& K- p, Z: R; n: @1 p - & }0 q7 p+ [7 T# I
- #undef EDMA3_DEBUG# T0 k6 o: Y/ X: [4 ?) I! A
- /*#define EDMA3_DEBUG*/
1 E9 h8 D8 {# a# Y" w
0 J4 N: E2 J+ u: [. i5 X+ h- #ifdef EDMA3_DEBUG
, o# X" w* d* O. `9 K - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
! f1 j$ J. D1 t9 h s6 H - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
2 A9 Z l+ a, |9 K: t1 w - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
( F( I, G1 K$ F4 W - #else
& Y" Q& @" [. B# h7 ~ - #define DMA_PRINTK( x... )7 I H9 \$ E$ r Y1 p
- #define DMA_FN_IN: J( P% T% q9 v& p1 p
- #define DMA_FN_OUT( q6 s' ?2 c2 D
- #endif
; G( g. E0 n$ q8 c6 C
+ E8 ?# M* I2 m% Y* H- G, ^* y( }1 V- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
+ H- g( g* w/ ?4 p! V2 T" M - #define STATIC_SHIFT 3+ i0 t5 `5 E$ s5 D4 n" m$ J: s( l
- #define TCINTEN_SHIFT 209 S, {% V) Y6 y8 E4 N- w
- #define ITCINTEN_SHIFT 21
/ M5 P8 s! n! @' M' F- l - #define TCCHEN_SHIFT 228 T% X! R8 V7 @6 d, B: E# @
- #define ITCCHEN_SHIFT 23
! B2 u' Q6 a( x4 }' E/ T
/ t* ^+ S+ \4 C I- static volatile int irqraised1 = 0;
" V- e% N" {( ]( ^2 K - static volatile int irqraised2 = 0;; u: L6 D; P$ }
- 1 d6 i4 O/ N& p
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! x- z5 |6 j0 J8 B& m* n - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" ] N, u. M! \8 O. F9 i
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ c/ ~! d X- E% t) n
4 l8 }: f5 @( \ }- dma_addr_t dmaphyssrc1 = 0;
_" t z0 M8 r$ |; W - dma_addr_t dmaphyssrc2 = 0;: f9 @5 }& u% K% w4 F
- dma_addr_t dmaphysdest1 = 0;) F! D8 Z# G/ b
- dma_addr_t dmaphysdest2 = 0;
& U& k8 B% ~% k7 W6 O/ d& y - ' F7 Z) R/ [% G
- char *dmabufsrc1 = NULL;4 o1 q* g& u+ C1 o& G+ K: A
- char *dmabufsrc2 = NULL;
$ G i8 ^, b2 X0 I - char *dmabufdest1 = NULL;1 m& N1 g/ L! ~
- char *dmabufdest2 = NULL;
+ [/ Z! x7 b. w - ! j- F+ J6 n6 x+ o1 r3 G* B* D1 l5 B. Z
- static int acnt = 512;# T3 W6 T5 Q4 \8 T
- static int bcnt = 8;
* Y; R! Y: q! R; ?3 V* I - static int ccnt = 8;! t8 k% L/ F5 d K
- k0 N, Q5 v" D' S1 x+ {2 a% v h
- module_param(acnt, int, S_IRUGO);
! O& y' `1 Q; d& v% R* S - module_param(bcnt, int, S_IRUGO);0 R% V6 U' T- e; z
- module_param(ccnt, int, S_IRUGO);
复制代码 , t/ g' Q3 g S! }# [1 l
6 b3 W3 p2 G# w" j! m+ P0 O' ]
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 V) ~: R. d+ d$ W
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 z; b8 n. K6 @7 v$ a 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 Z+ J9 Q) m/ G' {
* M1 V, N6 v% _8 R; i* U$ {* @3 l# p. [, ?% }
|
|