|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + v- [: \ m, Y+ `, n; g
- [code]EDMA sample test application* u0 V" |1 W( a
- /* ]1 V' I% }: Q" D4 |3 Z
- * edma_test.c
# D4 p+ f* n3 V& Q9 c% a - *
& a5 w6 g9 R2 Y1 }1 Z3 b& P2 e - * brief EDMA3 Test Application
4 X) Y+ |1 u9 ^. A2 d- \3 i - *% A9 a4 [; D7 A! z/ ^
- * This file contains EDMA3 Test code.- \: O$ h5 D7 l9 b J, v5 K& b; T
- *$ v. p; G8 i5 T0 w" L$ _+ e% A8 k
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) Y9 x6 g( D, ~ m
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 y1 ]: c) X, E; s
- * TO CHANGE.* ^: q9 h. b/ h" r5 P0 c4 u
- *9 x( M/ B3 h, W
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 p3 q6 }! H) d3 h$ o
- *
! h( g/ }% A, a - * This program is free software; you can redistribute it and/or! E0 h7 d, H1 O/ |% D
- * modify it under the terms of the GNU General Public License as
: @, |/ j5 l* }" [0 f/ Q4 W3 X( m( C$ q - * published by the Free Software Foundation version 2.% V! J( ?* k" c0 | S1 J
- *" M3 i0 i3 ^$ i3 ^% E/ r2 [3 c. Q
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
. |5 Z- G& D: J, u0 U' H9 r I - * kind, whether express or implied; without even the implied warranty
$ ^( W; ^( m2 T J - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
( o& v1 a( N# ?0 G7 W, d6 ` - * GNU General Public License for more details.$ P% H$ S/ h2 L S7 K7 m1 E
- */
2 E# D8 C% F Z, a: y* C; v2 H
# \& x! a- l1 e/ Z5 i0 a- #include <linux/module.h>
; ~ A5 q' `9 { - #include <linux/init.h>
3 u7 v! Z7 R3 W7 G- x0 F - #include <linux/errno.h>
- N, |1 u+ o5 g( E5 ?) r; l% E* k. A - #include <linux/types.h>
- }1 R6 V6 l5 u- ?! }) ^ E - #include <linux/interrupt.h>
9 d" k, Z, Y( H( Y) l' M O - #include <asm/io.h>
& ?% F% Q7 q9 _/ u - #include <linux/moduleparam.h>
5 X$ i$ e8 m$ w% O6 W5 W - #include <linux/sysctl.h>
2 T ]$ F: [% ]1 U3 |4 ` - #include <linux/mm.h>
- v4 J) @5 R3 r: F9 s - #include <linux/dma-mapping.h>% U ~3 y/ x1 m2 X5 G, \! E5 H# J
- ; Q6 Q @& h' i: J K% e8 @* O7 r% o' y
- #include <mach/memory.h>4 g2 {# t3 b) C
- #include <mach/hardware.h>/ `# H, a( `& M. W$ E$ m
- #include <mach/irqs.h>2 l3 A8 `- Q% C: C
- #include <asm/hardware/edma.h>- W4 u T/ _ `8 q/ I$ D: u; N
- 6 o9 f- l6 _$ R( T2 l2 |
- #undef EDMA3_DEBUG
* f. q7 p/ Z* w. b4 }* ]) j - /*#define EDMA3_DEBUG*/$ q: S7 [! Z. a0 ~2 u
. f. K% X" N9 U6 n. x' }- #ifdef EDMA3_DEBUG
7 n; p# ]+ k+ w" F0 x - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
W7 i; q" _1 N" B; r" c - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ d. b( j2 S5 E3 W8 s
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' C6 y. m( F8 b% x+ k# E9 p
- #else
2 p( y, ]% [3 X7 \# r) S& K F+ B, C - #define DMA_PRINTK( x... )3 [2 a0 Y4 [+ q* }$ @! e/ G
- #define DMA_FN_IN. s& \8 l W' C2 Y1 t& |
- #define DMA_FN_OUT
7 W# B$ p; X! S" d- `4 d% x - #endif# ~, u/ A* s: P! W( g' c& g. p8 Q
9 }; r2 N) r4 s2 a, Z4 q- #define MAX_DMA_TRANSFER_IN_BYTES (32768)* I% S6 `- A5 I$ m; a2 y% o5 H
- #define STATIC_SHIFT 3+ S. T9 A3 m, V% w
- #define TCINTEN_SHIFT 20
. S/ R! g2 B8 o+ ?" n1 b2 q2 H" | - #define ITCINTEN_SHIFT 21! V9 A5 @5 z7 y: Y" @
- #define TCCHEN_SHIFT 22+ }. T: s; R( O8 V6 [% {, A) W
- #define ITCCHEN_SHIFT 23
( T& F D) Q$ r8 ]
* H# j7 r% I2 ^" |+ J: V- static volatile int irqraised1 = 0;4 x; t0 I( F8 b
- static volatile int irqraised2 = 0;
A! g5 w3 d/ H2 a+ r
0 \- ?) N. h3 m! Z8 r- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! Z$ v1 f: b2 X; s* E$ h" |: X
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 r, m7 [/ A! Y2 c
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 a2 I+ A! R; N, p- L, r
- J$ k3 z. Y3 s- ~) a* o- dma_addr_t dmaphyssrc1 = 0;
$ ^2 J: C y5 l+ r - dma_addr_t dmaphyssrc2 = 0;7 u" c: p4 A; y% l
- dma_addr_t dmaphysdest1 = 0;
! T( v' C3 h+ T* c - dma_addr_t dmaphysdest2 = 0;
/ M2 i$ u; N1 W0 C6 e5 w# @ - # }' {) ^0 Q# J6 F. }$ C( K; x; h& w
- char *dmabufsrc1 = NULL;
/ }9 z- q z1 F- u7 v& S- N" a! j. ] - char *dmabufsrc2 = NULL;
3 Z5 U5 U, T7 `; C G1 ? - char *dmabufdest1 = NULL;
# N y1 x* C0 M* V - char *dmabufdest2 = NULL;
# C3 f" E+ ^, f+ z5 e9 m, s
" R7 K4 c# |+ w; c6 j6 H- static int acnt = 512;
O4 C3 H7 r. q: M9 o - static int bcnt = 8; n3 A* G9 l$ {5 a3 E6 |3 H( _! k" T
- static int ccnt = 8;+ F, q8 Y+ A. G, B; x' s4 z7 [
8 g$ @# T _. a0 O% X" J" {- module_param(acnt, int, S_IRUGO);
4 E' C; ^ B- A! J* ~ - module_param(bcnt, int, S_IRUGO);& w9 }/ t: H# i3 r& h7 c) s
- module_param(ccnt, int, S_IRUGO);
复制代码
1 ~) w8 m; Q1 [' G* p z+ h% `: {7 B: F; z5 D
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' X) I4 ~8 @+ z: S0 b1 n, N/ @6 K
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+ U2 V. |/ {; T
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- X& J6 R+ c+ k/ [+ u
. X7 v. n/ n. ^; q' F- Q% k" e0 r2 ]. Z0 z0 l
|
|