|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% U! {9 w( u3 ^- [code]EDMA sample test application
, q2 b$ o) n1 ^; J - /*
3 {3 s1 j- U2 B I' k; g' e0 y - * edma_test.c. d) `. ?' v) K, _- ]- W- H. Y
- * z- v8 R' {, s
- * brief EDMA3 Test Application+ ], {! f. ~. P# ?& T+ s% C
- *
( D' S+ n4 o3 y, e8 h - * This file contains EDMA3 Test code. M! N& p1 r9 t7 d/ j' s" v! U
- *: t3 @( C) R+ A4 q& J1 C
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
5 X; h0 a( \3 Q7 m2 B6 [0 L - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
; o6 e; p5 k" I - * TO CHANGE.
5 g; t7 F4 f4 C1 ~ - *# ? [! P3 `, v7 u5 R* u; g
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
4 Y. D- J4 D% W& \ - *
& V& D# @" S. D, e s1 p - * This program is free software; you can redistribute it and/or
r2 g2 d) n0 u. R9 n9 h - * modify it under the terms of the GNU General Public License as) ^; }% F: o8 L, t2 B/ D1 @, ~
- * published by the Free Software Foundation version 2.
* s" e* r4 w6 o% m' l - *
+ k$ |; B+ B' e! s7 W1 A% z' u - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9 p6 T/ j0 j( h - * kind, whether express or implied; without even the implied warranty, |" z4 A8 i; S. f+ ~
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5 Q. m% `/ T) n# e0 i5 U* G - * GNU General Public License for more details.
. ^! @* r, O4 l$ C - */+ Q; W" U* _) t* H, p
8 \" T! Y& w0 U# H- #include <linux/module.h>
$ E0 C8 ^/ _4 `# X, i - #include <linux/init.h> f$ k0 T2 j; |" L
- #include <linux/errno.h>- [* _% v$ q2 U- T( \/ X5 y7 k$ |
- #include <linux/types.h>$ l7 p: W s6 X' ]/ j
- #include <linux/interrupt.h>
$ A h m; V- _. I/ n% w& f - #include <asm/io.h>& N1 f8 {) D s& e* e4 ?
- #include <linux/moduleparam.h> J$ [6 G+ F4 k4 Q( g$ N
- #include <linux/sysctl.h>
* ~ U) _2 ]5 L - #include <linux/mm.h>2 V5 S8 T. V. f( U1 G. R# }! d% |
- #include <linux/dma-mapping.h>2 n9 o9 ?7 V; [0 n
2 n( @% p0 V o# a- #include <mach/memory.h>
) W1 T6 b0 m K+ h - #include <mach/hardware.h>
F- F* Z9 s5 J - #include <mach/irqs.h>
: h7 ^1 E" n$ z$ }2 w - #include <asm/hardware/edma.h>4 g, M g- m6 D
. H# L' d0 ~6 Q, f( ~6 c! R- #undef EDMA3_DEBUG
/ `# P+ r) b6 _# }; ]0 A! G - /*#define EDMA3_DEBUG*/
) F: x; Z( x, ~2 v5 o6 i* m' X
0 {& k- B2 s4 A: |: [- #ifdef EDMA3_DEBUG% {5 H/ {7 F; w
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
9 \2 W, Q/ v0 e1 z8 j - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 {3 h; ~+ B( q0 B; `# {
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
3 L' n# v/ c+ v& j& H - #else' C1 @0 K5 ?" R1 W3 A; ?3 j
- #define DMA_PRINTK( x... )* f( @+ V! f, B, N2 L) [" b
- #define DMA_FN_IN
; W3 x: G9 v0 R5 K2 c2 C$ P9 D - #define DMA_FN_OUT
9 D, `) ^) }* A" m1 m - #endif
+ g. u8 C, q, @: E
$ I0 G- X2 m9 S* E9 z- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
0 b' }; I; r# o" a5 l" r - #define STATIC_SHIFT 3
' e6 }1 N5 `9 E$ L - #define TCINTEN_SHIFT 20$ f' J3 a3 _3 f
- #define ITCINTEN_SHIFT 21
' U2 z8 o0 O2 N7 d, I5 w& a - #define TCCHEN_SHIFT 22
2 b2 t, e% \: M$ K% j9 I+ P% g - #define ITCCHEN_SHIFT 23
W6 @2 t' F- Y4 L- z - 5 e! ~1 d8 u2 j+ [
- static volatile int irqraised1 = 0;3 u: l4 r8 L. f5 `6 M% T2 R
- static volatile int irqraised2 = 0;+ f: f5 Z6 V8 E0 y/ R
- " T- k) p% R' X. U! J0 g
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. r3 o6 R* y i; ^' j# q - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 p1 o' e- j. N1 o/ K: P - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! m+ ~* f+ |( ]2 R; | i! c - 6 l1 m! f& q! Y g
- dma_addr_t dmaphyssrc1 = 0;% `4 o, i# i+ G( S" y" l4 v
- dma_addr_t dmaphyssrc2 = 0;, U4 Z0 t; r) z5 {3 d" \7 r
- dma_addr_t dmaphysdest1 = 0;# ~# J; M4 b- B. u
- dma_addr_t dmaphysdest2 = 0;
( X6 Z( }7 r$ F- Q9 C! [
4 K9 {/ ~6 q! D: Y, a- char *dmabufsrc1 = NULL;. D/ r# D: V& }& f
- char *dmabufsrc2 = NULL;+ k# [1 c1 k: [. Z- J* A
- char *dmabufdest1 = NULL;* T& t0 K* c. P) ?
- char *dmabufdest2 = NULL;
6 I( I: g5 X. e0 }3 Y - $ N" k& u E* y0 G" ^
- static int acnt = 512;
4 z' X, `2 C. e) B, u" B4 Q4 @ - static int bcnt = 8;
: J1 G9 `4 V( G6 Z - static int ccnt = 8;, g1 x& `) i& n3 v
- 7 s [) j! y. L
- module_param(acnt, int, S_IRUGO);- o) S5 Q2 `4 z9 t, v! @* Q
- module_param(bcnt, int, S_IRUGO);
3 g% L* }$ G1 k6 q - module_param(ccnt, int, S_IRUGO);
复制代码 $ T) f: J8 x& B
% ~; c/ S. z4 Y7 A2 c. e 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
Q" ]3 R% A: c7 karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 V+ n; y$ n, z0 B. @; B Y4 e
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 t6 s! W; N1 k+ _$ k8 b1 }- f3 |* t7 L, J
' ~5 x7 W1 R1 q$ ]3 y |
|