|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 m* w8 M* R9 J8 S
- [code]EDMA sample test application _1 O# J; W6 A' S
- /*
0 S# @1 E3 l" F3 Z/ R - * edma_test.c8 J7 @/ S7 r# C
- *
- k2 t$ _+ j$ C. C J# C& w - * brief EDMA3 Test Application* R3 q, T; Z8 D+ }' c) |, ^
- *% f# {0 O" x" n
- * This file contains EDMA3 Test code.7 e7 T! U% S$ f5 {& a$ y* T
- *# Q1 _! @& w; o0 e
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
: \4 g7 x. B8 G, O6 k( {: U - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
) o6 {( X% D1 v - * TO CHANGE.2 F6 |2 D, J; f5 B6 F9 f. A0 S- v* f
- *6 E4 O+ Q! G% y& ^4 H' ~
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. g) D* E: Q4 H6 ^1 I0 R/ ^
- *2 Y7 e# D/ ?; |; Z* p: l
- * This program is free software; you can redistribute it and/or
* L& W, Z/ D3 W; Y4 Y; q6 `6 y - * modify it under the terms of the GNU General Public License as
. A3 r/ c+ s" s9 e - * published by the Free Software Foundation version 2.
) {% [9 T8 y+ b2 I" g4 a# L - *9 R* e" O4 g8 W) B! Y7 r; D6 k( g
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 D. X- Q6 s$ `
- * kind, whether express or implied; without even the implied warranty& g" F7 p1 }" z" Q
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the) {5 P6 S# y+ N G
- * GNU General Public License for more details.
3 U( V: o4 ]. O1 O) q4 i - */7 S9 M6 D$ w! i: s0 ]* R# ?
0 q% t% C( D7 ]) h u; e- #include <linux/module.h>) N% g. |. v* T9 p
- #include <linux/init.h>
; z; y' i) k; V - #include <linux/errno.h>
7 E1 h) A3 Q! {( J" q - #include <linux/types.h>
) y9 i$ W/ h8 Q4 _2 e# O' k5 q6 h - #include <linux/interrupt.h>
# Q( j$ G0 }8 [ - #include <asm/io.h>2 ]( b N0 o% {& m* z
- #include <linux/moduleparam.h>3 i2 j1 |; g0 N7 N. A0 i
- #include <linux/sysctl.h>: R9 E! Y* R; D# W% o0 o, p
- #include <linux/mm.h>, c" W$ H" m( X
- #include <linux/dma-mapping.h>8 N4 ?' u% Y# }" U. }
- : p5 ?1 S' b, k/ P5 g$ i( u
- #include <mach/memory.h>
+ p3 C$ g; W$ `7 z - #include <mach/hardware.h>
3 q) f `- A0 i- l - #include <mach/irqs.h>
9 o+ L; O6 N P - #include <asm/hardware/edma.h>3 r* a5 f2 M, f$ ]0 o
) R3 G. F d; j2 A1 k( ~! A g+ |: ]1 V- #undef EDMA3_DEBUG
8 Y6 e. P1 N9 V9 ?( D. m - /*#define EDMA3_DEBUG*/7 X0 w' w8 ?& A) y% O
- Q' D9 p ?( N# z5 e- #ifdef EDMA3_DEBUG
2 v3 K3 E/ Q! i* T8 I - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
: p. X7 B2 e6 H' G- j5 s - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
( F7 [) ?2 W+ B! ^ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ j" ?% p& K7 s7 S- F
- #else
2 T |) @+ M n - #define DMA_PRINTK( x... ); i: D" k: L( x+ ^& S+ M9 H
- #define DMA_FN_IN
0 }( w" c2 F: @ - #define DMA_FN_OUT/ ^' C2 d. A6 y
- #endif
- ]( d+ B0 E0 h - 3 @3 n' Z, _' ?3 R, t M! M
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
, B, i$ B/ w( M. L0 ~ - #define STATIC_SHIFT 3
; @7 ? m5 _2 V) F4 G6 o! [8 c. F: Y - #define TCINTEN_SHIFT 20
: }! F2 B% H) I9 n% e - #define ITCINTEN_SHIFT 21% `, U" }7 q0 G# \
- #define TCCHEN_SHIFT 22. v- Q3 ?; R; Y& t, P k
- #define ITCCHEN_SHIFT 23, |* d: P1 `+ ^4 K ^
- 6 f) y+ t( [' s* `( d4 \6 {
- static volatile int irqraised1 = 0;4 X! S, y" F# h& \) m$ m3 `
- static volatile int irqraised2 = 0;- ]3 o7 X" _/ a4 Z- S
7 Z2 ^: v: i' \3 M4 q: g. H- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 E4 \# h: S: w( s
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 x6 D8 l* f0 [( B
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! O, k6 g. m3 q' g
: e# u4 k: X6 M- dma_addr_t dmaphyssrc1 = 0;0 {+ S8 b6 a, g) a: B6 i9 A2 A
- dma_addr_t dmaphyssrc2 = 0;
9 R+ e k$ n6 L9 C - dma_addr_t dmaphysdest1 = 0;
! S3 U, h, e6 i& O1 u! @ - dma_addr_t dmaphysdest2 = 0;* h3 {/ l) P2 X4 V! o, m) Q7 i
- " J5 R* G/ f. r0 b9 L' g, o
- char *dmabufsrc1 = NULL;- k; ~ t8 i5 Q4 h, G4 }
- char *dmabufsrc2 = NULL;
; F: B( q. j4 |1 [4 W - char *dmabufdest1 = NULL; H4 G4 {# B& U4 Y x
- char *dmabufdest2 = NULL;
6 Z+ `- b8 I0 N* r
# I! j W5 F3 c/ {$ C& C. N- static int acnt = 512;
" b1 N. B/ m) e6 `+ d ? - static int bcnt = 8;
# }. q. a7 b9 E7 j. {/ s - static int ccnt = 8;, p) A9 b/ s0 x+ \. I
. B9 ]) R; ^, k; U: ^: M* F) `" f- module_param(acnt, int, S_IRUGO);7 l1 v2 A! L/ D8 j
- module_param(bcnt, int, S_IRUGO);
0 d0 ~0 @+ j. R, b - module_param(ccnt, int, S_IRUGO);
复制代码
, l' d f' O9 y$ k- A5 K7 T- f) K: U' ~6 G, F- s" K6 O
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- D5 H$ v& H; c* U! b
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. v; {8 B) O8 P( Q 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- P& E/ Q/ D. `: `' [# I( c) G% D5 W; |. \
, Z) v& T# o8 Y1 C |
|