|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: l! w0 w$ ~& a$ n; x2 V- [code]EDMA sample test application
! c6 U& I% [7 ^" P1 E7 Y* k - /*7 y. k8 g& |' X4 f! z
- * edma_test.c
4 Z S! I" Q8 w2 w2 p- b$ E - *4 W% O1 n: `* }
- * brief EDMA3 Test Application
! _& H( R) {8 I e3 [ - ** h( E! G* p0 [0 t( e
- * This file contains EDMA3 Test code.9 p+ Z/ ^6 l# }/ y" z
- *4 A2 h" {4 k: d5 |! u b t
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
1 ?; e9 t' w2 z- M$ `& k, O - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
5 w. u6 T; V+ c; D9 ^% Q - * TO CHANGE.
4 b' M3 g6 E8 M, p% O0 X" Y - *8 D, u! G+ U" U; E0 o3 l
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 S' X' r8 l" I/ D3 k
- *. F0 y1 f: [" U
- * This program is free software; you can redistribute it and/or: V) Z h& t' w: Z
- * modify it under the terms of the GNU General Public License as. e# y9 I# I5 v( P) H& B
- * published by the Free Software Foundation version 2.
, Z+ Z( i" L' v8 y5 X4 z - *
) x0 I$ T9 _# ^! X+ U# i - * This program is distributed "as is" WITHOUT ANY WARRANTY of any* c0 g6 f! h$ A9 S
- * kind, whether express or implied; without even the implied warranty
# x. S" O V) t8 H1 P! c - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; F; T5 e4 f$ F" A - * GNU General Public License for more details.
4 h7 |. f5 @, K, t* q - */1 c3 C- h" j; y8 }
$ m% p; _+ x8 ^3 @- #include <linux/module.h>+ m: P* B" u2 b% M# m s
- #include <linux/init.h>1 Q: `! c! ?2 x* L% j4 }
- #include <linux/errno.h>: j8 Y9 n b5 _2 `( D$ Z
- #include <linux/types.h>
# [- m% L$ k" I: P( Q! x1 o, \ - #include <linux/interrupt.h>
4 a7 I+ ^' G$ T# o8 r% @- l - #include <asm/io.h>0 x4 E# s9 ]* \3 ?
- #include <linux/moduleparam.h>
0 K" e B$ b" l' q! v - #include <linux/sysctl.h>
) w# K$ E w- y- p, R* d - #include <linux/mm.h>) N3 ?2 k2 D4 ?0 n
- #include <linux/dma-mapping.h>
9 A* J1 d( E8 ]8 v B: s1 l7 ?
. e6 ? x2 E9 \( Z8 I4 F+ z- #include <mach/memory.h>
! u: u! `7 \) P& L) T! x/ Z - #include <mach/hardware.h>
! \4 Z3 T7 |. X" O, K& `8 n! W - #include <mach/irqs.h>- i9 B. U4 v- ~+ S5 g/ T
- #include <asm/hardware/edma.h>
- m8 i( I/ ]* ^ - $ o4 i$ s& H( s; x$ L ?) z
- #undef EDMA3_DEBUG
- \# @- J$ d0 N2 ^0 Z+ m1 _, y - /*#define EDMA3_DEBUG*/
8 B2 i* [' j- @) I4 n6 h. Z3 x - , A8 v5 [2 z% H2 r# X9 x" Y
- #ifdef EDMA3_DEBUG7 c& e; y/ Z5 Q) I. h! v
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
8 j2 m, Z# y& q# K0 ` - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
1 W: E! p1 S; p' t - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
% u, [! h" @; _8 ~0 T- M3 H - #else
5 |$ ^# Z, B/ i6 w - #define DMA_PRINTK( x... )1 U+ ~) H9 w+ J& g
- #define DMA_FN_IN
4 o* K* h0 e: B, L - #define DMA_FN_OUT; M F Q; h5 S8 p+ P4 w, \3 s* J
- #endif, I' R3 }: t$ q" V
- 7 Z% ~6 c( e" z
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)6 r @. L5 C& D8 ?+ L3 b* s
- #define STATIC_SHIFT 3/ \- ?4 B: z+ _ h
- #define TCINTEN_SHIFT 20) L" v8 A0 v7 h4 I0 t& g& C
- #define ITCINTEN_SHIFT 21
( r7 w5 F6 u/ M2 ~9 h6 x; v, p7 T) f - #define TCCHEN_SHIFT 22
( I3 Y F8 P& t, p% q, A - #define ITCCHEN_SHIFT 23. e8 n! D/ ?' N
- 2 `& J' l" g- d
- static volatile int irqraised1 = 0; }8 f+ N) G4 T
- static volatile int irqraised2 = 0;
0 G. }; z) Y1 {: T4 M
6 a3 R+ Y d, g) M3 U- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% K. j8 p3 X; f% Z! M0 Y - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. j8 L7 R* X0 H Y) H# O1 `
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* v7 H; B, @6 L5 E2 s7 Q
1 c2 Y! j! u3 Y. F# u+ F* V- dma_addr_t dmaphyssrc1 = 0;5 ? k& X! x. Q8 [# E* Q/ l. F
- dma_addr_t dmaphyssrc2 = 0;
& X+ s" M+ r- ~, W - dma_addr_t dmaphysdest1 = 0;+ f9 g2 \; J$ Z0 J( x4 l- D' p- G4 b
- dma_addr_t dmaphysdest2 = 0;
0 Q) ~; M( J% k; ]
6 w9 \. e4 W' R4 L, N- char *dmabufsrc1 = NULL;
4 s! z: k: X: j E; s6 x, u - char *dmabufsrc2 = NULL; k3 S7 e" }5 ?0 O, q2 q) B; d6 p
- char *dmabufdest1 = NULL;
7 L# X( E* W% s! d0 @ - char *dmabufdest2 = NULL;
% L* u$ k( Y' o3 O. C& R - % M; O* Y+ \2 V! p
- static int acnt = 512;5 F3 v+ h* L6 h* A- o. C# e
- static int bcnt = 8;
7 [6 J) O* O/ [* `$ o - static int ccnt = 8;5 v' U# ?8 W% S+ P% N
, E. v- z2 B2 d# n l, j q- module_param(acnt, int, S_IRUGO); f+ u* r+ q; K" I, Z# R
- module_param(bcnt, int, S_IRUGO);! ~6 v, q; Y' o" M2 \
- module_param(ccnt, int, S_IRUGO);
复制代码
6 S3 Y6 X) j. _; Q. b2 w5 Y$ F5 I5 y' c8 p3 e1 T* C6 o- X
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
J6 S5 K" O4 F6 H% h! D$ rarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。% G/ |7 K; L' ]) j5 Y9 n
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( x V1 A" Y5 M; N- @. m1 m6 l
8 q7 w/ Y: Z* G4 |9 x$ z( b1 O1 d( `
/ d+ r1 Y8 T# A |
|