|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' ^+ q* i6 k% Y5 n
- [code]EDMA sample test application
- G3 F: e3 q2 z' h9 b% F( K - /*
9 z6 z2 O' G7 ] - * edma_test.c
! s" \. { {' h6 ^ - *0 C( ?# D# w% ]- C: y5 _" M
- * brief EDMA3 Test Application3 l- a1 d6 `6 Z1 N; s- X$ J
- *
$ z7 r# J0 O8 ~, Q - * This file contains EDMA3 Test code.! i$ V. i. F0 R5 H4 m* L# T. b6 g
- *1 F/ T2 y3 U0 q9 T
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- T& z7 D( g5 K9 I3 n+ ^$ [
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, J$ ^& V' Y& m
- * TO CHANGE.
! T( m7 t b2 O - * b9 ]/ K3 C7 e& @: H3 R9 a
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ R6 {% `+ h3 x: |$ H
- *
. |" y; c2 N* ^6 |8 K5 c8 m - * This program is free software; you can redistribute it and/or9 N- i. |; w7 ?
- * modify it under the terms of the GNU General Public License as* Z4 V# [) r; Z
- * published by the Free Software Foundation version 2.
% e4 d6 W7 a, Z9 v - *3 n1 z$ d, [5 F2 m
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
1 Y" ^/ I7 j2 f0 `9 G8 E - * kind, whether express or implied; without even the implied warranty/ Z2 O/ ~+ o& J, q g& y3 M
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5 \, P ^( q7 P! [. j0 y, U7 m - * GNU General Public License for more details.
3 y) f- L/ j/ I7 X* y - */$ Y9 L1 o# P" d" U
- ( `7 \8 F, z9 z
- #include <linux/module.h>
. j( `+ o9 W0 r# w) {, [ - #include <linux/init.h> P. O1 y% x5 {% h$ F2 h
- #include <linux/errno.h>
, Y# ~8 e2 N' F/ ?. W' c4 [% _ - #include <linux/types.h>" F/ a7 l6 u! q
- #include <linux/interrupt.h>
s: g3 j9 K1 Q1 b7 q9 B - #include <asm/io.h>) y( q% n, e) \1 K: A
- #include <linux/moduleparam.h>
4 s) W4 A) b& e: S" j0 d - #include <linux/sysctl.h>1 ^/ y& P' V: u+ h
- #include <linux/mm.h>2 Q# {2 b. i) E* @
- #include <linux/dma-mapping.h>
7 G3 P5 ]- S) E4 V/ I - 8 g& A; E5 k6 Q
- #include <mach/memory.h>
+ o5 V- w# s+ D1 J9 F$ l - #include <mach/hardware.h>
) A3 v a& ^2 u% Q - #include <mach/irqs.h>
3 L* Q# Q1 V) }/ U - #include <asm/hardware/edma.h>1 c, E* |5 c0 ]) z) O) W% \
- 5 V, |" N, c. h! b% n& F3 o
- #undef EDMA3_DEBUG
' @* q6 N4 i2 Y( ^9 y+ S8 @7 R - /*#define EDMA3_DEBUG*/3 ?0 W8 C: K2 p6 O
, M1 g4 t/ C; X/ E- #ifdef EDMA3_DEBUG4 k/ U v7 r9 O( U5 p3 X: N- R
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
# o2 K: b0 d, y I - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
4 z- V1 B: C; a# X. j. G" j - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
1 l& G6 x2 o; H/ K$ p1 A - #else
1 N3 S1 N% o; A# m2 M - #define DMA_PRINTK( x... )
$ _, f9 c( Y* \9 n! A# ]# Z9 P - #define DMA_FN_IN% s5 Y) f9 @9 {2 K
- #define DMA_FN_OUT
# W* s9 f: R# B - #endif G% K3 b2 I& q$ V$ g
- * ?+ [+ j, l$ i H. ]: r% T
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
# _$ U. h/ K2 j7 ] - #define STATIC_SHIFT 3! }/ p# N* Z/ d7 v: J; d
- #define TCINTEN_SHIFT 20
" X: x' v5 Y. t2 A% C$ l5 k1 P/ w - #define ITCINTEN_SHIFT 21' G7 s' j& L: Y3 s9 H7 u
- #define TCCHEN_SHIFT 22
) o5 y& _! x+ ^% Q - #define ITCCHEN_SHIFT 23
+ c/ f4 l0 t( H% m - / T7 \- D) f% H' n# ^
- static volatile int irqraised1 = 0;
$ t+ B7 ]" `9 y; \7 y - static volatile int irqraised2 = 0;
; d1 a; q; n0 [: H6 q
2 Q. Z' t/ d; v! @ _5 t5 t; M/ v0 d- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ H% v& q0 h0 [- Y) ~* F* u - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 R: i$ Z# X$ a) }1 g' ^ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 d6 C* m$ O% u- M
1 {+ L% ~& [1 ]' X9 @/ E- dma_addr_t dmaphyssrc1 = 0;
5 i$ A& M) ~+ y3 D - dma_addr_t dmaphyssrc2 = 0;6 u. r* E5 |1 h5 Y7 Y* c/ V8 `
- dma_addr_t dmaphysdest1 = 0;
. P. Q. C' M; M5 L! C; X - dma_addr_t dmaphysdest2 = 0;
0 I' Y' | s, ^) r/ y
$ c$ G/ ~6 g/ G( o& e, S1 C& T- char *dmabufsrc1 = NULL;: \9 C7 I# A; g% {1 ]
- char *dmabufsrc2 = NULL;% x6 a7 O7 X) ~; \7 o8 v
- char *dmabufdest1 = NULL;; A2 P# X3 w# V1 J, u; T
- char *dmabufdest2 = NULL;
% A1 `# h8 a) e5 A4 k - ' A# S# K# n; q3 W
- static int acnt = 512;9 z3 j3 e8 f' r" X5 q- r, L4 w
- static int bcnt = 8;
7 V4 ?) O9 [" j0 g - static int ccnt = 8;* q- A9 T% p/ l" o3 f# e3 x- _
- , @+ o% u4 G) ]* W
- module_param(acnt, int, S_IRUGO);
3 G5 x. \, r. K$ g - module_param(bcnt, int, S_IRUGO);
+ V( q8 E9 ]& y1 f* M - module_param(ccnt, int, S_IRUGO);
复制代码 8 `+ u( H! L2 l2 k! r( @( ^$ U$ D
; d; n* _. ]* _% B# C8 m* Q9 ~
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
\; f% f* K3 N- X8 f' `& [$ s3 Parm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: I) U# K1 g. V
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' @: b0 k0 a8 t) _$ R1 c& {
9 E, }4 F/ P) w
6 J$ H$ W6 [8 \ m6 s( Q- n; W |
|