|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 |. j4 W% g0 R& k& K
- [code]EDMA sample test application
! \9 ?. N1 i& H0 M7 Y3 y - /*0 G- m" z- o" Y
- * edma_test.c& e, h" z% @1 ?: y8 \
- *
5 s% l( x- T0 e! |* B( A- o - * brief EDMA3 Test Application
+ [3 W/ V5 l6 V6 _/ F - *
4 `( y( B) h, k" A- d+ D - * This file contains EDMA3 Test code.
! y3 `# L+ S8 E' m - *! c3 |" c2 ]2 @4 U4 t. M
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
! Y) p& j" G3 W9 f$ d - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 j7 |0 @+ W; h/ G
- * TO CHANGE.2 R) c0 k1 t/ J& @/ X+ k
- *
3 ?: {) w3 I. L7 Z. X& B* Q4 V+ U - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
2 Y% J6 d" a8 ?$ O! _- S - *( V) I) y4 ?2 `3 S# r- s) N
- * This program is free software; you can redistribute it and/or! g2 i4 W0 ?5 \
- * modify it under the terms of the GNU General Public License as
6 @! B: n. H* H( f, q& v* l - * published by the Free Software Foundation version 2.3 d5 C( r( [9 T% B
- *4 W6 U! g3 n5 B* B& }
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9 ^+ K+ W+ ?/ Z - * kind, whether express or implied; without even the implied warranty& V! ]8 {2 M* w% |3 p
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the" }; l# g: M6 F+ {7 T! ]( P
- * GNU General Public License for more details.9 o/ K: ?- e. D. `: l& g
- */ @6 k2 {+ J- H% R
- 5 @/ c& {% E. q0 E
- #include <linux/module.h># p, k6 D C1 P5 T. I" G8 ?) p
- #include <linux/init.h>
; s+ p$ A9 x6 a; T! N1 ^' t - #include <linux/errno.h>
- X0 C/ s8 l& T$ Z - #include <linux/types.h>4 _1 l- |& r4 t& h7 g' u
- #include <linux/interrupt.h>
; N* ]' Y, r' Z! A - #include <asm/io.h>) }& l& \- ^; @4 _, I1 V0 w7 x6 d
- #include <linux/moduleparam.h>
7 Z" U& Q5 r# h' e3 T4 d" W: Q6 m4 O - #include <linux/sysctl.h>$ I: t' c1 ^3 M+ ?, U6 g; x
- #include <linux/mm.h>
* `$ g8 l/ a3 G! x - #include <linux/dma-mapping.h>0 ^3 |; G8 y2 a3 \( Z
& x, d% \& D* A2 ]# H( z. [- #include <mach/memory.h>5 x/ v# Z) _2 v# z
- #include <mach/hardware.h>
7 }4 S) v9 N% ^ - #include <mach/irqs.h>
( A" s e& }% a. _6 u! l - #include <asm/hardware/edma.h>
" j( Z0 |: h" N" ^/ p
( O' k7 v( N; K# z+ v- #undef EDMA3_DEBUG5 s' B, z; b8 t
- /*#define EDMA3_DEBUG*/
' X; h/ m/ S$ l3 D* G9 R - 2 M) E' G( C8 l
- #ifdef EDMA3_DEBUG
8 { T# g& _1 j2 [& R - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); ]$ j) J4 y7 r- @& G# s; z/ B
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
, ~: f$ O& O5 a7 J* ?, s - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 A9 _! E1 b/ x, M* H
- #else
; Q: Q6 O9 U# E( W2 p( m' Z - #define DMA_PRINTK( x... )
& N3 c' b' X0 n" i( S4 V# y8 A - #define DMA_FN_IN
( Z0 N7 G% Z2 h' ^2 M - #define DMA_FN_OUT2 y. q @+ O% ?% `) m1 z
- #endif
$ h& p- A& q! V& U9 N, _
% q! i' r) Y9 O# h/ V: j- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
: Y) J1 T' U: c; ^ Z4 C - #define STATIC_SHIFT 3
2 W& H$ k* [' k* [ - #define TCINTEN_SHIFT 203 g5 x* s7 W7 f" i7 d
- #define ITCINTEN_SHIFT 21
' f1 Y. h( r! Z- b- \ - #define TCCHEN_SHIFT 222 L8 t! V6 }) I0 E. @
- #define ITCCHEN_SHIFT 23
8 r! u6 L, r2 x* N* k3 N
0 |# [* B. ^6 I- static volatile int irqraised1 = 0;
4 t: Y: D' {0 ]* J; m - static volatile int irqraised2 = 0;8 b# O R2 ^7 I I# X( V4 x! l4 T
) U7 ^! I& [* {' O; J7 v- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- p4 Q# ~# T" | - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! y1 m2 t$ X$ S0 r5 F - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 H1 `) o' Z* H& \
% u2 K+ K, z( r3 U V- dma_addr_t dmaphyssrc1 = 0;
; Z! D Q: {: o6 x; m8 h* E - dma_addr_t dmaphyssrc2 = 0;
2 u2 R, V& k4 d9 S2 t! c9 Q - dma_addr_t dmaphysdest1 = 0;
3 }6 G- ^1 q7 c1 L7 ^- @ - dma_addr_t dmaphysdest2 = 0;+ N: c' w1 \) @
& w a( ~5 x+ T/ P8 G5 ]- char *dmabufsrc1 = NULL;
/ q3 o q# X& i# Q# S- u) j - char *dmabufsrc2 = NULL;( ~8 _& N! B* @
- char *dmabufdest1 = NULL;
/ J2 Y3 u' d! P0 O E$ G9 o - char *dmabufdest2 = NULL;; A2 o/ V% S+ Q% B* N" [
- 6 R& e) G3 P9 A% X; ~- R& U5 U7 Q
- static int acnt = 512;
) ^& ^6 M6 O5 `8 ? m - static int bcnt = 8;, z5 g' F/ a0 g) L Z
- static int ccnt = 8;) h, j: R1 g/ W- n
- * h7 f. D; v# n7 H" ]/ D' [! E2 c
- module_param(acnt, int, S_IRUGO);8 V5 U3 L7 d# m* @! U$ o
- module_param(bcnt, int, S_IRUGO);
5 _0 J0 K, ^5 N* v5 _3 f) k - module_param(ccnt, int, S_IRUGO);
复制代码
: Q% `% g1 D4 ?% {6 h9 P& h- r* l9 V* W6 @! m- F
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; @* ]& G; {6 earm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 |+ l4 t+ L, |$ p! p' {' A 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: d4 A! b1 I. @* P( E% Y
, K1 _ ]: k; N
7 v% t) X! \0 a. e3 t |
|