|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; G2 o+ ~' _7 t; d" }* F
- [code]EDMA sample test application% w" r, V M0 `. l, z
- /* G* f+ u9 K |- @: A
- * edma_test.c+ `% {5 n& Y9 @/ m2 L2 S0 \6 q
- *: M/ M8 m( \" k; X% d B
- * brief EDMA3 Test Application
/ C4 M1 V, l. r. o0 y - *& a* T) m J; z) L( d& \2 |
- * This file contains EDMA3 Test code.; \9 h1 H( U) b
- *" T8 g1 o$ n$ D2 S
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
" g: I( t# l, @8 K# } - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
! }7 X$ A( T& h1 y" U a/ _% B - * TO CHANGE.7 O# }: l" p- v! M/ \7 o6 G) z' E% }
- *; |7 D$ A# d5 |
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
8 Y* J b1 o6 w6 V& w - *. z$ n4 [ W. {5 r9 s8 j4 o; B
- * This program is free software; you can redistribute it and/or
2 U! s6 f+ y2 n6 g# M - * modify it under the terms of the GNU General Public License as
5 h, g- `+ P6 ~$ V - * published by the Free Software Foundation version 2.
1 b7 g9 k2 }( C; e$ r% Z( S* A - *) y$ P5 H" {4 M) U/ `
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
' `3 }0 O; g8 O' ~+ R' H/ m1 e& g - * kind, whether express or implied; without even the implied warranty
o) n5 G* Y( M1 g2 I# [6 {/ X0 L - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
( c& t1 x g) v9 p: ? - * GNU General Public License for more details.
* y1 Q0 Q$ D& d3 s5 { - */! ~* u6 N: T1 Z6 Q# P' p
5 m. B7 Y$ g, {" h- B8 r) x& M; A- #include <linux/module.h>
# ~ w+ P, W" g5 E3 q9 A - #include <linux/init.h>
6 z( W- _/ q( E7 V% o - #include <linux/errno.h>
. X: T+ ]5 W# z! E' e, p - #include <linux/types.h>
& G& ?% Q A, E2 j - #include <linux/interrupt.h>
3 `0 c/ }7 _! t- v8 W. D2 \ - #include <asm/io.h>+ i1 K; I4 M8 G
- #include <linux/moduleparam.h>6 ~6 D8 X1 }1 {6 K# e- g- x
- #include <linux/sysctl.h>
: ^. d5 @' W/ k# ^- a - #include <linux/mm.h>" Y" F4 v. C1 A4 x7 E
- #include <linux/dma-mapping.h>
1 _7 o& Y# e% f( h" d n
+ f S" g7 v2 A3 X6 Y! [! s- #include <mach/memory.h>
9 e, c" m* o! Z8 I9 p% S - #include <mach/hardware.h>) f6 B2 S' v8 F4 g& g
- #include <mach/irqs.h>
6 a# }( ^6 a* f6 `6 f - #include <asm/hardware/edma.h>
7 i! W7 L E) U- z% Z! b - 1 v8 H% R& S7 |* a$ c
- #undef EDMA3_DEBUG
- h9 X; _* D9 X; h - /*#define EDMA3_DEBUG*/9 F& [3 A- ?$ Y3 j, z
- 0 J# Y9 {5 J/ \) r- S& l0 g0 C7 F6 L
- #ifdef EDMA3_DEBUG
8 {% t3 k$ y P1 o) s' ? - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
) P; ^- q" m4 N3 h0 c7 D4 @ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). T V& b- M* o0 w8 g
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" l9 u* U2 c( l8 Q' G- F* b- \7 y
- #else
$ K- ] `$ y. c: q0 M5 Q7 Z - #define DMA_PRINTK( x... )* Z+ P0 W: i6 E% D! N
- #define DMA_FN_IN
4 p& g4 p% v* _. I- s: [% I1 |: b - #define DMA_FN_OUT
% z* J: Z' }8 D5 t9 L - #endif
! _ P3 c/ K$ G9 y4 {: K& A" m - 4 L/ V% F" \) c' W) h. ^4 r
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)" B2 k5 f% Y6 v- ?5 X$ x# S( k
- #define STATIC_SHIFT 3
( _; n1 p# n* n0 |2 v0 C - #define TCINTEN_SHIFT 20. ], R$ o0 W$ n' }
- #define ITCINTEN_SHIFT 21
# |/ q( o& }. |, |: m; v- e - #define TCCHEN_SHIFT 22
" B* Y6 y; s+ Q3 F# z) _/ s! T - #define ITCCHEN_SHIFT 23
2 ^+ H5 @ S3 b6 l3 x! C j
/ a7 W0 \! ~8 T* q- static volatile int irqraised1 = 0;
J6 Q' H" S7 h2 a - static volatile int irqraised2 = 0;
, h6 q* B; o8 ^& h
1 Q6 z+ ]' e$ c7 Y# a$ G i7 F- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- r: _& B: ?- t" r/ P
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 J7 R3 N) k1 C - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. M) M% v& s; X( s( ^
% h2 r x0 e* x. l9 ]- dma_addr_t dmaphyssrc1 = 0;* V% i; O- n( x7 B8 f/ k. `
- dma_addr_t dmaphyssrc2 = 0;; F! b( X5 V2 }3 V" x7 S4 o
- dma_addr_t dmaphysdest1 = 0;
: ?) R. T& |; y) c: ~" G1 D0 y - dma_addr_t dmaphysdest2 = 0;6 T7 |- G& r- V/ x, t
5 t) G0 ]! M0 T- char *dmabufsrc1 = NULL;+ d1 w8 l. U0 B8 g
- char *dmabufsrc2 = NULL;
# P& q7 a0 k) }1 _& t1 q - char *dmabufdest1 = NULL;
5 o" m& r& x1 k9 a9 F5 f! x( Z" w - char *dmabufdest2 = NULL;) Q" d. C, j) K% h' {7 ^8 {; e% G
& ]* ^9 D! K5 ^ S9 ]- static int acnt = 512;1 S) o- b' t. w2 f; A X) e% X
- static int bcnt = 8;" C8 [" L& Z' v* m0 ?/ ]3 q
- static int ccnt = 8;; |. [, t) d: G, j
- " I# t+ _* R! p' y! f9 u4 K
- module_param(acnt, int, S_IRUGO);0 I; v* ?# `! f' [2 c( D2 Q* A
- module_param(bcnt, int, S_IRUGO);' P# F% y A: {. y7 e$ i: d
- module_param(ccnt, int, S_IRUGO);
复制代码 1 u( @ n6 e! H) X* c. e
3 n4 Q3 e! T8 V- C 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) e$ O7 s; W8 }# Garm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 ]: f; T4 k. {* K4 J! v
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& ]* f3 M i- N. ^( @8 j' Q# E( s1 K- |! |, W# t
& S9 \- k% l- f4 S* {2 H
|
|