|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 ^: s& b* c n# Y+ ]4 `
- [code]EDMA sample test application4 _& x) Z8 B4 B" j
- /*
, i7 x0 {& ^: a# F7 ?6 ^( W - * edma_test.c
+ @6 a: ?6 u# N$ q - *
9 ^0 c, F. t" R4 t" y& }* H) J - * brief EDMA3 Test Application) Z' Q1 E( q2 R+ l
- *
& B( l2 c: P- E+ n" ~3 s - * This file contains EDMA3 Test code.1 [) X7 _ }9 p8 @" ], Z
- *
+ Q/ ^$ U' n% [1 x3 F! y7 J/ W7 a/ {. V - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 N, \1 ?0 Y" s0 r% K2 l! t
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
5 E4 l. F" i' A% E - * TO CHANGE.5 D- L' Z! l' _/ J
- *% c- B6 Q0 R; J" W
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 D2 h0 I8 E9 A' C- M4 m, j
- ** w5 u( {; ?0 i5 Y
- * This program is free software; you can redistribute it and/or f8 S# N! l- ?& A* t: w1 B
- * modify it under the terms of the GNU General Public License as7 u2 W7 q: a; O" {# b; C
- * published by the Free Software Foundation version 2.
) h8 W% W$ Q Z' ]8 c0 x4 i) D - *
( i8 k! V0 ?2 K! }4 {7 [3 o" j - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
) |, f& O7 e2 l( T- W7 u: T - * kind, whether express or implied; without even the implied warranty
3 |/ M6 g; l: U - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
, G3 P3 m1 H. T | - * GNU General Public License for more details., n0 a" K1 Y# w( l& C
- */% G) n$ z: B8 y5 Z. g
% p& i, n! q4 h4 T- #include <linux/module.h>
% r. D/ f$ |3 ^- O - #include <linux/init.h>
$ h+ M+ [- q8 |/ X! j* g - #include <linux/errno.h>6 r# ?. v3 D- B; ~! x+ d
- #include <linux/types.h>
7 h. c( V" Z% o6 b7 _ - #include <linux/interrupt.h>
- }$ `: R- j. f5 _( i; |: e - #include <asm/io.h>
5 ]+ z% n# _% E9 n/ a - #include <linux/moduleparam.h>- r) x3 \4 q, V* o# c# X; j3 p; m1 |; ?1 l
- #include <linux/sysctl.h>. d) \3 Y9 o, ~* C3 Q0 x" s
- #include <linux/mm.h>
7 r, B* q# Z2 Y. W2 X- v7 O0 T# ` - #include <linux/dma-mapping.h>2 j+ v: \8 S% ]) c/ @# w$ c$ }
! M( Y+ H, w$ c2 L8 ?7 X' b' M& G- #include <mach/memory.h>$ @$ t; X R0 w& y8 T: j; u: s A& u
- #include <mach/hardware.h>) t. b$ {! m5 Z* l* i2 }' v( \& J
- #include <mach/irqs.h>2 j t2 {, Q5 O- ~
- #include <asm/hardware/edma.h>3 E8 n- r4 R. L. G! {& P
3 R9 [% Z r) W0 J- #undef EDMA3_DEBUG2 h& _. N- ?3 | l
- /*#define EDMA3_DEBUG*/
7 N& @0 K& K$ ]+ j* t4 x8 W5 e
W3 A8 J6 t/ l& i) C$ \: I" h! y- #ifdef EDMA3_DEBUG6 K2 a1 @: y8 L
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS) J, p) t" e, O0 M! z; i
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
. b' K1 _% B; c* F - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
, ]& C8 I/ C1 C: ?2 V - #else
1 l4 S% g" P+ n2 x2 Y, c - #define DMA_PRINTK( x... )
5 G2 ~) ]1 O: s* I( J - #define DMA_FN_IN# y! \' g* R9 C1 f( X) r7 p
- #define DMA_FN_OUT% K; E- h: o% U3 L8 _
- #endif
" s r5 T: g) Q! A
9 g5 K# b9 y* ~6 ]; S9 g4 v- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
+ W3 y8 H# p! u: m7 ]: P2 E - #define STATIC_SHIFT 3
. q+ }/ Q/ A( y( Y1 ?% a: p - #define TCINTEN_SHIFT 20+ u5 w, k# b z% W+ G3 F0 r7 z
- #define ITCINTEN_SHIFT 21
2 c. n. }; _0 ]/ i! \2 Y - #define TCCHEN_SHIFT 22
; D6 j# [+ x5 G; T8 B. W6 a - #define ITCCHEN_SHIFT 23, b. e" z, c$ {: U# p I
" Y0 ~! N1 s p2 l5 N: j. R; l- static volatile int irqraised1 = 0;- W! E p! s) z. s: `! K2 o
- static volatile int irqraised2 = 0;) Q* ?% D/ M) j( s* K! |
4 `8 A9 [( @# I) M- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" g* X; o6 p' F6 s6 T - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 e. L3 v. P2 q - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) z/ V% \% F1 B7 s- ]2 N* p5 t
5 _. X2 e3 m s( r- dma_addr_t dmaphyssrc1 = 0;
$ C5 A' b$ q* R9 H# | - dma_addr_t dmaphyssrc2 = 0;
) N2 u$ Z! c [' _, T o - dma_addr_t dmaphysdest1 = 0;* q& p& D c; ?/ r. L6 }
- dma_addr_t dmaphysdest2 = 0;
3 U5 e" w8 P( E% G' U, S7 K9 o
4 b$ M3 M* Q4 u7 a; Z! D- char *dmabufsrc1 = NULL;4 n) @& I1 o8 j' T4 y
- char *dmabufsrc2 = NULL;6 |' D0 M7 f3 l' O/ B2 u
- char *dmabufdest1 = NULL;
' m( L4 `; {2 V X# b/ K" ?* ^ - char *dmabufdest2 = NULL;
; c1 m) [) o" I0 Y
A- v% p- A7 H1 S7 ~8 G- static int acnt = 512;
( @( y' N* d* `. e5 W3 d$ f - static int bcnt = 8;
* v' {7 E3 L/ H: P% C0 H - static int ccnt = 8;
5 F, q* e- C& R4 u3 @$ _9 H. Z - 4 x5 F& S1 C/ O1 e7 n: z0 u9 X2 ~
- module_param(acnt, int, S_IRUGO);; z u$ U& y! R) [9 F; M* B3 Q; E
- module_param(bcnt, int, S_IRUGO);) r7 Q! v- o$ x7 a
- module_param(ccnt, int, S_IRUGO);
复制代码 % |9 v$ M, | ?3 T: P! I
; O2 t" a2 Z7 C0 i) x1 n
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 y) }, p5 _" U! e, T4 `
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 n6 p3 @6 b7 A, G) {
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& j1 O% J* E- o
+ L6 B6 e6 E' k0 D& U) S
, r7 Q6 t5 \9 R4 c& ? |
|