|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 `, \7 P9 ^- Y8 y
- [code]EDMA sample test application
9 g7 U1 Q, }/ i5 w. c - /*/ y7 s N% V4 o' k5 m9 a, J
- * edma_test.c: ~ K1 h5 n+ \& a* L8 \
- *
; Y O! ]. `1 |4 C- R - * brief EDMA3 Test Application
9 D0 Y5 r; x$ Z0 A! F8 D - *
; I+ b. g6 ?) ` - * This file contains EDMA3 Test code.8 {6 ?& q+ j: ~4 L; T+ i1 M
- *2 A6 ^! O& p# X" ?# j3 X+ T) X6 Z: {
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
! Q; M% c$ `; i( Z" I! m1 h- _5 c - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
; z- u/ [ ]6 y - * TO CHANGE.! |$ v: K3 ^# {
- *) }% S$ y( ?! }5 N! l
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
9 x/ M# M% U% B/ ?3 S - *
F6 P! F/ M: {) E - * This program is free software; you can redistribute it and/or
5 M, n9 ~8 [3 Z3 g ^' M9 t - * modify it under the terms of the GNU General Public License as) p1 Q2 e6 F) Q( p3 m9 a
- * published by the Free Software Foundation version 2.. Q8 }+ Y) {# y, U: |
- *
) N# B8 t/ X& @) {% V - * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ z& K0 V; m# n
- * kind, whether express or implied; without even the implied warranty: w* U y, c" J6 a' n9 f" h/ l' O& ?
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1 j# _/ u: n: u5 y# v0 j* S
- * GNU General Public License for more details.3 D8 b2 J; W5 A; l1 W8 c" [
- */9 i) D: e3 ~) \1 |5 z& m
- 1 B; a7 w$ N- m/ c: {
- #include <linux/module.h>% _: `- r, X8 K( v- @6 M
- #include <linux/init.h> X0 w |9 q! a! n9 a7 u% r
- #include <linux/errno.h>
- M6 Y, }; D0 W9 a! t; H- M - #include <linux/types.h>
7 Z7 K* O4 Q" O0 x( k' S% O - #include <linux/interrupt.h>
4 D+ y# N# s- _( ? - #include <asm/io.h>. N3 ?2 ^' s2 k4 J0 Z
- #include <linux/moduleparam.h>
5 [8 X0 \) E5 x& x: K - #include <linux/sysctl.h>8 t# E- |: N% x& G8 j2 o" u5 Q
- #include <linux/mm.h>9 Y$ u* t" A: i) I
- #include <linux/dma-mapping.h>
% z1 W' @: ~2 g5 q; H2 s
: F7 H- s- `+ j9 f- #include <mach/memory.h>+ c/ H5 h6 W' y O& X
- #include <mach/hardware.h>% }" E Q9 \& W& U
- #include <mach/irqs.h>
& l$ F; ?7 S9 V2 W$ y( | - #include <asm/hardware/edma.h>9 ^. e. K7 Z$ k6 M7 r
- + k$ R/ U6 T3 o/ t" J
- #undef EDMA3_DEBUG) Q. v& M: S- _; X# k8 k+ `) Z e
- /*#define EDMA3_DEBUG*/0 \7 e1 i9 G3 @; V% n$ t
) i9 f2 c! M7 N( Q$ e3 F/ e( x- #ifdef EDMA3_DEBUG1 }$ X0 V+ M& l/ E% S9 _7 v5 Y
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- a9 W. S6 D( A, f( q; q: D
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): \1 B2 y2 d( _/ X* ^! Q6 \# K
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
9 w1 c+ [3 Q: I, d6 U3 v7 e' z - #else
9 {4 `! d4 V3 p& b - #define DMA_PRINTK( x... )! w, A5 F6 |4 ^3 F1 L$ \9 }
- #define DMA_FN_IN1 L0 U% Y; M& m/ R0 I* P
- #define DMA_FN_OUT. C4 T6 L3 d- _, w0 o Y
- #endif
: k9 d2 i6 K; D" N
' S% M: x: }* ]* I6 q- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
: m" Y/ Y6 e, d% U. _5 M# n - #define STATIC_SHIFT 37 N* o; O+ ~' Z- j
- #define TCINTEN_SHIFT 20% `$ ]& m3 x5 q! c) w, m" a& B
- #define ITCINTEN_SHIFT 21
) g6 V3 Z3 k9 m+ n9 l8 j" p - #define TCCHEN_SHIFT 22" l0 K* B* f9 Y F& {$ W
- #define ITCCHEN_SHIFT 23
6 n8 E) `0 c, M$ A% i n7 v! l - ( F. L0 B6 h8 j2 l: q- B
- static volatile int irqraised1 = 0;
! ^# a7 s( f: |& J! Q8 A' @; ] - static volatile int irqraised2 = 0;
, Z$ o/ r. k5 V; _, N8 R9 j
! H8 P" h, K. C, u# Q- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: `& b) Z$ m2 y' ? y2 [( E - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 b7 h3 s% v) y6 b+ Z" X# T4 B" h+ w - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% e: F% _8 O& E* _ - 6 n }, t8 u2 A& g, }, O
- dma_addr_t dmaphyssrc1 = 0;
1 i: i w9 O) `; U2 ~9 E9 C0 i - dma_addr_t dmaphyssrc2 = 0;
9 {9 K$ J' V* {, v" h - dma_addr_t dmaphysdest1 = 0;
3 ]8 @- @( N9 Z$ m, G3 k# i; C - dma_addr_t dmaphysdest2 = 0;
7 H5 j o- {6 R6 w9 d
& S) X; `3 `2 `. E8 n- char *dmabufsrc1 = NULL;
0 o2 a6 P; L7 A - char *dmabufsrc2 = NULL;; `( h0 ~0 Y0 n- w% M7 B
- char *dmabufdest1 = NULL;; B# D1 W8 N2 b! S$ D# ~
- char *dmabufdest2 = NULL;2 y4 {; f5 \( E1 Y
- " p6 \9 e. {% x8 k# E n
- static int acnt = 512;
( {" x, a" o- a' j0 Y6 d3 K - static int bcnt = 8;
% L0 K% X, h$ S- B; Q - static int ccnt = 8;
4 T5 ~' S0 r8 z5 r' r( @
) C" o/ O2 \" F f; E- module_param(acnt, int, S_IRUGO);; s+ i* p: u& s& |' p
- module_param(bcnt, int, S_IRUGO);$ j* E2 ]7 H0 }8 {/ Y% l
- module_param(ccnt, int, S_IRUGO);
复制代码 . `' a' Y5 F# ]* Z, w
- H; E3 `( B2 [# V2 t 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( P& s: Q3 G1 |9 b) O+ |6 q
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: t5 E' J) d$ B9 O
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ |6 A: Z- D8 U5 A5 a4 p
' u3 n+ }6 g, t. L& ^2 N
5 \" j# u2 C, [+ Q
|
|