|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* Z. ]* N! b3 z( C: @) {" t- [code]EDMA sample test application B5 \/ p- z& g& D6 @' `, T
- /*
: x/ h x f' |4 P8 O/ ` - * edma_test.c. }" a2 m- f! l
- *
9 t5 @! a& Q4 u0 z+ c8 I6 P& o - * brief EDMA3 Test Application3 ^9 j0 m( V1 f; h
- *( a$ t- @! S }, m: g9 V- V+ F' e
- * This file contains EDMA3 Test code.3 {4 d4 _& |; [. m+ w: `1 t
- *
: q$ c ?; G4 J9 E5 o9 ^ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
0 `* j- l! H# G; h! c - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" l% [. |4 E% ^ r; }
- * TO CHANGE. G% N1 Y5 i3 m9 d" T& J
- *, l9 M# [2 \: h1 l6 C" v
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! d" {5 {/ R; C* F$ X6 U
- *" g6 L0 t% \* C$ m# v
- * This program is free software; you can redistribute it and/or
: p. h7 q! X8 m! } - * modify it under the terms of the GNU General Public License as
/ m: \7 t; T& {& u5 ~( H$ o - * published by the Free Software Foundation version 2." j: n0 w+ @) r) c' Q
- *
c* d. h3 d! F5 a7 w - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
: {2 ~# e/ ~; d. l* i - * kind, whether express or implied; without even the implied warranty, [0 O, _: {; {! K6 [8 `4 i. t
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
) O! f8 B4 K c& ?+ h; a9 a; h8 H( W - * GNU General Public License for more details.- n0 r3 t$ W K% R/ x6 S
- */
" G1 O3 b- H C) v7 |# k2 A2 e - / G& w* G2 H7 G/ L# d% h: p
- #include <linux/module.h>
% D+ M6 |. G- `5 V1 g/ _ - #include <linux/init.h>3 t* m# z% e% ~( |; R' k
- #include <linux/errno.h>
* `1 T3 S# k N4 D - #include <linux/types.h>
( v' L' c5 v: E# ?3 E# M4 f - #include <linux/interrupt.h>
6 Y$ L& p7 G: Y S - #include <asm/io.h>1 {9 ]# M1 C: k. H7 _5 l C0 ^- g
- #include <linux/moduleparam.h>
6 U6 x0 k; O. d7 ]9 N' ]% b - #include <linux/sysctl.h>
+ G$ @& _% D3 y; ^1 {8 s% m6 G' r - #include <linux/mm.h>- s9 ?. I( T/ O0 R, [; m
- #include <linux/dma-mapping.h>' u; b- [, y9 ]+ u
3 f: P# X9 U6 S, ~- #include <mach/memory.h>
: N4 v4 r/ o1 P4 a - #include <mach/hardware.h>
2 A9 l |' T! s6 d' h9 a - #include <mach/irqs.h>
5 P2 F; p+ N+ @: ^7 w7 ` - #include <asm/hardware/edma.h>
+ X" X4 i" L3 l% W" E* c
. T! X6 D! R$ M! E- #undef EDMA3_DEBUG6 s- v; D" }! t: @8 U7 ^, D. _+ i
- /*#define EDMA3_DEBUG*/5 s1 ^- t7 I n# d. i; @. s
- 6 ~" x" O( M3 Z9 Y5 m* s; L
- #ifdef EDMA3_DEBUG* r! h) K% j7 M& e2 I" Z; q
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% Y8 r$ t" \. w4 o2 j- E$ \# A
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 a/ V1 {; B/ E a3 ^9 S
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): e! U) O) g: F7 ^+ K% j
- #else
3 c( }% X7 n( q! C0 | - #define DMA_PRINTK( x... )2 b$ u& P G/ m2 \/ r1 f
- #define DMA_FN_IN$ f) C9 g! d( D
- #define DMA_FN_OUT6 t/ a# {2 r2 ] k2 v! `$ P
- #endif5 F2 Z- h# {6 B* X2 r* E
2 N% E5 ]3 z/ V! O- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
) y# o$ ?% c1 M' ?: ] - #define STATIC_SHIFT 35 `) ?+ e( Z @* G1 C9 s' e
- #define TCINTEN_SHIFT 20) p+ l3 L& Y7 V( Z. S4 U
- #define ITCINTEN_SHIFT 21
5 F) |8 H" J! e) v3 s' A; A - #define TCCHEN_SHIFT 22% a0 ?- _& H- p. x8 K, ?2 \7 O; B
- #define ITCCHEN_SHIFT 23; E4 V, D7 J% b$ a
2 D3 n$ g3 \( a9 E: ~- static volatile int irqraised1 = 0;
0 p7 q9 z8 i( P& D t/ C - static volatile int irqraised2 = 0;
5 C* T0 h( j. z/ \! d9 H3 m' n
- Y; `- J+ i! O% j0 z- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 B8 {( K) U9 C$ \% `% C1 Q - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ o) R. e3 G9 K
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ e) R6 D; i1 f. w1 }& m! c% Z: c
- ( u- ^. m: s1 g1 T+ `2 R
- dma_addr_t dmaphyssrc1 = 0;
5 S: f4 ^: y5 ^' R" B - dma_addr_t dmaphyssrc2 = 0;
) O+ d- k6 ?4 C L; X8 }) q8 N4 y - dma_addr_t dmaphysdest1 = 0;
5 [4 s7 E2 c5 N$ d( I" R& ` - dma_addr_t dmaphysdest2 = 0;" J0 `* I4 G* {; V/ d6 {, P/ r
- : o1 @8 H, t/ c x9 z, x. \
- char *dmabufsrc1 = NULL;
. y) w( i4 t7 ]- C: w" p2 g1 e - char *dmabufsrc2 = NULL;
0 j2 o u/ S W. s! } - char *dmabufdest1 = NULL;
k: F) U* ~9 }) @/ `* }7 V9 A - char *dmabufdest2 = NULL;
' v' r' o* B! O, z
0 j3 y6 W5 K6 ]3 e! n- static int acnt = 512; @5 x2 ?' W9 ]2 O& ^! U m
- static int bcnt = 8;/ `" Y m4 `$ o" e3 S1 a
- static int ccnt = 8;, s9 B4 `* A% i! c
+ V* B& [5 a9 n" G2 e- module_param(acnt, int, S_IRUGO);. K3 i& x% b$ r. i
- module_param(bcnt, int, S_IRUGO);4 g J, |: M$ ~
- module_param(ccnt, int, S_IRUGO);
复制代码
. B3 N4 Q' T/ B3 n/ D
% Q% F+ x- `+ _0 v# ] A0 L 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 Z4 a1 }/ Y1 T7 \: larm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 u7 T. y7 [" v0 r3 c6 a. B
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 h- A1 B5 e) A
/ U8 d6 M% H8 z5 H. Q0 k+ m
# a. j+ _4 a" U% K6 P1 u |
|