|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" x9 |* @: w7 o. T9 ~ A* {- [code]EDMA sample test application
7 {+ b0 S0 h0 M" e1 d( Q - /*. V0 h4 W C. L* ]- M
- * edma_test.c
. f2 w/ e1 B" X0 @! n& V0 _ - *
! X' q0 R" g8 C4 i6 r5 R7 l - * brief EDMA3 Test Application
0 R" S' W2 t$ H- j: i- N - *) s# c# W" Y/ c, g# W( M
- * This file contains EDMA3 Test code.+ g$ a- j) v+ \5 e% j
- *5 o! ?* h, K6 v- l# N" Q7 n" Z4 d
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
# F# r5 ]1 M3 a+ Y; d - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
+ s5 A# I4 O* ]. E - * TO CHANGE.& \1 ?9 r! a7 A0 ]) `
- *
0 M5 _* W+ @: H; l( q' L - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 c* C8 C$ h9 K. L o5 `5 S5 B
- *
/ b/ X7 ^" w/ s( t; E - * This program is free software; you can redistribute it and/or% H8 O8 ^: }' {7 Z( |7 c
- * modify it under the terms of the GNU General Public License as3 J. x2 k; j" O6 D
- * published by the Free Software Foundation version 2.
4 S- y- P2 a( y! U5 P - *
! I: J8 l1 Q8 }1 W0 x! q - * This program is distributed "as is" WITHOUT ANY WARRANTY of any( e9 n1 U" V# D E
- * kind, whether express or implied; without even the implied warranty
7 L& F+ B( @ ~1 E - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6 |8 U# |* H, ]9 y/ i - * GNU General Public License for more details.
, V" ~5 R* w5 k) N3 }) j - */# D& O/ J+ }2 O7 Z6 K
( c. I' z! [* \& C% {1 L @- #include <linux/module.h>/ J+ ^1 ^0 P' Z, ?0 K( E8 b
- #include <linux/init.h>
1 ^' Z, X, O$ a! A z+ h6 j/ x - #include <linux/errno.h>
" _; v [$ U h& _3 M1 | - #include <linux/types.h>* O* f! w1 V$ V" t8 E: u* J
- #include <linux/interrupt.h>
% c, _6 @) O- G+ u7 ^# ?/ o - #include <asm/io.h>( W' t2 w6 B8 C- e& A
- #include <linux/moduleparam.h>
8 K9 _6 s9 M/ S1 n; c7 S1 f# D/ d - #include <linux/sysctl.h>9 u, @# A1 k! c' I% D
- #include <linux/mm.h>3 }; n- I+ S8 _! \, M: `
- #include <linux/dma-mapping.h>
; d- E! \8 C1 r, v/ i* J8 |. c4 w* O - 9 g/ m& q# A3 I% X( J) {& f
- #include <mach/memory.h>
, ~% s& m: M0 R( ~4 L, q8 x - #include <mach/hardware.h>1 @- N( S* u- D l& q2 B1 \( k
- #include <mach/irqs.h>
- @$ ]! P8 n1 Q2 i, B& Z - #include <asm/hardware/edma.h>
2 G( f/ l4 C7 ^ `
- H8 O6 E& D7 Z% z+ W; a- #undef EDMA3_DEBUG
) _# f3 J% V- ?# p - /*#define EDMA3_DEBUG*/
; J+ q8 T- Z5 C/ c& v5 m" m* H - ' G: D1 z4 M! `9 g( ^/ k9 j
- #ifdef EDMA3_DEBUG
" A* k: W6 j8 }( X- ` - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). }/ n6 k: O9 Z: i9 ?9 Q0 j
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
$ h2 S2 H( L9 P# K; g6 p" F& T - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( E5 m) j* [3 J: f9 Q+ h9 i' C( Z
- #else
' v. Z; Q6 h2 b& _9 z; h - #define DMA_PRINTK( x... )" ?( C, Q" _1 ^1 S. B
- #define DMA_FN_IN" i3 L- \/ W! v' ~. ?2 h
- #define DMA_FN_OUT7 z$ o6 Q6 Z4 ^
- #endif
M7 f( r! g# [0 M - ; a6 S+ K8 U3 ]- k1 V) R1 H6 L
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)3 C* F7 s& ^8 D2 W( s3 X" B
- #define STATIC_SHIFT 3& d9 d' h% s, {; K5 k
- #define TCINTEN_SHIFT 20/ C2 F7 o1 U8 x2 F) m# l$ `
- #define ITCINTEN_SHIFT 213 \: Y8 h, Q3 P! ~- V @: }
- #define TCCHEN_SHIFT 22' @/ i, z5 o% i& D; R) U
- #define ITCCHEN_SHIFT 230 a) g3 a5 C _+ P
- 5 x8 q) O! f- D; ]/ Z# w: r
- static volatile int irqraised1 = 0;1 o. z+ C% |% t2 I6 v1 X
- static volatile int irqraised2 = 0;6 N9 c! G/ g. L
- * Y5 W) a: Y" F& N# `$ |( d' o3 R/ j4 G
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 F8 s" z+ ^/ [! [. r
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( `( C& c% E) G ~ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 H5 j/ D. Z/ k( g5 m) X! _8 q
8 V, D; ?+ b4 P, Y! q- dma_addr_t dmaphyssrc1 = 0;- N# q6 ~+ U9 F
- dma_addr_t dmaphyssrc2 = 0;7 g0 k. _! y" X* \& @
- dma_addr_t dmaphysdest1 = 0;
, T& E! P% A j0 p n- t9 i - dma_addr_t dmaphysdest2 = 0;
. G2 k" z3 X5 s. d r
8 D. F3 c- `6 [+ X- v- char *dmabufsrc1 = NULL;
$ q" E& Z' V y" _, S4 u0 ~, q, X - char *dmabufsrc2 = NULL;
- E. C# C9 l- ~ j' z8 {7 o: e - char *dmabufdest1 = NULL;
; P3 J0 t: u0 I( `; w H - char *dmabufdest2 = NULL;
* |# A2 \. @, O$ U0 {
4 g* G& R0 U: e* l1 B2 u/ O- static int acnt = 512;
+ j6 z9 v6 e, }, ^1 A/ D' M8 _* a - static int bcnt = 8;
4 B" [3 B) v9 m ?7 E2 m - static int ccnt = 8;
! Y4 N" w) r; O) |6 C. i5 f; q
. c2 ~0 A, u& \- module_param(acnt, int, S_IRUGO);
" {5 |& X! @! u4 f% C& a! c - module_param(bcnt, int, S_IRUGO);
K8 ^ c1 w! `# {# @' W - module_param(ccnt, int, S_IRUGO);
复制代码
% b7 b [0 `3 T# I; D6 [: T
, [6 w7 L& O( D+ V" C0 q 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 C9 l5 x/ N% x, n! r
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- a4 X O7 w8 k8 p: I0 O2 `
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* _/ i& }( l7 v2 u5 Q$ b
" V2 g8 [3 s, x8 D2 l6 Q `0 S& _5 v+ F+ y
|
|