|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 m" K+ @. p, Z9 S9 Y- [code]EDMA sample test application
5 m% m n" L: [3 S/ v& j* @# e8 x - /*
( @3 X" Z1 Z1 J5 j- W9 H: v/ S - * edma_test.c
$ t% f2 m+ `$ ]/ @0 R! ~+ n - *
* Q7 z0 P2 W3 T, r) ` - * brief EDMA3 Test Application
% l( b1 I+ }+ u, \$ N - * a9 n/ P9 S. A8 n
- * This file contains EDMA3 Test code.' R9 H: l' }9 `+ ~8 h: a
- *
' l# w1 ]5 X- \# S3 R# K5 C - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# z) N! D+ x9 ~, e/ G
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 ~# j a9 c0 _% l5 n
- * TO CHANGE.; j9 v3 f( ~+ g9 i1 e
- *5 e4 Z, W6 C& R. q8 y2 _6 D9 C
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 P; K6 c& _% j: g; v' b2 p0 o
- *+ C* C+ d$ i5 t: x! ?8 C6 S" F
- * This program is free software; you can redistribute it and/or8 K4 m; {! M1 v: m
- * modify it under the terms of the GNU General Public License as
8 H, k( q( O" j7 ~4 t) K* j! | - * published by the Free Software Foundation version 2.
6 r1 u9 w, E1 A - *
1 ~6 K/ q W" l' X' b3 r - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
' ]) C2 a3 D( C - * kind, whether express or implied; without even the implied warranty3 j! R6 L7 i9 x, g6 P
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the) R, }9 p9 S" Z4 A' [% U
- * GNU General Public License for more details.
1 B3 |8 z$ u) R, P5 Y$ d - */3 }, W- ~. m4 |$ P% l3 `# o
' y/ u4 H8 p- k9 a- #include <linux/module.h>
2 M* M) V5 P& s/ ~" N - #include <linux/init.h>
! c- ?! n4 R% D' I1 M/ `% W4 e - #include <linux/errno.h>
; N# W5 b5 m* ~ - #include <linux/types.h>
A% j3 t; R+ d - #include <linux/interrupt.h>
0 g. } ^6 t2 [; ] - #include <asm/io.h>8 Y! ~; R7 t5 T) O. c2 O( j
- #include <linux/moduleparam.h>
9 ]5 s0 r" s, U0 n, ^: q - #include <linux/sysctl.h>
# z( h5 i9 F' h" r+ G1 R7 P8 p - #include <linux/mm.h>
) n, g; G6 @# f% C: p& [# F - #include <linux/dma-mapping.h>( f+ h( j2 h& z# l5 M2 H5 m2 s* t- Q
- ( w9 f. ^# z \: {3 G
- #include <mach/memory.h>: h% K/ ^2 r! L
- #include <mach/hardware.h>' ~1 s$ ~- J: Q" l
- #include <mach/irqs.h>! X4 M8 J/ m+ o
- #include <asm/hardware/edma.h>
6 L7 N3 Y) N. c! u" k0 Q- X) O - / x) V7 G) f9 F2 Z% y1 v0 k
- #undef EDMA3_DEBUG6 n I' V) B8 P- V" f
- /*#define EDMA3_DEBUG*/
* ?4 V* s! r, b. v
/ \% h6 }; D# _2 E; G5 O+ m- #ifdef EDMA3_DEBUG; B6 L( \8 Q9 E1 n% j7 F
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 c2 Q K2 _& \+ [
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
# K/ L, {1 r: C/ V5 m9 p - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__) h# ` q6 O& s+ v4 k$ @: L/ w
- #else% w; H1 K" ^0 z) {5 c' g
- #define DMA_PRINTK( x... )- X c5 y/ T4 O- I6 n/ r
- #define DMA_FN_IN
3 P. n3 `, ]0 t1 M3 u$ u - #define DMA_FN_OUT: o. s; W3 J' F5 a9 P
- #endif# l, d9 i# I5 u4 z! ~
- 7 a4 @' `! H5 j
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)5 ~! w: n8 Q6 K. ~+ P! S& j, R8 [
- #define STATIC_SHIFT 3' e" u1 a4 E& q) `) e* I" z* c4 ]
- #define TCINTEN_SHIFT 20
2 R: p& x# _+ p7 \2 ]5 p- l - #define ITCINTEN_SHIFT 218 S' I9 [$ g+ u2 d! q% F- Z5 Y7 t
- #define TCCHEN_SHIFT 22
7 _# L- w( _. L - #define ITCCHEN_SHIFT 23 o/ U6 L: s" o& A, f- m
- % o* `# \/ g9 B8 b$ R
- static volatile int irqraised1 = 0;
; J5 ]1 Z( p3 E, Q5 G5 K - static volatile int irqraised2 = 0;
1 g& w; i7 V* }! e% R2 l - & i, E: Q; {# k- L0 ~& L
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 \8 K. M2 m, g9 n% s: X& i - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, j5 ]$ X( \5 ] e9 w5 @ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 [3 E9 |1 P) L9 X
- " S, L3 W8 H. T b1 ?
- dma_addr_t dmaphyssrc1 = 0;9 ?. C! d- c" w% Q7 S6 P
- dma_addr_t dmaphyssrc2 = 0;
- w5 T7 ^& L( n( |5 Q5 P - dma_addr_t dmaphysdest1 = 0;
$ Y7 c, m# R; y0 R; L6 ~ - dma_addr_t dmaphysdest2 = 0;
: I6 Y, v$ Q! K, y# j; L- `
1 d! I% B8 |2 u f- char *dmabufsrc1 = NULL;1 L$ l* T' X( t* k9 W
- char *dmabufsrc2 = NULL;$ Z; ?) x. N& e
- char *dmabufdest1 = NULL;
; S$ s2 o( g7 y' u& k - char *dmabufdest2 = NULL;. {8 y6 ~ `- c3 a7 r/ d; p
- * M ]9 g# G: W
- static int acnt = 512;
5 f& C3 ]1 F( q. D1 @' E' l - static int bcnt = 8;; j/ E, O7 y2 ~4 P
- static int ccnt = 8;
5 X, C+ l+ f5 p# x. K+ f3 t0 c
% C! U. i* E' l! h, f: |- ~0 {- module_param(acnt, int, S_IRUGO);# G: M# l/ n! g! D% X
- module_param(bcnt, int, S_IRUGO);; o+ H6 r5 @9 r( i5 E
- module_param(ccnt, int, S_IRUGO);
复制代码 5 q& |5 E0 p/ o; f, f5 p0 J2 H; p
! y# S+ a0 {& z9 h1 x 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( ?' d0 K T3 X- V# G" {, ?
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# P' L3 m) d B9 n; C: u/ h 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! c: |6 G0 f. U# {( K& v% b# U2 D
) ~& L4 Z/ s7 w+ U" J6 t# k
3 l* G: D5 Q8 @! h, Q |
|