|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 J, \. y* O3 d4 p8 _4 E! ?
- [code]EDMA sample test application- J3 N4 j" r( ^1 u. G1 g4 I
- /*% T, w; _% D& \5 v
- * edma_test.c
* n. h5 h7 O Y; }: J* k4 I - *
1 l* z; p+ o8 ?5 ?( |8 i2 I0 [ - * brief EDMA3 Test Application
% }2 v8 F# v& a) R0 m0 Y/ O - *
* \; k$ {$ A6 C: ^1 F+ n% w% z! x4 r - * This file contains EDMA3 Test code.* d p# u, G! N L6 N
- *0 S+ W* T, j$ O% }2 I
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 h* G; w! h: p, z* q& n& [$ J8 B
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
! W' N$ h0 t$ R6 ~& [ - * TO CHANGE.5 E8 t4 ]' |4 o
- *
) f9 t$ o6 }5 c- K* ?* h+ P5 W - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
* a9 Z& Q' a3 V$ F7 R' S1 M - *
/ t9 B% y* T6 e. P - * This program is free software; you can redistribute it and/or
7 P4 e3 ~6 c0 w$ D1 ~ - * modify it under the terms of the GNU General Public License as B! B# Y0 g! z9 R3 R! M3 ~5 [
- * published by the Free Software Foundation version 2.; |( p# ^- H( O8 b
- *
* U: B2 a8 Q9 v& F - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
) W% v* B8 | t- ` - * kind, whether express or implied; without even the implied warranty
# Q2 Y2 l' e7 ^! Q( ^2 w/ g) D8 \ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the$ m4 @2 f' g% }( E) T1 F4 p2 Z+ x4 t
- * GNU General Public License for more details.
# s% h+ ]2 @" @9 o - */
% v/ V$ B. E- h% o: w, F5 A
9 M9 P3 W; E6 H- #include <linux/module.h>
8 m& D1 P$ e+ ^' ]6 `$ Y7 c s - #include <linux/init.h>- i! E+ y$ X+ {# d4 B# ]
- #include <linux/errno.h>
6 T/ a" e7 o) {( M: w4 V6 S - #include <linux/types.h>
, J0 |( K l' W1 Y - #include <linux/interrupt.h>3 l1 }. u* X i
- #include <asm/io.h>/ _ o- G) ^8 s. X4 H* e
- #include <linux/moduleparam.h>
' i' X1 K, \5 H! ^( Y- e1 C - #include <linux/sysctl.h>3 s7 p2 k$ B( I, G7 j
- #include <linux/mm.h>1 x. K2 T$ x- a. u* S ^3 T. {4 y
- #include <linux/dma-mapping.h> ~- U5 D+ \! m2 w
2 d/ _9 A5 J: H4 T j' u2 o% H- #include <mach/memory.h>
# N6 `; J3 q- P6 k s o - #include <mach/hardware.h>6 Z4 y, Q% Q; h6 i* p# q
- #include <mach/irqs.h>
/ ]0 L2 W6 \+ w+ [ T t - #include <asm/hardware/edma.h>
% ?. {' }8 E5 f$ g. Q
, z$ |' j w; H: f$ J, E- #undef EDMA3_DEBUG
" V. A" L8 [, U2 |4 B3 ` - /*#define EDMA3_DEBUG*/7 t |0 _0 g; S( q
) N o, s0 h- N; ~2 v2 h- #ifdef EDMA3_DEBUG
) g$ T4 M) w5 O9 Q) b1 f) d7 y - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 m5 ~- N& e8 }1 J; U, E7 n
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
! l- Z# O3 b+ b: C - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
R2 g* O9 G6 b/ I2 N - #else
9 [' S. y6 }( E4 S - #define DMA_PRINTK( x... ) ~5 W; ~( h: W9 N x* O2 c- h4 {
- #define DMA_FN_IN
) H8 H t2 r3 o+ U6 n9 \" I - #define DMA_FN_OUT2 d! T, |; Y/ x0 y5 N
- #endif% o t- R$ }2 Y! F( D% I
% X! U, R. Q$ K3 b. z- #define MAX_DMA_TRANSFER_IN_BYTES (32768) m" P; l6 P1 X. R
- #define STATIC_SHIFT 3% P, H0 |& S/ i; a3 U
- #define TCINTEN_SHIFT 205 ]- Q( Q# J6 S8 B+ t3 i7 k
- #define ITCINTEN_SHIFT 21
+ K- f1 i7 q+ p$ X9 U - #define TCCHEN_SHIFT 22" x- E# p) d8 e3 d T
- #define ITCCHEN_SHIFT 23
. p D3 \) h% t! D/ | - 8 |8 ?* h0 Z$ R1 o1 P
- static volatile int irqraised1 = 0;
% W3 T1 P" c* ` - static volatile int irqraised2 = 0;& l' {* ~: ^5 K& U' d- I
" b4 t4 N0 w/ [# N7 ]( j1 H- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 m5 F6 {% m% z7 s+ }
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& o0 l3 t3 U h& B, P
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 G, T; Y9 d& P! d7 V' G/ U
6 }- Z7 D' a h' M: Y: `- dma_addr_t dmaphyssrc1 = 0;- q$ a8 n. V' {
- dma_addr_t dmaphyssrc2 = 0;: V9 Z, M3 ~# W4 t# x7 s# I$ ]
- dma_addr_t dmaphysdest1 = 0;
4 x! s+ z) B* N) Q - dma_addr_t dmaphysdest2 = 0;& F0 S& E4 l' j* H. G9 k
' S* y" u0 Y: {3 g6 I: y- X; J- char *dmabufsrc1 = NULL;+ `, N; D( R% T
- char *dmabufsrc2 = NULL;
2 U. D: m# _5 ?# ]& A# M) L - char *dmabufdest1 = NULL;
9 A# N' u7 v6 g3 K$ U - char *dmabufdest2 = NULL;
o5 J/ f6 H9 H2 v' d: z# i
! C" h+ o- G z0 e' w' S- static int acnt = 512;
: B. I0 y% U& G+ s) ^+ Y - static int bcnt = 8;
" ?# @ F( S/ j# C - static int ccnt = 8;; H5 J. } ?6 {5 H% G. f
& L- ~0 ~7 g! Q: ]. Q- module_param(acnt, int, S_IRUGO);1 Q- f# W. K# Z/ @5 o, x$ P @
- module_param(bcnt, int, S_IRUGO); [) o5 p. j" o, U
- module_param(ccnt, int, S_IRUGO);
复制代码 / f. g, W. _6 t% Q9 N" N: ]' d
$ m+ x, O# P D T 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 X) d' f1 }1 M3 Harm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ w! C, w0 _; R0 g+ L4 ?' a
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; O) z4 p0 G. W$ V
8 C A3 A- a7 O) A
% Q4 a6 R$ L, `8 w |
|