|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 e9 i& |: t x. q4 N; f
- [code]EDMA sample test application" \$ F* Y$ _, I' M- P; \4 Q& U
- /*
* E8 A6 C- I/ D - * edma_test.c
) V& ]% ?5 h# p3 `% \6 ~* a - *
! d! W* ?+ G! C8 _2 } - * brief EDMA3 Test Application6 k/ K4 b% ?$ E2 }' z# }; Y
- *, r. M: I ?! m: T
- * This file contains EDMA3 Test code.# n4 Q) v# ^+ t
- *- U o L/ g6 e7 G2 U( l
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ S; C# q$ K# `$ ~1 f% ^
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* X& X2 f, ]8 ~' j# ]5 J2 ?
- * TO CHANGE.1 R, n% \7 g5 s& A% y$ q
- *! B0 ^ l. y# _
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" `/ w, M3 r( a- _: I8 w, Y* Y
- *
5 V3 K$ j* s6 D0 H- o1 t4 B U& \ - * This program is free software; you can redistribute it and/or z9 L$ M: w2 {' J5 r! X# P
- * modify it under the terms of the GNU General Public License as( ?) J1 y1 ^( |1 J' H; F, V' S K) c
- * published by the Free Software Foundation version 2.' r" R- _) ^+ H9 @5 @4 E
- *
* B+ E( Y4 ]- _9 B' }* c7 s - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
/ L0 C* A% @- d! ?' j - * kind, whether express or implied; without even the implied warranty! X! ?# G$ D- F+ Y
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1 y% n: j# [/ f$ P* j! _
- * GNU General Public License for more details.+ ?/ E% h1 S. ]8 g# C6 [1 U6 Y
- */
9 y7 |3 z( `0 [. d$ l - ' A; e$ n' ]# p
- #include <linux/module.h>1 n$ Y" H U( w, _ a! X
- #include <linux/init.h>. W7 y6 }3 j9 c5 L1 a$ U" L
- #include <linux/errno.h>
# w* L' E9 _1 U - #include <linux/types.h>: R4 U- f9 G5 t% }# J4 ?0 I# `
- #include <linux/interrupt.h>
; N. F& d" }# x: {# b4 a" ? - #include <asm/io.h>, v0 }0 v/ q5 `8 l
- #include <linux/moduleparam.h>. Q% @* U# N" U- ^7 L$ @' z4 j; u
- #include <linux/sysctl.h>
; l8 J$ j1 u& ]. W* X+ X l# A - #include <linux/mm.h>
3 p1 G7 }5 w- {8 `, M p - #include <linux/dma-mapping.h>
n# U1 T; t7 ?+ U) \& h J
, i( t8 Y s7 C) z# R& {" ^' {6 l) I- #include <mach/memory.h>6 E3 D- v. _6 q8 `! Z4 N
- #include <mach/hardware.h>
, ~2 F6 b/ B% n3 [ - #include <mach/irqs.h>
2 y8 V8 y0 n( g4 c9 X. ?* E { - #include <asm/hardware/edma.h>) F( ], |/ ^2 ^
- & A% ], K% J S* j
- #undef EDMA3_DEBUG
) R1 v% j0 [: a" w7 p4 d - /*#define EDMA3_DEBUG*/$ a6 r; s! o' D( }5 X9 F
- % }+ }' H2 p+ B. _3 k; Y P
- #ifdef EDMA3_DEBUG4 Z! q1 B. t3 u
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# c2 x7 Q4 l7 n) @1 C. x {( N
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
8 y/ V; v) P4 X - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), F% e; w8 f! {( t: F7 y
- #else
0 u. |" u( \4 T9 u S - #define DMA_PRINTK( x... )1 m% \# U9 c( R6 E) n
- #define DMA_FN_IN0 M v) L6 |' n0 r
- #define DMA_FN_OUT
2 b8 o: R$ y8 i: I( | - #endif C2 D0 o ^& a( N6 N8 ^( Y7 c
- & W7 O8 H7 t. S3 Q" E4 Y' ]
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)5 h& R6 e2 c# x2 D
- #define STATIC_SHIFT 3
5 W( c- u# s! @9 Z9 l - #define TCINTEN_SHIFT 20
K1 J: @- d! b% ~. q - #define ITCINTEN_SHIFT 21
$ z! O3 y4 T" U: }# Y - #define TCCHEN_SHIFT 220 S; b# z: w9 }9 ?0 L& p& c7 _
- #define ITCCHEN_SHIFT 23
% C6 s2 w' K' p6 l3 H
1 \- L# C3 M) o5 s, S" a- static volatile int irqraised1 = 0;
6 C W& v4 M6 V7 p/ H - static volatile int irqraised2 = 0;
3 j5 V: F/ U, k4 u! o+ N - ( l6 w# h! A0 [6 V
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 N5 [0 J2 A# Y( C
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: _$ w ^0 Y! ^0 B- W5 d! }5 \ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& W5 L5 Z: [7 n3 o1 f - # ~- }( P4 T- ~: y5 f
- dma_addr_t dmaphyssrc1 = 0;
% ` s% R5 x/ k: I1 P - dma_addr_t dmaphyssrc2 = 0;
) Z* h+ h1 M+ U. f# F- X) C - dma_addr_t dmaphysdest1 = 0; O5 ?: d2 k" n' g$ `, e2 x
- dma_addr_t dmaphysdest2 = 0;- T4 U9 s8 P1 ]# f% P8 d
- 6 z3 z, [7 Y4 ]8 f4 N$ m
- char *dmabufsrc1 = NULL;
& A _) G4 | M0 W: z - char *dmabufsrc2 = NULL;
7 b4 u/ {8 O/ l; w/ [6 ~: b - char *dmabufdest1 = NULL;5 {# [ C) i, m" d
- char *dmabufdest2 = NULL;
" Q1 j! \9 ?& U+ o5 I
/ n! `& L v7 ^ p3 b; v1 H; A- static int acnt = 512;; h# Z6 [2 [/ q5 |: D- ] ~
- static int bcnt = 8;8 d6 z4 C6 u' |- W/ P6 {
- static int ccnt = 8;
/ l& o/ x/ @& Q+ h9 V
" u/ V7 v$ S2 g/ y) x1 i- module_param(acnt, int, S_IRUGO);. l- q# o) }% `! s) K
- module_param(bcnt, int, S_IRUGO);
4 `. o! \) Y) G8 n2 G$ S - module_param(ccnt, int, S_IRUGO);
复制代码 ) m9 ?. P' b: v
! O$ g! }$ X. ^4 @5 v; b, \ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 g" A9 q% J8 ^- g9 q
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 q6 |; D% H1 s 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 n: y, t0 e% w
2 g) X# G: X5 p# v# r( b' D6 v2 i$ m
|
|