|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . f' G1 I- e# w7 J% F' w( H
- [code]EDMA sample test application
' R% ^' Z- M+ h+ U - /*# C' O2 A6 o, K8 H
- * edma_test.c& i2 x Y& y5 O. }8 b6 J
- * N; s' @' t1 r2 A7 ^
- * brief EDMA3 Test Application2 Y. v3 v5 H3 Y& @
- *' e7 ]0 X" L( @
- * This file contains EDMA3 Test code.$ \ g. E1 ]- P1 f- C! z8 ^7 `0 y) G
- *& J9 q7 J0 ^+ \) E
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
l1 Q" I3 T4 d4 q - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
4 ~* @. {# w2 u% G6 Z- {0 N - * TO CHANGE.
( g3 a$ \0 J0 v2 Z# @' p - *
- e+ B, l4 H% e - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
# O# f6 O5 s$ I& \2 V; x0 d - *' Z2 I! b T0 B9 K
- * This program is free software; you can redistribute it and/or: t* p0 S$ T1 Y% v
- * modify it under the terms of the GNU General Public License as
) Y7 B, V1 o% O5 b5 A - * published by the Free Software Foundation version 2./ p F* w+ @1 L; P( F: v
- *
, j/ V: y8 v7 {' |# i% Q - * This program is distributed "as is" WITHOUT ANY WARRANTY of any* K0 m, A- p [" _8 A
- * kind, whether express or implied; without even the implied warranty
* j6 S2 ^6 O7 F. @/ n- _ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# y3 a$ P+ v! {- _) t. G - * GNU General Public License for more details.' S; |" Z' w/ f
- */
* K1 U) e; |8 i- p - 3 F/ D( r" p/ b7 u
- #include <linux/module.h>, H# Z; z/ v' ^4 `. i8 G2 L
- #include <linux/init.h>9 i9 b/ [1 O; l
- #include <linux/errno.h>6 ^, s5 J! q1 L! l' S# ^$ z1 r8 R8 i
- #include <linux/types.h>
/ o3 T L* @( q! c! a - #include <linux/interrupt.h>
2 G/ y$ f' l( k$ L - #include <asm/io.h>
( ~ M" C0 `/ {) V - #include <linux/moduleparam.h>
. q+ X9 p/ s3 E5 Y$ ]4 | - #include <linux/sysctl.h>
! W3 I! w. [: f. ?; L' \ - #include <linux/mm.h># Q. g' s8 t& a5 j D
- #include <linux/dma-mapping.h>, K: W4 K% V3 _) G+ \0 O
- 3 C; }! G4 u+ Y7 M% P# }
- #include <mach/memory.h>
/ H) G% R2 W! z1 i8 v; J$ L - #include <mach/hardware.h>3 B) |3 p" N0 M% u$ b; J% {
- #include <mach/irqs.h>
" x* x5 @; r( ?" l- Z9 h$ C- e - #include <asm/hardware/edma.h>! m7 Z) L; E ?& o1 }
- 3 h1 b3 a5 c7 w/ {
- #undef EDMA3_DEBUG
N$ ]8 _; y4 Y. l ^ - /*#define EDMA3_DEBUG*/
' u% G9 a( b5 M, l: U2 R - % W4 g+ A# N+ u- c
- #ifdef EDMA3_DEBUG
% l- n" \, h! r9 f - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' n) X: B( |7 @8 [
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). B0 w/ |% I& f
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( i# s/ c, ]3 b- U3 u' r1 L$ B( Y: p% F
- #else0 L7 f; ]1 Y- d A& k, f; I" N
- #define DMA_PRINTK( x... ), a) V: B i+ R2 _8 f. G+ W
- #define DMA_FN_IN: ^ P0 [! _4 {3 N; {
- #define DMA_FN_OUT
% o% K; d$ h- K! y - #endif1 g) |& a* q/ f8 c( X
" u" O7 y' ?. B- #define MAX_DMA_TRANSFER_IN_BYTES (32768)7 C5 k) n" I5 \) f4 B, I, w/ a
- #define STATIC_SHIFT 3
+ k3 c, d1 D/ z" M0 k) A0 T' n - #define TCINTEN_SHIFT 208 F: z5 R; _/ w4 d
- #define ITCINTEN_SHIFT 21$ [9 x. p1 z6 d2 y; e6 y3 T: ?. V, l9 l
- #define TCCHEN_SHIFT 22, }! M# O0 o8 B5 A( m+ L
- #define ITCCHEN_SHIFT 23
, \' L8 v8 [$ X
. X3 A! f+ R. s- Q6 ]3 t- static volatile int irqraised1 = 0;
5 K5 }- x9 `# w/ l) ~" x% V: C - static volatile int irqraised2 = 0;
& D' ~9 @0 P1 m. E
5 G2 m, ?- f! S) @- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; Y+ M* ?. y6 i6 q3 W9 Q4 \
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- Q3 h, \) K, n" [, n - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 C2 [3 e. E4 l# V& A$ p! I
6 F% D! `5 _3 t- dma_addr_t dmaphyssrc1 = 0;% r# L6 g9 B' C5 ~
- dma_addr_t dmaphyssrc2 = 0;- ^" z, G& s) |. P: W+ H
- dma_addr_t dmaphysdest1 = 0;( l: N8 y. ~ G0 K5 P# w4 T
- dma_addr_t dmaphysdest2 = 0;
/ a$ q) v% X% [. V6 Q. x# c5 R8 a6 e - 1 o) S# `. z* N2 j6 K* H) k
- char *dmabufsrc1 = NULL;
: c1 ]8 S5 O) e+ _4 @) v1 ^0 ~! E5 E - char *dmabufsrc2 = NULL;* y$ r- v; d. i1 Z
- char *dmabufdest1 = NULL;, S& B2 U8 K- n0 x$ c, l
- char *dmabufdest2 = NULL;# k1 U' s+ c# ~4 w7 X( a
- j, f4 E/ \5 [# O! z6 K1 u
- static int acnt = 512;
7 ]9 Y/ Z' J: x3 ~' O$ y - static int bcnt = 8;
, v W. k1 ^! Q! ~4 ~* e0 \) [ - static int ccnt = 8;1 W- C: d3 Z) R5 ?8 k% I
0 p a- ?0 G; Y2 E; D- module_param(acnt, int, S_IRUGO);$ |/ B0 Z0 U) @) ^* D& n- Z! Q3 L
- module_param(bcnt, int, S_IRUGO);
: k4 g7 O" y A+ C- u2 j& Y P- k - module_param(ccnt, int, S_IRUGO);
复制代码 * ?8 d0 y) i+ Z- P
0 e+ q8 A3 b4 x5 I8 c 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 g) G3 l1 Y/ ~3 q# [. @' B( Farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: q7 c1 N0 f5 A5 J9 K+ C
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# O: t" H* h1 W% ^. h" z
" Q% o& u1 y& X
4 r$ d' U6 M% U
|
|