|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % j1 o' `" G' M0 d- N
- [code]EDMA sample test application
2 [. J- _* ^6 b4 v - /*5 k R0 ?% X' V8 M* f
- * edma_test.c
- K$ g, W9 s ?; j+ \ - *
- a. e+ ~, V' F5 i3 K - * brief EDMA3 Test Application
3 D4 z* ~: n. `* `3 P, n/ M - *
. t" x+ C. d# r - * This file contains EDMA3 Test code.# G* J7 {$ z, ?, |% F) S9 r
- * F+ Z6 G; h0 B! n* ]" t0 J/ i. s
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
1 |' l6 m8 k e* r1 U - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
8 h, }+ a' ?, F2 _ - * TO CHANGE.9 @ \6 F k7 G3 ?
- *
7 C1 ]- R- p; \* L& D. Z- h; c - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ ^; T) V& M' D, P% V1 Q4 q2 u
- *
! p/ W7 j2 p# f/ D2 L - * This program is free software; you can redistribute it and/or
9 w. ~. J& w: L. P; u: ~, I - * modify it under the terms of the GNU General Public License as' v- } ^+ v/ k# G$ ?
- * published by the Free Software Foundation version 2.
. o* I- N( _# } - *5 H4 Z$ _' z: X8 W1 P8 U: _
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 a x6 {- d$ ]
- * kind, whether express or implied; without even the implied warranty
3 t0 F' f4 J' p% c - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
" v+ z/ Y8 z; S- K - * GNU General Public License for more details.
( x% t/ T- M9 m0 H# t, e# w: n - */
% {3 C/ E: D; A9 C - + Q. z, E" e* _+ Y9 I5 [; y
- #include <linux/module.h>6 C, _3 |4 h- B% ]! M; t
- #include <linux/init.h>
$ d+ g3 y! T$ F; W; S - #include <linux/errno.h>
# I! q* g# k, m7 B - #include <linux/types.h>
3 b' y4 E: ?2 n; W$ A( g J' z! w1 p1 i4 h - #include <linux/interrupt.h>. Z& ^9 }5 i3 @. E" L) [4 ]
- #include <asm/io.h>
4 r1 I+ O/ } V y - #include <linux/moduleparam.h>
8 f, m K& j& \8 b! d - #include <linux/sysctl.h>+ p/ m4 {6 V6 ^( w# l# ]
- #include <linux/mm.h>
7 |9 b& z! ?; _7 m( F; i- | - #include <linux/dma-mapping.h>; }6 W' {& H" S, I* p
# p Q* N, `& Z% H$ }- #include <mach/memory.h>; [3 p! |- S' g* m4 Z
- #include <mach/hardware.h>
' |0 Q/ }$ E# N% M- H% q r - #include <mach/irqs.h>
# x& g' A7 v5 B8 M. J( v - #include <asm/hardware/edma.h>( J+ Y$ _7 \# [6 E1 d0 [2 i
- $ W+ @4 G, a( R/ n
- #undef EDMA3_DEBUG8 c2 G" \+ B/ w5 a. z
- /*#define EDMA3_DEBUG*/2 _' x3 @) Y3 C2 s0 P, E/ X4 e/ l
/ V6 _8 X6 C _+ p: R( t- #ifdef EDMA3_DEBUG% g s% S3 A a- p
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); f W3 T/ J8 i1 S
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): D& E9 T1 V' \* t; D
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 M6 @& M0 }; R( h) |5 l
- #else' P) d0 c3 f6 e, S4 O
- #define DMA_PRINTK( x... )3 ^; T, _) H' a! G
- #define DMA_FN_IN
' g/ o7 U5 n+ m% H' S) | - #define DMA_FN_OUT1 ?2 `5 Y/ h2 I
- #endif
0 c8 k9 O1 A' e) d- v - / K) F+ F$ E# S
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)* H5 G' J0 ]; k7 `7 w F
- #define STATIC_SHIFT 3
; n% Z @4 r2 @7 V9 l( Q2 t& `$ B - #define TCINTEN_SHIFT 20
4 y, G* j2 o# ]9 N2 M/ Y1 L' O9 b - #define ITCINTEN_SHIFT 21
5 F8 b9 `$ @, x1 T - #define TCCHEN_SHIFT 22: ~( f0 x: o* C7 t( l0 U5 D$ K. f
- #define ITCCHEN_SHIFT 23
" I4 e: t5 i; u t& H+ P# ^1 ~
$ \% p7 L0 q, C& \# e( ~- static volatile int irqraised1 = 0;
3 {% R+ `! q* i7 k$ k! \8 L. j - static volatile int irqraised2 = 0;
% t6 J V. S+ P- X- t9 A: G/ z# h9 a0 s - ! B9 Q1 `5 ~! j% E
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; t; a0 q# g; C- V1 {' v
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 P. D, z0 q( p: k4 \% m3 l6 @5 o
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 y7 q0 m- Z6 [8 ~7 n& y6 G" x
" [& ]. }; ~( L. g6 m- dma_addr_t dmaphyssrc1 = 0;) C0 ?9 c0 H" m7 o
- dma_addr_t dmaphyssrc2 = 0;
0 i/ d, q: k/ ]& `% i3 x - dma_addr_t dmaphysdest1 = 0;: J( B" [) z D% v( P/ ]4 H8 C1 C8 ?
- dma_addr_t dmaphysdest2 = 0;- G3 R) J1 }) S1 v
. F1 U& t' Q4 O! A- char *dmabufsrc1 = NULL;
3 f" ?- m$ }3 o - char *dmabufsrc2 = NULL;4 B, x! ?$ C s2 A
- char *dmabufdest1 = NULL;2 G7 g* T4 C( S' n: i% c4 m
- char *dmabufdest2 = NULL;
" ?# k2 D/ i% d/ F# x6 _9 P0 f - : ~" J* E: X* u/ U4 R2 i; l3 y/ D( C
- static int acnt = 512;' h, t& a3 [# a, T/ d8 z
- static int bcnt = 8;
, V& b' O# e$ l' ~. D; c - static int ccnt = 8;
! y; j! }! ?. K3 R5 x$ `
6 U+ z) b8 ~9 Q/ m# y- module_param(acnt, int, S_IRUGO);2 H: r4 j( b t% [
- module_param(bcnt, int, S_IRUGO);
) d$ I& F# J; T: I# `* G7 W; [ - module_param(ccnt, int, S_IRUGO);
复制代码 9 X0 @5 @7 Z2 U5 g2 u" v/ |; X! H
2 W+ J8 t U) E6 E E; Y
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: \) g- Y& c1 Q' Q) c( Z7 v% f& j
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" R) X2 T# F4 n9 t9 A
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
d! f" `4 p1 ~) d2 X8 `' d! U" |+ }) I
$ L; t3 B0 z* `: _
|
|