|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 Y2 H4 b8 R2 n
- [code]EDMA sample test application
; i/ S9 y# H* U* j( F% I' K - /*
+ R( a$ F! b% E E - * edma_test.c3 V; k0 A; P) T, o5 w
- *
0 z, {: p: S T" o9 O& V0 m - * brief EDMA3 Test Application7 r; e: j$ D% c! F" Q
- *
6 L% G R9 n$ s; U4 G* [* h - * This file contains EDMA3 Test code.5 W# h" G. b4 Q0 _9 N3 u' X8 J
- *. B" I1 `# g+ l" r" F2 j. S; B
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
7 E) A7 L0 f$ x. \ d - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
# l3 ~) ?5 n( X! l% x - * TO CHANGE.$ C; j3 Q. { v# X6 p
- *
3 b) p3 Y1 Q1 D: N$ ?1 N, _ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) }* S$ j& P9 w; O: Q
- *
2 V- f# M8 Y3 i4 |& p - * This program is free software; you can redistribute it and/or
& c: q z1 M- x, @ - * modify it under the terms of the GNU General Public License as
, J( D. ^& J# n1 G) ^ - * published by the Free Software Foundation version 2." `; `( K3 l2 \+ }+ s
- *4 z8 X$ h9 z8 t0 S I/ ~; j
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
4 k# |2 y; z7 E - * kind, whether express or implied; without even the implied warranty% Y- O3 N1 U( \' q
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ X' m3 C0 G* b, M$ s; _$ r% v
- * GNU General Public License for more details.
5 A6 q F3 b! C# y& N$ \6 v - */% S2 r/ C5 e w6 W0 Y
2 E6 x* v6 g: S7 a* |& ]" B5 j) C- #include <linux/module.h>! A. {* j2 ]5 Z: C3 c
- #include <linux/init.h>
4 H, L$ n) l7 n5 U. ^* q0 { c$ e6 T - #include <linux/errno.h>
! e- e- n9 H) Z - #include <linux/types.h> M" G0 I D. y$ L1 g
- #include <linux/interrupt.h>
3 ^9 o0 J1 P- j: Y - #include <asm/io.h>
; S0 K, ]! t: w- o7 {# ]7 i - #include <linux/moduleparam.h>
! ?" H' {; L7 G4 W+ ` - #include <linux/sysctl.h>
7 J+ Z6 Y) T) S - #include <linux/mm.h>+ A9 c# t8 {) F$ T
- #include <linux/dma-mapping.h>
" w% w4 f# Y+ }% J& L
+ i. P L' h: N) {) i; m5 u9 [- #include <mach/memory.h>
; ?# X9 W8 W% j8 t& h: }) N% K" Q - #include <mach/hardware.h>5 L& O9 t* e7 a
- #include <mach/irqs.h>
0 H5 h0 l S7 { - #include <asm/hardware/edma.h># r, E, t# A* \& W8 W' {
- 0 b) v+ m B+ E9 l, n
- #undef EDMA3_DEBUG
1 n: W5 Q' m" r: e% u( E7 t, f3 F - /*#define EDMA3_DEBUG*/
* |% h% q6 F( k' W( F: I! u
# u8 A3 e2 ] w$ r- #ifdef EDMA3_DEBUG
' g9 U" i: Z' J v, k - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
% L" W4 C8 [8 C, j0 @ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
; L' e" ?3 F7 `9 A# g - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- u) a; e7 g6 D8 a7 e( Q
- #else
: v8 Y- A6 \! ^' K8 G# q9 U - #define DMA_PRINTK( x... )* u) X# c$ F& t) ?) }
- #define DMA_FN_IN
8 U4 w3 h; y" ?: z$ ] - #define DMA_FN_OUT
) \- |. {$ b$ m' j - #endif$ Z- U; c# x# q6 ~% E3 V
- $ @# Y- B O: t
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
; L3 I% D6 T# a% r2 a* g: ]: ^ - #define STATIC_SHIFT 3
0 w8 L4 q* G9 ^: \" O - #define TCINTEN_SHIFT 20# O+ g! _- L3 i$ k
- #define ITCINTEN_SHIFT 21
" G7 l0 h: j$ D. k, e4 r3 [' J* L, s - #define TCCHEN_SHIFT 222 v4 ~7 l" J ]5 j$ d ~+ t
- #define ITCCHEN_SHIFT 23: m# i* m$ e* N5 V& s
. N3 {, Z# o2 I Y: y, l& v- static volatile int irqraised1 = 0;+ R$ s; f8 Z, O1 b
- static volatile int irqraised2 = 0;
8 [6 H# j' Q# ~) x" _7 f/ T
7 h3 \$ C! s) m- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 b& B4 \& N, b, l8 A - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 g8 j) ]" g4 R6 N) |7 D
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 [" I: S3 Y: m1 ]$ i8 J - 0 Z! j0 e% {9 y& H" q% X' F4 K
- dma_addr_t dmaphyssrc1 = 0;& z% x" o$ |* L2 x( B
- dma_addr_t dmaphyssrc2 = 0;1 }5 x: X+ F4 A( M! r. ?- h
- dma_addr_t dmaphysdest1 = 0;
% R; H) s& X4 O$ o - dma_addr_t dmaphysdest2 = 0;
% j% B4 |6 F4 B& @% M* G/ a0 Q3 _3 W
; k3 B- D; P4 H# C. r- char *dmabufsrc1 = NULL;+ B' U3 j7 E& V
- char *dmabufsrc2 = NULL;/ U- |# i' ]8 N! G U
- char *dmabufdest1 = NULL;
7 w$ I, _9 H- v Y - char *dmabufdest2 = NULL;; e/ S! J; ~1 G' q# T7 R
- ) v! j; z$ o+ ^7 X
- static int acnt = 512;) j+ L. {7 J, Y! O4 [# z
- static int bcnt = 8;
- E9 o4 a9 y# d- M - static int ccnt = 8;& t) ^7 k; I5 E9 e; F" \, ]
- z6 _1 v3 L% n+ C- M- module_param(acnt, int, S_IRUGO);7 [$ R1 j8 ^. i5 k' k/ t1 e
- module_param(bcnt, int, S_IRUGO);
1 R i0 Z/ B: Q- j - module_param(ccnt, int, S_IRUGO);
复制代码
" l/ g+ P6 ]. L7 a* J% _, q, y" G+ {6 ?/ c5 ~" d
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 t2 |( k! ]8 S& I7 X7 m
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 }- K& w3 I1 k 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: F! t0 N ^4 Z1 C8 c
* Y5 \3 s W M0 E& g) l$ ~( w ~4 @5 e# `9 Z# c* j
|
|