|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " o% {' e& K$ B
- [code]EDMA sample test application
3 P/ {: D' H/ f4 n - /*" R$ n | E+ P. `# C# j: h
- * edma_test.c
# m& ?5 Q, N4 x/ R - *9 u _4 O* U8 \4 y' l! ?# Q7 F
- * brief EDMA3 Test Application
h M; c; f' I; H e) g9 \3 a$ O - *. N: b$ a2 E# d- I1 i6 a
- * This file contains EDMA3 Test code.% k. T4 B7 A8 O! t* Q6 E g
- *# F$ M: t+ n; A- u- r3 c
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 f9 \0 l8 T4 r7 c) ?. \
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: U) Z2 {" }2 d0 C* }
- * TO CHANGE.
( p( O n8 n2 X/ Z - */ J. t0 U+ V5 C' R5 p
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ P- Z& S3 j' V8 b y5 S$ ^9 J
- *
/ p% a1 V( \" U - * This program is free software; you can redistribute it and/or
$ R5 A) v- M9 B - * modify it under the terms of the GNU General Public License as( r8 \$ y1 C) a* ^
- * published by the Free Software Foundation version 2.- a0 E0 R/ H4 c
- *
& R" H4 x; O0 C' }1 P; P - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
8 d9 l4 Q$ ^6 }/ Q3 N0 l: m! k$ R - * kind, whether express or implied; without even the implied warranty3 ?. o8 ^; J) |, {$ z% E& U: M
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6 r' e- ^( h2 B0 K) ^# D8 i - * GNU General Public License for more details.
7 D9 P# g7 L$ Q- y0 {5 ]7 t - */
6 K; X# N+ Y9 ]0 p" {+ }
! J0 I! k$ U! K2 c9 w- #include <linux/module.h>
. N: F8 e# l9 K2 d( V/ |/ T) u - #include <linux/init.h> o7 B; u0 c2 `; s7 z. E* S
- #include <linux/errno.h> C' ?' x6 }, B, L. L# x
- #include <linux/types.h>4 Y) S! n, d. t* W& x- P
- #include <linux/interrupt.h>: ]5 L7 |- p) ]$ V9 R) g P( Z
- #include <asm/io.h>
- [ e/ T6 L) ?0 W- N. I - #include <linux/moduleparam.h>
% J1 U f$ \8 ` U7 ] - #include <linux/sysctl.h>5 C' M* C' X1 ~" Y1 v" _& j
- #include <linux/mm.h>
& c3 i1 V. e. q1 S - #include <linux/dma-mapping.h>. H( F% R9 a/ S3 A
- 8 I1 p! o+ t8 Q" F( D! K: H7 F6 l
- #include <mach/memory.h>
7 G& |) V8 V) X* w& b7 [8 j - #include <mach/hardware.h>
: e7 ^3 J! Q" J; o - #include <mach/irqs.h>$ D9 X8 J" I) i, `6 d
- #include <asm/hardware/edma.h>' H: o! g4 e& `4 V! q5 ~( H
4 Q+ x5 d+ c5 \) ?& [6 t- #undef EDMA3_DEBUG! `- V4 r+ s) u' N# F
- /*#define EDMA3_DEBUG*/' n" K: e; y6 H* \. D7 K! O
- - U' R% r! H3 S7 J( \% o
- #ifdef EDMA3_DEBUG% U" J9 F. ~0 X6 ?/ ^: V
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# j: Q* _/ Q: ?* w7 r( g
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 r9 f% L9 ^: w) F
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
1 R9 j u6 R& }9 A* g, r - #else
) ]* G: @& j: ^$ ]+ A - #define DMA_PRINTK( x... ). _5 }1 H/ H k( d9 x# e
- #define DMA_FN_IN6 ^6 e9 B* g( U4 t7 x% W! W
- #define DMA_FN_OUT
! ?, f; m$ V& a- w; u# V8 N3 z& i - #endif
! W9 d- t8 T& _; K6 m8 j% d7 M8 y
) |+ U* c( x1 C/ }9 o7 h- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
. q5 h! Q7 L) P$ w1 x, r* E' P - #define STATIC_SHIFT 3- q3 O+ ], f& W6 e1 y5 }
- #define TCINTEN_SHIFT 20
6 M- g: ~# w, }" a0 a - #define ITCINTEN_SHIFT 21- p% Y1 _4 g) B8 X/ J5 M
- #define TCCHEN_SHIFT 22* g4 g; I0 a; v3 W1 P
- #define ITCCHEN_SHIFT 23' H/ {3 H& z& I: w, l
6 A2 H0 N, H! J- static volatile int irqraised1 = 0;
/ E4 D: w; Y; v; R8 P$ e( l - static volatile int irqraised2 = 0;
9 _! z- @6 m* h7 G+ U# b. A( B
! }& C$ Y, A4 _/ C- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) J0 E. U9 ~2 v3 C - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ `/ H$ O% X/ s# k# {
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# ^5 g9 q) z# `. s. S& ~
- $ h" f6 ?% A+ B, w3 m" W, q
- dma_addr_t dmaphyssrc1 = 0;) n: R9 q/ y' w$ x/ ~
- dma_addr_t dmaphyssrc2 = 0;
* m: J0 d7 \# A* a! p! }7 g - dma_addr_t dmaphysdest1 = 0;
5 v2 L8 r- M; e% ~2 V! n - dma_addr_t dmaphysdest2 = 0;
, {( @* M* s: M/ B+ C5 L - F0 { w- d, q6 |
- char *dmabufsrc1 = NULL;$ b4 b2 F6 J- W, X
- char *dmabufsrc2 = NULL;9 x: t% o6 o" R2 [$ t
- char *dmabufdest1 = NULL;
9 ?6 K `/ v% J( e( F - char *dmabufdest2 = NULL;% ^- M f3 G) I0 H8 g/ F, S
) z8 [$ L- h/ t5 n' k% ]+ z- static int acnt = 512;
+ k. m4 R& V# ?: t& b - static int bcnt = 8;0 }7 b2 u# Q" Y% D
- static int ccnt = 8;3 X2 P: `2 p. w* ?) z
' A# x) ?1 U, a0 w7 `! w1 H- module_param(acnt, int, S_IRUGO);
* {* \, P1 Y" I A) y: K- Q - module_param(bcnt, int, S_IRUGO);
4 `% M( E5 ~7 P; U* l; r' m - module_param(ccnt, int, S_IRUGO);
复制代码
/ n/ s6 m8 k% T, o, {% t. `- `* O" y. l! [4 t, e
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 S5 j. v9 R3 Z) W- _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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 C/ j. g/ e! u
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" x! f" b, F& Y4 U J' g6 ~- C# P2 j
* K! h3 O* x3 R2 l
|
|