|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( U& w3 n( r' J. g
- [code]EDMA sample test application
/ \) R3 Q& d* K( \/ [ - /*0 |! I# l- @' f) N& [% {8 J7 u
- * edma_test.c. h5 B* Z* z) c, N0 Y5 Y' I
- *
. \6 l# {. S9 M - * brief EDMA3 Test Application( t0 v1 a" a! {% T T
- *
2 R. `* d# l" C+ ]' Z9 H. ~- ? - * This file contains EDMA3 Test code.9 b/ i. n Y: _
- *
( X% j% C4 r6 }/ B# ^: j" q: l - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
; s/ J, z N; T' t - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% Z& P$ D9 \6 W5 {! H i
- * TO CHANGE./ b/ Q5 A' u. K. I7 [: C
- *+ s1 B7 ?% f* }* `* Z
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ L0 {" ~+ u/ b
- *
+ b5 X |2 a* j" M1 h7 Z - * This program is free software; you can redistribute it and/or
; V$ U Z9 m) C$ o - * modify it under the terms of the GNU General Public License as2 k2 i+ |0 k2 B4 V4 D+ u
- * published by the Free Software Foundation version 2.
' O7 [" {3 Y6 X/ L - *. x+ r; b& f5 I+ }- h
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
X9 M: i3 |- I' v i+ E' E K - * kind, whether express or implied; without even the implied warranty
- `& o/ H: c4 O( a2 v$ U - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
& F! ]0 Z+ g" y w1 z- B: w - * GNU General Public License for more details.
2 V6 G$ F% V8 M2 H. {; g - */6 U5 ]0 y# p! w% Y' c
- * k5 G( ^- x4 E) `
- #include <linux/module.h>
* y* J' C; D5 h6 K2 C# G - #include <linux/init.h>8 z, v. o: K4 {2 e
- #include <linux/errno.h>+ o/ \8 l, E- p6 g8 J' r w3 z
- #include <linux/types.h>6 `+ U' P/ ~3 o" v/ W) g; f! j
- #include <linux/interrupt.h>. D: \+ m( b. A1 E+ `4 d2 L- N. q; P
- #include <asm/io.h>
/ N5 W$ X7 Q! Q1 K; X4 S - #include <linux/moduleparam.h>) r5 r2 U& d1 d
- #include <linux/sysctl.h>; J! y* g& v8 P1 ^6 ?) P/ h
- #include <linux/mm.h>
5 t |6 d7 u/ q- F' m0 Z f: f* u - #include <linux/dma-mapping.h>: W8 C9 y$ \$ ~* X6 X
- 5 t* h# G1 A, J$ S* S. v0 N
- #include <mach/memory.h>
& H6 n' T' X+ L# f3 g0 m - #include <mach/hardware.h>& T; U7 G8 }( G N& V g. Z* V
- #include <mach/irqs.h>
% |3 o* L4 V/ J* q, E - #include <asm/hardware/edma.h>' U0 X( l4 T: b/ R* z# @2 _
~$ d; u+ k* A3 y0 I- #undef EDMA3_DEBUG
. m+ w) N# G. _! e! X - /*#define EDMA3_DEBUG*/7 P& @, _5 h" A0 z. H
" c: K1 \' _7 |; @! k- #ifdef EDMA3_DEBUG9 ^$ r, j& o! H
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" ~1 b. r$ [- c; O
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 c5 V0 v' v, O6 V0 [. t
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( @+ e% g$ s# W j3 S
- #else' @' K: |. ]' G7 j2 ~6 D
- #define DMA_PRINTK( x... )
" E, X+ d8 H: T+ h5 k - #define DMA_FN_IN
$ K, t; _( Q+ Q4 |7 _5 [ - #define DMA_FN_OUT
5 b. F7 `+ t5 G8 S - #endif5 l8 p4 Q5 S" {3 y
- ' c* |( b/ u/ E5 |) q; @# f7 w
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)) c. H$ K- ^4 ^2 d* Q7 D
- #define STATIC_SHIFT 3) S: B8 Y3 ]) k7 i2 T; [- h
- #define TCINTEN_SHIFT 20' m$ |( D2 l4 S: K4 v
- #define ITCINTEN_SHIFT 21
2 ?$ ~7 i8 ?( z3 j - #define TCCHEN_SHIFT 22
7 C4 _% m& E# G1 I - #define ITCCHEN_SHIFT 23
% l9 [) H& j7 E( J& }! m6 S: _8 r
. X3 [! F& G5 _1 ^! q- static volatile int irqraised1 = 0;" @) o0 |9 b& H3 V7 B; @* A
- static volatile int irqraised2 = 0;: G1 @. x) Q8 n& {! f, x* V, C3 S
- $ ^" C# y/ J$ Q& y; r/ Z4 t
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 `, A, a, f5 f j5 r9 q5 j
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 r' \# o# b" w& V - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% T$ b3 `- {0 B ? - 2 u9 y+ P8 n6 P# m& T
- dma_addr_t dmaphyssrc1 = 0;
/ s1 \$ ~# h+ { ]: T - dma_addr_t dmaphyssrc2 = 0;1 Q' ` D/ Q8 _. ~! c: V( Z4 l
- dma_addr_t dmaphysdest1 = 0;" Q4 p/ g# [0 y
- dma_addr_t dmaphysdest2 = 0;& D, U1 |8 x, l, N- E2 C
- 2 y1 {& L' w9 Q2 @3 C) [# _7 u
- char *dmabufsrc1 = NULL;+ s* W* T' }4 e2 _( w' K& [
- char *dmabufsrc2 = NULL;
9 u- o6 ^( r* f4 N8 D2 ~8 D1 b - char *dmabufdest1 = NULL;
8 L$ _4 s1 t: P; T) g' S" }/ O - char *dmabufdest2 = NULL;4 H5 M* q% n% J
( i# R3 \- W% |* B4 S' q, w- static int acnt = 512;8 D' v. N6 C9 c; u% u2 l5 F
- static int bcnt = 8;; \: }! `) r4 g0 ]- q0 R
- static int ccnt = 8;
& A( n7 {. t9 F: A) I
5 [; c) I2 b* O3 v$ o) q( t- module_param(acnt, int, S_IRUGO);
' l& O: L B+ F5 K# n - module_param(bcnt, int, S_IRUGO);
# M' M1 W6 M D% W9 c# N% T - module_param(ccnt, int, S_IRUGO);
复制代码 / X+ G5 r& X0 u
$ d7 l6 \2 C0 V& x0 Z% T
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 _; W0 E: b6 _: R Y5 c
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; T. A& g- G; x5 O2 T* Z
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 b- j, P2 p1 Y, b- e
4 x# S7 P/ P O/ Y& s7 e) Z
/ K0 K# w0 m7 r% Q) |" g1 T, O
|
|