|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & n& n% T: K* K7 U
- [code]EDMA sample test application) r7 d0 J% k6 r0 u
- /*9 ]3 C5 N$ E+ N6 W
- * edma_test.c+ i9 l2 [5 V8 q( R
- *
9 d! v: }+ y& j t1 p' V - * brief EDMA3 Test Application
% n. V7 C2 s5 L% t0 Q# n - *, d* S# B/ q/ ~( Y0 K& D: K
- * This file contains EDMA3 Test code.
# M D- w' H* f% R8 [ - *
- L! x% K0 S/ d/ z6 |. i; Z - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
: k t! s8 X4 _" R! ]/ W9 Y4 h - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
; T$ `/ b) _$ A9 B% c - * TO CHANGE.
5 n+ H/ m$ ?: l! i5 @ - *
[$ L0 ~! V; A0 K. b+ @# ]/ e - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 Z- _) U! O) s
- *: r2 r+ {5 @) {0 e G% V' P/ ]4 j+ i
- * This program is free software; you can redistribute it and/or
: v0 R. F) J" ~0 ~& o - * modify it under the terms of the GNU General Public License as
; {" ?, H/ |# ~6 B% z0 T' d( U - * published by the Free Software Foundation version 2.
! } b, _8 y8 F - *
' w& o6 `2 s! ]! q: k - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
5 |9 _% r1 R! z0 j$ Z& U - * kind, whether express or implied; without even the implied warranty
3 G. e) N8 B" K% h+ ~1 m - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the, y$ H7 q2 l5 @- b: A1 ]' R9 p# r
- * GNU General Public License for more details.( w, N" s' [2 i7 n# Z
- */
2 t- p3 J# M+ Y+ ?! F& D6 d. E
( C& ^! i$ z( t- #include <linux/module.h>) C r( @* Y$ f" T
- #include <linux/init.h>
9 c& ^; N9 K9 h - #include <linux/errno.h>
( H: T7 Y) I% ^ @' p$ W# q - #include <linux/types.h>
! I' m) p5 ^0 D* ~" L - #include <linux/interrupt.h>
+ O6 Y3 E) D* M# F9 q3 S - #include <asm/io.h>+ Q5 v* J1 I) w1 E) s3 }* n0 l
- #include <linux/moduleparam.h>9 y8 B# B4 o" u1 B! H! L; E
- #include <linux/sysctl.h>5 n/ s J2 e/ f+ C
- #include <linux/mm.h>) b! H& Y: x2 }
- #include <linux/dma-mapping.h>/ v" Q6 f$ K6 w9 p
, s, D& n1 w5 g* }- w* @- #include <mach/memory.h>
$ A6 K( F1 r/ x1 m1 B4 Q - #include <mach/hardware.h>& B, M5 }. y* p1 V; f
- #include <mach/irqs.h>$ b. A, x. E& \1 C& S+ [
- #include <asm/hardware/edma.h>
2 A5 c4 U4 E7 o1 y2 b2 I4 \+ ^ - 9 |; O' V2 @* O5 [5 u6 Y4 P
- #undef EDMA3_DEBUG2 \2 ^2 G& C7 V0 i
- /*#define EDMA3_DEBUG*/
" v1 K) M/ W: |! l9 S# [" I! C% q
7 E# p8 G" n/ q2 [$ Q- w- #ifdef EDMA3_DEBUG# F7 n$ c/ \+ U
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
$ | c F6 R. A1 x+ x" Y0 M6 e9 c# z - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). z) ?" T. G1 j6 h% k, O" K4 ^2 Q
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
( X2 i( }% H& b5 d - #else2 k% y( ]0 w3 T7 p! C- I1 G
- #define DMA_PRINTK( x... )
1 e7 m, u# ]$ o9 E) P - #define DMA_FN_IN- j |" K) q& Y* W) ^0 o
- #define DMA_FN_OUT# L: T( k4 X3 M z
- #endif
) g: x) q' s8 m( P2 u
- k8 Y( w: j2 @; A& ?- #define MAX_DMA_TRANSFER_IN_BYTES (32768)6 `2 s$ R) U+ \' [
- #define STATIC_SHIFT 35 e# ]$ W5 e: D- h3 V- y. t8 E& ^0 W
- #define TCINTEN_SHIFT 20
8 N* \) ~+ d+ j ?' \ - #define ITCINTEN_SHIFT 21% T. c/ G6 }3 A
- #define TCCHEN_SHIFT 22- _/ I( f4 g$ K- O
- #define ITCCHEN_SHIFT 23
/ D: a4 s+ _, [. L. Q - $ B8 R+ u z/ U ^) m
- static volatile int irqraised1 = 0;
' @7 G- {- k! y5 [& H& C. g - static volatile int irqraised2 = 0;$ r# I9 E! i# `6 F8 m& ]3 t
3 A7 F' z- i# m. s0 I( I6 I4 D" B- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* N* B3 {# o$ S# o4 j+ ~- p
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 T. r" M. m/ v - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ q' u- m/ B6 Y0 }+ Z# U3 }) h4 ^# @ - ) U* b$ W- v' v! ]- W2 V6 `
- dma_addr_t dmaphyssrc1 = 0;9 q4 E8 t% F" I; @, w
- dma_addr_t dmaphyssrc2 = 0;
5 G2 u8 T6 w6 r' i- { - dma_addr_t dmaphysdest1 = 0;" ^) ~9 d$ d* J2 I4 s; s
- dma_addr_t dmaphysdest2 = 0;# ~$ W R3 x$ {1 v% }6 F6 q
- 1 D1 S6 t/ m7 [# x8 d8 V
- char *dmabufsrc1 = NULL;
+ G U3 H8 k- b8 I0 w2 M: b( A - char *dmabufsrc2 = NULL;
* r+ W5 ^- a' ]. [ - char *dmabufdest1 = NULL;
7 j1 k% y5 \( c' m( p4 u }8 | - char *dmabufdest2 = NULL;
: i5 \* P( K8 W) _1 f' \ - / g; A& v) N" z# b9 \
- static int acnt = 512;
/ i7 y2 _8 N5 p) `' k - static int bcnt = 8;* ~9 j& a+ Z/ M$ F4 i4 w. P
- static int ccnt = 8;" T" c0 x$ U) a
- ) m3 N+ b# F: T% M2 r7 Y
- module_param(acnt, int, S_IRUGO);
( D$ G4 }: {5 j* ^ - module_param(bcnt, int, S_IRUGO);
9 e. `6 F: G }7 A+ E - module_param(ccnt, int, S_IRUGO);
复制代码
$ Z2 _6 n) A% E6 h# \
# s' s5 d' k+ n" O 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- G6 ]1 ^( C, I+ Y V. o5 c
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! j# d, e2 H, A( d5 d 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 I0 q5 m" H. e# u+ f U
" {" T- s2 b" w9 {2 Z, T
# N, p4 o- D7 W/ I$ r0 T9 p |
|