|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # D9 L0 O8 }0 e7 F' s
- [code]EDMA sample test application5 [; E& |2 m; s1 D& S
- /*/ c* `: n* `" Y. }' }1 L
- * edma_test.c# e; p ]9 `) p+ W
- *! ]8 e; |2 p7 o# @; m2 p
- * brief EDMA3 Test Application
: H B* r- [0 D, x1 o5 }& k - *
( x0 w9 V% S% c) i% C6 s- A - * This file contains EDMA3 Test code.+ B7 ~5 }5 q( H0 Q$ B# u6 }
- *
+ b; c% n2 `3 V# R0 Y. x- N - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 K; W( c: e6 w
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 R7 N. r$ a1 P1 f1 w8 U
- * TO CHANGE.& X3 |# R: `$ m2 e7 q& s
- *
% p% B3 ^% g9 q+ a, |, A - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
4 K5 o' y7 a. }: x6 w- t - *
; @ G/ V4 w% y+ q - * This program is free software; you can redistribute it and/or9 Z1 L b5 _) D/ Y7 A
- * modify it under the terms of the GNU General Public License as/ D4 e. j( x5 B6 A$ I. z
- * published by the Free Software Foundation version 2.2 ]; e5 Y, h+ H2 j) I) w- v+ l+ S
- *
" H6 |/ y) B# o9 p0 N - * This program is distributed "as is" WITHOUT ANY WARRANTY of any# n/ J4 R, h# u# x8 S1 A
- * kind, whether express or implied; without even the implied warranty0 w, E |( L# U/ |; p2 d, Q& T
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the( M, ~! J! H& @* ^ U s
- * GNU General Public License for more details.
* i# F, L# X, ~. h. D* m* h# L - */
1 N% `- [- p4 l9 _/ w! U( j
" k/ `3 F; j; b0 L! Z- #include <linux/module.h>, A, B$ E; P3 \5 w6 f
- #include <linux/init.h>
) R) @, E6 H# i' X0 H0 E, @4 L - #include <linux/errno.h>
# W H& a/ e7 p6 e, I - #include <linux/types.h>
8 l( y/ v% T; W7 b8 @) T( O8 e - #include <linux/interrupt.h>
8 Y( y5 y6 o& S. j: o - #include <asm/io.h>2 V7 A4 \' C* T# U# H
- #include <linux/moduleparam.h>2 i f' A2 K* T6 \# ^. M
- #include <linux/sysctl.h>. A9 m6 j! Z7 U) c* |' b3 E
- #include <linux/mm.h>$ [4 [$ d8 D7 E: E4 q9 \2 b
- #include <linux/dma-mapping.h>2 s# d6 \1 {) @; @. M
- + {3 g. D9 {; ]& _. L
- #include <mach/memory.h>% C* h( U$ ` _$ Z
- #include <mach/hardware.h>
- |/ @" M @) A+ g( a - #include <mach/irqs.h>
3 o% X2 j# g' C - #include <asm/hardware/edma.h>2 d9 G7 Q$ y$ g- x
; ?8 [9 G# q1 G- #undef EDMA3_DEBUG0 ]- [& q v. s; G4 d
- /*#define EDMA3_DEBUG*/" f4 F: _! Y6 S( u3 t
# o' k! k2 B% f' R, H. g5 @! f1 W- #ifdef EDMA3_DEBUG
% p5 C; K+ z$ m; x - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) j4 k' ?1 B$ H
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
/ c3 X0 `' {3 o; I! f- } - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 }; h2 W/ d( j$ q) H. `
- #else, V2 o1 e# g( M5 A, [, n8 R
- #define DMA_PRINTK( x... )' M# [: J: a ~& y, E
- #define DMA_FN_IN
' I: S9 x7 d U% t3 f P8 \% G5 l - #define DMA_FN_OUT
4 J. W$ L! r1 m) i9 r: { - #endif
1 ]* p3 u0 w$ N - # n( W- {0 r. B' U/ Y6 H& ^9 u+ A) P
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
( z# [& G5 ?+ S+ d1 v. S/ ? - #define STATIC_SHIFT 3
) A z2 I" D7 R! a* J - #define TCINTEN_SHIFT 20
& f2 R Z1 t7 ^' v - #define ITCINTEN_SHIFT 21
* b) Y0 y& ^( z! O/ @& E - #define TCCHEN_SHIFT 22
; v+ w# t8 p: u, Z. ^, g& t5 R( A9 S1 T - #define ITCCHEN_SHIFT 23
$ q+ Z: O+ g9 p$ j7 ~" C& \. r1 D
& ? J9 F9 f/ m, R/ N6 e2 P& N7 p- static volatile int irqraised1 = 0;
0 R# s8 _8 z. w" P* \5 G3 { - static volatile int irqraised2 = 0;. Y4 y8 b( ?2 k, a. t! A
. g. Q0 w/ a# B/ c; ~2 B- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 e+ d4 I' H3 ~; O e
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 D2 J1 [2 l2 ^/ v
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. Z9 [3 p+ t, I+ h) r
' ~$ F4 {# L- y) F Q* }- dma_addr_t dmaphyssrc1 = 0;- L* P: Y7 ^. m% n
- dma_addr_t dmaphyssrc2 = 0;
0 C* y/ V! x+ I) S" \, n! f5 v - dma_addr_t dmaphysdest1 = 0;; z) i( w( O8 p) h2 K
- dma_addr_t dmaphysdest2 = 0;& E9 `, ]$ V' n2 y
& v& B0 ]' j7 f/ Y- V( f0 N- char *dmabufsrc1 = NULL;
7 P5 b" Z% L0 A* `/ ~! u. d - char *dmabufsrc2 = NULL;4 o9 X- O5 T# ~, P- u+ R8 r7 M( X f4 X: d
- char *dmabufdest1 = NULL;: H& B4 T1 I+ B) D5 t3 A
- char *dmabufdest2 = NULL;
: p4 [+ j: @3 ]; f) [ S - ) V) T2 a- n( Y( c+ O6 N
- static int acnt = 512;
6 y& U8 Q1 H: @ - static int bcnt = 8;
0 ~2 s {0 o4 x& M l0 L - static int ccnt = 8;
, K* Y5 b6 {3 r" q" b
/ r' K0 L. g Y! n) s, p- module_param(acnt, int, S_IRUGO);
. v6 G2 A% P- P4 ?5 Z$ X3 I- ` - module_param(bcnt, int, S_IRUGO);! S+ v6 o/ t# ?# n* P4 H
- module_param(ccnt, int, S_IRUGO);
复制代码
. L8 B) }( U, S1 O! V) V) w: t4 u/ E( i
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! M9 z0 J- y w# H$ {+ k# W2 \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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。 i* ^0 w9 B- y9 p& Y
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 F# u1 e" }* w$ W( z
9 p/ \ J! |( m: Y* r+ ~ D5 \( ^/ m+ c: J r5 }
|
|