|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ h+ Z/ Z% Q/ K/ t- [code]EDMA sample test application% y$ {" k; b- z2 v% q1 `2 R
- /*5 O" ]% R' X# ]5 B! r. A* j
- * edma_test.c1 K: \0 H7 D Y% Z. g! y
- *2 U: \- ]& R' l& k8 M
- * brief EDMA3 Test Application& q! U3 r+ v' Y* z( j4 ^) s; T
- *
f( R+ c7 {: @4 \& d0 c - * This file contains EDMA3 Test code.9 l4 h C9 y& k3 K' `/ O7 S' v
- *
$ e$ `/ g5 S/ ~" P7 u9 ` - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
, |$ a! ], a0 w4 S' m6 A; t - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! T+ }' F$ [! S3 P
- * TO CHANGE.: W F: n5 @% f7 `$ Y
- *% i+ Y7 u' C, J; |
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
; f5 b- G$ t. z+ u0 N - *: O; u! p( w: @
- * This program is free software; you can redistribute it and/or
, M$ i7 j x1 T0 J- ~ - * modify it under the terms of the GNU General Public License as6 N8 P* F/ u K8 B5 i
- * published by the Free Software Foundation version 2.
5 L$ U0 U8 L, S - *
: s5 L$ y+ w+ L( \& v: F4 q - * This program is distributed "as is" WITHOUT ANY WARRANTY of any( W+ V+ W/ F4 a: j q
- * kind, whether express or implied; without even the implied warranty
8 T6 `) K7 s# F, L - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! V; a! y& ^, l9 \% K+ H& ~0 ^& n - * GNU General Public License for more details.
9 v" \& x- G$ V1 p9 T. p - */
8 g# x8 w- _& g7 N7 P# M* i% E. b - , K0 ?1 j" L4 A
- #include <linux/module.h>
. V" p5 H' S( p0 O! W5 t - #include <linux/init.h>
) Q) h6 |& a! n+ ] v7 D - #include <linux/errno.h>
& V. c$ s2 m% i* D- P4 M3 d - #include <linux/types.h>
& G5 S" ]$ F6 o! O - #include <linux/interrupt.h>9 i# K- t3 X- ^; \$ m
- #include <asm/io.h>% W2 V' {6 K# i
- #include <linux/moduleparam.h>
$ o2 F p/ |8 _0 D4 D6 c K) i/ f - #include <linux/sysctl.h># I' H+ z l6 ]' Y- g/ O4 j
- #include <linux/mm.h>( y, z0 u# U% Y( e( }$ r
- #include <linux/dma-mapping.h>
$ q/ i/ L% W9 M# E. _
8 I% d2 {" a1 [2 Z) P- #include <mach/memory.h>( l0 i) O3 |, r9 q6 ^' ?
- #include <mach/hardware.h>; e7 l d2 @1 a8 @
- #include <mach/irqs.h>; N7 \* V3 Q7 b8 K, f0 ?! s# h& N' U
- #include <asm/hardware/edma.h>
^- h$ \! Q$ G+ Z6 F9 H# C) c - b0 C7 h3 Z, y. U) B: E* e
- #undef EDMA3_DEBUG# [( j) d8 v; B* ]' o. I) I
- /*#define EDMA3_DEBUG*/9 H; A2 X, e7 @' \6 Z0 K9 s
+ V7 V: |5 w/ J% r; Q8 u# g+ A- #ifdef EDMA3_DEBUG
8 I$ d& A7 a$ C# F* ?; p - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
8 ~1 i2 G$ }* ?- a* i* Y& Z$ W0 F - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' [+ r/ ~; _0 x" p8 c5 g
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) k9 m# P( q' u+ W
- #else
- v. d$ p" a' E: J$ {3 q - #define DMA_PRINTK( x... )
) [. b" ?! T9 Y* m - #define DMA_FN_IN( o, j) O0 E% H- m
- #define DMA_FN_OUT
' u3 x) o, Z3 I5 r; _- d4 f - #endif
$ O5 Y: J& q5 H/ ?( G9 s - # K6 U, M- f* r# B- \. H/ \
- #define MAX_DMA_TRANSFER_IN_BYTES (32768) s9 Z4 \: f% G8 d- S
- #define STATIC_SHIFT 3
" i- B: m; M, B M - #define TCINTEN_SHIFT 20
4 e" P, e# X" o% Q ~- I* c; W3 e - #define ITCINTEN_SHIFT 21
! {3 F7 _: N: a& [) A4 |& K* P - #define TCCHEN_SHIFT 22
$ z: z) [7 l+ b. q- i - #define ITCCHEN_SHIFT 239 O% k+ A; W3 I* L) R3 }
- 2 M/ g) p' M6 d- X2 d a
- static volatile int irqraised1 = 0;
( K& w( k; [; w x) K - static volatile int irqraised2 = 0;% x8 N& H2 t; h/ ]) L
' h: P: T- d, [8 Y( b e- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' N8 G0 d }1 D3 e3 h - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ S" k( s9 t( O/ d
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- R \ u; G' I
- " u4 o" Q( B$ q( L* T3 \
- dma_addr_t dmaphyssrc1 = 0;; F1 ^/ d* ?) h
- dma_addr_t dmaphyssrc2 = 0;) i9 a# Q* t7 }# T
- dma_addr_t dmaphysdest1 = 0;6 J$ \2 I) r: E
- dma_addr_t dmaphysdest2 = 0;, K5 [8 ?9 i4 B0 i
O8 x+ E# r4 l7 d* w- char *dmabufsrc1 = NULL;
3 r; |. x& Z) X2 C3 z$ D2 | - char *dmabufsrc2 = NULL;5 u6 b7 h+ s# b( |& W' H) n
- char *dmabufdest1 = NULL;
0 _5 L. T5 H% v! y6 K0 ?6 @9 n - char *dmabufdest2 = NULL;
0 T* ?7 P5 I1 j" @+ }- T u
9 E& |, E. l+ i4 s% e- static int acnt = 512;1 w/ J7 ~$ i2 B0 b
- static int bcnt = 8;1 ]" A% q- U+ X
- static int ccnt = 8;
; R9 o$ `8 \) T! ^6 c, R - + Y; q& e0 F# b$ u* f+ a
- module_param(acnt, int, S_IRUGO);% K/ M F9 S6 T7 y" a) x' M
- module_param(bcnt, int, S_IRUGO);
( U+ y* w6 w# r3 {# N5 y - module_param(ccnt, int, S_IRUGO);
复制代码
( E# {3 X* P' T& q5 {# l% X6 a: N" Y4 g' C3 w# U
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- R1 y8 }& ?2 b; m5 o* n+ ^. M
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
U' R* E0 T" ?8 `# c& @ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; l1 g, ^; \9 Q! J; K( A) w% e0 o4 ^2 t2 V
# J6 u4 d3 r$ r7 @* ^- v) T |
|