|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! ^/ n' S& B2 o( R; A* P7 T- [code]EDMA sample test application
3 C& H" `* q e - /*3 U5 T$ E& a' d2 @7 F. |" F' P
- * edma_test.c, W$ u g+ m) j7 Q0 S: h
- *
" T1 r# |- c2 K - * brief EDMA3 Test Application
' l* J' W. q4 v3 u - *9 V& _% b1 C5 q5 C
- * This file contains EDMA3 Test code.' |# j. E& u8 T- i' p# s
- *
6 D8 t2 j, ]( \1 T5 V% F& O: V - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
" {2 u( S q% ^ n1 J$ C! a% P - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 P+ f# z: x# w
- * TO CHANGE.
, r S" T9 B: y# k b" e2 x: m5 n) u - *
S( N$ p$ c3 L1 m - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 M" {7 e- Z% ], l( B1 F' E
- * y, h: h0 [* r2 y. O# |! t
- * This program is free software; you can redistribute it and/or
% g9 C2 ^) R( @. s+ [; ^+ r - * modify it under the terms of the GNU General Public License as6 L; N$ d1 [. Q
- * published by the Free Software Foundation version 2.
7 V& P! ^1 h! h/ z. O4 f4 q - *# R3 S/ b, j$ n3 ~) z# a
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
4 k! ^! Q" H, W" I( S2 N - * kind, whether express or implied; without even the implied warranty
- P4 q! I1 A' j0 |) I) o - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the, M% C( C7 F) o
- * GNU General Public License for more details.
" e6 J/ b3 [1 @& v# Y n% j - */
( T: t& w: F- }0 x; ` y# u
- u1 W6 D0 ?5 B4 g4 j6 t- #include <linux/module.h>
" I5 P5 x' A" O" a7 |8 E" v1 j( W. { - #include <linux/init.h>
; n; |( f7 O z - #include <linux/errno.h>$ G# k4 E P6 {- b$ ^' ` X
- #include <linux/types.h>$ C$ ^& F9 q; M
- #include <linux/interrupt.h>
. V0 _4 _4 x- p& V. Y/ V6 F9 D - #include <asm/io.h>
. m, v. m! K1 B$ K8 ^# ^' ~2 T+ G0 `: e - #include <linux/moduleparam.h>7 ]% s6 j# a' \1 o4 k
- #include <linux/sysctl.h>3 [4 o4 G# i3 z2 e# [
- #include <linux/mm.h>6 ~- w! C ^& ?6 g5 o
- #include <linux/dma-mapping.h>8 {- n! o" W1 t
, w; e5 Y5 H3 t9 k c- #include <mach/memory.h> @! }0 h7 }3 _4 a" ~% \% d ^
- #include <mach/hardware.h>
0 ^6 G/ |7 G1 a. H; Q - #include <mach/irqs.h>0 P1 X. L+ p" g' B" I/ n
- #include <asm/hardware/edma.h>$ J" m7 A3 b3 Z- ?
: }1 N+ V1 ?8 } k/ x0 o6 U- #undef EDMA3_DEBUG
+ U/ m" a& g( m2 }' g1 U - /*#define EDMA3_DEBUG*/
7 C3 `" a8 f, D5 Z) E - 2 ?; f5 P& O! E( f, U
- #ifdef EDMA3_DEBUG
6 q& {4 i5 h# y* ?) t ^ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 B/ z) U) v2 e ^+ n
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__) I; N! g1 X5 _$ ~7 z: Y
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
6 n( b/ l+ y! p% |5 v6 `. C - #else- i) ~+ O( f3 Q" Q- V
- #define DMA_PRINTK( x... )
. |( ^! K; w6 S" } - #define DMA_FN_IN
+ B: ~' w: `, X& ^$ D) e - #define DMA_FN_OUT
9 G: d0 E. n( m/ e+ ]- Z0 A* M - #endif3 [: T4 ?% g; I" m
) T( b: A" S7 L9 b- #define MAX_DMA_TRANSFER_IN_BYTES (32768): t; Y( S9 G J" x4 [
- #define STATIC_SHIFT 3
! |' V$ r, j$ [" `" p. p3 d - #define TCINTEN_SHIFT 20
3 J3 }: R j% A4 ^. | - #define ITCINTEN_SHIFT 219 ^, q+ I; |. e5 N9 K
- #define TCCHEN_SHIFT 22* I# o4 _: b, y: R, B* g
- #define ITCCHEN_SHIFT 23
3 }0 @9 v8 _$ R5 u
9 ~, Z4 J: ?9 z. ]- static volatile int irqraised1 = 0;
$ i6 x& \" }! z! v1 v! l; @" T$ R - static volatile int irqraised2 = 0;# B. B. Y. V& C! H" |" ~
- . Y( C( y7 b+ ]+ u% z5 \" h; n
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' m2 {$ W9 k# X: H# @ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ O7 u% U& I; S* ]( g
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" b; U/ Y1 z% b9 O+ j
9 [; A" U3 w8 a: G) ]# [- f- u2 a- dma_addr_t dmaphyssrc1 = 0;
; L4 u3 J( p( X/ Z - dma_addr_t dmaphyssrc2 = 0;
1 S5 Z( _ r; t6 t: p2 R - dma_addr_t dmaphysdest1 = 0;
1 _; S: w7 F* W( m5 N - dma_addr_t dmaphysdest2 = 0;
9 d3 O, R2 o6 x$ N$ w' G* u
" W2 W4 T8 u2 [+ J- char *dmabufsrc1 = NULL;
% C5 t1 a$ Q2 W) g7 j! W8 e" c - char *dmabufsrc2 = NULL;
. a8 ?1 H' K: X* P - char *dmabufdest1 = NULL;
4 a: ?2 _8 `2 D4 x/ p+ I' C) |6 Z1 j - char *dmabufdest2 = NULL;* L$ D& E w7 T& g. @
& {( ]; A7 g$ D. I( h/ }+ i1 s* i- static int acnt = 512;
' g8 p3 W' x2 I5 l# d - static int bcnt = 8;- t# N) t# C6 n: h( c/ d6 C( V- A( U
- static int ccnt = 8;
& w& S5 l3 }8 e* W
5 e4 Z' a# | d5 H, I k; H X- module_param(acnt, int, S_IRUGO);2 C+ j. \9 m/ F* i9 f5 \
- module_param(bcnt, int, S_IRUGO);! W$ X" X7 R+ I+ D- D
- module_param(ccnt, int, S_IRUGO);
复制代码 # ^5 }$ F1 Z. h- O3 u# }
! t0 v# p' N# b" I, N
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: E' d4 u0 ~7 I. ]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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 u! g( {0 a6 r( O/ u; H 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! j: r! r# H' X3 ]
4 e& I/ r% O& X2 z e/ G1 Y* ^8 [5 J% d
, H# D& P. j' y( j |
|