|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! v y% [* n* N/ C4 }" V5 p
- [code]EDMA sample test application
* {* N; N8 ~1 H7 u2 v - /*7 D; |1 _# J0 P1 W3 f5 |
- * edma_test.c
2 c) p% Z" u- C7 b" O, l2 }/ Y1 Q - *
" o% J. z' h/ E3 c+ V) H - * brief EDMA3 Test Application1 a I# r+ Q0 }7 a" [8 _' Q
- *
- L+ W5 F( ?* Q! t7 D" U# Y2 S - * This file contains EDMA3 Test code.
1 s3 b$ c2 g; r3 {# Z' ~) C - ** @- j% w" D N J
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
$ ]/ p0 [" @. T. n - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ H2 o" w- j) }! j( d C* m
- * TO CHANGE.
3 A% d, b2 N/ J$ `* } - *7 { R& F" q: a* N4 Z6 J3 `8 K e7 k
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! F; s+ x2 l6 s D# d7 F
- *% k; j! P, _. F
- * This program is free software; you can redistribute it and/or
. l; L/ W1 Z, U - * modify it under the terms of the GNU General Public License as9 D* `+ i" V" l" e& }8 [5 s- `
- * published by the Free Software Foundation version 2.- B3 k* o$ B$ t* |$ h
- *
, ~8 H( x# f, P& k: K - * This program is distributed "as is" WITHOUT ANY WARRANTY of any J2 @+ n, K. V: x: e" T
- * kind, whether express or implied; without even the implied warranty* |5 J6 l( }+ _8 B4 G. J$ L
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the& {# I; _$ Q7 ], c
- * GNU General Public License for more details.
" j# D) F9 q* s/ z: | - */: U+ m- u% u! q+ V4 b# S) _* h
; l; M, J2 R) v8 V- #include <linux/module.h>
9 p- D4 Q% e# \, S8 y - #include <linux/init.h>* ~' w5 \# T! K3 I3 y8 h: G' Q
- #include <linux/errno.h>8 ]# ^& W5 B5 k5 _( y9 T6 j
- #include <linux/types.h>
* N& H' N0 N$ ^' I) x - #include <linux/interrupt.h>; `' u% F% A ] c
- #include <asm/io.h>
7 j" v( s; ?9 { - #include <linux/moduleparam.h>3 t, c6 Z4 o1 w- _& n' {, t% G
- #include <linux/sysctl.h>4 g9 }- O4 O% D
- #include <linux/mm.h>) h3 P! @/ Z3 i; o* v. @
- #include <linux/dma-mapping.h>
: C+ b3 |$ f0 {0 Z2 D" f0 R3 V, e8 i - : h9 ^. l8 }, r* Q0 I. b# l6 D
- #include <mach/memory.h>
( A! R7 o" Z. {* E - #include <mach/hardware.h> B8 L; P& S, [3 B$ S3 s1 f! g" G
- #include <mach/irqs.h>
& Q8 `1 f6 L& h- L - #include <asm/hardware/edma.h>& G$ F [9 {% @0 B1 d2 {# c
- 1 g" n' J5 f6 O( j. M. z: ^- ~% H
- #undef EDMA3_DEBUG
% A- A$ q( K$ k( `' b, L - /*#define EDMA3_DEBUG*/. C. s$ K- n+ N3 K! Z7 i
, T! q7 I7 x9 s; _- M4 T- #ifdef EDMA3_DEBUG+ g0 ?% T4 f: a3 ^1 C' z
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
8 ?4 L& Y7 t4 ` - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# D2 a' k' n2 O* c
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
, g F2 f, [, ^: f* A" | - #else2 B g+ ]8 R2 l, W
- #define DMA_PRINTK( x... )
, a" O. M: P% R4 s, n7 ] - #define DMA_FN_IN
- z. I3 e7 [* Y( L* N( J& f - #define DMA_FN_OUT
1 d9 a3 D. q" R8 u7 K# C - #endif
! } m" f) s# m! s1 s+ [ - : v# [3 P4 q: Z) H: [1 p2 W
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)4 I) \4 {& O8 H% Y: G
- #define STATIC_SHIFT 38 m5 P& t0 t& A' b9 l
- #define TCINTEN_SHIFT 20
; Z" e7 ~& D( ? k, \ - #define ITCINTEN_SHIFT 21. B4 n# r. Q3 Q; J5 Y
- #define TCCHEN_SHIFT 22/ s# |; @3 L4 o* U/ _. I# X
- #define ITCCHEN_SHIFT 235 h7 T/ A; E) ~& S1 H
! \2 N8 q) f& s6 u( ^- static volatile int irqraised1 = 0;
9 W' ]! b; ?& V' r, R* f2 P - static volatile int irqraised2 = 0;7 f: C) H/ C Y6 ]
- + Y v7 N* F1 e" e8 X9 G; x
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- e) X4 ~& M2 Q @, f: i/ J - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( ~% b4 _1 ~5 ~, y
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. j5 K; g3 r- T2 G8 O: \/ y
5 t* r" q2 Z6 V0 x- w, F2 q- dma_addr_t dmaphyssrc1 = 0;
) A. |# _/ N: H5 T j1 a - dma_addr_t dmaphyssrc2 = 0;
7 N+ I8 U' H6 h* n( n8 g3 O' d - dma_addr_t dmaphysdest1 = 0;
9 |' Y6 B, h8 [ - dma_addr_t dmaphysdest2 = 0;
4 g' D+ l8 f& h7 z' ~$ c" f - ; M- m; ^# q, F( f& |
- char *dmabufsrc1 = NULL;
5 Y. ?/ |. z6 D, ` - char *dmabufsrc2 = NULL;, h+ n+ F, l; M/ f+ i
- char *dmabufdest1 = NULL; I& ?2 _4 O7 N# J( H
- char *dmabufdest2 = NULL;
$ `; x8 k7 N# Z7 H* E& { - + ?, q. H1 J" s3 N9 X' c
- static int acnt = 512;
% c3 O+ w& B3 w) S: {( P - static int bcnt = 8;
+ t" f4 R/ O/ O2 c3 C1 u - static int ccnt = 8;
# {, c; U F% O6 ^
: h5 \+ b0 Z# b5 k# L- module_param(acnt, int, S_IRUGO);
" R: i" O O ?9 E9 P X/ Q- |/ Q - module_param(bcnt, int, S_IRUGO);8 Z; l/ }- Z! x
- module_param(ccnt, int, S_IRUGO);
复制代码 8 q7 T/ o6 ?8 o) g: Q6 {, Z% q
/ l9 c" x. a1 A& _) L# b* ~ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ b @( h) E' q9 ~
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
3 G% C: W0 U# Z2 g! O 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! F |6 F7 \3 c
6 p7 L, {9 M- g0 x
6 K9 P7 l R0 Z m |
|