|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 f4 x7 ~! P! q5 ]: d" [7 j- [code]EDMA sample test application
% H0 z3 ]) m# z: Y9 Q U4 C/ { - /*
! h9 T# N" f" J - * edma_test.c
* U4 B1 f7 u4 h& u9 t - *, Q+ D# Z5 u% M/ q: }
- * brief EDMA3 Test Application8 W) E7 T- \5 _2 V! R" M
- *! ?* Z" ^& n* \" {$ t6 g
- * This file contains EDMA3 Test code.5 V; H R: r/ _) Z3 k
- *
2 {& x# Y1 l2 z# C& h$ Z7 w) N4 p - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 h9 B. v5 h3 Y, l8 K |5 Y! t w
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
( C, |- P5 H- ]3 M - * TO CHANGE.& ^% ? S+ n% j, h! v$ z
- *
# m6 L# f* ?$ j7 t! {+ M - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
5 F5 a) j# [' Z3 X b" S - *& U% n5 m% l/ F8 U* c
- * This program is free software; you can redistribute it and/or# i( M/ r+ s8 N u: p
- * modify it under the terms of the GNU General Public License as6 v: n# t0 X* m; |: ?6 @& \8 F
- * published by the Free Software Foundation version 2.$ O$ H/ m3 h% d; l& Y5 v% A
- *
+ }0 j; `7 j0 F! z) D4 E - * This program is distributed "as is" WITHOUT ANY WARRANTY of any& }9 |8 Y9 P) h
- * kind, whether express or implied; without even the implied warranty9 A6 Z M+ @5 o2 d" @6 K
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the" z8 U$ j# }8 r$ j* j
- * GNU General Public License for more details.; g( g8 `( p! s5 x7 q
- */
& i" c' e; B3 S: U# G - 8 E- W# G- A+ z& V$ J
- #include <linux/module.h>
4 m7 f- q0 ~ m; a - #include <linux/init.h>+ t0 `7 A" S# T2 f. T* K. J
- #include <linux/errno.h>
, V! U4 ?' L% M4 W( M9 b - #include <linux/types.h>
C5 m+ F* A8 `( w2 [7 z - #include <linux/interrupt.h>
3 V& G+ Z( U9 _+ X, Q( b - #include <asm/io.h>/ H3 A4 o9 }0 i
- #include <linux/moduleparam.h>
* ?# r" D, [- A7 I- d% `# \ [, H8 D - #include <linux/sysctl.h>' o+ g$ ?: o5 P0 o+ e8 d' J9 F) E
- #include <linux/mm.h>+ ~5 S Y) j) Q
- #include <linux/dma-mapping.h>
- M; ?. N) L$ j/ X - 3 S+ A9 D5 o% p( }
- #include <mach/memory.h>' G; n( o/ j! T, z* O
- #include <mach/hardware.h>
9 T. W4 c5 l: B% l% K6 Y - #include <mach/irqs.h>
6 `% Y" D. B: ~; q! [' W6 f - #include <asm/hardware/edma.h>
; V0 R! {6 Z7 ^& A - 1 F" K5 ^- q! r( F, [9 x L' Q
- #undef EDMA3_DEBUG" U, R; U! L1 C
- /*#define EDMA3_DEBUG*/
8 e3 b" {' k$ x- M
8 I7 x6 L& w2 \* H3 M* P. B- #ifdef EDMA3_DEBUG* I; y2 k2 r1 Y3 F
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); |% X2 C0 J' [5 }2 L
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 S( I2 ?9 g0 Y& M! X
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
4 S2 L0 c, D: t5 ]$ z* d3 ` - #else* R3 H W/ }/ R
- #define DMA_PRINTK( x... )3 `5 R$ O/ @- w2 x. H. f
- #define DMA_FN_IN3 e- J! X6 f- o
- #define DMA_FN_OUT
1 Z/ g/ S7 n) R3 w' B1 f* s0 T - #endif. V9 V- D% M* ^) ?
- 3 M4 d) [6 J2 G7 j, X
- #define MAX_DMA_TRANSFER_IN_BYTES (32768). h- `4 v i1 E
- #define STATIC_SHIFT 3# [! n' _, Q0 B/ d" M
- #define TCINTEN_SHIFT 20 J z( [, X; G" B
- #define ITCINTEN_SHIFT 211 \" [# \ o% c5 g
- #define TCCHEN_SHIFT 226 h$ r: o+ o, }: f: Y
- #define ITCCHEN_SHIFT 23
+ N. a( Q) X1 L# Z) o% [8 Y - 6 |3 v) d) y" P$ d$ v
- static volatile int irqraised1 = 0;
5 Y' m: g/ T( m$ {* R7 K - static volatile int irqraised2 = 0;, g- p! l& Q. _1 p9 W6 s
- $ G1 m" ^" c! m
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 b, t( G& o0 J5 t0 |6 m - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ O6 C7 a7 D4 @. @$ Y2 I$ _
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- ^4 h2 x) N" M) e; x6 b6 E - ! j8 e5 F& k- `- A" f
- dma_addr_t dmaphyssrc1 = 0;8 ?, ^% p8 O) I8 ]4 ~8 d$ Z
- dma_addr_t dmaphyssrc2 = 0;& y6 c/ ^0 J3 |" [6 a
- dma_addr_t dmaphysdest1 = 0;
K% O9 z2 U2 Z o; { - dma_addr_t dmaphysdest2 = 0;
" E2 H3 j9 G, M" \ - , J- X5 [1 I+ q! ~* C% K8 {9 `
- char *dmabufsrc1 = NULL;& q+ u& U. W/ _% D% Y6 E+ P
- char *dmabufsrc2 = NULL;
3 U1 o4 M. h. Q6 E - char *dmabufdest1 = NULL;
0 W2 Z3 v7 p0 Q; R) l% J( Z - char *dmabufdest2 = NULL;; A) n/ a, U: A
: q! a0 i& @7 ?- r1 E- static int acnt = 512;
+ W- q0 L) U) M5 d* b7 e! D - static int bcnt = 8;
8 O* Y/ j( e* n- g - static int ccnt = 8;
2 m" L6 `5 E- @5 E" ^8 _. K& |1 }
" k0 r9 n8 |- A- e- module_param(acnt, int, S_IRUGO);7 x. {& \4 n. \! V0 O
- module_param(bcnt, int, S_IRUGO);9 R+ j" k- p0 P* k( C/ K
- module_param(ccnt, int, S_IRUGO);
复制代码
( G, `6 u' e' N; G) @2 N# n, C
G3 u& m. D3 A7 E' d: S3 c% p 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 {9 z& }# s$ p% B# J- o7 l9 ^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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! a- J k2 N- z) O$ h. ~, L 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 z! F# ~5 O. K+ u- i! D m& A7 _& ]$ X3 f6 K& D
7 a: c5 I8 d% t/ O" T) q
|
|