|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 f- j7 P. L5 d: N8 `: {0 S
- [code]EDMA sample test application" C$ ?. S' k3 `; Z- X/ {
- /*
/ r; v% T# P6 q* G - * edma_test.c
' D7 G; S, w& A- n$ m% Z6 \3 Q - ** I. {) q* R# j
- * brief EDMA3 Test Application
9 Z, s. N3 \5 @8 y - *" w" W1 E& d& b0 @$ n
- * This file contains EDMA3 Test code." ^7 ?+ p, ]" H% i
- *; y8 _6 ?7 \+ `$ F5 }
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
! \* Z3 P. m! s/ U! _ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( O4 e. }& _" p, [6 t
- * TO CHANGE.5 i0 F7 ~ K9 B
- *) m3 g3 {7 o3 k
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% v) c$ e( t& ?1 H
- *
" o R2 b: R7 x; ^1 H8 n: L - * This program is free software; you can redistribute it and/or
) D/ ^0 F( n ?" O3 b- W - * modify it under the terms of the GNU General Public License as
A# V. m( \. M% \$ [ - * published by the Free Software Foundation version 2.
8 E; P: w( k3 t {5 S6 M, |+ K# z - *
- H9 E2 ?( h" ]1 ^& H! u+ R1 x - * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 Y; y3 i2 [7 u- D9 r
- * kind, whether express or implied; without even the implied warranty
- [( `" [0 R7 g/ F - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- O8 h; M( o: K! M/ x0 k
- * GNU General Public License for more details.
$ U# `& a4 X7 w/ N - */
, Z. e# [# G* k9 R# j" b - 6 U3 n( [+ F/ X" A! a* G: X* w7 l
- #include <linux/module.h>
5 o2 k# b1 H+ |6 a f0 C - #include <linux/init.h>
/ t/ c! X i. J4 A. q! ?* M - #include <linux/errno.h> s# K1 |. d2 S2 x! l
- #include <linux/types.h>
' d$ z& R( K8 Y; X - #include <linux/interrupt.h>
* n8 x, r) S$ r6 J- j+ L - #include <asm/io.h>
' G, L% P+ h. t# y# |7 s5 T F - #include <linux/moduleparam.h>: `- s) P6 ~0 b& o8 N
- #include <linux/sysctl.h>
! n. \: `+ L% U7 A1 k! k. } - #include <linux/mm.h>% c5 S: Z5 B X/ Q9 k+ Q' R# q
- #include <linux/dma-mapping.h>$ o7 e; u7 u. j2 Q& C% q2 f
, V' h% R- ^" y+ Q" q' ~- #include <mach/memory.h>) r$ Z4 B7 e) n' N0 S% U
- #include <mach/hardware.h>1 v+ O3 j: a0 B; s, z
- #include <mach/irqs.h>
# W; ~3 f/ V e - #include <asm/hardware/edma.h> Q# U- Q p* S' l w9 @6 R2 o
" g0 v$ ~4 v2 _- #undef EDMA3_DEBUG# ?9 [0 c) O% t7 g2 e" g
- /*#define EDMA3_DEBUG*/
( `8 \$ K; {9 A# k( C& S& i+ | - % q# w- D8 b# P0 ?, i
- #ifdef EDMA3_DEBUG
# H- F x% ]" z" a7 ` - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
7 ~$ ?1 {9 o2 Y( O - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% p3 T( Y- u* l4 Z& r3 Z8 v4 h
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__) ~8 r1 @4 d: K1 w: K7 {$ t, \" l
- #else
- U' N) v; e. S - #define DMA_PRINTK( x... )8 ]1 r1 V: h4 \ r
- #define DMA_FN_IN
7 A( @7 q4 I4 ^6 Q- q4 O0 @ - #define DMA_FN_OUT$ v3 v* F2 d( l8 c) ?5 k @/ C* z. j
- #endif D& c$ h$ W% `$ D* V. Y1 }
, X4 b/ M0 Y; O7 t9 v! j! V/ J: x! r- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
9 c5 C C% ~. o' N - #define STATIC_SHIFT 3% O, X S2 x7 @% j4 I
- #define TCINTEN_SHIFT 20
0 E! N8 o& F! U" Z, t) R; [ - #define ITCINTEN_SHIFT 21
U6 k( R# T: V- e; `" ]0 n - #define TCCHEN_SHIFT 22
' W$ l) D; Q3 _ - #define ITCCHEN_SHIFT 23
6 F& E6 ?9 ?9 s- m: h! e, n7 L
# q- Z- v* p" x. z" D- static volatile int irqraised1 = 0;
- \7 l5 z/ S* c: K. t+ j/ b" G) k - static volatile int irqraised2 = 0;
/ P* d& d) ?0 J3 G7 K; G" x" o
( |' a/ K3 E$ {% m3 n0 T- M- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 \: v# O" i, g6 }6 t
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: {+ G k' c# y& e* a0 ]; Z: G
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ N" S4 P. [% A7 E' [ - , N* `' f1 \: {: n3 _0 Q4 l+ N
- dma_addr_t dmaphyssrc1 = 0;! q5 `8 Q+ f: Y! {
- dma_addr_t dmaphyssrc2 = 0;
/ S+ g2 f( u$ B! ~ - dma_addr_t dmaphysdest1 = 0;0 F& s$ O& C2 W* F% m6 k$ |
- dma_addr_t dmaphysdest2 = 0;& h% `3 J5 B) ~6 t9 G$ c" r; Z
( P+ }8 [% r! d6 f# |& I2 @- char *dmabufsrc1 = NULL;4 f8 R& a, w4 S1 ~# u
- char *dmabufsrc2 = NULL;( c) ~+ P2 ^, J# f) j2 p
- char *dmabufdest1 = NULL;
; a8 ]4 a; B1 m p9 D( D3 b - char *dmabufdest2 = NULL;
# p: D9 c" Q' ~5 |1 j2 d5 ^
+ M$ q# {7 J, U( R. C# Q( {% j- static int acnt = 512;
6 v! @: {+ b- \" s$ P - static int bcnt = 8;
0 U1 q! W% ]2 M* I( l - static int ccnt = 8;9 n; L# P% L' `3 ^% B
- " {7 @& Z# R& q; p$ t
- module_param(acnt, int, S_IRUGO);- E. g7 T" g& B" [5 B0 V; v0 R* W! o
- module_param(bcnt, int, S_IRUGO);
% r, e* K, l: r - module_param(ccnt, int, S_IRUGO);
复制代码 : Q# R6 E) m; `+ I
- d) f% I* L# d! J- C& Z/ }1 X 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% X1 K0 L" F2 ?! z' J
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 x* q7 r( X7 ?9 z9 ~9 c6 z 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- `' k E; P2 p m, q% h0 d1 B+ T$ O1 w0 Q7 m, T* n) U) D! V
* ]8 u ]2 ~" c7 S4 u
|
|