|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# [6 d" P" S' m1 |* l' l- [code]EDMA sample test application
9 \5 M9 t/ d: C, ` Y - /*
/ q. @& H, a9 J/ B$ x0 w/ b - * edma_test.c
. U2 u# f, Y( i+ b - *
3 ~6 t2 I, X p k0 K( S - * brief EDMA3 Test Application$ S0 I/ B0 X4 E$ H& J5 h( ]+ n4 }
- *
_. N+ J. W# l8 ?- `# X - * This file contains EDMA3 Test code.$ s7 f" g) y! ?% d
- *
4 `. b7 f8 O3 k! s) `1 h/ T2 S - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& n8 Q, A7 v; E/ p
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& f8 Z8 L5 F! w" k* K
- * TO CHANGE.; ]8 V: x c* ?% c" S2 e
- *
: P3 J8 C) O# T - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 p( t7 x/ I% A! ?8 @
- *- o& Z U5 L6 t7 _' x9 W
- * This program is free software; you can redistribute it and/or8 q/ D+ T4 E! I
- * modify it under the terms of the GNU General Public License as* L% J% _- P1 L) J4 D& b# B
- * published by the Free Software Foundation version 2.; L& r) F( p+ W! P9 F9 a' e/ Y
- *, F# M. }. k ]: n+ G4 E
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
, H$ `2 m; H1 c- D6 |& L! w - * kind, whether express or implied; without even the implied warranty5 ~1 a2 W, U, Q, j# G" s1 k$ D
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
. a0 M/ O# w: ?* Z, c8 K - * GNU General Public License for more details. w: M+ o3 p% m x6 X
- */, Z( b" E% F o$ m# v
; T' i$ G( I9 C H9 q- #include <linux/module.h>
" F2 c6 c/ p% h3 Z3 U3 ?' x( f* h: U3 { - #include <linux/init.h>, g/ U5 y* a. p8 C) l' D @
- #include <linux/errno.h>
! @ U, S/ ?9 g* ? A: S - #include <linux/types.h>$ j$ I5 Z+ E* W2 V& |% ^- l) T8 Z
- #include <linux/interrupt.h> v) R0 ~) b+ |5 v' x: h% w
- #include <asm/io.h>; `+ z4 P$ o0 |" N: S
- #include <linux/moduleparam.h> Y7 D. f% G0 o- w
- #include <linux/sysctl.h>
' A& y( i$ f3 t' ]' P - #include <linux/mm.h>
! e7 c0 c* x2 G7 H - #include <linux/dma-mapping.h>8 n& T8 d$ O! z+ \9 @! U, @7 `
* z' r# z; e: ? ]- I# G- #include <mach/memory.h>9 c. o. F/ q$ _
- #include <mach/hardware.h>
; P$ @5 r- ~% ] - #include <mach/irqs.h>7 o& ~3 ] Q+ L# n7 c
- #include <asm/hardware/edma.h>
; E, y, Q' M( C* t ^$ G - 1 P! x4 j! e3 b( o" _
- #undef EDMA3_DEBUG
% q8 l9 _* D9 B1 F5 b7 ]( @- \ - /*#define EDMA3_DEBUG*/
$ A1 [( G7 k j B5 N+ {. R0 f( K - 3 ~. v3 v4 ~, q7 X) ^3 v% k
- #ifdef EDMA3_DEBUG
( x/ i& j5 n, t S1 z8 W0 O% ? - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
* z. _0 _8 }: C- a - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
7 H9 y# S8 h- C" P0 B( B$ i# a - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
2 p1 W0 R3 W( m2 U- } - #else
$ K" v9 P) {# J* A - #define DMA_PRINTK( x... )6 z. v `. u0 D# h4 ]
- #define DMA_FN_IN' N" u$ G! j% s: l2 L
- #define DMA_FN_OUT
2 a: z# W. y8 W& I( h. w - #endif0 R) G( Q; f# G6 S- E$ k3 K& W
! G1 s+ D1 T# e- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
' B- b+ w7 f: A3 p4 r" Q! @1 Y; a - #define STATIC_SHIFT 3
# _# n! D$ H' y - #define TCINTEN_SHIFT 20
: H( D$ r" t8 H8 {4 y0 A - #define ITCINTEN_SHIFT 21
- l) `6 }, j& l7 a/ i. f+ h7 u - #define TCCHEN_SHIFT 22
2 A& b$ y0 V1 _+ {. T( a: N, i - #define ITCCHEN_SHIFT 233 i0 }/ M3 F3 g) B
; n J7 H: l/ j @. y% K t- static volatile int irqraised1 = 0;7 [. K+ \# ?; N# f2 r$ b5 G5 ?+ D
- static volatile int irqraised2 = 0;' z3 v0 `! d# f7 S I7 O
- : X6 ]1 E6 ~: _( y! m% b; J3 o6 M
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 m% S' u5 z2 x% B5 c: C& ~
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 @* E& g* i+ o5 B1 N G3 k0 s+ } - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ S; {6 }8 c+ M( a2 a9 l4 {
- , @, z& b! d: B
- dma_addr_t dmaphyssrc1 = 0;
- }9 i2 }, O# o* p8 t - dma_addr_t dmaphyssrc2 = 0;
. k0 ^! a/ B" J0 L0 y - dma_addr_t dmaphysdest1 = 0;9 P9 {' C0 `" ^- @) ?& X+ m
- dma_addr_t dmaphysdest2 = 0;
; J2 m6 S5 z- S; | - : p9 S; x; c1 L
- char *dmabufsrc1 = NULL;
$ e5 p& Z) q3 H! n - char *dmabufsrc2 = NULL;
( x% r# @0 a3 c) k) Y! ^ - char *dmabufdest1 = NULL;/ K4 d# J* I! u, i; n
- char *dmabufdest2 = NULL;3 Q( z8 S( I# }( L6 @1 O+ h2 \* D
5 l! E0 z. s; Z& A1 f7 Y3 u- static int acnt = 512;# Q2 s2 {) E; `
- static int bcnt = 8;9 }. o, Z+ {7 n6 o- a; ?$ b
- static int ccnt = 8;
4 e V; R$ I+ c, E
; j/ W3 @) M/ V" y! p0 _- module_param(acnt, int, S_IRUGO);
6 }/ J+ e0 r6 x o- v1 b R% q4 W - module_param(bcnt, int, S_IRUGO);0 X: X) Y* X1 u
- module_param(ccnt, int, S_IRUGO);
复制代码
; u# Y/ |, H7 _* N& f5 ^% s
2 S# y2 ^: K' Z2 `$ D 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 N: R/ S4 C g' Y* N
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 S. _; f9 m0 h, O6 ~( H) V 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 }/ L$ ~( B" Z$ r- c) O
1 [" j7 v4 ^$ _: ^
9 a+ R% s \3 }+ ^# Q" f2 G( r
|
|