|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' V4 B1 t! ]* W) a8 f/ G" j# D- [code]EDMA sample test application
/ M* T6 f4 [0 B4 \- U: Q - /*2 d3 a* r: y3 b8 B$ B
- * edma_test.c- [* F* I/ q# f5 V) j2 l: j: R
- *" M, {7 k) g& b5 w
- * brief EDMA3 Test Application1 E: u# z9 i4 i5 f+ t- m7 B, D
- *( t$ C9 ~# d5 w6 {/ N# R0 f& B
- * This file contains EDMA3 Test code.
9 ~- m+ z8 ]" J- F' I - *
8 F6 e1 \* D: w/ s5 i h: v - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 ^8 J. i0 L: v( \" Y) v" g
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
" `- j5 f$ Q$ Q% ]# P6 h F$ l8 X7 a - * TO CHANGE.
* b+ a9 `5 x, O6 L4 o% W* Y' M# q& }1 F - *
. H7 V$ t8 w t9 B+ I/ _9 z - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
" v" I5 e! `2 {" _& g* c2 X/ ] - *, S) }+ B. x& {& d+ I
- * This program is free software; you can redistribute it and/or
, f1 N. f" z* q/ ?( ~. h3 K! N \ - * modify it under the terms of the GNU General Public License as8 O; V( r' E( c2 E& E; y
- * published by the Free Software Foundation version 2.' X+ C3 l- X1 C/ g
- *
2 L8 o |6 T4 g4 z+ k4 t - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
/ Z0 l) p* v7 ^" o7 m5 t7 K$ u - * kind, whether express or implied; without even the implied warranty
1 k5 a: ?+ E5 g6 c; ^3 o8 c) n8 | - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the% t F" d4 Z' B' }6 i0 I
- * GNU General Public License for more details.$ d( z; y5 X- C
- *// x4 I% N; A" l. i9 ?; Q: C
2 D: g9 z; }; f- #include <linux/module.h>
1 _6 M8 E% v0 n9 y% u5 E+ X% Y! } - #include <linux/init.h>
. f P- y! d( L - #include <linux/errno.h> K% A% q! K p. w3 |9 x
- #include <linux/types.h>
, C+ {" w$ s* o" | - #include <linux/interrupt.h>: O& k. w8 k" s# {9 |
- #include <asm/io.h>5 s8 Z Q1 l: i
- #include <linux/moduleparam.h>" F+ K5 w* v$ ?2 A! k
- #include <linux/sysctl.h>9 x. n# n. T- P; n( R9 i
- #include <linux/mm.h>
, M! f- m' b2 a9 v - #include <linux/dma-mapping.h># P g. D3 t* G9 U( [: v3 ]
- 5 L1 @* W ~& \4 w; |+ W- l0 Q
- #include <mach/memory.h>0 j0 r: F* K; f6 p5 X, [5 `
- #include <mach/hardware.h>
" Q5 ~5 l& H' c. P$ i* W( w# m - #include <mach/irqs.h>/ L. s4 B& R6 k- e3 f8 k2 Y
- #include <asm/hardware/edma.h>
1 q1 X( i& Y/ x2 f# o+ m% X - 4 a8 @2 [, ^1 v" g1 @
- #undef EDMA3_DEBUG
7 t' P/ a5 E8 Z9 P% W - /*#define EDMA3_DEBUG*/1 h5 c+ l* O0 f3 f, u3 N
- ( a9 `; S7 @& Z& ?
- #ifdef EDMA3_DEBUG
0 R9 U9 r4 ^6 C: X2 A5 Y+ {3 [% U2 n - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
& q$ D; h2 v, X4 y - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
, D/ [/ e# F& h* k0 b - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 ` B" l# s! O# I9 K- q0 M
- #else
" s/ J3 f. t5 E( b - #define DMA_PRINTK( x... )
q8 q& }$ A+ q) H, a U0 w, [ - #define DMA_FN_IN
. O3 u" ^: @; H+ f8 g - #define DMA_FN_OUT
R! v6 s/ f+ j7 U' v) @" J - #endif8 D4 ]" Z5 c! \
8 U# `3 A. P2 Z* h- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
9 ?! F7 g, l! }0 [+ j; b$ K( O - #define STATIC_SHIFT 3: {% l: F4 c; W. U- e& y; x! h) A4 {
- #define TCINTEN_SHIFT 20
+ v; b& ?: j8 G8 t - #define ITCINTEN_SHIFT 21
; y. R0 e% n) C' k - #define TCCHEN_SHIFT 228 _- ]( s9 Y5 ]3 }, n
- #define ITCCHEN_SHIFT 23) O, L9 ^$ {* W+ n$ k: x: i
- 9 C+ {( j U5 ]
- static volatile int irqraised1 = 0;5 U$ j* L `- @) i# W' j& a
- static volatile int irqraised2 = 0;
+ T/ ^! m0 U0 _6 P! Z" T) S - - r, G" x6 _; V( \) [' b( e8 \
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 ?; a1 r) W( V0 e
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 {* y: P, B1 n/ ~5 l& J - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* a# C0 e T8 `2 o9 \
+ L+ G- v! ` @7 H- dma_addr_t dmaphyssrc1 = 0;+ K( n( B' G8 T* J
- dma_addr_t dmaphyssrc2 = 0;
2 v3 W' V9 D# \ - dma_addr_t dmaphysdest1 = 0;
& Z1 B! r/ X* V. E. i2 T/ x( S - dma_addr_t dmaphysdest2 = 0;" I3 ^* ^8 S* _
; n4 X2 m9 j& K/ Y- char *dmabufsrc1 = NULL;
' d) x6 [3 m" {3 w - char *dmabufsrc2 = NULL;
% C& S( D- Q2 K" x# F3 a* } - char *dmabufdest1 = NULL;
+ S+ |: a& n* J/ Y - char *dmabufdest2 = NULL;
; Y8 K' S$ W- d% D- f1 Z6 X$ N - # ~. R1 B6 l4 k2 G* u [
- static int acnt = 512;
2 s& Z! b! c: e9 \) p - static int bcnt = 8;
! M. f) ] n2 m - static int ccnt = 8;
9 W1 [: q- r) H; Z& R3 Z
. X' V9 s g8 r1 Y D0 _: o6 N- module_param(acnt, int, S_IRUGO);6 g. w; h$ n3 C3 ^
- module_param(bcnt, int, S_IRUGO);
3 F& t4 W. S) l$ u: e8 H8 A }6 R, g - module_param(ccnt, int, S_IRUGO);
复制代码
& u9 V4 l) M7 _* r1 y/ T) z( }5 Y) M M; H2 L( V, T
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ j6 v2 ], ?1 g' @2 r( 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) R Z4 Q# f/ e& l- I& J
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 B6 d: x0 J# W( p- E% L
$ ?' d" R% e. r+ ?* r. |
% ^6 M" [/ A! n, { |
|