|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 Y+ H8 d5 x ~7 O! T0 F
- [code]EDMA sample test application! C+ _$ q/ x" L5 {
- /*( ?: x3 S2 N& E0 d
- * edma_test.c$ S5 D$ F# x! N* d; X' i
- *4 l7 q6 K* a& v' o
- * brief EDMA3 Test Application: v) T |' g7 P4 G! X
- *0 N# b2 N6 A' G7 s7 ~7 s
- * This file contains EDMA3 Test code.
% ^, [. e5 ?" O2 M/ n) U. M - *
- d& ?: ]* h6 o - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
C1 v9 s$ Y* g4 f; N4 m - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 g. R+ W& h$ ]" Q
- * TO CHANGE.- I" {- T6 N. M3 T" m) T3 n. S
- *
8 @1 s1 Y4 C* z7 D6 y# F" ? - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% A( s8 q5 n. m/ z7 v8 w
- *
* E1 b7 v. o9 ?0 H - * This program is free software; you can redistribute it and/or) Y/ u+ p* v) ~5 ?' p9 q
- * modify it under the terms of the GNU General Public License as( k; U: B: a6 k/ Q5 E9 `- Y
- * published by the Free Software Foundation version 2.
, C* g# B! ^ e: T) f- z4 `- ~ - *$ _7 W$ U. h* ^' ]
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
! Y0 a1 k' `+ t K1 | - * kind, whether express or implied; without even the implied warranty3 ?. O" a4 d4 g/ i8 m, U; [
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 h; d. f$ X7 |$ E1 s - * GNU General Public License for more details.( u( o6 v# @3 X
- */
- B3 u% k& C6 c8 h1 e% }7 S
/ l, G8 S! k# l% x1 n" l- #include <linux/module.h>! d0 E: U" q. M4 U
- #include <linux/init.h>
5 h9 M' n& b) o4 W! b+ e6 c, v - #include <linux/errno.h>
5 @5 E6 d, I9 f& m1 Z - #include <linux/types.h>
1 ^" q( J! e3 ]2 z - #include <linux/interrupt.h>
* T- l6 z& L; A) e/ } - #include <asm/io.h>
* ]5 J v/ G8 u, G" E - #include <linux/moduleparam.h>
2 P# ~: x' g; |5 x - #include <linux/sysctl.h>' U% l; z5 F) C: E" Z# r2 j
- #include <linux/mm.h>
1 n7 @9 B' h, h8 Z: } - #include <linux/dma-mapping.h>/ L) y1 m" \9 l( S" U
% w! D5 o$ A8 i+ Q9 I5 c- #include <mach/memory.h>
* P" o) Q( a8 T- s- r; `' V - #include <mach/hardware.h>. m" r% Z; U: ^. {" l
- #include <mach/irqs.h>+ I5 [! d/ f/ |& |! t: |
- #include <asm/hardware/edma.h>$ Y4 q2 S5 F7 u V5 B+ O, Q3 S
- - r7 P9 L& B2 r/ d7 U) L: e/ U
- #undef EDMA3_DEBUG
; b: [5 n/ `6 U - /*#define EDMA3_DEBUG*/+ x- C6 D h: T* ~* v6 b3 _
- 0 A7 n1 [5 S4 D/ p! Y; S4 z: c+ { [
- #ifdef EDMA3_DEBUG+ J: P' W5 H% \/ p3 X
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' J6 {& A* i" F; G' L
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). W9 [3 Q) w+ c
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
& \; W. r5 z0 G1 j( x - #else
% L6 Q, k3 D, i# Y& _8 G* ` - #define DMA_PRINTK( x... )& ], n& U- e- Q: O7 z/ G. G/ ?4 a
- #define DMA_FN_IN; R" {2 o6 t/ w- B" V
- #define DMA_FN_OUT
( ~- l4 `5 R' @4 f" ]# E6 q" M - #endif2 J3 o, H I* ?* D
- 3 C, m# x% F2 O; D. ?" Y4 }- `
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
0 {( Y. L, n# ]4 v5 Z - #define STATIC_SHIFT 30 P4 m: n5 ^2 M/ q$ D4 n) o$ Z) Q7 m
- #define TCINTEN_SHIFT 20
9 R' s- i! `8 j, R* g* f, \ - #define ITCINTEN_SHIFT 21
: X0 E/ O. r$ V* M) x9 P - #define TCCHEN_SHIFT 22
* I: `9 T$ Y5 J$ v - #define ITCCHEN_SHIFT 23
& n2 c( v3 v, i, j' R# Z3 a - # f) m# j# \" Q* x$ q @
- static volatile int irqraised1 = 0;, P* e! H: n( C! u) e i, K
- static volatile int irqraised2 = 0;# z1 \! O) _7 q9 S- Z
' M) d# ~$ `4 c$ \9 k- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: k/ |* m% m7 C8 s7 l" ^
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' ?* ]5 N5 d" |) x - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( U7 T; v/ Y7 j7 L8 h% z
3 E5 t9 y: {; F) k" n; N- dma_addr_t dmaphyssrc1 = 0;
: Y* M- o" d& S1 w& r: Q - dma_addr_t dmaphyssrc2 = 0;% s' {/ D Q& ?2 l
- dma_addr_t dmaphysdest1 = 0;8 i4 l/ c8 `* M3 ^8 r7 \! h* r
- dma_addr_t dmaphysdest2 = 0;) R% B* q0 F0 T0 k
. i, S. t+ ?) Z2 h+ U- char *dmabufsrc1 = NULL;
+ ], v' F) ?1 u. o$ w7 ? - char *dmabufsrc2 = NULL;9 R8 c2 X1 P+ x2 e# \1 L# R
- char *dmabufdest1 = NULL;
. O$ @0 @2 H; W/ A" G1 ] - char *dmabufdest2 = NULL;" t# [# l2 |; E+ `) r
- 7 ^* `% b' A: G& z
- static int acnt = 512;
* @3 W4 N: X7 [5 ?5 ^5 }7 Y - static int bcnt = 8;' @2 |% n& x3 w+ i3 a- E
- static int ccnt = 8;
) m6 M, j9 s+ r+ U6 ~ - 8 d, t$ j0 p! `$ ]+ ^! g
- module_param(acnt, int, S_IRUGO);
, g, B4 n5 E' Q& f - module_param(bcnt, int, S_IRUGO);4 f4 ^: }7 p: o" N" P" B+ y' t( x
- module_param(ccnt, int, S_IRUGO);
复制代码
. z+ m [/ J" P/ h! a, a [, J K' E( X( ^% ]3 s0 @1 O6 E; t
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* ] X6 }) C, ~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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。 y- c' x. Z- G9 ?: `/ ]% D
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! i/ {% |3 |5 ?: V7 y* o/ z
% g4 `# ?( o- T6 O" c; ?; S6 { Q
( M% J \. ^, A" @# @" F/ M |
|