|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * D6 V- m" p- f0 x1 I" K$ J' n5 A
- [code]EDMA sample test application! m2 n6 Z( p! `, a; S' f; J+ X @. h
- /*
% o/ l# d" z# B1 x" J7 B - * edma_test.c* y* ?0 B4 ?1 z4 S8 \ B7 o* V
- *
, _# C7 O+ |+ g% G# Q' M - * brief EDMA3 Test Application0 t7 A8 T! k* L% D5 H7 r$ u
- *
; v! E6 s7 a( {2 u - * This file contains EDMA3 Test code. B& _' n) ^* L& J) K# C
- *7 g: Y$ s0 M+ c5 @
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
$ J& m% p. }5 g6 L! c. p1 Y, k - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* L& q' Q3 {* M/ x0 q# n. f3 S
- * TO CHANGE.3 d5 I4 u7 o/ Q- P! n4 w0 P- j
- *
$ I; H4 ^% G$ ? F, p* B - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
7 K1 Y0 T9 Q4 T% E' O O' }" t - *. A: F* Q3 d, X9 Z& h1 }
- * This program is free software; you can redistribute it and/or: J( Y. R( m K- U& a' e
- * modify it under the terms of the GNU General Public License as
. \/ J4 U: M; C8 g. P6 p - * published by the Free Software Foundation version 2.( U$ p( l9 `9 R" d8 n' M
- *, f, r' R6 @8 L& `( D @
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
6 N. {" n& d) P0 m# v: B - * kind, whether express or implied; without even the implied warranty7 g, x0 A2 f, K, C* I: X
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
i% u5 s9 Y" r$ x) ^' Y+ h( A - * GNU General Public License for more details.2 Q3 D$ R) O- u* E6 O9 z3 U
- */3 B1 t# W6 U9 |' E0 [+ X$ q
1 j j8 D. F5 ^' t, g1 @- #include <linux/module.h>$ ?# U# U8 p& v$ V
- #include <linux/init.h>4 x8 P B% W" E- A
- #include <linux/errno.h>
9 b' Y2 v( m5 Y* q% u- ~ - #include <linux/types.h>
8 M. t4 r+ H* V - #include <linux/interrupt.h>
5 y- B$ Y4 ]7 I: P& I" z% ? - #include <asm/io.h>8 v3 L. k) ?5 f8 _- Z
- #include <linux/moduleparam.h>
/ N1 ? u7 t7 L+ g5 v - #include <linux/sysctl.h>
4 o5 ^% B1 V) I9 A - #include <linux/mm.h>- S( u h( Z; E" R
- #include <linux/dma-mapping.h>/ i% q1 h4 y7 M$ Q, R' l! q/ y
4 L( S2 u; h" M. }% u1 w) s- #include <mach/memory.h>
. D5 C# }% O% c7 n+ t - #include <mach/hardware.h>
; V; z5 e* a' b6 I' v6 |$ ~ - #include <mach/irqs.h>3 r b% g1 |& D1 D8 f
- #include <asm/hardware/edma.h>, S5 k+ B" p; D: S
( [- \) z: f" y% |2 ~- #undef EDMA3_DEBUG
# i5 W# C& `3 a" b5 X+ U - /*#define EDMA3_DEBUG*/& Q/ e8 [2 o) V% Y! f" t/ E( Y# \
- - L5 d* P5 {3 l- Z% f1 z2 T) w" l
- #ifdef EDMA3_DEBUG
. X( F/ h. d+ R - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
9 V4 e* L; n* D8 \ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 g1 ?5 A6 R8 N! y1 j
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): J* A$ C+ f% s7 d1 _! K
- #else' A) `* ~1 c% E( c
- #define DMA_PRINTK( x... )
1 o* a* c4 [$ P+ D$ W# p+ u* F o, h - #define DMA_FN_IN' `$ {3 [1 Q, y# a' A
- #define DMA_FN_OUT
: F( e; H* C5 [& ^: `6 y - #endif
1 r2 b5 l/ l& w) ~# m$ R! F - 9 H3 h Y4 s5 }: a2 C8 M
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)- f0 f. D5 }0 l( G c
- #define STATIC_SHIFT 3
$ j1 c# ^) P" ~- P9 H% D - #define TCINTEN_SHIFT 20" z5 O5 U* R: m' g
- #define ITCINTEN_SHIFT 21; B5 \9 ~; d2 h( O/ y
- #define TCCHEN_SHIFT 22
8 O+ a' U0 z+ M- U' U - #define ITCCHEN_SHIFT 23
8 x, j g7 c' E- U9 W
: g8 q S: {3 v; {0 l- static volatile int irqraised1 = 0;: x# @% `* b8 l1 N
- static volatile int irqraised2 = 0;
- Y2 J0 r# D1 F% F
6 D( { C' m% @7 C4 X4 ]- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ T1 B- q$ ^' K, r/ T8 Z( v - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 K' c0 e L6 `7 f4 b8 D7 |* i$ ` - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# ]- o! X9 v8 F) |9 ]% _+ c
' c# b+ J) r5 `" ]9 c9 E# ^; @- dma_addr_t dmaphyssrc1 = 0;9 L6 U# j0 G0 X' D: ?- N
- dma_addr_t dmaphyssrc2 = 0;
( s; `2 \2 l9 T, y- l" [; v - dma_addr_t dmaphysdest1 = 0;
l3 c8 o7 L I) ~' l - dma_addr_t dmaphysdest2 = 0;
/ S5 l' P( w3 r4 {7 P - + X) @2 Y8 [8 {5 {* u* r( V4 T, O" u
- char *dmabufsrc1 = NULL;) B7 Z S. U" e5 E/ Z, Z k
- char *dmabufsrc2 = NULL;7 d! d3 u! l! V1 ^+ I" v# M7 [
- char *dmabufdest1 = NULL;# Z0 Y/ F" ]9 r. U
- char *dmabufdest2 = NULL;- m1 _5 l+ S/ Z& p$ e" S; t3 O/ w
$ e, Y9 u! O1 V! i! |; M- static int acnt = 512;
8 |; H. M/ p: M8 m8 D - static int bcnt = 8;/ h, V+ O0 I5 D1 T% d
- static int ccnt = 8;* Z7 e+ y1 G8 C# K
8 L: A, H8 v& v+ g! o- }2 w- module_param(acnt, int, S_IRUGO); ?7 }5 f7 T, Q! W9 f
- module_param(bcnt, int, S_IRUGO);2 {$ ^& h) S( {) A1 y) N! U
- module_param(ccnt, int, S_IRUGO);
复制代码 5 l$ B4 q" R( _6 ^
! \- d* p( `; Z- [( t8 l 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 K6 M% H* S& a
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! s9 a( M/ u7 p3 Q" S7 {
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 L' W: C3 f; c6 `1 V% m! O: j- V
$ r% R: B# t: Q7 o- O7 A G1 B2 f' g
|
|