|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: C4 G9 y! x! {" I- [code]EDMA sample test application# `1 \2 G+ W! X" q# h" N7 p" g
- /*
$ L7 v! b& p4 B& ]. u9 V A% v7 S - * edma_test.c
" d) i: i' Z2 w4 w& D8 S6 H - *
7 q3 l2 P) A5 A K7 u/ u( M - * brief EDMA3 Test Application
: t2 k# \9 y$ E [ - *
( `; n) Q% ]* j1 [% v6 x: w - * This file contains EDMA3 Test code.2 }# g9 m5 w( i; z8 B( z
- *
1 f2 s0 \0 j( j; a! Q# W. D - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
7 y7 n- ^3 D$ C2 V" y - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 a8 A2 L0 H5 S5 [4 Z9 W
- * TO CHANGE.
' {6 t0 \2 v) Q/ r# v0 s: z - *
; r0 l" w, t/ m1 n% r7 w8 ] - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! J! ~. M7 K2 y
- *
3 u5 {2 j9 F6 A( Z. F# w5 d - * This program is free software; you can redistribute it and/or
! g+ C$ l+ @9 ^ - * modify it under the terms of the GNU General Public License as
' \: E T" e( T) [/ @ - * published by the Free Software Foundation version 2.4 y# A* Y- r# [8 i% x" e2 ~
- *
9 `3 V1 L2 ^2 ~* }5 c4 U - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
- l, w1 m3 P$ P0 r - * kind, whether express or implied; without even the implied warranty
: c4 o7 k- k' ~- @5 ]$ c - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6 Y4 b" J# t/ `( ~4 {$ \# Q5 @! J - * GNU General Public License for more details.( U% {6 C2 c% F6 W4 D4 m6 F6 A
- */
. Q/ e; p' I9 Q6 A l/ ^0 | - 5 I% U( @( t* b' v- g1 n
- #include <linux/module.h>
) e2 i3 r' `7 m$ e7 C - #include <linux/init.h>
) G. S9 A' F8 {! a; _0 f - #include <linux/errno.h>
6 i0 G; v: j N K# B6 q) Q - #include <linux/types.h>% E- J s0 x# T2 m# ^
- #include <linux/interrupt.h>* `; {) |5 E% B: s* ]
- #include <asm/io.h>
+ h. I4 _, y7 Y6 ?/ X. \ - #include <linux/moduleparam.h>
. n I$ G) e6 i' ~ - #include <linux/sysctl.h>. m/ e) V* K$ p$ S5 Q9 D/ D* C3 ~% x* W
- #include <linux/mm.h>
# |, U. c" ^2 `* [9 ~* b( d1 w6 ] q( M - #include <linux/dma-mapping.h>: h( ^. v' f7 m9 u9 C: q# E
! |3 K3 {# y* k5 u/ B. c- #include <mach/memory.h>
/ V: A7 D' ]. u* e# U. W - #include <mach/hardware.h>' W4 d; e1 ^2 v' K5 g
- #include <mach/irqs.h>
$ U0 E9 m; ^- U! d* f* e - #include <asm/hardware/edma.h>3 w4 _' ~! v7 j) ] U! b/ k- Q
+ x* K3 |& D) v7 p' w1 U( D: |1 |- #undef EDMA3_DEBUG6 g9 n9 o" q! Q3 s8 u8 u
- /*#define EDMA3_DEBUG*/
3 _+ F. n0 [& w6 O& e
! O4 X$ C& q0 B- #ifdef EDMA3_DEBUG9 N0 B4 ]. s' \1 \# T, f0 }
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); G7 w; j! U! }0 a7 x
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
; Y/ O) ?+ b+ g7 N - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& k0 j) ^" x. U- K7 }
- #else
" i4 V7 b( H6 I% v' W1 {3 T - #define DMA_PRINTK( x... )4 Y2 D8 v; G {
- #define DMA_FN_IN) m) @( B2 u2 `' a
- #define DMA_FN_OUT
" b, z# O% | p% D' P( a - #endif
; i: |- ~# B& x
) v' z3 `/ }* H) o- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
! `6 n* w: u! H0 A' K5 o - #define STATIC_SHIFT 3, Y$ c. I4 s0 g0 }! u" \2 x! W
- #define TCINTEN_SHIFT 20& H+ P$ S: X: z. Z& c
- #define ITCINTEN_SHIFT 21
# @# G! d0 R, ^! S1 M$ @ - #define TCCHEN_SHIFT 22
5 u1 K9 Y5 y' g* D, H# w$ V3 M; W - #define ITCCHEN_SHIFT 23
' V2 H7 A: q6 Z7 h8 M* Y: N3 b% m - - ]2 F7 U2 o9 x2 C' g$ l l; Q
- static volatile int irqraised1 = 0;
% p- l: a, |+ z4 d0 a - static volatile int irqraised2 = 0;' d9 ]8 W& r& E
8 L; @* A: }$ n$ R2 O4 ^4 t% y* z- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. W" R9 l, } {7 e) |8 Y' s. J& B
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; z$ I1 B/ l% u9 ? - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ \& P' {" s, Z9 c/ r - - X1 g* ^( K, \0 s
- dma_addr_t dmaphyssrc1 = 0;
4 b I8 B% O% C4 |8 J5 T - dma_addr_t dmaphyssrc2 = 0;7 g3 F/ t! R' c4 u
- dma_addr_t dmaphysdest1 = 0;7 M9 Z! p' Y! }; K) w
- dma_addr_t dmaphysdest2 = 0;3 C; o, F8 z: B% L
- 2 K5 `9 h+ ~0 M5 c9 Y$ [1 j
- char *dmabufsrc1 = NULL;; \* M+ u5 T7 J7 {) P" ~* M
- char *dmabufsrc2 = NULL;; A! c3 Y% G7 q+ G5 Y* r9 D
- char *dmabufdest1 = NULL;9 {( u/ d- w( u- S# f
- char *dmabufdest2 = NULL;
2 |; q* w) P7 F, V5 O
4 E9 m: D* m& J. _- U# A( Q- static int acnt = 512;
0 R- O" g: d. u0 ~ - static int bcnt = 8;* M' c; F2 q# d( x c2 H. g9 g) O
- static int ccnt = 8;
. ?, Y8 `% d$ [% W6 L# X. X - ; n" u4 H. g5 e
- module_param(acnt, int, S_IRUGO);
( B- G- f. u ^) H0 _3 V8 F - module_param(bcnt, int, S_IRUGO);! W. x2 s# ^# A; h, W/ G
- module_param(ccnt, int, S_IRUGO);
复制代码
i$ u+ {# r4 _# ]* |$ g6 J, W5 K. J+ N9 s- u6 C
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ j" L- ~9 e. q! `% V; k) f% \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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 S) \1 ^$ Z! @9 q% { 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 ]8 E. H5 |( ?9 ^8 l2 D6 J+ U
: C" a8 p8 Y: U {8 h& W3 {
2 X+ b) u4 ]& M0 } |
|