|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . u. ~5 T$ P# ]7 k' ^& ] s8 |
- [code]EDMA sample test application7 V; }' C( k. a& u, v4 X! y0 ]: J
- /*0 m! n; j/ D7 s7 `
- * edma_test.c+ F6 z! S7 Z9 `2 p3 m4 f
- *2 A$ N. O) C9 B+ P
- * brief EDMA3 Test Application
9 ]# d: M V! Z0 ?) j+ C3 l - *: L! ] @( i$ |% d, ]0 u% C, e
- * This file contains EDMA3 Test code.5 y7 U, p0 ^2 e. m) J4 A7 D0 i' Y
- *$ z3 J: o4 }* z1 g7 D
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE r# J t$ K' i4 |+ |; C
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% m+ d5 d( N L) H
- * TO CHANGE.& f5 N, x4 S) f
- *
& X7 O1 Z$ v% x - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
7 {2 }. r$ I2 L - *
7 g6 n# L5 l- q0 N; _ - * This program is free software; you can redistribute it and/or- \$ G, X, J+ ^: p; d
- * modify it under the terms of the GNU General Public License as
7 e" W" T& l7 f' e# J: a3 _$ P. X - * published by the Free Software Foundation version 2.
6 k- C+ s$ R) S7 j - *
+ A+ G" [2 t% b+ P - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9 t: O: @( z* q0 v. U+ z - * kind, whether express or implied; without even the implied warranty+ B* F5 q: T* t: m2 J4 V
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the9 }0 k6 P9 o; M( G& a( Q/ e
- * GNU General Public License for more details.
- U: M4 O" w: W8 f$ v - */
4 ^: D! {- H$ R9 M - + f$ ?9 D3 S1 _" V' b8 Q0 s
- #include <linux/module.h>4 o: g8 e9 i' V$ Y6 }
- #include <linux/init.h>- J- k; [) B/ @) e3 v1 H
- #include <linux/errno.h>/ G, y. @2 L7 @- x! J$ _
- #include <linux/types.h>* k- t* X/ B2 z( h9 o
- #include <linux/interrupt.h>; @- v& r5 n/ [4 `" [, Z2 t
- #include <asm/io.h>! w) L) n% X- P& |5 R
- #include <linux/moduleparam.h>
7 Y, b1 b. ?9 k# N" {* b - #include <linux/sysctl.h>1 ?8 v0 S& c! U
- #include <linux/mm.h>! D; G' k* J: C- p
- #include <linux/dma-mapping.h>
4 o0 m9 O) m' }8 u - 1 H: d% u9 A% y6 {( }* D, a6 \
- #include <mach/memory.h>
' A6 Q: L9 C5 N - #include <mach/hardware.h> f2 l. B; b+ Y$ X
- #include <mach/irqs.h>
6 J# ~# b$ C9 c - #include <asm/hardware/edma.h>+ ], l0 }. K, p! ]; q4 O* x D
. X9 E+ L5 E3 Z9 i0 z- @% Q* W- #undef EDMA3_DEBUG. R0 Z5 C4 ]$ t) o
- /*#define EDMA3_DEBUG*/" s: B# w/ u% h. z
8 c' d. L8 `3 x$ b- #ifdef EDMA3_DEBUG
: @ p* l. A @; J0 w - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 @8 z/ z$ K) G# v) }6 d
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ [0 K6 M; k6 N) q$ u1 o2 d
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
; q$ t! f+ h+ _3 k4 m - #else: s8 k9 r: L4 ~ S+ Z, D5 h. w1 J
- #define DMA_PRINTK( x... )
! C$ e5 M6 j4 y8 D - #define DMA_FN_IN
! q |* l7 B' D# s2 z+ K - #define DMA_FN_OUT
1 K1 g3 R5 z, R0 c - #endif" C9 e) s$ G0 T' ]9 p
$ g6 K) V- J. w6 ?( U$ p- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
' U3 M4 s: @/ R: L0 J$ i$ | - #define STATIC_SHIFT 33 `# t- [0 j W3 `* f, F. S
- #define TCINTEN_SHIFT 20! v% {) |/ E. ^& p0 D f; e0 g( |# \0 j
- #define ITCINTEN_SHIFT 21! V2 X7 \$ m8 j; K/ z% t1 z1 z
- #define TCCHEN_SHIFT 227 K+ B: d% t% k
- #define ITCCHEN_SHIFT 23/ ~+ o! p) c1 b; Y9 [
- ; {0 q) ~* M" P* f. T
- static volatile int irqraised1 = 0;
H5 |' J v7 R1 \. x - static volatile int irqraised2 = 0;8 U3 m- v6 g& E2 y
- - A! u Q3 i+ j" O2 S- Q
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! ?2 W% k" W1 U5 V4 E7 [8 H, Y - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 q0 h* r6 @- s) T' \3 l$ z - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 r3 y: s1 f) q' q
- ) b% i6 N9 x; \' i( `, o1 d. ]
- dma_addr_t dmaphyssrc1 = 0;& F2 \- t6 s$ ?! g5 v! v
- dma_addr_t dmaphyssrc2 = 0;
a5 U% \& k/ k - dma_addr_t dmaphysdest1 = 0;
# C2 k5 P1 c; i9 B - dma_addr_t dmaphysdest2 = 0;
3 k. t) Q3 z5 o - 4 X. d( H: v; ^* x G' K
- char *dmabufsrc1 = NULL;% C6 J) a7 ~- l
- char *dmabufsrc2 = NULL;* ? I/ ]$ O; v1 x7 _% n+ [9 b4 R
- char *dmabufdest1 = NULL;( g! d7 R2 J# W
- char *dmabufdest2 = NULL;) B8 ~/ m( Z+ l
- - E0 j$ ^2 W! I
- static int acnt = 512;: z2 ^! K9 f0 F( |
- static int bcnt = 8;
' J0 ?5 H- |$ R% B, A - static int ccnt = 8;7 F1 r) o: C; ]: q9 u" \9 d5 Q
4 d; C0 ]9 `6 Q( h- module_param(acnt, int, S_IRUGO);* }4 `- C3 J3 {9 P9 }( O
- module_param(bcnt, int, S_IRUGO);
`# {1 [* l6 P. P - module_param(ccnt, int, S_IRUGO);
复制代码 E" i# M9 _0 f# @6 _' B0 e- j- `
S1 o, Q' y: I
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 X6 B( P" P! ?5 p2 _5 @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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' P" ^ D8 C1 Y# y( C5 w4 o3 ?
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。 s" R9 [* D6 ]
. m' K/ D7 N- }; }( d
6 |% W7 I! `3 I" g! | |
|