|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % ?& E9 P0 k3 f
- [code]EDMA sample test application& O$ {$ j! C! n# `' M& L
- /*$ ^9 [4 T2 ]- R4 x6 y
- * edma_test.c
2 B% T# a, V) j% T* m+ i' p6 ?" U - *
% N% }2 V: H* P& z - * brief EDMA3 Test Application% n! V, }7 g+ L+ G
- *
, q" V3 W4 \* Q, O& @ - * This file contains EDMA3 Test code.
+ V' G- R! _: P# @, \ - *
6 U4 V o* D! O; q2 S q8 f - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
/ y9 S6 T( [' f$ o# |$ K6 i - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
; G) O$ j; ~) x- I - * TO CHANGE.) D1 O& q! j+ q, z9 y& _3 [
- *: c% A4 ?8 u9 W4 J9 t/ I
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
* T; Y" h$ I8 y5 n' I `3 S - *
1 I( Q' G9 H3 b/ e5 C - * This program is free software; you can redistribute it and/or+ M# O G5 K4 |; b6 C
- * modify it under the terms of the GNU General Public License as" X; P8 G+ d0 C; `! x1 p$ ?+ ^
- * published by the Free Software Foundation version 2.# p$ b: b) u. r, }& x6 E1 K) |0 p
- *7 ?7 Y2 H1 Z4 a. |$ G/ |9 G
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 m% p4 D+ A) `% @
- * kind, whether express or implied; without even the implied warranty
! M" i4 T$ g. S# y0 r. m: t) M - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- r$ h: d0 S3 I: D j! D
- * GNU General Public License for more details./ N! X& V2 P; l, V3 d
- */5 @) ?% Y9 L# d: y
: h4 N" j* h5 C% B- #include <linux/module.h>8 s' P" m9 {6 Y& G
- #include <linux/init.h>. I5 n0 {, ?9 h, |; z
- #include <linux/errno.h>6 z% T5 x: v. O+ a
- #include <linux/types.h>) @/ `. ?) E9 G# c% C) A! A0 u
- #include <linux/interrupt.h>
5 l# K0 r9 g" b& K0 W: u - #include <asm/io.h>
5 T o4 I* |5 v! | - #include <linux/moduleparam.h>
+ ^: l1 |1 D/ Q. N0 }% u Z - #include <linux/sysctl.h>5 e' M; S* @3 X4 T
- #include <linux/mm.h># }! h( Y6 S: Z: s9 p* m
- #include <linux/dma-mapping.h>
0 j) j" M# b! Q1 y
- m( a6 [( |9 \8 h% K* m+ I- #include <mach/memory.h>
" D. v% Z1 }9 W; o - #include <mach/hardware.h>% s! C2 ]8 z9 }3 G ]' q8 g6 k
- #include <mach/irqs.h>3 q9 n6 w# N6 O. u' d* d3 {
- #include <asm/hardware/edma.h>
, q# {. I1 J+ z. c( u - $ j t- U/ |: ]- I9 K) e
- #undef EDMA3_DEBUG
1 x: h- p9 v, F - /*#define EDMA3_DEBUG*/
! p$ I( a& F. | - / N' i. R0 E5 e9 G+ }8 v9 ]
- #ifdef EDMA3_DEBUG6 h; d. e0 o3 T3 V& O; R
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
) L3 ?7 R0 b9 }* M0 M - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
$ ~; \# [) l; f0 [' u - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 w, O P5 j5 l% v
- #else: T6 R! U- R3 H! Z
- #define DMA_PRINTK( x... )
% M/ f1 n9 k- _4 a8 b - #define DMA_FN_IN+ p. t/ q, H' `; G5 u4 M: z
- #define DMA_FN_OUT
' n5 b/ h. Q9 v( [ - #endif
4 Q6 ?& \. [5 [0 r
4 _( f4 C& `3 h6 c1 G- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
, I+ M' e; \7 y: s1 _ - #define STATIC_SHIFT 3$ b" @6 b9 X: Q! q; D2 X7 ^
- #define TCINTEN_SHIFT 20
) Z) P% t% n; ]) N: H; p - #define ITCINTEN_SHIFT 213 [ g% A5 U" E5 G e0 N9 V8 ]
- #define TCCHEN_SHIFT 224 p( q# b/ z7 {
- #define ITCCHEN_SHIFT 23
5 a |8 z+ A6 e% ~8 Q& f' J - k2 Q$ `% d! N6 M
- static volatile int irqraised1 = 0;
& {; M9 R) y$ w+ u - static volatile int irqraised2 = 0;
2 R) H5 e f/ k( j Q# L - / O) d9 u5 h4 u, g$ q
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' N' \, ~* ^5 |" E! \
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 A. ]6 a% Z6 K' I/ N [; S
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" L% i6 {1 g7 ^' } _ - 1 w& A, [! L; ^
- dma_addr_t dmaphyssrc1 = 0;7 z/ _8 t8 Q+ D- M Y
- dma_addr_t dmaphyssrc2 = 0;3 l9 E) A2 i" _) D6 B% |0 m
- dma_addr_t dmaphysdest1 = 0;/ S: u r# p x) v) p! V
- dma_addr_t dmaphysdest2 = 0;
, I p! I, _4 M7 ?2 \4 g# K
0 Y' [9 f& b8 |+ t% ?' p$ f- char *dmabufsrc1 = NULL;
% C3 g) M& v( ^0 _/ U1 m: v7 T - char *dmabufsrc2 = NULL;
6 ]$ M! y: s6 N$ p - char *dmabufdest1 = NULL;4 X- G8 Z5 o2 p4 J) p }; K6 R) L$ c
- char *dmabufdest2 = NULL;2 @3 Q3 {$ t2 G$ Z/ q% n$ Y
! k3 ~$ \$ w5 N- static int acnt = 512;
- X2 d* O) q4 c2 X; @ - static int bcnt = 8;9 v% [" D# {* }* }1 K5 U
- static int ccnt = 8;0 x8 C t% T( t. u5 @" m+ D
- 8 c/ |" k' l: j
- module_param(acnt, int, S_IRUGO);
4 e( V7 _% C7 T# X4 Q% x - module_param(bcnt, int, S_IRUGO);* `6 D: ]6 x2 D/ @& t
- module_param(ccnt, int, S_IRUGO);
复制代码 ( o- e( c- H g$ X/ y) F
8 L# ]* j/ u. B8 P$ s
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
C: k. v! P- b( _6 Aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 ~0 t' h' Y# P6 f- L' }4 L
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# z& ]4 i! S/ D. O
6 V3 G1 v# q4 Y+ p! u8 e% Z- k H Z9 ?! ~6 W3 E
|
|