|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 I5 }, l+ ~$ L3 H0 t: R u
- [code]EDMA sample test application
0 H( q( j* [" V7 }& Z& y - /*
( h K" a9 P, B9 p) W$ F - * edma_test.c5 V8 G, K2 I) |
- *
* u# d0 Y1 X) u( o - * brief EDMA3 Test Application
. K& s6 u7 R( H& D0 j6 C! H& V, ? - *
0 Y0 O- v0 K: A/ l* ?. f - * This file contains EDMA3 Test code.
+ O0 ^# k1 h5 \! s+ o - *
; w7 V/ l2 _# F" ^# P - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
$ p- ^2 c/ c; i! m2 I - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
8 X* U3 D1 P+ K/ ?# A - * TO CHANGE.
! l9 c( i, i" M2 a - *8 {1 \) ]% ?: O/ ]) o1 q
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
8 _) z' |! ~3 a6 J - *
+ n5 B3 v' R. T" ~2 q2 s$ m - * This program is free software; you can redistribute it and/or
& G0 K0 O+ |/ M3 a) Y - * modify it under the terms of the GNU General Public License as
% U9 n, O# O, c* O - * published by the Free Software Foundation version 2.; F) ]! w$ Y* g0 }; M+ E( }, t
- *
' Q- D+ b) Q% s; `+ r - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
; o8 J' i$ |, S% Z - * kind, whether express or implied; without even the implied warranty# C3 c) `6 h% A+ {
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the7 ~" y7 Y+ o7 J0 U1 f
- * GNU General Public License for more details.
" O2 u; N0 r9 c; t4 u - */0 T( w3 ^ {5 z& e
- 1 w4 [& K$ g: V1 q7 n
- #include <linux/module.h>
2 M" n9 S* L. ?5 x% }: e - #include <linux/init.h>
6 X& a% {) d5 \ ] - #include <linux/errno.h># T; Z' M$ y# q4 f5 N& H( X
- #include <linux/types.h>
+ i7 u2 I& }+ c0 [( P* B) N - #include <linux/interrupt.h>
3 P! C: `" J; o& X$ D7 s- R - #include <asm/io.h>
7 l/ P6 `) {5 O1 r! a+ k, o& C' X# V - #include <linux/moduleparam.h># m& s$ X1 t8 Y6 I9 P" t5 o
- #include <linux/sysctl.h>
; X$ S/ `& q1 t4 d - #include <linux/mm.h>
: p. R) P7 t4 u. J3 c+ A% N - #include <linux/dma-mapping.h>. d) g' X+ y! i3 a/ P1 v0 u
- $ P. }+ Q! K. S- I( v( x
- #include <mach/memory.h>
: Z* C9 \' }$ z2 y- O - #include <mach/hardware.h> H( K" I$ X! T6 M: t+ k, ` H& N
- #include <mach/irqs.h>7 q# K, n3 z! H7 j2 z
- #include <asm/hardware/edma.h>
" P& J( ^! I$ d% e+ D - 1 C9 t) O" P. S( A3 C& ^
- #undef EDMA3_DEBUG2 L* c( p9 F; p
- /*#define EDMA3_DEBUG*/3 ~. U* D: q) x. d
! _% A" {, D4 \6 m' n3 U. G8 y' G- #ifdef EDMA3_DEBUG ]8 z$ T4 g3 a E4 ^
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# j7 y5 `5 a. E6 [5 ]' I! i
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
/ @7 g; g+ `* K* J# t7 N - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 k! s+ g, v/ ^
- #else
/ S g' F9 A/ q+ _ - #define DMA_PRINTK( x... )
, o3 k' G3 E1 c( f( y - #define DMA_FN_IN
- f5 U5 D0 y( h) A - #define DMA_FN_OUT8 I" e( ?' @9 N. U9 @1 h2 T1 S6 Q
- #endif; F2 M! [3 [8 W4 m; t$ K* b" E
- 7 q O. s" e/ p! \8 p6 N
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
6 J! e4 T4 C5 D5 w - #define STATIC_SHIFT 3# Y9 s8 N4 @+ ^: K
- #define TCINTEN_SHIFT 20/ f( L. u3 Q7 |6 ^$ o) T' p2 _' v
- #define ITCINTEN_SHIFT 21
, W6 I4 s: A. |7 N, l- @- m - #define TCCHEN_SHIFT 223 S$ W4 ^: b" u- B! m- ?: a
- #define ITCCHEN_SHIFT 23% ~+ j! ^& B u. Z4 b+ ^9 S
6 a9 I4 b6 S! `1 T- static volatile int irqraised1 = 0;
+ O/ J* G- I5 |! h5 Y( z% n" U; D$ o - static volatile int irqraised2 = 0;& m. n/ T; |* J) l( o
3 ^1 k; Q6 y. g |* A! a- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 W" H1 \( g# d
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 w% m- z) {! w
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; N' v& j0 S# o- A
( P+ z' P* f+ b. r5 a: s- dma_addr_t dmaphyssrc1 = 0;+ R6 e7 H( U2 {- c
- dma_addr_t dmaphyssrc2 = 0;1 \* h* ?) Z4 j. F
- dma_addr_t dmaphysdest1 = 0;
) }4 m$ z: r4 R7 Q$ [+ ~4 [: v: b" ^2 r - dma_addr_t dmaphysdest2 = 0;2 p- W8 v m- x8 e% A
+ r8 u! r* s9 D5 ^- char *dmabufsrc1 = NULL;7 p6 ~: m J1 s+ L
- char *dmabufsrc2 = NULL;- J5 A" V$ i, W7 l9 O- C
- char *dmabufdest1 = NULL;
* u! _0 d# F1 C8 C, ~: D% }8 B [$ z - char *dmabufdest2 = NULL;
/ Q s. T6 ?9 Y0 J1 E - 1 m/ H6 W$ H0 P u, T8 ~# ?$ u7 T
- static int acnt = 512;7 O( J0 a& D# d: \
- static int bcnt = 8;* B* K3 a' a E9 C/ g$ l
- static int ccnt = 8;: K: N" m# [& { e
4 a% M7 k! D5 `: x2 G: D$ {- module_param(acnt, int, S_IRUGO);
" b/ O. o i6 E; I# m6 [3 D - module_param(bcnt, int, S_IRUGO);% y4 A, x: e9 C/ ]& O9 l3 h4 b A
- module_param(ccnt, int, S_IRUGO);
复制代码
1 d! T* Z* m* D' M6 o4 r3 f L- {+ I4 x( c- B' x( v. @
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% Z4 S4 E( t3 o. K. Xarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) f9 E1 R2 b/ |, r
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. }' i+ A: q. E- s
/ y( D& O* ~0 `5 i" j% M
/ Y; u* |$ m; h2 G+ I" e |
|