|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ o# M2 W4 q h0 J( t# p3 g: U% d- [code]EDMA sample test application
" X) z& J7 s! j3 r' \, r/ e - /*4 S/ H2 E/ m1 `: g6 ]; z4 p
- * edma_test.c
5 Q# G7 B Q/ b% ~; w - *
5 H; w9 \9 ]: l4 {1 u! d8 B - * brief EDMA3 Test Application
* H; }$ C0 X9 C8 ]9 U - *2 ~; U. d# C! }$ ^. J f' l5 Z
- * This file contains EDMA3 Test code.+ F& S2 O, G& v1 e/ D
- *: g# A1 a4 i; D+ C/ _
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
1 a. x/ K. X- K0 [2 @* v, w0 M0 |2 g7 o - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 [$ F% Y" O1 \
- * TO CHANGE.
5 P) P6 Z( D1 c! H+ ~/ Q - *" y, v |: j/ Z& o& S& F
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 I1 O* b! Q W+ d- Z6 [
- *
8 B& K3 n, W* r/ c, q/ M! J - * This program is free software; you can redistribute it and/or j/ N- G# Y2 F! B5 K2 B' P
- * modify it under the terms of the GNU General Public License as @+ D- O% A# D
- * published by the Free Software Foundation version 2.
1 J( S/ ~1 @2 K6 E, {8 I - *
# _, g4 I; ^; N* L - * This program is distributed "as is" WITHOUT ANY WARRANTY of any; H8 g4 S8 B" r. J
- * kind, whether express or implied; without even the implied warranty
/ M% T$ d$ k1 F8 ^ ~ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
& u' I% U: t, l( Z - * GNU General Public License for more details.
7 ^8 n9 @ o) x8 H - */
. F/ F8 G- X7 o5 U5 ?( w
: ?# Q# c, p3 h5 o! {- #include <linux/module.h>- i1 z" E5 ^ |9 \/ @
- #include <linux/init.h>
" V6 D# R1 w2 y( q& g8 l* Y/ T) q - #include <linux/errno.h>
- g9 E) M) P" v. S$ ? - #include <linux/types.h>7 k R2 L: t- Z, ?- H, ]
- #include <linux/interrupt.h>
4 C$ m+ {1 \7 N1 [! H - #include <asm/io.h>
I0 E. ]; X9 _# c. ~ - #include <linux/moduleparam.h>
! s) q% M9 q- B( s( ]; d - #include <linux/sysctl.h>) G! T3 x9 l9 O) v8 x3 i9 [7 K
- #include <linux/mm.h>) g& B7 ?( M+ U+ `; t/ Q
- #include <linux/dma-mapping.h>
# J2 a4 v: {& M' O* j/ B
! |9 Y k3 g- q c k& r- #include <mach/memory.h>
: X! Q* l0 O) `1 Y3 x, V - #include <mach/hardware.h>6 s: [9 J: W* v# Y4 a; ~
- #include <mach/irqs.h>
8 I9 s3 G8 s( W0 t* {2 h! A; H - #include <asm/hardware/edma.h>
; ~( z+ ]7 V: n' { - . Z9 f$ y+ x' e
- #undef EDMA3_DEBUG5 q3 t) S$ e2 [5 q6 ^" n
- /*#define EDMA3_DEBUG*/
: C4 A; X2 H' G; y$ a - , \% [$ {( Y; ?$ E g: W) }
- #ifdef EDMA3_DEBUG0 ~- E- F) N1 A7 [1 f4 Z/ M
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
1 j& }! U$ v( s* d2 Z/ g - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
9 |3 y) p8 e1 X' L - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
- S6 C7 T' z3 T, Z( T* q - #else
2 J3 m. G q0 B& S3 S% b- ]9 R - #define DMA_PRINTK( x... )9 C: F/ H1 Q8 k
- #define DMA_FN_IN
1 f! e/ Z; Q# c% T. B$ L - #define DMA_FN_OUT4 j. _4 Z& t# I5 ?' n! t- `+ Q
- #endif9 |: Z8 L$ i5 B2 a
- 5 D# G U: a: w) d2 q+ Y
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
. ]8 d4 T, t' ? - #define STATIC_SHIFT 3
/ }2 r( |1 N1 H0 k - #define TCINTEN_SHIFT 200 {/ L7 w; i1 M; H) V. l. T8 K
- #define ITCINTEN_SHIFT 21
# S0 N; \! N2 t3 \9 b7 y5 t7 k - #define TCCHEN_SHIFT 22- p/ H2 B! E; P1 f! b v
- #define ITCCHEN_SHIFT 23
$ H4 S6 `) ~, R4 Y! r - : f* \- q$ a) S4 x
- static volatile int irqraised1 = 0;$ i r7 J: u1 U h @ i: l: `
- static volatile int irqraised2 = 0;
+ {5 D4 K" M2 d" D% m
- ?7 o; ?* Y/ M- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; r6 ^3 l& k. @
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 @' `+ k9 h2 V& f/ i4 T2 _5 P9 p - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ y7 @& q+ @! H; h6 Y# g7 `
- ( o) {3 `% ]' A7 T) ^. b- f. T4 M7 P2 i
- dma_addr_t dmaphyssrc1 = 0;- @1 \. k1 g" m1 D2 K" ?
- dma_addr_t dmaphyssrc2 = 0;$ p* u; Z4 s, b
- dma_addr_t dmaphysdest1 = 0;. a- v; x* h# t: d. v5 F& e
- dma_addr_t dmaphysdest2 = 0;+ E( p; D3 G; q- C3 `8 W
- T. @+ m' ~4 \
- char *dmabufsrc1 = NULL;7 Q$ d. Y* ]1 L6 ^& \0 }
- char *dmabufsrc2 = NULL;( u! `* d. ^4 V% c" \; V
- char *dmabufdest1 = NULL;5 {# y% R! p: P
- char *dmabufdest2 = NULL;
' N5 f. u) f4 j" M8 `
7 z; z- `9 K5 k+ W& J& `) @- static int acnt = 512;7 v7 @" M" P$ W/ z F" x
- static int bcnt = 8;
1 d( u$ S; o' H3 U - static int ccnt = 8;, @* X3 M' Y' w$ r
# }6 W9 i8 M* q7 m1 I- module_param(acnt, int, S_IRUGO);
- Y; ?& a! M* A - module_param(bcnt, int, S_IRUGO);
* e% D; d* l) _4 R" q" r( j - module_param(ccnt, int, S_IRUGO);
复制代码 ; O. I& j) t8 U" P" [+ z0 e6 n/ j
8 T) c. f/ O0 p0 X f% O5 i7 L
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 T3 ^0 V0 N x0 W o
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( C8 t Z) |# u5 m5 |, D& t! p 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, p9 P- W, x: e2 q
5 ?6 _8 t! W8 i* R4 z a1 B) U8 [ O
' _9 m8 K/ D) T& H
|
|