|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& [ P B5 S# E4 R/ f8 h8 L- [code]EDMA sample test application
: ~& O t6 D- n$ R7 I0 r# U( M/ s5 | - /*
- f m6 q" p7 z0 ?* }/ b, L$ ?: V3 s - * edma_test.c) l6 ]$ d( d- T( H3 p `
- *
: }) Z8 _7 V/ `- ^% Y4 x- F7 O - * brief EDMA3 Test Application
6 \8 \& f/ |3 s# c; i9 @3 h - *! w; `+ g' @! r4 ?9 V7 h0 N
- * This file contains EDMA3 Test code.
, L7 I$ B( `9 Q8 a: } H% [ - *
& {: _* O( ]# |* s/ [6 O X# u - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ E5 p9 c. H% G# C4 [- m
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
9 d/ t& w5 s# k, @( W, M - * TO CHANGE.& K8 o2 }) K& x3 H. D
- *
Q0 {* e/ K, L' z - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
' g- O0 j. L- |. i7 q - *
4 x& N# O0 q# w- U5 D - * This program is free software; you can redistribute it and/or
1 @: J8 Z# w0 d* E5 ~! d9 I; d. t6 d; Z - * modify it under the terms of the GNU General Public License as
5 d" j: t$ j4 r* c# [' c. Z& E - * published by the Free Software Foundation version 2.2 m/ T5 H7 l$ U' @* \ B7 l: f; [; W
- *
* I+ ]# J, K3 }) Z$ W7 } - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
* S- j- W/ z8 T0 k/ l - * kind, whether express or implied; without even the implied warranty& ~1 F; U) a4 `- Y$ `! L
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
' h( K' [7 ?; v! i( A - * GNU General Public License for more details.+ Z1 j4 h) L, i. l
- */
0 |; N# ], Z& `( S1 P( e
9 t" O- A% n) ^% I- #include <linux/module.h>! ^, E+ x; r& U/ T: ~% m
- #include <linux/init.h>
" r1 v# M. I" E9 W- {) N - #include <linux/errno.h>
9 b; _! v1 U$ x1 w( {) } - #include <linux/types.h>
. ~2 `) o5 v# y. F* q - #include <linux/interrupt.h> l, X1 v4 `) K3 b- ]" D
- #include <asm/io.h>: L) b, c7 l; a0 H
- #include <linux/moduleparam.h>
8 N0 b. p+ \2 M! j' L% A - #include <linux/sysctl.h>1 x+ [5 b8 j( S- O3 x) x* `
- #include <linux/mm.h>
4 S+ a& P0 [" T) ?; s+ ^ - #include <linux/dma-mapping.h>
& a, \/ Z/ i, R% l - ( N+ \) g: T) o! u, k8 g* J/ R, h
- #include <mach/memory.h>; U! c* V4 j6 Q3 I! H V2 F
- #include <mach/hardware.h>
5 j# F. H F# ]+ ^; I; G - #include <mach/irqs.h>
+ G' L; A* f% M$ s9 h: G6 _/ [7 u" E - #include <asm/hardware/edma.h>, J" A: U' ?" W+ F# O- O
1 Z+ j, H+ G& q' \ x& B6 e9 g- #undef EDMA3_DEBUG7 b5 |# y. e: G2 Q8 k
- /*#define EDMA3_DEBUG*/
- g& @2 ? u! p" s9 A W, U" ` - 8 y. A! O( a9 y! p' Z2 k. @+ @2 q
- #ifdef EDMA3_DEBUG- E- ]" l R! K# ]. D; G
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
- E5 ~5 _+ Y' a, ]+ {4 K) O z - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 W7 K/ P- |. @; B3 o
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 J+ X' w, j+ {: D! p. y
- #else: A( {1 o4 B' |
- #define DMA_PRINTK( x... )3 N% V( Y$ {- [5 l
- #define DMA_FN_IN
& |: J0 Y# y' o; s: n, }6 Q - #define DMA_FN_OUT
- n) s" c+ X* o0 v \9 r- \! i& Y - #endif# [8 n. z) c3 [: f j
- Q& S9 K* f8 F1 ~4 J/ i9 x
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
' J q" Q; c( \1 l, P' M - #define STATIC_SHIFT 3
& Y6 ]2 V# n0 O7 j2 P# r, I$ D - #define TCINTEN_SHIFT 20
; D& ]5 \0 J2 q [8 m - #define ITCINTEN_SHIFT 215 R* } _% z. b5 j! p9 F" X' |
- #define TCCHEN_SHIFT 22
' m$ H, ~* n, [" @& H - #define ITCCHEN_SHIFT 231 X) ^( \2 n# |2 i! @. a4 [
- 0 b0 X6 L4 i. f1 {
- static volatile int irqraised1 = 0;
% F! l' t' T# I) t* o+ q: C - static volatile int irqraised2 = 0;, v. c/ B5 R' ?) W/ _) H- F" E
( H, e2 X m6 r" G- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& r5 d* z3 G1 q$ C1 u4 a" B! M - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# q' u5 O- m6 r5 ]6 i - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 u# k/ e D( ^3 s# M, u0 [: \
- ; j: P" s2 v" L( N) J( o
- dma_addr_t dmaphyssrc1 = 0;
% r8 {) V, ^6 U! _8 I# R8 H6 U1 n) o3 [ - dma_addr_t dmaphyssrc2 = 0;
* I0 r; e d! \2 }9 i4 u - dma_addr_t dmaphysdest1 = 0;) {% J# d7 D/ J- V, Q. d4 v' H
- dma_addr_t dmaphysdest2 = 0;
0 |) h- S5 `# w. n& b: C. | - 0 W6 @( F5 m# A* i B" L
- char *dmabufsrc1 = NULL;! d" r, h$ D- Z+ V& @0 _
- char *dmabufsrc2 = NULL;% `$ q6 U/ ]- |; a1 J! `
- char *dmabufdest1 = NULL;2 e0 A7 m, Y: d8 ?( k
- char *dmabufdest2 = NULL;% d/ h/ V; k N, j
- * V+ {7 R E) G$ p2 w" U0 e) Q( A
- static int acnt = 512;7 p1 r, m# Y3 D l" D" `$ v
- static int bcnt = 8; @- h; O" H( l+ I5 h
- static int ccnt = 8;1 N" J, b- K9 y1 S8 [+ M p
- 7 I) l9 g2 E. V- A: Y0 v4 f8 {& c" A
- module_param(acnt, int, S_IRUGO);# j. c" Q, N' X2 w3 Y9 T
- module_param(bcnt, int, S_IRUGO);
% Z" k- X' ]* S( i: h) q% S - module_param(ccnt, int, S_IRUGO);
复制代码 / |- n$ a# X+ C# y8 {0 r @
2 K9 B0 b6 P1 W3 p2 P 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" w9 O, s8 r6 n0 V5 ?
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! }1 T3 Y; E' Z3 } 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 c# E" g p. P6 i
- i7 ]3 ]% j* i! U
# \. y" K& [7 G
|
|