|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# ]$ T" F9 o; G. M2 N- [code]EDMA sample test application0 A9 h! t+ V. Y7 g6 M. |/ R
- /*
! K% u; [5 E# G' [- S - * edma_test.c
4 [. Z" V' O0 o; E; i9 i6 t: N - *
; Y! f' o1 B4 ~- [4 C - * brief EDMA3 Test Application
, C ?9 j: Y7 Z- [6 H. L& Y - *4 ^8 D: ]5 q* }* G m9 A
- * This file contains EDMA3 Test code.
7 Y& t0 F! X: w8 F1 \6 G - *7 u% B) P. z$ g6 E3 |# b
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 v2 F- w" T2 f, z0 M K
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
, u* d. l& Y6 F* a/ R; r8 f) J - * TO CHANGE.
7 W `9 N1 a0 X x: t - *. Y# G q3 @1 t
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( V# P U! d5 m9 ^, Y5 m: E" I
- *! H" `/ \+ h: i$ ^
- * This program is free software; you can redistribute it and/or; S4 h: P7 X( y5 D
- * modify it under the terms of the GNU General Public License as" Q6 R/ x( e8 B5 a
- * published by the Free Software Foundation version 2.0 g' ~* ]- Z) r. b5 P! j. z3 I
- *, a% j5 O# r. J* F& m6 m: J
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ U) q, x1 t; K) [) E* S
- * kind, whether express or implied; without even the implied warranty. a0 p6 @- o# k# W1 c
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the& G+ L) R z. m% v& n! u( L1 Q
- * GNU General Public License for more details.# O" t/ Q) h( s% _
- */
" J; V9 p' y9 g$ m# Y' [4 _$ J
6 H6 K, i8 @1 Z. P- #include <linux/module.h>
8 u$ ^# o6 S+ h - #include <linux/init.h>
. c' u, H5 f% {' r - #include <linux/errno.h>
4 D5 o6 ~! ~! n( F9 R/ h) a) \ - #include <linux/types.h>5 L+ u" q1 l& c. i
- #include <linux/interrupt.h>
( z0 X; t' M1 B& S1 K - #include <asm/io.h>* b+ |: ?' W9 B
- #include <linux/moduleparam.h>
- \! O; ]% [2 M" O( v2 i- ^ - #include <linux/sysctl.h>; R) L v9 V6 B7 i# i
- #include <linux/mm.h>/ X- p8 r# Y9 H$ L6 h- R" t
- #include <linux/dma-mapping.h>+ u7 @ q1 g8 h8 }
- , t( o5 n6 S" v# l
- #include <mach/memory.h># q' F& z* T' B2 m1 z5 {, k6 _
- #include <mach/hardware.h>
* ?5 G$ J/ {6 F - #include <mach/irqs.h>9 M; |& A5 s+ n$ N
- #include <asm/hardware/edma.h>
* Q6 y: Y, q- n" O) n! Z9 l+ q
' n! X- I5 d4 b" [. l& l- #undef EDMA3_DEBUG7 t7 g! z+ v+ {" q
- /*#define EDMA3_DEBUG*/
: Y; |* |; W" T' k( D# W- Y w - P1 w# y7 S& W$ j
- #ifdef EDMA3_DEBUG! |! a! M& R; w' a! ?; I; L
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 { i/ \9 C0 R* d: d2 E
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! H( g; V- U9 Z+ _/ B
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 Z* h0 A& [# K* f
- #else
) v7 A8 ^% d0 G" n3 H - #define DMA_PRINTK( x... )
% i- G) ^ B6 u* B1 z6 D$ H5 t - #define DMA_FN_IN
" j$ U( G" h. w( m2 \& f# |" b+ k - #define DMA_FN_OUT6 N4 U6 H G$ p' q2 V4 Q
- #endif* c% e! s* S. f( Z
- 3 |- D+ O" g U2 w# F- z; w
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)5 d3 F3 @4 H$ {
- #define STATIC_SHIFT 3
7 ?! f; Q/ W0 \$ _* w1 G0 F. \ - #define TCINTEN_SHIFT 20
+ j2 g8 F) X4 [6 U" {8 i [ - #define ITCINTEN_SHIFT 21
; W1 v9 n; ?# A! C/ G, Z - #define TCCHEN_SHIFT 22
4 t: d0 W3 }0 Z- M" n }! P3 {4 ~ - #define ITCCHEN_SHIFT 23
+ N0 v7 k$ j. ?6 e4 A: {
5 c! k' T0 }$ e9 o! W. N0 g- static volatile int irqraised1 = 0;8 r* |3 E7 N: @ _8 Q+ h
- static volatile int irqraised2 = 0;
* F- h1 v% M5 p: s7 \. r2 g0 p
V! i6 b7 j& h5 c. g. ]- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); c; {1 ~9 ~0 g) F {+ q
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 r! z& ~' y: }. h& j& O5 S
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 m: p3 ?0 {4 P5 d2 E
3 i; y g+ g$ K) P- dma_addr_t dmaphyssrc1 = 0;
0 v/ _9 u9 {9 |. a0 l+ U% n - dma_addr_t dmaphyssrc2 = 0;1 W- E& m" h1 ]# u3 A) Y
- dma_addr_t dmaphysdest1 = 0;* S. m; f0 C( h/ \6 a
- dma_addr_t dmaphysdest2 = 0;
; t4 G5 E! x& q6 P( S - 3 B+ p- x/ n" I. _0 \
- char *dmabufsrc1 = NULL;
4 c. l$ `/ [2 k% r; T/ v - char *dmabufsrc2 = NULL;/ @* Y6 }- c% m- }; v7 s( D# A
- char *dmabufdest1 = NULL;
% U) `( C. {; w; U - char *dmabufdest2 = NULL;
# Q! [8 F/ H7 e" d" L
+ X+ ~% V! x! k. {% q: p- static int acnt = 512;
9 D9 O: T! \& R B - static int bcnt = 8;6 [) l o2 I M
- static int ccnt = 8;% b8 ]- e: o5 W* N+ Q7 S
- 6 Y8 t$ }, `9 ]$ x
- module_param(acnt, int, S_IRUGO);8 D( l( D3 t. I5 @
- module_param(bcnt, int, S_IRUGO); C% }" ?8 z' \2 H; ~0 |6 o* h4 H
- module_param(ccnt, int, S_IRUGO);
复制代码
* C# i3 T4 K9 c1 S g$ f- S
+ g9 E% z+ {# S% U j 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 X- R" z! B! i$ G* rarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) Q' l2 M& K$ Z- s1 w1 T
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ W, R- [& N, y L
6 I0 y* U- A( d. n
6 ~9 J3 a5 \ [ |
|