|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: _8 H/ d& q# O+ h8 O- [code]EDMA sample test application
6 Z Q7 h; G2 Z0 k5 w5 r% U) P4 c - /*' m( P- V" y6 }# W
- * edma_test.c
' P* S" |0 b. c! `6 m" f - *- B9 Y" o" ^& E/ C2 c
- * brief EDMA3 Test Application! R0 j U( Y. O$ D4 `
- *& f; C5 S' y' {: y( c( ~9 l% E
- * This file contains EDMA3 Test code.
0 C0 Y$ |0 V# [0 O. b) I - *
, N( s% G9 @0 w8 W- M - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
7 y, C4 l& ?- v6 \: h: w; |6 K; D# l - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
+ {( Q0 H. V! E! X% o0 G - * TO CHANGE.
5 w2 U" }! \. n7 B$ P5 j - *9 A" W+ y9 |1 U7 J
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, C b9 B: Z u& J' ~* p1 o2 F
- *
! w, t- a! r$ K* S) ~: E - * This program is free software; you can redistribute it and/or- d ^' F- |$ E; j
- * modify it under the terms of the GNU General Public License as
' u) {% i0 L0 ?% s- w$ {" u - * published by the Free Software Foundation version 2.: T0 o G" O9 t" v
- *4 I: ]5 ~3 u! n! w7 d: E9 o
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
$ o3 Y2 i" ]6 n/ g: X7 q - * kind, whether express or implied; without even the implied warranty3 ^7 L. [- G1 m7 `
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the' J8 A3 Q- T% T, O, x
- * GNU General Public License for more details.1 x+ J# l$ `% O! p% Z1 s# j/ R
- */2 C$ B. ^8 P& {( M$ d
- - @ \4 z& R3 G( G+ G7 [4 I
- #include <linux/module.h>( }7 H% f. q6 w" \) ^5 _1 k
- #include <linux/init.h>7 r, y; z: e2 t9 Z7 t/ `
- #include <linux/errno.h>
/ A. p! B C0 p! O9 {$ C6 T - #include <linux/types.h>
( p# W+ F q) r# ~2 p- b1 K; F - #include <linux/interrupt.h>
% k4 f1 G5 E- I" ]% `4 x! v, U2 |1 F7 g - #include <asm/io.h>7 P) m1 h( G( K- B
- #include <linux/moduleparam.h>
, I4 f$ n$ \) q4 R - #include <linux/sysctl.h>
, q& F. h6 i5 j" |$ ]6 W( h j - #include <linux/mm.h>
0 g/ T* g3 ~7 V3 c% a! c - #include <linux/dma-mapping.h>
/ o$ {! {) K' I% M+ @$ c - |- E# q5 d ^% `" u# S" J. _6 ~
- #include <mach/memory.h>1 i" v! X [8 e* D% I0 j }
- #include <mach/hardware.h>
- r2 }( @4 n' q! ^0 j - #include <mach/irqs.h>( m$ l, M- v0 n$ _
- #include <asm/hardware/edma.h>$ G9 E( [7 U# b$ }6 Y9 J3 _2 K
5 P" _2 v& x$ c- #undef EDMA3_DEBUG9 [( Y' R- g! g/ W
- /*#define EDMA3_DEBUG*/
4 ^' o" d5 M: C( D! R/ E2 D
: q6 c# z" C! H" x# t( I2 o- #ifdef EDMA3_DEBUG; T; |3 z/ w" K8 T. _% M+ q% }
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
; g# g. h; i1 M - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
& t% t' ?7 w9 n4 x - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 L" j6 S" N8 \, f6 H2 }
- #else+ W. l" b' ]- y3 s, S4 y
- #define DMA_PRINTK( x... )% o/ z$ m! j: X" ~: R; t
- #define DMA_FN_IN, k) A$ ]: c0 v N
- #define DMA_FN_OUT
5 B! D6 T' H& c) k* N6 d. ~ - #endif
7 w) s+ }) J9 t0 f; K! N - 7 }& o2 r4 L; |# Z _! Z% g
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)% {9 v) a& T" n
- #define STATIC_SHIFT 3
+ A+ ^* X$ B6 C( x& U - #define TCINTEN_SHIFT 20
) x7 ?* ~8 y6 R! Q - #define ITCINTEN_SHIFT 21) Q3 B3 Q7 L2 K1 M
- #define TCCHEN_SHIFT 224 q) s8 C# s! M6 Q8 H
- #define ITCCHEN_SHIFT 23
) K. d- ]& [9 x8 i) a7 T& V* B
2 ?$ F9 q2 L+ h) D$ n% N# q q$ q- static volatile int irqraised1 = 0;
k' {1 s- Z& l. C6 I% Z - static volatile int irqraised2 = 0;
# [* I! X/ c1 A) B+ l( u
5 m7 x! Y/ r1 m2 S, [4 _6 D2 d) D# V- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. l3 h& q0 i+ P5 O# ^% G. a
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 l6 ]* X9 I1 [* Y6 c9 E) Y( e; T - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' P0 U: r, t; e9 o9 n$ B
, m2 l0 a8 h9 A% A+ D' g# Z- dma_addr_t dmaphyssrc1 = 0;
* A/ \ r Q$ e7 A( f4 J* t - dma_addr_t dmaphyssrc2 = 0;; M* I# K7 o2 G4 y$ g6 v, \
- dma_addr_t dmaphysdest1 = 0;
# L+ w6 M& E" d$ ?, L _ - dma_addr_t dmaphysdest2 = 0;
# f0 H. y2 P5 _) C R - ; P7 l2 ?0 D; H- F" y L+ _
- char *dmabufsrc1 = NULL;6 u" z+ ^2 W; I$ R+ F2 j
- char *dmabufsrc2 = NULL;9 W) M. i; S# h( |$ V0 f
- char *dmabufdest1 = NULL;, T7 M& |8 N$ e) z* `$ @
- char *dmabufdest2 = NULL;
2 L# N- A, ^8 P$ V& w% @" E4 Z7 N! G - - X- R" E5 E# X+ h% O
- static int acnt = 512;4 M& w. q% C2 S
- static int bcnt = 8;& B2 g( B0 O* C: T
- static int ccnt = 8;
: p# W3 k' a7 ?- P2 C
. k) d/ D0 l" ?' A+ p8 u/ g4 J- module_param(acnt, int, S_IRUGO);
$ C3 y" S) S$ T7 f0 ~" d - module_param(bcnt, int, S_IRUGO);7 L( |2 |# `, @+ j( E- h
- module_param(ccnt, int, S_IRUGO);
复制代码 " Q& F7 A: S6 n0 V7 Y% x9 O6 r
* X; O4 k: \! s( v8 D% | 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 l" S! ^8 |) B# t2 ]5 p 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* N; |6 t) D2 B4 o5 Q/ T 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 v, Z/ }1 }7 h8 v0 h2 n# f( E( s
; v/ Q# s& p/ g/ z( J0 w3 ] g8 V2 D/ z7 ?, }
|
|