|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; U) \5 n/ X V- [code]EDMA sample test application
% o: B& F* q) x" t J) ]' S - /*
: e9 D4 t! F7 U' k: x4 A - * edma_test.c/ `( U) F* ~! S
- *; v% D* X3 J" e) |9 L$ v; j
- * brief EDMA3 Test Application8 L+ F0 ^. F" u8 h7 |: X
- *) h" p% u A$ l
- * This file contains EDMA3 Test code.$ y9 w$ U2 ~" e* C* u* Y
- *; N0 V. J0 {# ~6 n( q" I
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ U6 A7 H. P& t9 M, c {' X
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ ~: `6 i/ d% v1 T# H! F8 b# J
- * TO CHANGE.
* I; m( L+ r J- y- ~5 K- ] - *1 A2 f! a0 Z" d, j
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
! O/ A0 v/ y+ `5 L& G - *- f& N; R: G/ D' ]
- * This program is free software; you can redistribute it and/or
* s8 E0 D; G" N" t5 E1 X! g - * modify it under the terms of the GNU General Public License as
' _* h: M; X5 q8 _% F - * published by the Free Software Foundation version 2.
6 L% Q' h& ^7 `% q6 [5 o - *
0 t- L$ c$ M3 x# m7 ]( k - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
, ]% F& d7 s0 A# q - * kind, whether express or implied; without even the implied warranty
& W; K3 {: q8 B - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ N5 m4 G9 M# U - * GNU General Public License for more details.
7 t) }1 i" f! r' y& [; v - */1 U, s, j# v8 Z
0 o% K/ X/ {1 v" I/ ^) _- #include <linux/module.h>' Q" l4 N$ ~7 `
- #include <linux/init.h>
1 ?$ t1 b: ~9 b1 ] - #include <linux/errno.h>% Y" y5 t5 @! H0 f2 J9 i( P' t
- #include <linux/types.h>5 C" X9 f! y1 \. V! ^
- #include <linux/interrupt.h>3 G) V# n6 R5 P
- #include <asm/io.h>& \$ m& h; }8 B: F
- #include <linux/moduleparam.h>
2 G5 n4 e( A: U0 [9 z. \7 G1 O) t - #include <linux/sysctl.h>; V4 a" |1 S4 _$ T0 M5 I
- #include <linux/mm.h>
# c; [# @% f7 c4 S( M' V' [ - #include <linux/dma-mapping.h>
c3 K. q+ s. d3 W) y$ V$ o* ~ - 0 y5 Q' V& y% u7 k: _' [0 c% b
- #include <mach/memory.h>
8 z5 M, x' i+ q. B, R7 K - #include <mach/hardware.h>6 T8 x8 P+ ~7 ?0 M, T+ K
- #include <mach/irqs.h>, m& X9 _, t; x& i" |
- #include <asm/hardware/edma.h>, K: i3 ?" y. Y
/ E8 ?+ X- N3 A$ @) G. r" b* M- #undef EDMA3_DEBUG" N6 c* H/ p; x l d- l+ Q! e
- /*#define EDMA3_DEBUG*/ ^/ \. q9 J3 I; C3 Q2 X
- ; y1 l% \) l( R. H
- #ifdef EDMA3_DEBUG
4 S- [: o8 O7 ?% C - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
* p1 M7 u+ P f - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
! S9 ^2 e; @4 K/ g3 S- B - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__) [) P3 _+ d* H9 [4 N* U
- #else
8 T4 O/ M6 J; e, M% C - #define DMA_PRINTK( x... )' k1 W7 t+ e% s# `9 N1 h# |
- #define DMA_FN_IN
9 [# R4 J* o9 s7 J' ?+ O - #define DMA_FN_OUT
4 U! X$ q Q: K; }3 i - #endif/ z) \ u% w" v& a+ k0 ]( J
- ) y3 w+ i. F7 U2 g( M3 v- j
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
( W4 P ^8 a$ o2 R( h8 c - #define STATIC_SHIFT 3& q& l2 e. A$ d- Y: b6 ^5 Y
- #define TCINTEN_SHIFT 201 n+ b" b( a* B" p
- #define ITCINTEN_SHIFT 211 C8 j7 S o' W9 E0 y
- #define TCCHEN_SHIFT 22& O7 K4 x8 i) ^$ e8 c
- #define ITCCHEN_SHIFT 23* Z/ J9 g: ~4 O9 f: z2 e2 h8 p
8 \% n. P7 X8 Z- static volatile int irqraised1 = 0;
% f8 |9 H% u3 h7 s - static volatile int irqraised2 = 0;. l2 p- ~8 m( B/ l$ _. N7 c
- " _; u6 d% d* }
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ C1 E' d& G, L8 `) q( t - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 d: m* E! p: } - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; G; a I& o: \
( n, E8 r- R; \2 j- dma_addr_t dmaphyssrc1 = 0;' ^9 W) n8 K |3 h$ l3 i4 i* f
- dma_addr_t dmaphyssrc2 = 0;
5 Z# _9 c1 d. _5 v$ z; ]6 E( p( A - dma_addr_t dmaphysdest1 = 0;
- T! ~6 E2 W; Y! S$ a: ? R - dma_addr_t dmaphysdest2 = 0;" n0 T# I! Z3 q% _
- % q! y# |: C& c2 e4 n8 r# i
- char *dmabufsrc1 = NULL;
6 Y/ J7 T- T6 j& {$ _2 }$ p g - char *dmabufsrc2 = NULL;
. Y4 H9 z5 ^# M2 ?& Q' d$ w - char *dmabufdest1 = NULL;9 u: n8 u. T( b' M4 t# w2 c
- char *dmabufdest2 = NULL;
{; f( A% O7 E& F+ Y) v! T
, l0 u, @ P8 O0 t5 `- static int acnt = 512;
( W7 _/ q$ p/ L" W! r - static int bcnt = 8;
0 W! n& P& ]2 w/ W F7 g/ b - static int ccnt = 8;
3 H7 \: W' y1 r, q+ r! g/ c$ t4 p
; G: Q4 E8 ~" d8 g! [5 Z* `- module_param(acnt, int, S_IRUGO);
- P) V, S0 [; { - module_param(bcnt, int, S_IRUGO);& T" V: e) t5 n) \
- module_param(ccnt, int, S_IRUGO);
复制代码 - b: v" w3 z6 { F. u1 `
' n; N1 I7 J- z5 u( a3 W- e( f7 Z 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! }/ ^7 N9 ?; f( u' n5 c) darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& |; t! [8 A% }; Y9 A# k: x/ T 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! h$ s( N2 _+ W1 g/ t2 v: r
, C# y" ^, W( U2 P2 V0 q! ] @7 G: y! Z) J4 m
|
|