|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ e- l/ }" q" k1 }
- [code]EDMA sample test application
0 e/ r8 B; S3 ~3 N - /*7 q" A! Y+ N8 e. I, |: O
- * edma_test.c! Q4 s/ K$ H; o: z% F# D
- *- W3 y: }: e$ c! `+ |/ I
- * brief EDMA3 Test Application1 H0 ?1 Y- o5 @* [7 s
- *
9 ~; ]% N7 H, i$ R( T3 j* F - * This file contains EDMA3 Test code.5 R" v! e- g+ ]( K. x
- *
1 ]; ^9 @8 P3 n$ t, f - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& \. p" p$ f$ G
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
& K. |6 C" _& A2 V* l6 E - * TO CHANGE.$ k# B7 Q, f5 u$ j1 E Q8 c
- *7 h4 ?1 P, A% W* ]( ? D6 U
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 P( v6 x0 P$ ^- c- g) b
- *$ T( `: u$ C* I- S/ W6 F
- * This program is free software; you can redistribute it and/or
" g7 x' e5 k' k - * modify it under the terms of the GNU General Public License as
# P9 O9 N J* p. w9 p, {, i( {* ` - * published by the Free Software Foundation version 2.( }3 c7 v# _/ r9 C: u# ^
- *
5 Q. S6 N4 s* X% u9 { - * This program is distributed "as is" WITHOUT ANY WARRANTY of any# _4 v9 _+ q- B1 w
- * kind, whether express or implied; without even the implied warranty
. P( B0 g4 \0 |& ?0 \! {0 k - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
. Z, D* J: Y8 B% Y - * GNU General Public License for more details.0 y% i5 v( \6 I8 Q2 {+ e4 f
- */
& ~& L8 L* M, C- v
6 h, o/ k8 R- R- a- #include <linux/module.h>
( P+ v: y# G4 {1 B9 `) }1 a4 a - #include <linux/init.h>2 H1 z9 y7 T1 V& U! j ]' B
- #include <linux/errno.h>
$ C' o9 J K1 U( E' D+ o# N; I! _ - #include <linux/types.h>1 h# m# D$ g: f; {! E
- #include <linux/interrupt.h>) \0 }2 Y( X1 Q
- #include <asm/io.h>/ F" f3 j8 |0 q. X, Q
- #include <linux/moduleparam.h>0 u4 V8 m8 |3 O5 x' B: R1 R p
- #include <linux/sysctl.h>
( x( M4 G' Y: U+ C - #include <linux/mm.h>
) i# e' w3 Q# k- \# d - #include <linux/dma-mapping.h> N. s& R5 b- p/ x# ~$ z% |
- ' @; z* w7 K2 S, e2 ~) _
- #include <mach/memory.h> X1 s% A$ E/ m/ B0 B
- #include <mach/hardware.h>
" D1 e) _; Z- |( Z. H# F6 O- | - #include <mach/irqs.h>- U1 [; P6 w% } w
- #include <asm/hardware/edma.h>
' ^ W/ F2 b$ G
- j. A; R) i! |1 k: ]4 K: h- #undef EDMA3_DEBUG' s) @1 k- F* C3 y; C2 I3 j C
- /*#define EDMA3_DEBUG*/' K7 Z$ i" n6 a' G3 P- `0 a" X6 P' b
- 2 c6 }3 G( h4 S/ S1 v
- #ifdef EDMA3_DEBUG A: d% W4 M+ N6 F: e b" N( v
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): N# I) P) {0 C- e) S+ L
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 a z9 F5 g4 B( g! C0 ^% }
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
" {7 I1 M5 Q- @" x. k; H - #else& O# T! K$ Y, F6 b& {
- #define DMA_PRINTK( x... )
* h3 s$ L: p1 u% @7 L6 Y% g' y5 ` - #define DMA_FN_IN3 ?4 n/ R i! j4 E! c3 P" Q0 i# v
- #define DMA_FN_OUT
9 L, N4 {2 I. Z( }1 S! t - #endif" M9 s8 b" P: |6 U
9 Q) @7 _6 a7 F- ]- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
) g1 c8 n% I. I- z - #define STATIC_SHIFT 3
. T7 V/ g3 S& R7 y7 v% F - #define TCINTEN_SHIFT 20
5 n' j( U7 I, X" {3 K3 L+ p( F/ t - #define ITCINTEN_SHIFT 21
! {' E4 h- \# t - #define TCCHEN_SHIFT 22( O4 y* L$ r) A
- #define ITCCHEN_SHIFT 235 X' q Z5 v A# `$ {* Y
- 5 p7 n7 T z2 I1 y2 d2 y5 W, n
- static volatile int irqraised1 = 0;5 u8 N, O( P/ h D4 a, C! d: c9 Q
- static volatile int irqraised2 = 0;
/ S1 S- r" i1 N$ `' v6 e8 s$ e3 o - 4 s7 K4 G' v8 S1 o6 z" P3 t
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ A: I9 m! W x) |9 K - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" a3 Q" n. d/ N8 ? - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 p; u0 B! q; |+ r$ {; L
. j# O* U5 u' }! k- dma_addr_t dmaphyssrc1 = 0;3 P8 Y; B+ {1 B8 b* \6 @0 V8 m
- dma_addr_t dmaphyssrc2 = 0;
1 @+ d5 m7 z8 O, u: G C, T( T+ D - dma_addr_t dmaphysdest1 = 0;
2 ^" T3 a$ m* t5 L$ { - dma_addr_t dmaphysdest2 = 0;& o8 t) v" j) S' S
- * ^) ?+ S$ b1 ^% M7 A+ P6 y3 X
- char *dmabufsrc1 = NULL;$ G o+ x& ]2 U7 x1 o
- char *dmabufsrc2 = NULL;. ~. Y* d( W6 v$ l1 ?8 X) }% }
- char *dmabufdest1 = NULL;0 o4 p U' ?3 l
- char *dmabufdest2 = NULL;0 U7 F3 V; U" z$ ]
- 6 _ ^* f1 I2 u, F
- static int acnt = 512;# [5 G4 h- @$ b) |
- static int bcnt = 8;2 }# N! C! m4 C. [, f# D E
- static int ccnt = 8;# g% U6 l/ ^( t, C7 j8 ?/ K, n: k
9 Q. i# k/ e( C P- module_param(acnt, int, S_IRUGO);, U, c' x4 q) l# w
- module_param(bcnt, int, S_IRUGO);* l. F" h4 M" ~5 ~) M% {
- module_param(ccnt, int, S_IRUGO);
复制代码 1 E! ~- L6 y# D+ c1 Z% W& Y" T- R
% T8 f, D. b# r" c1 r
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& N8 X- ^: v* S5 h
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- N' Y+ `7 |- T! J 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, O% v# a3 ~7 c& w: G2 @/ L
9 H, o& B: a; H$ B! m) I5 L; o$ h) ?1 O( Q0 ]" r
|
|