|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 q: J0 g7 p* e# ~8 _; B5 Y- [code]EDMA sample test application
4 g4 R& }& b( d1 S) f% B - /*
; o4 H1 _" K* Z' T* _0 G4 [& w - * edma_test.c+ m; m( y8 Z2 m9 [/ i
- *' S3 u( d1 e) a. M0 f" v1 s" a
- * brief EDMA3 Test Application
2 E* V0 z6 N9 D! o' _5 w9 ] - *
+ X, }2 p& U$ y0 o - * This file contains EDMA3 Test code.
% @. b6 v7 ~( E9 v - *
M- j- Y) l* L" m: G3 d, u - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
5 r, O2 `% Q0 h5 q) }5 E! K - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) O/ n+ k5 S; R& D
- * TO CHANGE.
1 h, f1 K+ }6 l7 w+ k2 | - *
/ _+ T* u+ `/ P# f# y$ K+ H - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* m' O1 C {! g9 \' R8 g' H3 }
- *
- k/ G; w! `/ \1 \! s, e, C- e - * This program is free software; you can redistribute it and/or# S7 ]% @0 Y4 P% X
- * modify it under the terms of the GNU General Public License as
" k5 P4 k- O9 v' |: R- ^ - * published by the Free Software Foundation version 2./ r3 k3 ]' P4 H8 [% C6 m' F, @
- *
5 s4 V7 A7 @! O2 O- u \( | - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
* q3 T- l+ k, l& K* c0 Q; s: ^ - * kind, whether express or implied; without even the implied warranty$ M% ], y$ R9 ~) |3 Q
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8 o4 Q: k8 }! m8 [2 G - * GNU General Public License for more details.
* I# v% C' e2 f+ p2 n - */) H( d$ k& K4 D! u
- o6 Y1 ?0 L& [# c' r- #include <linux/module.h>6 r6 N* V+ `5 l! H
- #include <linux/init.h>
+ b. j0 k. `- @& D - #include <linux/errno.h>
5 O2 t, C8 S% H F - #include <linux/types.h>
6 \/ E6 O" f& p0 d - #include <linux/interrupt.h>
; D3 D" l1 V% }7 A$ B - #include <asm/io.h>9 j) {' k) W% o6 |; A1 u" Y
- #include <linux/moduleparam.h>
% u% m( T* ~$ P, e( j3 ^ - #include <linux/sysctl.h>9 R+ G: f/ q" B1 a! N5 I6 }
- #include <linux/mm.h># c, q: c8 z2 N2 p! ]6 o, n
- #include <linux/dma-mapping.h>0 s) e' V! H) [3 {+ R, U7 [
- % l3 l) k0 i& {0 F) U7 _% t
- #include <mach/memory.h>2 J1 D: k! A( N; p) M+ p- G
- #include <mach/hardware.h>
M% _% o" s" C( w7 ^ - #include <mach/irqs.h>( @$ f N- |) b: @9 |
- #include <asm/hardware/edma.h>. Q, p, O3 _: ^/ f4 H
% V) P5 I1 N% b; R' k3 @5 ?- #undef EDMA3_DEBUG
9 o! m1 O& ^8 Y+ c6 R - /*#define EDMA3_DEBUG*/
* m/ Z: b& \2 f& t$ s* m3 d w7 x - - I! \% C) ]3 }* p u& j
- #ifdef EDMA3_DEBUG
7 e7 q1 S& `& R3 [( ? - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
& ~4 @0 V* `. i - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) A4 r' q$ N3 D _( z2 f
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
! t4 q$ b- D2 X - #else6 _1 h0 |+ d" e3 T
- #define DMA_PRINTK( x... )( P6 Z- b6 A' G( {- j% H
- #define DMA_FN_IN
$ S a$ {: e& j$ b - #define DMA_FN_OUT8 J1 y& c% J. [1 s' W- r p( I
- #endif" ]$ q3 B) U) l8 Y: G' f3 I8 Q1 D
" h& I2 U& G3 O: E( x# [- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
( h1 U/ C& n1 b! A4 E - #define STATIC_SHIFT 3% Q5 O" Q; K# f
- #define TCINTEN_SHIFT 204 b: s9 U% T+ |) ~
- #define ITCINTEN_SHIFT 21. c$ p6 ]* a D r' `8 @4 k6 M
- #define TCCHEN_SHIFT 22
4 S, B) L9 E2 K1 {/ Z. E - #define ITCCHEN_SHIFT 23
/ K( D3 `* W' \7 E# Q3 e$ q" r4 P1 B
8 `# E1 K/ }6 ?* F! L- static volatile int irqraised1 = 0;8 f" H( s& D4 b6 Z& Y9 Y) Y
- static volatile int irqraised2 = 0;0 T9 b! V1 b( V# e4 f
% ]9 p# I f6 u9 r- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: \. j5 t! c" A* Z0 z, p - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 f1 t5 E/ {3 G+ C8 C - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 C! A. J. C; X. Q
- , Y8 j% `/ a a$ O) ^% y$ I s
- dma_addr_t dmaphyssrc1 = 0;5 F, G" B$ D9 j9 k& v
- dma_addr_t dmaphyssrc2 = 0;
6 w* ^1 Z5 j6 x) s0 T! u/ B - dma_addr_t dmaphysdest1 = 0;
# E T8 L; v- ? - dma_addr_t dmaphysdest2 = 0;- V) s. P% ?+ g6 \. e$ Z) [& ]4 S
$ K) L/ n7 w" `0 V. L- char *dmabufsrc1 = NULL;/ i$ F( m/ h) c$ A3 Z4 ?
- char *dmabufsrc2 = NULL;' V/ G6 J3 Y5 _8 C/ Z
- char *dmabufdest1 = NULL;
4 }; |( ^+ q0 w: Q; r( |5 s% P - char *dmabufdest2 = NULL;4 D$ u; P" T& P2 z: {
5 G5 M! P* s" L. Q& D5 B0 Z7 ]- static int acnt = 512;
1 G- }, F S3 F; p! O3 p4 s& s - static int bcnt = 8; ~; B* r4 A3 n. Y4 V9 W
- static int ccnt = 8;7 B( x7 c" s& N3 p
2 }; V: p. b9 c- module_param(acnt, int, S_IRUGO);. N$ A+ `1 G3 X& [& [' |
- module_param(bcnt, int, S_IRUGO);
2 u4 ]4 t9 b. y - module_param(ccnt, int, S_IRUGO);
复制代码 " O+ u/ P" [/ j; R( G
$ H+ d' N! d4 @ C9 u 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 G4 T" @0 R- X7 {( s6 n; n2 V
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# f3 g: A, t$ y' ` 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 z) t, P. d' @; ^1 }3 y
2 @2 V0 g n* ^
. j. `8 J; W9 d6 a6 o: J- G) b
|
|