|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 Q% `: ^0 r6 E5 l6 R7 S: n- [code]EDMA sample test application
3 z G4 Q8 U* @+ R - /** T7 g& s' M$ v; G; [8 k- Y
- * edma_test.c2 J. ~# T# t( W: ^* [" l# n
- *, k, b# U- w- k0 S
- * brief EDMA3 Test Application8 {/ r8 A- ]2 R2 I s/ a
- *
, a: {- |4 J2 t9 F - * This file contains EDMA3 Test code.
1 ]. ?, a- L! p! e: N - *; ]$ Y! J2 o* n% h
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 y; ?$ A( s% ^* j+ S* Q: J
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
|. f% Y) M, I2 o# H - * TO CHANGE.0 x, J7 _ D& w1 o- e
- *5 I4 |% s8 D$ x! O$ Z+ h
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% W$ C+ H+ N" a e% s7 m% h
- *
& s. l! m* O/ x3 B# G% A! K - * This program is free software; you can redistribute it and/or
) s+ a" ^4 b+ W! ]2 [8 | - * modify it under the terms of the GNU General Public License as
/ Y! b/ k, Q& `1 g' m" B' a - * published by the Free Software Foundation version 2.: a- t5 l# s: X) g. ~' l7 S* S( ]
- *" ~0 D1 b" L7 ]! O) l) o: i! d
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
- x! c$ E5 l0 H) ]3 ]# c- t( l - * kind, whether express or implied; without even the implied warranty6 t; m; y" _0 i) P' _7 V2 q: v# B
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# F1 j5 _. t3 R/ ~7 } M( U5 h - * GNU General Public License for more details.3 y# h; ]) |# M& r5 A7 u3 u; }
- */
1 w- n4 n* k- c* _3 Y, M
( K) V/ ]7 {- Q' o! P/ {- #include <linux/module.h>
, T; H! x: ~, c( D - #include <linux/init.h>
, c& W& {% U T7 X, G$ j# U- C - #include <linux/errno.h>
. }* q& @+ |3 B5 a+ w- Q - #include <linux/types.h>
. }3 H2 i3 p) N+ Y* w - #include <linux/interrupt.h>
. o9 @1 q" E' [, d; L - #include <asm/io.h>4 {. F3 F0 `! r7 ^1 j3 \/ ?
- #include <linux/moduleparam.h>; A) u. s4 c u1 o |
- #include <linux/sysctl.h>
" m/ B' }0 J' k; N- O - #include <linux/mm.h>5 z( t! ~1 s: R$ E0 E$ o: d8 s* v( I
- #include <linux/dma-mapping.h> a) \( q% c& P9 j3 m$ m
- d; a7 T; @0 C+ p- #include <mach/memory.h>
1 E' {8 e5 j% Z4 Y$ y, N, H; J5 V. T - #include <mach/hardware.h>
4 M6 ]8 g- S7 W( ]" _ - #include <mach/irqs.h>8 H5 a4 \7 X& u' w
- #include <asm/hardware/edma.h>
! D. G7 Q- R, n% R1 h, f$ a/ ]
: v \0 p4 g+ D6 {- #undef EDMA3_DEBUG
5 n& C% U' ~: e! B% y - /*#define EDMA3_DEBUG*/+ d9 Z6 F, s$ E# I
- 4 P0 \2 r& @3 z1 H, ~2 s: L
- #ifdef EDMA3_DEBUG
; d6 i8 o3 ~& t3 M" w9 ^! R5 R - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS) L7 H4 ?( ]- X- ]! n/ y: Y
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); ~3 a7 ~' T- {# ]6 b! i6 S. q) m
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 C9 U+ F% \' B- z
- #else
7 E. ^+ m- t% t- I5 x( L - #define DMA_PRINTK( x... )
Q# Q' s- {0 N' o" m0 I - #define DMA_FN_IN% j" M6 w# l9 D* w
- #define DMA_FN_OUT( E4 z' J9 O" _6 U8 p( Y
- #endif/ O; @( _1 H" P. H' u
- ( U5 R3 L: o$ ^( V. j' c
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
8 `$ J$ a, t( j - #define STATIC_SHIFT 3
7 x) C: _- b7 B. M4 [8 K# g1 z/ m - #define TCINTEN_SHIFT 20& Q9 r6 a/ {6 ]( I/ N+ C
- #define ITCINTEN_SHIFT 21
x- m' O1 _; K' ^' k - #define TCCHEN_SHIFT 22
9 x/ i G# P7 |' C - #define ITCCHEN_SHIFT 23( N' Z- C) a2 S2 N( R2 |
8 m- @0 c" H5 _& O, s- static volatile int irqraised1 = 0;
4 S2 v8 @' K8 G' f! a2 D: k - static volatile int irqraised2 = 0;
/ ]0 r1 N3 z) Z# z
7 `2 R8 P4 Z8 f# h& ?6 j+ y. N8 @2 q- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ S" W' S+ J9 G/ ?: l, K
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! J: z: e. G7 I' B4 G
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# c0 t3 V% o3 H6 M- d: ? - 1 ?# H9 M* i [% k5 g( W
- dma_addr_t dmaphyssrc1 = 0;
$ [' x- A+ G: \7 h: V5 _6 z - dma_addr_t dmaphyssrc2 = 0;
* Y' x7 L, J& m$ e4 k& [ - dma_addr_t dmaphysdest1 = 0;. H# j' u& a' y3 a% Q& y; z" W
- dma_addr_t dmaphysdest2 = 0;
. ]9 {3 u+ ?* ], x* f
9 d6 E8 a. w$ X# [- char *dmabufsrc1 = NULL;8 H( S3 k- s* `; P7 \1 A; `
- char *dmabufsrc2 = NULL;: i: P# o3 U. d/ T- F
- char *dmabufdest1 = NULL;
3 n; Y1 Z) ~ R3 Z9 a - char *dmabufdest2 = NULL;
% D7 S( Y: B6 J$ @3 [
5 y3 J% [1 o- Z5 ~ X- w) f* ]- static int acnt = 512;
8 k: L r* \& ^4 P( D7 D$ V8 N - static int bcnt = 8;
; P1 D! B, m* I" [$ }0 h5 j - static int ccnt = 8;
, n3 j8 g: z8 b- L. H - % s( r$ M7 A1 l3 a* F. V
- module_param(acnt, int, S_IRUGO);; Z" h# _* {* N( n' N. p: [
- module_param(bcnt, int, S_IRUGO);
/ @/ J" w$ Q( l, g; J5 b - module_param(ccnt, int, S_IRUGO);
复制代码 ) h- w' a2 S- t& Y7 m
6 ^' n0 ]0 M: s' N& s' G1 T' S6 b
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# C. A7 ^/ H$ H% o2 ~/ \/ {
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& Z. K8 R! ]4 k6 H5 I8 t$ L2 j 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# |( J# w6 o; L/ S0 s, d) x: h# A
' r6 x$ g# I4 n
& A1 [/ Y/ c% @$ _( S) U |
|