|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % b% h7 Q2 L0 f! E3 F" v3 P, N
- [code]EDMA sample test application
& G% T$ S! ^" f: |6 d2 x# V - /*
- I" u2 ]7 P! S, ^5 v8 ~: p# a! [! O - * edma_test.c
' y1 p9 K1 N$ M5 V: z9 Z! s% N - *' J5 n, o( f1 K; j; d6 V0 b
- * brief EDMA3 Test Application- s/ d8 b. F( L+ s9 i, o, q6 f
- *
4 M! v3 t$ i. d1 o2 ~ - * This file contains EDMA3 Test code.
7 X! i* }& H G4 S/ m/ ` - *
/ l2 o% k6 v! s. k/ a. o' A! \! g - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
5 T. t! K% x' w: F3 D) K - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT V! P3 j4 u9 d8 \9 U
- * TO CHANGE.4 m# l/ X$ F) e( J* D) G0 W$ N
- *4 i) ^2 |- j6 k3 n5 z6 J
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. w' n4 K7 |' o7 }: ]
- *- C( G0 g9 p1 @, e* ^
- * This program is free software; you can redistribute it and/or
^0 f8 s* [/ {+ |" L) [ - * modify it under the terms of the GNU General Public License as
! R4 X9 _0 e6 p/ \6 X - * published by the Free Software Foundation version 2.
5 A J" w1 s# T$ f# v - *7 p; N( G) v2 ^4 Y7 I" G
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any) R) I$ N4 G8 x" z4 a: \7 |3 l
- * kind, whether express or implied; without even the implied warranty- x" V5 F- D9 T" C
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the5 _$ O7 U2 [' e2 K
- * GNU General Public License for more details.
: h0 r9 a$ v$ T+ J1 y/ V+ x& w" k - */
0 ^. C+ w1 l" `. y7 n- I/ A9 ~, ]
9 i1 ]0 H4 E2 a' M! [& V- #include <linux/module.h>1 K C3 Q4 G$ f# r! K# o7 b
- #include <linux/init.h>
4 e, b$ r l+ G/ x) M: U - #include <linux/errno.h>( B! H; B! v/ M$ v0 B. i, \
- #include <linux/types.h>6 ?$ h! u! L# a( X M4 m
- #include <linux/interrupt.h>
* j, _7 P% Y; U1 m' k# }9 n - #include <asm/io.h>% H/ r: w! k9 t
- #include <linux/moduleparam.h>
# B) E0 T3 p$ A: F - #include <linux/sysctl.h>
! R& U! l x0 m7 _7 @7 l - #include <linux/mm.h>
8 P* x! P6 G" l2 D$ ^( Y. k - #include <linux/dma-mapping.h>6 F# K/ N5 f E; _1 n
. n* w" } I. I8 M/ f- #include <mach/memory.h>; a/ S! R' B2 t9 b+ U s
- #include <mach/hardware.h>; w+ N! o& ?1 m% @# m) w! M
- #include <mach/irqs.h>' f! \4 V5 t" g* E
- #include <asm/hardware/edma.h>3 H2 R; x8 K) V6 @3 l$ O4 F7 M
- : o2 l2 V0 d5 `: g$ {4 @! w- }
- #undef EDMA3_DEBUG! K# R* \1 R" U) _! {" h/ Y
- /*#define EDMA3_DEBUG*/7 [- u1 H% {3 b& y
7 {6 }& T6 L( [+ Z5 h3 r- #ifdef EDMA3_DEBUG
) e9 G% `) B: D! s, }) Z9 e - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). z" n; ]% G1 Q( ] j4 }9 [4 R9 k
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
5 f% f- P0 o; I8 N - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
2 H5 {, V% z( D) x - #else
2 f0 i' @: [& w - #define DMA_PRINTK( x... )2 ?: ]6 H8 D3 F# i& N2 C
- #define DMA_FN_IN
, c$ J. u* q& W1 `% s3 R6 E+ E# r - #define DMA_FN_OUT/ V2 ~9 d) f. g, ]
- #endif
; c/ }- Q0 \% R2 I7 l6 {6 F
: ~- t( f# |& Y1 m+ y; \& u- #define MAX_DMA_TRANSFER_IN_BYTES (32768)1 D. ^% c( t0 z2 p6 [% `2 E
- #define STATIC_SHIFT 3
5 c2 G9 M7 l7 x2 s5 v) N) N5 d - #define TCINTEN_SHIFT 20
3 U @9 a- u: I6 ? [6 G - #define ITCINTEN_SHIFT 21
, @7 |( g, g& Z; i - #define TCCHEN_SHIFT 22
5 C: b4 ]$ w3 C/ p - #define ITCCHEN_SHIFT 23
; M& Z K+ k; A, l, f' s6 S- t - 8 E w6 b. O3 o# w( b
- static volatile int irqraised1 = 0;3 o' m" p, ~" t+ j: G8 B4 E
- static volatile int irqraised2 = 0;
' T) K6 Q, W ?! ?. i0 V
' x8 [. ^7 p, d& i2 I9 R- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' _+ {: E6 o8 }1 e1 v7 I
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ e! h/ A% Q4 |1 l3 k - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% f) ^+ A( G: P9 R' i
- * c/ H# k$ `. G" ?7 H k; l/ M0 u
- dma_addr_t dmaphyssrc1 = 0;0 }% n" f# ?: X7 |# T0 o/ N
- dma_addr_t dmaphyssrc2 = 0;7 j# r; k# \ D8 Y9 |8 h2 f, V& b
- dma_addr_t dmaphysdest1 = 0;5 f, b* V4 `9 G. n. v
- dma_addr_t dmaphysdest2 = 0;
7 X d$ T. O) k
3 g1 `1 A, A/ b# `( _2 z- char *dmabufsrc1 = NULL;
& A9 d: l3 S' i }/ i - char *dmabufsrc2 = NULL;
7 V& [- h* P5 y4 B8 @( b2 D - char *dmabufdest1 = NULL;
$ q& r9 L8 Q/ P: d! E0 H& d - char *dmabufdest2 = NULL;
1 m* o$ ^, i/ G. W
: S+ y* I) R+ w; g- static int acnt = 512;
1 n4 u- i- q7 y6 B' v( Y, K& \0 \ - static int bcnt = 8;) f, u x8 L; J8 f9 Q3 r
- static int ccnt = 8;
8 U6 S M1 }9 {4 N$ ~- ?
% k; f, |) o: b7 m! V3 D+ z- module_param(acnt, int, S_IRUGO);
1 B8 r3 j7 E; O; w( N( O - module_param(bcnt, int, S_IRUGO);
' E7 H+ }9 r# v- w/ b2 N0 S - module_param(ccnt, int, S_IRUGO);
复制代码
( \5 M/ G* ^" Q3 j6 G! c% s- s/ N! L- ]7 B- y0 }
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' S3 v' A2 j! W# w/ j- r
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 F. r5 s1 D- m+ ]! T# l& g 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 L+ o" R1 h1 z* j* G
# a6 H9 d# q4 b, V
" X; W; J/ ?: n) W! s2 v
|
|