|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 s7 r0 V d U+ \+ `* v2 D* c- [code]EDMA sample test application. y9 r7 ?' N1 ^& i4 h. Z& c7 C% j
- /*! l' ~" z, u, q: n
- * edma_test.c/ D, `' P. o6 [3 U
- *
' D. ~- Q5 Z. H4 t8 m2 M" V - * brief EDMA3 Test Application
3 w( D# y) P; o4 o0 _/ \ - *
" Z1 p. c, R1 i& r+ P2 K% O - * This file contains EDMA3 Test code.
( H. p3 Z4 n4 i/ [/ d2 n. o2 h' _ - *
2 l: D3 n9 S5 H& T& c n3 z! I ~ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
. x+ p2 d$ d) X, ^ F- h2 m2 g - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# j. l1 z* m1 L' E
- * TO CHANGE.
- a3 {% V/ g. p K. K - *! G% r0 i, T F' ], I5 C
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& y3 ~/ [5 r( p+ z: Q
- *
2 c" r3 ]( L8 S3 | - * This program is free software; you can redistribute it and/or
% q. w* _# f/ u$ T% F - * modify it under the terms of the GNU General Public License as; h( O* |* y3 L/ m/ n5 a8 x
- * published by the Free Software Foundation version 2." b+ d8 e* C1 ` X: V! W
- *
+ R+ w6 |7 N7 `0 A - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
' X0 O a% M; t# J3 \2 z1 x9 c' I* U - * kind, whether express or implied; without even the implied warranty2 Y' }" P, Y1 A/ X t* R* k
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5 S6 z. }% L) l2 e" r9 t, Z - * GNU General Public License for more details.
( C$ x% b7 u) a. h5 ^( e - *// w" q- j1 Q7 y4 g
- % }9 Q: O" d% S& s
- #include <linux/module.h>7 w0 t; F& J8 P9 t% Z
- #include <linux/init.h>; O& S, q3 t! c; z- c3 z" g
- #include <linux/errno.h>7 y1 Z! {( R \4 h( ^+ T( Q
- #include <linux/types.h>
% P5 ~0 ~9 \4 f3 C& a0 @' n - #include <linux/interrupt.h>3 Z% n4 l" j! }/ h
- #include <asm/io.h>7 x. X) D0 _( [
- #include <linux/moduleparam.h>% H" S- n& N9 S( B3 m( X8 o# O0 V
- #include <linux/sysctl.h>
5 k) N6 C7 ]9 `4 _$ X - #include <linux/mm.h>% u, x+ C; {! j* a6 U( `+ W
- #include <linux/dma-mapping.h>
, ^2 a1 t% ^) @: _' j' d2 i7 m. H - / w1 i( H6 }- t3 _
- #include <mach/memory.h>
' A$ `& e, M2 A) }& B4 V7 o s# k - #include <mach/hardware.h>
. p8 |) K0 G. d1 b - #include <mach/irqs.h>
8 S3 y, M4 F9 Y$ n4 u& b) k - #include <asm/hardware/edma.h>4 K5 f c/ y m' E4 G5 k
& Q) z$ T {7 q* q% v; a- #undef EDMA3_DEBUG
% t' Z) `4 q: y# F - /*#define EDMA3_DEBUG*/' U+ ?5 w( m; G; B( q
- 3 z; J! o. h1 N; {* j% M
- #ifdef EDMA3_DEBUG
, X: f2 W* S) B; E! U5 G( N9 A - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
6 v% { B6 u& z4 E/ d. ~ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), F) x! f# Y: A
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
- d" a" g. I* e - #else* M5 x" z( P# r) c' e
- #define DMA_PRINTK( x... )
9 i+ L+ U E. [) ?3 z2 I - #define DMA_FN_IN
: M- K# T2 Z8 u% L4 N. \ - #define DMA_FN_OUT
+ [! U1 N8 {3 ?* `7 { - #endif
$ T% T5 } T6 {7 M - 4 c) e5 P) X [* H( B& V
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
1 \' P% A- [9 x3 D& r - #define STATIC_SHIFT 3
" ?+ C: A4 {% y7 ^ - #define TCINTEN_SHIFT 208 m {. y, L: x. U% A A# f6 v+ g
- #define ITCINTEN_SHIFT 215 \! z, F0 H4 @' V2 x9 |: M. x/ j8 N
- #define TCCHEN_SHIFT 22
, `. B& V; z9 B6 e) T9 I1 H - #define ITCCHEN_SHIFT 232 G3 B% x/ x$ Y7 t7 u) }) Q3 M
/ c3 H# X# W1 [! i7 E6 Y+ P- static volatile int irqraised1 = 0;
9 r$ ~) M" G# X# v - static volatile int irqraised2 = 0;
% @, m8 i# j" T# d+ _
' J6 {' }! y0 C. w$ O# _2 k3 {- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& e- ]7 `2 F' P* |4 j/ B( F - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
H, D9 w$ j/ |/ y' J - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ {* t: ~ I+ b. t2 @9 u - ) n. s5 G: {" L( Q! ? j
- dma_addr_t dmaphyssrc1 = 0;+ I2 c/ ~" Y. Q$ m8 j5 }# I3 l
- dma_addr_t dmaphyssrc2 = 0;
_7 ^: c" {/ }' u( Q5 z - dma_addr_t dmaphysdest1 = 0;! X* \& I7 p# Z
- dma_addr_t dmaphysdest2 = 0;, x; q, \$ M+ H
# J* z/ x& Y: U8 q, n3 [- char *dmabufsrc1 = NULL;( k1 M" Y4 O" c# X( Y5 {8 j& n0 C
- char *dmabufsrc2 = NULL;
$ Z8 q- Y6 T9 O4 y4 u2 B7 K - char *dmabufdest1 = NULL;
! }/ I2 S, O# r) J* h - char *dmabufdest2 = NULL;. j, U2 \$ ] ~: m/ p; m9 C1 s& ^! G
- + g @! f6 \, k: Y% |4 N
- static int acnt = 512;, ]: I2 s( x' Q. n: W6 z3 ]+ C
- static int bcnt = 8;$ w" A: S/ U" M& }0 m0 W# Z4 l: U0 ]
- static int ccnt = 8;
; M. q! C `6 E7 T1 I4 ? - * k& s4 h7 J! j0 K1 f! ~6 [
- module_param(acnt, int, S_IRUGO);
4 H* j& R: v7 N2 P. o# o - module_param(bcnt, int, S_IRUGO);+ _" `8 s* w2 M/ n
- module_param(ccnt, int, S_IRUGO);
复制代码
) H. Q9 v8 q$ j. g2 T
0 t; w3 m5 n- h7 |. E# w 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! R M, t" M9 R& T! n' B) Yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。% {3 b2 R+ s' R7 y- I! U
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. ^- c. X# K* ]* y: j# h E2 W( Q- m
R. [6 `3 k3 k |5 A- T4 W, A
|
|