|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 J1 [2 K2 ?5 A% t: z# J4 K- [code]EDMA sample test application
- B7 ?! p0 l, b - /*1 v+ w$ X* b. Y2 t4 E' x
- * edma_test.c
) j3 k/ j# K4 p% ^# L* ^# ^& L/ M - *, J, F# u; A: i' u: B- v! \4 N
- * brief EDMA3 Test Application
$ j/ s4 m& T# T - *
( O3 j5 s7 f) ^" f* m - * This file contains EDMA3 Test code.4 S; p4 e( z" A; [% c
- *
+ l0 ~/ W W& T0 f* H' g0 s - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& {7 b* l& l$ M' t; [. |: Y, k
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 M" q! N( Z. O, g v0 W! W2 o6 @! P
- * TO CHANGE.
]8 w* @9 u N$ L# Z# I" T - *
. u7 W" h1 T6 X7 w" O4 ^' c: p0 `( \ O - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- c, A( w3 g2 S) {, T
- *
: B$ H5 I6 Z' L) ^4 f9 ~ - * This program is free software; you can redistribute it and/or M8 }) A4 D( c- c
- * modify it under the terms of the GNU General Public License as0 Y% u- ~, j+ X7 B1 f' L
- * published by the Free Software Foundation version 2.( x: @! u3 ~5 Z2 s$ X7 E1 C$ n3 P
- *
% e) D/ Z4 E0 i( ?1 E - * This program is distributed "as is" WITHOUT ANY WARRANTY of any; {. t1 f' J6 G. r
- * kind, whether express or implied; without even the implied warranty! W- F+ N2 P. ?5 Z) ~0 m8 q
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the/ |7 J4 I8 w6 R$ l4 {4 h
- * GNU General Public License for more details., O& a. Y& B. L+ h
- */
" ]8 a4 V, U$ S! S5 L - 0 z- g a& f3 ^$ ^5 o/ y
- #include <linux/module.h>
" ^- r9 D% z; H$ \% L4 } - #include <linux/init.h>+ L6 z" a2 U2 n3 S. x4 y4 b
- #include <linux/errno.h>
8 G- P r& E- Z. N) T - #include <linux/types.h>, {# |. @2 {% h2 A4 Q% i: L" r
- #include <linux/interrupt.h>
6 n; K% M; e) U$ T9 A! P - #include <asm/io.h>
# D8 I# g: i6 I4 }* D9 `- r - #include <linux/moduleparam.h>
$ r5 o2 U) D9 [) P - #include <linux/sysctl.h>
# G5 \5 w9 H; \ - #include <linux/mm.h>0 V) u) q" t% N! S/ F6 L
- #include <linux/dma-mapping.h>
( w7 r# l r3 m* g7 L' N
3 G( W% F& F c6 j! @& U& D- #include <mach/memory.h>
7 Y( w$ T3 g8 p% m' Y% A# a0 U - #include <mach/hardware.h>7 S( ~* q6 B2 k" I1 r
- #include <mach/irqs.h>+ o1 ?' l6 n; I& P
- #include <asm/hardware/edma.h>2 E1 t, o2 f- j+ `8 E0 Y4 G9 O, U( o
- 6 v7 A. L* t f6 ?. Q. l" Z; `, t
- #undef EDMA3_DEBUG# u) ~6 j* G% Z7 w3 a ]' K
- /*#define EDMA3_DEBUG*/
6 ]. ^+ t5 f7 x) I2 F Y
- e; C$ g4 a: v- #ifdef EDMA3_DEBUG* Q% E$ w/ M$ V9 g
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* R$ Y& T9 K9 t6 L% M
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ f( t7 o) j8 N2 {" p0 k
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
4 @7 S3 y8 Z* v: Z/ a7 a - #else( h# E9 R, b8 w. D5 f# Y$ K/ @
- #define DMA_PRINTK( x... )
9 ]) W c' A8 _8 L6 F - #define DMA_FN_IN
1 |" `: a4 Q( Y$ h+ \ - #define DMA_FN_OUT
! @* @# X" A- F9 b7 D# W! ] - #endif
0 N+ B8 r7 l B& q, U# g - 6 {; L; c/ T( W' V4 {. H7 ?
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
\# l, } N* L. Q H - #define STATIC_SHIFT 3
% O3 K! d: J7 G. F J. L! e - #define TCINTEN_SHIFT 20
; `2 U# Y" k( h- F* d& A% ^ - #define ITCINTEN_SHIFT 21
" Y! f& y! N8 d/ a - #define TCCHEN_SHIFT 22/ y# r7 a: I; z+ _
- #define ITCCHEN_SHIFT 23/ Q S# c. {/ I. @3 k* I
0 m2 m7 `9 ~% S2 G) U+ u! @+ u6 m- static volatile int irqraised1 = 0;" Q4 x3 U) X7 E8 |: D4 M" j
- static volatile int irqraised2 = 0;9 O2 T- |- c8 t3 B5 N: C& k8 A
- ]& H$ r& |" x2 H' g- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% X5 I1 n2 E' s* ]
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ ? |/ f1 s y% W* D6 i' U$ t
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* y- S9 `6 E; | U2 [
: ^0 Z M2 B# M. h: v$ n- dma_addr_t dmaphyssrc1 = 0;% \2 q6 W/ K9 q4 Q
- dma_addr_t dmaphyssrc2 = 0;
. ~: J5 z8 a3 V! o - dma_addr_t dmaphysdest1 = 0;
. |2 Z6 r( Y5 b+ ? - dma_addr_t dmaphysdest2 = 0;
9 s7 G/ j/ t: h
6 J0 h7 [* t' J) ]: G- char *dmabufsrc1 = NULL;% l# O; \: V: l) U$ b' ^& @' A
- char *dmabufsrc2 = NULL;* i3 g+ c' v( K) f0 ]& s0 g
- char *dmabufdest1 = NULL;: y* U" M# B! k0 {2 t# a u
- char *dmabufdest2 = NULL;% F7 l0 e8 F M) p
" v" ~7 p: e/ ^" i- S- static int acnt = 512;8 Z1 O1 x* t2 I- `
- static int bcnt = 8;
m e' v0 d! X/ L }& {' k( |: u- L - static int ccnt = 8;
* v% y5 l0 X& a4 S. c/ E) F - 7 M2 l# G* t; [
- module_param(acnt, int, S_IRUGO);
. s6 c/ c; F8 L3 H1 j0 S6 q8 U5 ] - module_param(bcnt, int, S_IRUGO);
( C9 V" S3 L* i" t - module_param(ccnt, int, S_IRUGO);
复制代码
! K X Z$ t, [; a: m6 w* v9 s& N; r
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& l2 e0 R2 k H1 Zarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ p* ~9 ], G' r# h1 v5 F4 b 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 ~$ `1 j( Z! B; w2 h
: r; N; d3 ?- f5 [+ q
( `- q2 K( ~- }" m% v' ^ |
|