|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ t* z0 n& y$ ?( R2 o. R8 }- [code]EDMA sample test application
: {" _3 \8 m4 D - /*5 p) M8 S* @- W9 A' l$ Z
- * edma_test.c
7 I9 t; h1 i" ?$ V2 o# x - *
* U" f. w& E) K2 | - * brief EDMA3 Test Application8 q, ]; D- {4 G) |8 @! g
- *
1 f, `& K) H: B9 G% ? - * This file contains EDMA3 Test code.
: q) f4 w) J7 Y! J' y- D - *
$ p$ S3 n$ ?( Z+ D& f" c - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ p: M3 o9 V4 W9 Z1 F' A# y
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- ^, J6 J! T' y3 @# W; V; w
- * TO CHANGE.% T. \: J5 @$ R- T4 L9 m
- *, T& C1 @; l" n4 F: r% Y
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( C1 h2 A* ~4 s e9 [: T
- *% i' k7 o) [5 X! q) o$ H
- * This program is free software; you can redistribute it and/or; s( s6 p$ `# W d# X
- * modify it under the terms of the GNU General Public License as. |0 q3 k- O: ]6 q: j& }+ D
- * published by the Free Software Foundation version 2.
& p8 ~2 a0 I5 W- T3 n" }) y - *
) e" f% U2 [9 [& T2 e( p - * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 e( l6 ]+ D+ u* F1 V. ?1 @
- * kind, whether express or implied; without even the implied warranty
, @( e( r2 U+ s# ?# T% B, W& [ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2 I8 ]; A+ i; x2 _ - * GNU General Public License for more details.9 X [6 u. u/ i3 [ B: h
- */
2 m# z7 r: `% h% C5 N) F9 H5 {
% h3 {* R& `2 d* B* \1 K! M- #include <linux/module.h>, V: |5 V* R4 P+ r" h7 n
- #include <linux/init.h> }8 k# p' N3 i8 a6 s
- #include <linux/errno.h>% {5 S+ U# q, |
- #include <linux/types.h>+ m3 z: P5 x" z9 F8 }6 G
- #include <linux/interrupt.h>
1 ^6 z. W0 ?& @0 P7 E& S5 h - #include <asm/io.h>
7 L) Y2 k% S2 R+ U# p; }; ~& B - #include <linux/moduleparam.h>* L# }; q- E% |. _3 s5 |
- #include <linux/sysctl.h>
$ }& i3 X+ [' _2 l! } - #include <linux/mm.h>. N, T) U8 C7 v7 x y2 h
- #include <linux/dma-mapping.h> O& O% r( H2 w! Y! W
( d7 t9 n3 x- @ T( V& F- #include <mach/memory.h># R6 v, s2 z0 `' l, P
- #include <mach/hardware.h>4 y8 X2 Q" [# J; a) Y
- #include <mach/irqs.h>
3 D" x) v- [1 u/ T. K+ ` - #include <asm/hardware/edma.h>
) }7 U/ f. n \& C$ W g
?1 [( A" _: _) r: B9 e- #undef EDMA3_DEBUG2 R" y' d- s$ U0 o
- /*#define EDMA3_DEBUG*/ G( s7 x6 K1 n" \' N c
% O# G7 N7 s9 M/ G- #ifdef EDMA3_DEBUG* D0 _5 B3 v2 {: s- {. y8 h/ N
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
5 p7 Y: ?6 B3 l% O9 l# n5 }+ j - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
6 L H i7 Z, c( [1 A3 p1 C - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
1 ]5 }4 Q* Z- d) R4 w - #else' @ l4 ?7 `3 p2 c. u
- #define DMA_PRINTK( x... ), k- |" [- |; D% q3 G( Y+ k
- #define DMA_FN_IN
* m) q+ v, }: J - #define DMA_FN_OUT& L/ q9 A$ P0 L" X; o4 G7 a# R- n
- #endif) J" f& ~- V) k/ Q
- 0 w, i/ Q; e' [: i; E
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)) |; U b, N/ |+ i" p
- #define STATIC_SHIFT 3
6 l9 y' s4 K0 ^9 ?; t7 A' [ - #define TCINTEN_SHIFT 20+ h; `4 g9 ?- i* S* W
- #define ITCINTEN_SHIFT 21
- `3 M u- S/ T - #define TCCHEN_SHIFT 222 d! n* q2 i8 K7 {* P4 {% E) U9 p/ p
- #define ITCCHEN_SHIFT 23# p2 T3 e7 w- \* U3 h
/ p2 f; G9 E( p6 g( t% o- static volatile int irqraised1 = 0;, z' l# N) q2 U! p6 T9 u
- static volatile int irqraised2 = 0;# r# b+ U# ]8 q; Y$ X- R! i
- 8 H7 ~8 X, q3 r* v( |5 M8 c
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 _. K0 ]/ L- q- _8 e7 z
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ I4 Q1 p+ X) ^: v" t, U - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! u% h# M- M: _5 w6 ^
- n7 s; {# J$ L0 v6 u, D7 t
- dma_addr_t dmaphyssrc1 = 0;
7 ?6 t% o% l8 u9 `: f& Z8 _ - dma_addr_t dmaphyssrc2 = 0; g7 A# ~) t; Q4 E; {) E. f
- dma_addr_t dmaphysdest1 = 0;% y/ N( z. E v$ I! \# d
- dma_addr_t dmaphysdest2 = 0;
$ q, b3 Z2 |+ p! q; f5 P
3 S |( l( [1 g1 y- char *dmabufsrc1 = NULL;5 h+ k- y* o' d) a) {2 G
- char *dmabufsrc2 = NULL;1 f6 i7 ?/ v R% z$ m7 j) [' j
- char *dmabufdest1 = NULL;2 ]# N* V/ r+ o$ C1 j
- char *dmabufdest2 = NULL;
- n" O2 Z& h7 M0 ?) ^4 \, ~ - " ?+ e. `8 f- B: F
- static int acnt = 512;. V$ ~# l5 r9 S
- static int bcnt = 8;; o( {& _$ H/ S
- static int ccnt = 8;% O0 ?5 T( P7 d+ d8 G
8 Q0 z& ]; S: K/ [# Q& g1 ~- module_param(acnt, int, S_IRUGO);9 h$ K% F! d0 j- X
- module_param(bcnt, int, S_IRUGO);
2 O' P& W! H: F2 t; | - module_param(ccnt, int, S_IRUGO);
复制代码 T8 I0 a/ x- l- }' q9 t$ v
$ a2 v. o3 { ?+ a
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, C. g9 K/ q# G, z' Z# e& Harm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" @# w# Y% F N& N 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
Z$ f0 u; ~0 B; s5 `4 `8 D
" ?2 m0 \7 `% S! a2 K4 V/ @' m( M( [2 I. a& T1 S
|
|