|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , G- C! Z' x$ I+ J' v3 b
- [code]EDMA sample test application. ?8 J0 Z% J) _& b5 c
- /*
% Q2 @2 S) R1 B) m - * edma_test.c: j8 ^. ~/ C6 d# E
- *" ]8 L* J( \( d! b6 I/ P1 c
- * brief EDMA3 Test Application. |: }4 _5 m b4 ^
- *
4 a6 q8 v% L1 @" E2 m* V: A# n* f - * This file contains EDMA3 Test code.
3 W( \2 `" U, Y5 F - *
; D1 x6 J6 W ]2 a9 b2 s- N4 a* Z( ?- [ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 [* P' D+ i9 r v1 m0 i" R- P
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
5 V' M+ n4 e6 ]+ U$ f - * TO CHANGE.
& O' N2 t# t) L) W% D" _" J ~ - *
5 {, v4 K5 D$ W8 i* ~" @7 u3 y L - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
3 L+ V; h, H/ N. V - *
' S6 e, Y0 i" N P; V0 } - * This program is free software; you can redistribute it and/or4 Q, g8 F: @- O/ |% s. T) n
- * modify it under the terms of the GNU General Public License as4 X2 ?: f" E$ b9 O) {: F
- * published by the Free Software Foundation version 2.4 W: q ?3 B7 u
- *
) c4 m+ N, [3 Q; j0 Z& o - * This program is distributed "as is" WITHOUT ANY WARRANTY of any- I# @0 d3 [# Q9 H8 M# h
- * kind, whether express or implied; without even the implied warranty
; g+ f; Z% d! P5 ? - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the* w4 ]6 @+ P* e
- * GNU General Public License for more details.
; W3 A6 E; V; E7 D, i# T! M5 `6 F - */
( H G2 K0 M7 G3 [
, j7 C8 r3 ], k% S2 I) H- #include <linux/module.h>0 O7 y% h5 @7 ?, _
- #include <linux/init.h>
: [* [( [: V$ {: n; A6 I - #include <linux/errno.h>
8 W, ?1 u/ k0 G - #include <linux/types.h>
& ?2 t" _6 o' M4 k9 H5 O - #include <linux/interrupt.h>7 ]2 P* V( }& Q' A. Q
- #include <asm/io.h>
0 z7 r, V6 k6 m: p4 R( C1 O - #include <linux/moduleparam.h>% D: @* R0 r! P- R
- #include <linux/sysctl.h>
0 C% O% N' o* x: m$ P - #include <linux/mm.h>
2 P2 d9 |9 y. K5 V0 D4 z2 [, d - #include <linux/dma-mapping.h>
3 z- G3 X( P/ V& ~% o P2 W% K - " `5 l+ D( ?/ C6 p/ @# G, x
- #include <mach/memory.h>2 t! e# E5 K( ~
- #include <mach/hardware.h>8 s: h9 Z W( M' G r( g. O
- #include <mach/irqs.h>$ W f# Z' b* H7 m: e3 X# x9 O# ~. O
- #include <asm/hardware/edma.h>/ C( _% G3 Y1 Q: F$ [( r
- # f5 I2 t$ ]8 H# C2 E3 Y
- #undef EDMA3_DEBUG# z: f/ [- `' m' R2 [
- /*#define EDMA3_DEBUG*/
# V* I; u# h- k8 f8 D
$ i3 O# ^) e6 {# N" u# Z- #ifdef EDMA3_DEBUG
/ y" k" R) z2 B( k5 }! g, S - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
, s9 S, ` D5 K6 y - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
% x: K4 {5 h H% y: ?& I - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
5 G0 D9 L* {9 F8 q, y" A# j% x - #else; | K$ s8 J! E1 e4 W5 o) x
- #define DMA_PRINTK( x... )* h7 `3 {( Y, j
- #define DMA_FN_IN
) d' i3 m3 d: ?( E5 T! r" B - #define DMA_FN_OUT, r& p, b( \- V% t: k2 ]
- #endif
1 [2 n t( o' U
( r `8 A" Y4 A+ x2 L; [- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
; t l1 G- w! P3 Q3 M. t" U - #define STATIC_SHIFT 37 z8 u$ [7 H+ E0 C. }$ B- y
- #define TCINTEN_SHIFT 203 B( J) ~8 o) N
- #define ITCINTEN_SHIFT 21* @; m6 e% W5 S) c' U3 k% N
- #define TCCHEN_SHIFT 22) R0 S% v* a( f9 @6 I# `- F- w
- #define ITCCHEN_SHIFT 23 O# P4 x- Z B
% r% h- P4 o$ o0 Z9 ]- static volatile int irqraised1 = 0;9 ?! K' L. c5 f- r* T
- static volatile int irqraised2 = 0;- \0 S" x. e1 l# u
- 2 t! M. z% k+ `
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 b& Z: Y+ I* E, p1 \; l* N - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& N. p6 C! w& i7 b% j( m
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 u- ~, G- l" Y& ^2 k - ( Q8 X" u3 K t6 p: N
- dma_addr_t dmaphyssrc1 = 0;
' B8 m6 p% g8 D6 L: e4 h e- t - dma_addr_t dmaphyssrc2 = 0;, y" J# q1 E% S5 _7 s' A
- dma_addr_t dmaphysdest1 = 0;
- H" v1 q1 ?5 i* C/ w: D: {; ]/ E v - dma_addr_t dmaphysdest2 = 0;2 T& Z) R. s8 O1 z# `
- + b* H+ N# ^7 k( b
- char *dmabufsrc1 = NULL;
% f1 K) Y: p) e# M& \4 C1 I - char *dmabufsrc2 = NULL;$ R0 b) O$ B7 S; Y
- char *dmabufdest1 = NULL;8 ~/ r! e3 J# ~ h3 k& L
- char *dmabufdest2 = NULL;2 x9 o- U# ~8 U+ y: |: M
- ) E5 C w: H3 \
- static int acnt = 512;
" K; C( Q! A9 Y - static int bcnt = 8;3 f) I; X6 q' G( ?) m- R
- static int ccnt = 8;
" F7 V- l$ N) |! d" d
9 X7 {' d) C( ]( p9 F& X- module_param(acnt, int, S_IRUGO);
' v9 F8 V7 I9 _3 m% N - module_param(bcnt, int, S_IRUGO);
5 C! P3 x1 g# f% D" x4 d4 ]+ v, M - module_param(ccnt, int, S_IRUGO);
复制代码 ) `; p+ ~+ n7 `4 I3 c% k
% a; `' K+ q# _; J' n$ h/ q 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 I" I& B4 Q8 `9 i! Marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 f! W" a T2 r 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. h0 C% {3 K9 u3 ?* g3 O1 Y1 Y% o' s v: p9 w
2 g# P% |% Z$ D: H
|
|