|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , A6 v) \, a4 |$ ], C# p
- [code]EDMA sample test application0 G# i, d" G! ~/ r& D, p
- /*4 f2 y; b% P5 {: w
- * edma_test.c2 @4 M. k/ m, Y8 ^
- *5 p/ c; B, A" G% i8 x" E+ V1 S
- * brief EDMA3 Test Application
3 v$ O7 @3 }* G5 r+ U% O - *. l- I9 {4 d) s- e
- * This file contains EDMA3 Test code.
: s* g: K: v* O/ _5 o/ v% L# r; }- G1 I! a - *, P& r7 _2 l$ Z: d" X
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
- J; w, D3 U( H' j - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; J/ a) B' q8 B) b
- * TO CHANGE.
, B$ S& M$ E( v' G P - *! m* d& R. i8 n5 e4 x3 H
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
' x, n9 T4 R' j/ F/ B - *
) O9 k6 I" S8 E; ~' M7 I7 O; B1 ^ - * This program is free software; you can redistribute it and/or. \: G" ^3 P0 V H q
- * modify it under the terms of the GNU General Public License as
4 B8 O* w+ q& v+ I - * published by the Free Software Foundation version 2.
. k7 c4 u$ k9 C0 b5 G - *3 d4 J) s L0 N
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
: G8 }. T- W2 v; }: J6 C6 b3 r - * kind, whether express or implied; without even the implied warranty
( S1 a. K. H1 u3 y - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/ y5 f, Z. o1 X4 x t - * GNU General Public License for more details.
8 S( M v# K# F [0 W* H1 | - */
9 m' {0 \. q, H' F: A - 7 m- M1 ^" x/ r0 O
- #include <linux/module.h>6 i( j7 f+ P* x* b6 W# ?* M* ^
- #include <linux/init.h>* b( e, c9 Y2 N' p: h
- #include <linux/errno.h>
6 c8 H# Z U7 A/ i: U+ k6 C - #include <linux/types.h>- @0 `6 b m5 ]& v; n
- #include <linux/interrupt.h>
9 N7 s4 I9 t* h2 R& h - #include <asm/io.h>
- Z! j# ]" ?% z$ s$ P5 f* B( D - #include <linux/moduleparam.h>. W2 P& E( r7 {* p3 B$ Z, T8 _
- #include <linux/sysctl.h>: u6 X) y) [0 T. g5 o
- #include <linux/mm.h>
$ }& A5 ]" W# ^" o - #include <linux/dma-mapping.h>
2 w$ e: Q9 q! |5 m/ R
% X- u5 M Z- d2 G* Q- #include <mach/memory.h>2 `7 U2 i* a: k2 t
- #include <mach/hardware.h>' v6 u: y! ~5 m4 Q# B
- #include <mach/irqs.h>% _# l1 d8 R# }% e
- #include <asm/hardware/edma.h>! |. d9 R, ~5 V& T7 v" _3 E
, W* @# u" l& N& g3 t6 m, S5 V0 [- #undef EDMA3_DEBUG
1 T: m3 N/ |% d) ^( g - /*#define EDMA3_DEBUG*/
4 C. Z9 i1 F1 {# g/ t# i - + X) o9 Q' G5 R% d6 s) {
- #ifdef EDMA3_DEBUG$ T+ |8 v4 u! e+ G- M' r0 M
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
1 U: d5 |0 E6 U! f% n3 a - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
* i* G; f4 w3 Q& y7 x" \ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
9 X Z) E0 W" }# g% T* {* a' O7 w - #else
+ O: m2 k! ]+ x! n9 H - #define DMA_PRINTK( x... )" Q; L' g. S1 m% ]) W
- #define DMA_FN_IN! u, r0 [' L8 F
- #define DMA_FN_OUT
. x% ?8 p; j" v+ q - #endif0 [% p1 X- u6 l- a) r
- # r" z, n& X9 ?; {0 Z( R
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)7 \! B: K. U( Y. ] _# j
- #define STATIC_SHIFT 3( W' Y6 \8 S- X5 f
- #define TCINTEN_SHIFT 20
/ b& a: _$ g& H* q } - #define ITCINTEN_SHIFT 21
8 w7 i9 v0 ? A. Y - #define TCCHEN_SHIFT 22! W, |" I! f( X3 \0 z7 {$ o
- #define ITCCHEN_SHIFT 23% B+ d, ~- E; r: z
- 2 v2 m+ H+ f) Z# q2 D; V
- static volatile int irqraised1 = 0;
" ~5 P& b+ [. x7 Q - static volatile int irqraised2 = 0; q0 o9 c( v3 C% Z) P' M
- 4 C- E4 V% ]' |- s3 C0 j3 `
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); L1 Y( x3 R- O: J$ f
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' A4 L" r/ a& s: P. R! _1 o - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 b, K% @( Y- p( |0 o& K
! N( d5 J; l5 ]$ @* m( r8 s- dma_addr_t dmaphyssrc1 = 0;( w! X& u8 S; l8 c3 q3 Y
- dma_addr_t dmaphyssrc2 = 0;
( k0 |5 e! a: _/ }- i+ o7 g1 e - dma_addr_t dmaphysdest1 = 0;" F* b" h0 ^6 E' ?" O& y9 Q2 f! t
- dma_addr_t dmaphysdest2 = 0;
) H/ I) V+ W7 Q% u
. }* E; z L$ U: d- char *dmabufsrc1 = NULL;) y0 x X2 W+ d' R4 i+ i
- char *dmabufsrc2 = NULL;" ~/ `5 X% G! }6 S- X$ n; c4 T* ^
- char *dmabufdest1 = NULL;
0 K9 O# Z" |, ]% J - char *dmabufdest2 = NULL;
q8 G) k U6 J
, P% D. a7 `4 H: ~+ Z$ b8 c- static int acnt = 512;
$ J1 H, a) P9 P- ^ - static int bcnt = 8;
3 x7 z2 [: [: _, A& w7 d( f+ |5 d - static int ccnt = 8;( R/ d" S- J3 |: {1 F
0 C2 D* ?2 W& g% j6 g5 B- module_param(acnt, int, S_IRUGO);$ ]( I* U* h% P" m$ V! ^; x
- module_param(bcnt, int, S_IRUGO);# \! f/ H* ^0 X; j8 O; o9 Q
- module_param(ccnt, int, S_IRUGO);
复制代码 ' Z5 p/ b' U" C+ Z" h3 h3 [
5 M8 x9 v0 J7 f3 I* I& I# f
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) m. K4 k* A7 E
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 Q8 J1 u" x7 b1 m
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* ^$ ]$ H" U; g
, G3 P+ n$ M+ C9 A( J( y
' \1 b* ]& Q1 Y- E2 m* \
|
|