|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ j. n! S( }4 d% C1 O6 R- [code]EDMA sample test application" Q& ?2 }- f& O7 Q; z) F
- /*
5 e8 \# g8 q, ?" B! [1 e - * edma_test.c
4 _4 Z% u8 c' \0 o4 k- o0 V - *( z$ t1 @" ?, k3 P- W. e$ w2 C6 @- \, X
- * brief EDMA3 Test Application7 V0 ]8 B2 P/ Q! x! Z2 E
- *
& g F5 T' O% u: `- m* G# `* f - * This file contains EDMA3 Test code.9 N3 l. J+ ~# D4 b% F
- *& E0 E5 ~' V# t/ u" T7 m
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
3 ]; _# i/ @$ M) p3 n1 Z- f - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
/ q5 p& Y$ C8 z/ t: d: `0 B( Z - * TO CHANGE.# P2 U/ |6 u) C8 X' Z
- *2 e9 H/ q7 ^; D% n& G- I4 P/ O1 X2 |
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. R& K) ^2 S; B- t! ~( I
- *
$ F8 \1 s+ v3 P& R8 s* y& x - * This program is free software; you can redistribute it and/or
% w$ u. N1 y6 O& a+ Y' h' y K8 } - * modify it under the terms of the GNU General Public License as/ ]3 w) t) D) c' y2 Y! I
- * published by the Free Software Foundation version 2.
0 c% j. R4 E0 I1 x7 l5 A* P - *
# S& ]; ~2 |7 C - * This program is distributed "as is" WITHOUT ANY WARRANTY of any E( ?7 m& v3 a7 @ W' J
- * kind, whether express or implied; without even the implied warranty
9 w, q; J9 Z4 u f3 ?9 w% Z/ n - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4 }2 m! @/ b" j2 ~- M - * GNU General Public License for more details.
/ d# E0 L, f# C$ D$ r, N, L - */9 E4 [' E0 V: {% C; O# \
- 6 k" U! R+ H6 k, E
- #include <linux/module.h>
! \. w* o# ]! z8 B - #include <linux/init.h>4 r+ p# D7 r; T; A( n% V
- #include <linux/errno.h>% E1 Q$ ?( ^0 n3 b
- #include <linux/types.h>% W8 V* Y: p7 z8 o# H) H) l
- #include <linux/interrupt.h>
9 {8 h; J; W, i& e4 E, I - #include <asm/io.h>3 \' m/ v1 y0 w: G
- #include <linux/moduleparam.h>+ e/ z" G7 n2 K
- #include <linux/sysctl.h>
. `0 T( p5 X8 h `* u; }# f9 u& G - #include <linux/mm.h>
; t% Z1 N9 n9 o: ? - #include <linux/dma-mapping.h>0 E# E v# Z E- Z& A
- ; _: E; X3 a/ a' v# m% G( z$ ?
- #include <mach/memory.h>2 e9 ]* l$ \; C" e
- #include <mach/hardware.h>
7 L8 C" {/ K6 l C! l - #include <mach/irqs.h>% `$ L8 g" ]) Z/ }! [
- #include <asm/hardware/edma.h>
: G2 g( m( i& M& o - ' }% s$ s3 @9 l0 n& F& |. r
- #undef EDMA3_DEBUG: i+ y6 x6 v" L, @% Q. A, `
- /*#define EDMA3_DEBUG*/* X' f6 Q! X* \2 v* Y
- ; d3 O& F& ]) x1 l% j
- #ifdef EDMA3_DEBUG
( o( b! }1 N. k' c, M7 e% b - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 g% a2 N/ k! ~, m1 H: m. T9 a1 _
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); [* b# e8 g0 M
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
; T1 S9 o! m. p& B - #else4 f& ~5 ^/ \6 T+ }% S3 n
- #define DMA_PRINTK( x... )
2 g+ E( a9 P3 s( O- J - #define DMA_FN_IN
/ F0 X. E% E5 r - #define DMA_FN_OUT
8 s6 y& T A* r/ G - #endif
! W3 h$ j {4 i) r - # l$ y7 X1 `% q& X) ]5 X
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)& p; M( `, m1 N. y& W/ ~
- #define STATIC_SHIFT 3
/ q, K+ t) z! ?# `( O. `7 J - #define TCINTEN_SHIFT 201 b1 z1 O! q; v7 |# h; |
- #define ITCINTEN_SHIFT 21' [2 E: G0 l6 d& q: T( |
- #define TCCHEN_SHIFT 22$ P. v1 F+ `7 P$ a8 `6 G+ t, Y
- #define ITCCHEN_SHIFT 23
, K2 G8 z- l# W4 I# t& N) R - v8 n/ G$ u% n6 m! C5 h$ d
- static volatile int irqraised1 = 0;+ Y: I s4 b7 a0 V
- static volatile int irqraised2 = 0;
4 i3 C+ a$ p7 N/ k2 t
3 W D* ^9 Z3 h1 y) P" n, I- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. l$ I7 b3 l1 `, Y }" G1 W - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 M' t# J% G1 c5 N' F! r6 _6 \ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) L. J( g1 d; f) ~9 o5 F
& O5 r' |- W$ R' ^; Q5 x! t- dma_addr_t dmaphyssrc1 = 0;
* M" j7 _1 p- i, G1 U* l - dma_addr_t dmaphyssrc2 = 0;
7 j; ?8 M5 q5 K& F - dma_addr_t dmaphysdest1 = 0;7 Q. ?* `/ U/ z' u3 f; L5 d) k
- dma_addr_t dmaphysdest2 = 0;
% x' |% S& I( x. N# y- w ^. a
2 }# n Q+ j& s' q% _- char *dmabufsrc1 = NULL;, R& @6 g. }. J$ k' I7 e
- char *dmabufsrc2 = NULL;
8 o5 ]/ ?/ R- h1 z/ h6 W K - char *dmabufdest1 = NULL;' k f3 k( D! k) i. H: C. T2 w
- char *dmabufdest2 = NULL; u1 V( |, q4 n) v! o) N
: N# P3 `2 C) ]4 a- static int acnt = 512;: D3 }3 I+ w8 r2 V: C, P6 f
- static int bcnt = 8;* j: A( i9 z6 A* I& H E; c
- static int ccnt = 8;+ _' O8 N9 q7 k. v# C! }" M
* G3 U7 R. S+ B5 ]6 W9 \- module_param(acnt, int, S_IRUGO);
- T8 Z1 z& [1 {; i5 Y - module_param(bcnt, int, S_IRUGO);
: X% p* c/ \; B9 [1 j: b - module_param(ccnt, int, S_IRUGO);
复制代码 $ r( w6 o( y5 W1 O
- v8 s2 c# ^. |) w- @& w6 d
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- S. F: Q6 w1 ~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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 ?! @/ b! S, \ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
Z* A' _0 m( P6 @' ]9 g% b" n
9 C7 I9 W0 o: Q# ]1 P9 y& i
& f# c- t$ I% V O% O1 ? |
|