|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" @- p% d6 R; K) |& `5 o- [code]EDMA sample test application
- t6 e# f4 Z3 e7 D! [0 h# \# @ - /*
^% q# o% z' ^, T - * edma_test.c
% y9 w5 Z% {7 ? - *1 i W1 l) p" D6 F& _
- * brief EDMA3 Test Application
7 y" v# c9 g- ?0 Q. J- _3 i - *
4 L6 \- i( K3 L - * This file contains EDMA3 Test code.2 S" S( q% O" u: S( D8 E; b5 a
- *
# p o, m% L) h0 o0 d" Y* ?7 d7 i6 A) _ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 z5 Z! D/ D! ~7 m% G" s) @# a) m
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
9 u* V/ ^* u0 ~& y2 g0 ?& ? - * TO CHANGE.
5 i% @; {, `5 H7 Z0 j/ W - *, d; G+ {$ _; p' i
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
+ r- m! o. x8 V1 w& D - *
+ i6 E# X" G' J" w# q, U# R; n4 [ - * This program is free software; you can redistribute it and/or( O: Z- t# W. j
- * modify it under the terms of the GNU General Public License as' r! Y. ?( i5 u
- * published by the Free Software Foundation version 2.% i2 y1 m' r0 J W
- *6 G6 n/ C4 p6 e
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any- ]% P) {8 j0 k( S R- S$ p2 C
- * kind, whether express or implied; without even the implied warranty7 N7 a% h% H/ x5 ^! u0 [% x* |
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the! ^: d& D. h) N5 y6 [* R
- * GNU General Public License for more details.
2 e" N8 n# B% k8 I( c, A - */9 E4 J$ C; v& E" `6 l; s, Z
; P0 \* O" E7 |% \/ d- #include <linux/module.h>
; O! w% k; i1 V( T) x - #include <linux/init.h>7 d0 O D" |8 ]. e1 Q8 h
- #include <linux/errno.h>
% q$ O6 S9 K( q8 X$ H - #include <linux/types.h>
7 v1 ~4 q, `: e) \( U+ Y - #include <linux/interrupt.h>
; O: V# B e7 S" W' j+ ?: ^ - #include <asm/io.h>
$ Q; Q4 q$ v% u - #include <linux/moduleparam.h>6 C/ C" M0 \. v2 A& \
- #include <linux/sysctl.h>( c' s6 j m; G9 P8 V/ R
- #include <linux/mm.h>
) r3 f/ I; P+ j. B+ n - #include <linux/dma-mapping.h>
6 }7 R/ }; l3 S) k2 h0 [ - & ~& I2 ]+ p8 F# C( X
- #include <mach/memory.h>% O+ j" j/ X: r4 t0 X* f
- #include <mach/hardware.h>$ X1 P% R! I% c/ Y* W' i. f- ?
- #include <mach/irqs.h>
+ A" H/ S; b5 }8 I, k - #include <asm/hardware/edma.h>- V* a* [: X4 B. Q) a
- ) R B# Q8 i3 V, T* |5 n
- #undef EDMA3_DEBUG
8 D' G8 V1 R" r5 h- F( H0 q: R' N - /*#define EDMA3_DEBUG*/
3 V+ c: b" v3 X0 n9 n0 c& c - 3 Q- E" r0 M A( ~
- #ifdef EDMA3_DEBUG
. A: _- w. E& \' a' q0 ` - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 T) q( I w% Z4 b `9 u, Y" w0 K+ s
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
. n w+ D* L, x! M6 O) i- { V; B9 Z - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ H$ g% X \1 p$ r6 E; I M2 X+ O, \6 h
- #else
9 ]' H2 l# V3 ]# i/ J - #define DMA_PRINTK( x... )
, B3 x1 A- S. J2 @. m# ? - #define DMA_FN_IN" u) M5 x3 X* E& s
- #define DMA_FN_OUT
* g0 Q+ `) x( o/ v - #endif
* E3 T6 T c) m8 H& Q( ] - * z) \* v- V3 t+ U a9 I" E
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)3 T# S( `% D- A7 D
- #define STATIC_SHIFT 32 R* x; k; Q' R6 P
- #define TCINTEN_SHIFT 202 Z, ~2 b1 J. _! Z* ]- Y. u/ G
- #define ITCINTEN_SHIFT 21
# e% M P: l* B+ c- j - #define TCCHEN_SHIFT 22
' D* [5 Z: h6 a0 X0 r; e3 J9 n, Q - #define ITCCHEN_SHIFT 23
1 h$ b- F! i7 [, ]+ t" N3 M* b e - 0 z- f4 ^% g- Q0 ~" V. y
- static volatile int irqraised1 = 0;
- \' k2 ^9 s- x h3 G0 s+ S - static volatile int irqraised2 = 0;
$ D7 X$ y2 a& K& j1 M - , h; |9 e5 F8 x0 H
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 U! K0 r7 j& N4 z9 G4 ~# g) q - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 F9 F6 ^6 J/ v - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 Q1 i* d8 k5 D ?
& {8 ~" K% S+ H& G- dma_addr_t dmaphyssrc1 = 0;
0 R# n9 v9 x# F - dma_addr_t dmaphyssrc2 = 0;
: z7 x6 P; y) ^7 o- O+ ~. M7 u - dma_addr_t dmaphysdest1 = 0;( S# S2 P. B: @
- dma_addr_t dmaphysdest2 = 0;
+ r+ f/ ?. E0 e8 s) p - & {+ A( O7 F7 C9 K2 X' s! A
- char *dmabufsrc1 = NULL;
! V7 ?2 M8 h6 G4 q& W - char *dmabufsrc2 = NULL;9 ]2 i) b8 i0 F
- char *dmabufdest1 = NULL;, _9 S: o- V' Y4 ~
- char *dmabufdest2 = NULL;! V: C' T6 b$ J6 ] t
- " o+ [2 S. x. j5 U @* m
- static int acnt = 512;
/ w+ u5 l1 x8 i- b - static int bcnt = 8;
0 g' H3 d; C& A" R r+ o, {: O - static int ccnt = 8;
. ^6 z2 M# ~" a3 {& o8 W
5 B/ Q4 G5 M% ]8 O. ?" I, A# X7 F- module_param(acnt, int, S_IRUGO);
5 O% U& M6 }! c& D" F - module_param(bcnt, int, S_IRUGO);
- a9 z: q% f+ J5 b( C - module_param(ccnt, int, S_IRUGO);
复制代码 : i% \% S$ T4 }0 K) X9 `
, |: N3 a* v& s& Q7 y/ l9 d" i
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 q. k% x3 j3 d) y; I$ V
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。% ~$ Q8 T. X! ^/ h+ `
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 F. }# E' r% V7 o# v# s% ]) M9 f# i8 u2 y
9 A; i) E% ~$ X4 r1 x# q9 q M- e' K
|
|