|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, }2 r+ F( u; z4 Y- S- [code]EDMA sample test application( z, C- [" Z8 h K/ N7 F
- /*% K$ B8 ~* ^! A4 }0 A5 _
- * edma_test.c# S! @4 F9 t' r" C" t. ?" [% k
- *
7 n5 F& ~; e" Y! i5 O* D - * brief EDMA3 Test Application8 U a: U4 G8 U+ D6 ~' B% {
- *
* }. X! A, d% I& i8 D - * This file contains EDMA3 Test code.8 O6 b; W1 {& ?1 O3 c
- *
9 ^( B# v3 z& B+ Q, z' I# @ K - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
% C, L# o2 @, L - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
: T; I5 `8 r$ b - * TO CHANGE.
8 W; Q) e0 J3 \9 a$ q - *% c1 e! W3 e8 r
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 l& V$ A9 S0 n7 X8 ~
- *9 \# n' V" v. l5 Y' C
- * This program is free software; you can redistribute it and/or
: [7 R, ~# w" t* z2 J/ J" i - * modify it under the terms of the GNU General Public License as
' i# q# f F4 e! z* w0 q' a - * published by the Free Software Foundation version 2.
/ X4 ]9 t) y9 [ - *
2 v( v% ] b) L# T/ M% _' M% E - * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 z N/ A( Y' F" Z- X
- * kind, whether express or implied; without even the implied warranty" w. a; }) o, {: n
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3 F5 T" o) p+ t - * GNU General Public License for more details.% Z! { d# j* R0 y9 |- F7 ]! `- T9 `
- */
7 H! m: R. o. @6 E - # U9 h8 p; w$ |5 e& Y" d4 T- i1 y1 S
- #include <linux/module.h>, d4 i; D' H' L0 N+ p
- #include <linux/init.h>6 m# t* r9 c5 t# v6 [3 L% m3 @
- #include <linux/errno.h>
, a2 s1 |) f8 ^9 ~7 J - #include <linux/types.h>! p8 f I) W. q
- #include <linux/interrupt.h>
: |$ K1 R3 Z) u - #include <asm/io.h>
* Z* D; D) y. z4 y# c. D7 v9 P - #include <linux/moduleparam.h>
5 p: T; c" I5 [; X: N2 x) [ - #include <linux/sysctl.h>% b G! k% G, s! e& F# _5 ~2 ~
- #include <linux/mm.h>: J+ B( M9 T* }- \; X
- #include <linux/dma-mapping.h>
0 [& |# u! R0 s# k6 _2 o - # y# _* a8 _2 Z8 y2 \9 E
- #include <mach/memory.h>
( P1 w: |# _8 H - #include <mach/hardware.h>9 @' X! q( A0 D3 ^) W7 U5 T4 H3 ]
- #include <mach/irqs.h>
% J1 _1 T: L5 s0 p6 e6 g1 \& Y - #include <asm/hardware/edma.h>
0 b' S( ?( @9 f- u. ]
2 T ? m! Z) i/ q+ v( T* P- e- #undef EDMA3_DEBUG/ C T. C$ U6 { x/ G* x1 B
- /*#define EDMA3_DEBUG*/- i' s0 B: c G+ C
7 I) c6 `) O, D% \- #ifdef EDMA3_DEBUG
$ N8 T$ m$ [# }2 ^/ } b - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
3 V4 i% }$ l0 C% M - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 {) t: r8 H3 n, m! `3 w
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
$ I* g$ [3 h6 p# T; F3 x - #else0 O1 }- ]' j' f1 O0 d3 e& w
- #define DMA_PRINTK( x... )
2 }! \+ X' @ L+ T3 l - #define DMA_FN_IN% s$ ]$ a- U7 r9 L2 ]
- #define DMA_FN_OUT; k, j& l0 |, {
- #endif. m' L" S: U! W' C" t0 l
- $ G3 y' e7 \+ g# g- `6 O9 R! p
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
6 R6 T% A/ W" T- W5 r2 n! k. b9 m - #define STATIC_SHIFT 3# R' V/ T1 p0 C
- #define TCINTEN_SHIFT 20/ n9 `1 x5 X8 h- m/ c
- #define ITCINTEN_SHIFT 21
$ S3 O3 b( E4 Q. C& e8 f6 H - #define TCCHEN_SHIFT 22
; @- E, d- u! { - #define ITCCHEN_SHIFT 23& p, C1 }/ C$ }7 f2 v0 \
- + X" E% f0 Y2 T) ?. T
- static volatile int irqraised1 = 0;$ w) B) z9 F! t8 ^
- static volatile int irqraised2 = 0;
7 O# L9 `0 m, d( q" t$ J
, v7 M- t' q. w2 Y O- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 z" N; o) O, f/ ^% ^' K# X - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* X! F* C( V6 s# l0 `& q1 `& S0 `; v - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 Y, @! p0 U: m' z' t# ~
% T; u6 S$ L4 i( q8 |- dma_addr_t dmaphyssrc1 = 0;
9 r, \. Q! P& K9 w; l* C# a+ U - dma_addr_t dmaphyssrc2 = 0;, k$ _0 W* N1 V5 c7 y6 T8 }/ g
- dma_addr_t dmaphysdest1 = 0;
' p5 ]0 q6 t& z' D6 \+ [0 @7 N - dma_addr_t dmaphysdest2 = 0;* ^+ ]* j. J2 D5 G/ T6 T
- $ L. A% m8 h* M8 ]/ L
- char *dmabufsrc1 = NULL;$ Q+ y. C, x3 [9 \' B' z) y) E
- char *dmabufsrc2 = NULL;
0 c5 l, Q3 y5 A9 e - char *dmabufdest1 = NULL;
$ r6 h- x9 j' j - char *dmabufdest2 = NULL;0 v7 B+ {8 [! O3 F# M; j8 r( G
- , ~+ o" E8 I/ N4 x& X% m7 m' }
- static int acnt = 512;
$ ]- Y/ f. @; I- O3 z - static int bcnt = 8;
1 ^& ^' `) [! F) g7 Y - static int ccnt = 8;1 @. @) N1 G& ?( p, t& \# A
- ] n5 V& z8 s# D- module_param(acnt, int, S_IRUGO); g+ s0 v5 m/ p4 ?# \. W: \0 P
- module_param(bcnt, int, S_IRUGO);; a# O/ A1 w* t' P! K# U$ G! c8 r
- module_param(ccnt, int, S_IRUGO);
复制代码 0 @9 `' n- f$ @
+ n8 C% X" @3 B. f
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 p2 x) m! _* T) R. `- q
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 B: l6 D7 \, i
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 F( H7 i7 v3 g/ }& F* w. N
; _1 n, D7 b4 j! @$ L8 G
7 t, E, E/ H* m( u |
|