|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 S4 M; ^4 b- H$ C1 S; u4 j7 b8 y
- [code]EDMA sample test application" g# {$ l5 s4 O: N0 n9 X
- /*; N" k+ R- |8 |) q$ P2 K$ x* p9 |
- * edma_test.c9 n6 `: w7 Z* u2 D, D
- *
8 g) }3 t" g" T% t" T - * brief EDMA3 Test Application
4 |4 ]7 r$ I" i5 u1 t/ u - *
5 v! w o! I0 t5 D - * This file contains EDMA3 Test code.
W; C/ W; C" ^ - * l. I5 Q. S# |9 i1 y$ E( Y2 {
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
% F5 w; f& H4 v6 J$ o2 A4 R2 J/ p - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
3 z% f' V& a9 |# S) o8 R - * TO CHANGE.
( A3 q3 y1 u7 S. E3 }3 o' f4 ^" ^* M - *8 O+ a4 y4 F; x2 n6 \; M/ W
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 h8 \" P: c% N/ E
- *
" R7 W/ e; ?8 [ M# u4 Y9 C( u5 y: R - * This program is free software; you can redistribute it and/or7 l7 V0 Z5 n2 E' t& M" H- P
- * modify it under the terms of the GNU General Public License as' S: p+ i9 Q9 ?) h
- * published by the Free Software Foundation version 2.
; _: R) ?0 v2 c - * O0 S4 S" W/ D9 ~6 q* i
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
$ F# s# C! @4 z$ X9 d( V8 s1 e1 T - * kind, whether express or implied; without even the implied warranty
$ m" E5 }& c" R) V; e' S5 } - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the9 D. e" X# M& W3 P& A1 j/ W
- * GNU General Public License for more details.+ Y$ s( C% i& w' I
- */
& x& a% L9 p0 d9 f& ^
; j2 t+ Z& B8 x- #include <linux/module.h># A3 z }' `! b4 T. ^2 P
- #include <linux/init.h>) c) ]1 p4 k) [- G# Y9 c
- #include <linux/errno.h>
( p! w% k8 C2 c5 `5 E, }7 z5 `' @ - #include <linux/types.h>
8 F5 P9 `" `, K8 J* I6 ~1 l - #include <linux/interrupt.h>3 M/ v# w& b) B/ f: U
- #include <asm/io.h>' [ H4 v* n) l3 s9 U/ ^) h
- #include <linux/moduleparam.h>2 R$ X. q0 B( |' V- f1 ?/ A: g9 }5 D+ V
- #include <linux/sysctl.h>
, I1 i$ f+ q9 ]) o6 T4 d; Z; a - #include <linux/mm.h>7 ?+ n9 h; a- _( |# F
- #include <linux/dma-mapping.h>
; K% ?0 p0 E7 _' I; K) l
- m& r2 m5 X+ J- #include <mach/memory.h>6 k& m; h6 c( ^% s! l8 E: E. x
- #include <mach/hardware.h>
" U% ]: F7 M7 J - #include <mach/irqs.h>% o5 k3 }8 Q4 n. ?1 F, a# U; L
- #include <asm/hardware/edma.h>
- Y; `5 E1 O5 ^0 w
- d8 B, _( h9 e: R+ B- #undef EDMA3_DEBUG
0 B9 U& @6 v* J4 G - /*#define EDMA3_DEBUG*/# F# l1 b4 K% R
- - O' o4 h4 Q& B' D9 r K5 F
- #ifdef EDMA3_DEBUG
5 N% X. K/ p; k# [& X - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
5 s- E( h( V; T# O - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
3 k0 [2 U3 o1 m$ Y8 F& \ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); T' R) ^8 p! }7 \0 w: r f1 u, i" ?
- #else
6 U4 b( M: g2 E v - #define DMA_PRINTK( x... )
$ W7 k/ U' X, ~! O$ V9 K9 L - #define DMA_FN_IN0 h( g# [: a; Y. R4 P! H
- #define DMA_FN_OUT- \! G$ I' n- j) M' K1 J
- #endif! ~% m5 z# |6 I( V
- 4 W8 }8 U7 N- D
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)- W" P, \( q+ \; Y% \6 B0 I) m
- #define STATIC_SHIFT 3+ a! d! x0 }2 F4 P: W
- #define TCINTEN_SHIFT 20
' o, V! q" q$ Q, c* L6 T7 n - #define ITCINTEN_SHIFT 21
4 H @- r1 r3 P1 W- o0 p3 p: d - #define TCCHEN_SHIFT 22
3 @3 n6 k$ Y) `+ H. D/ a- d - #define ITCCHEN_SHIFT 23
" L3 x6 b/ H# O# D/ R
7 E8 R% Y$ P# ?6 S- static volatile int irqraised1 = 0;
: \) B7 P0 i& e P1 p# ] - static volatile int irqraised2 = 0;( o$ y5 G7 `8 Q
- v- ~7 o' C4 L8 [+ c- ^- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ d3 L0 `1 [* X$ h1 b0 A
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) Y7 y1 @4 y; D+ y/ o* s
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" M8 A; ~) V7 @4 W- o
3 ]( d" I% _$ A4 d9 ~' ~# U7 o- dma_addr_t dmaphyssrc1 = 0;% X+ @. m; m4 S3 J n
- dma_addr_t dmaphyssrc2 = 0;0 }, N) m& ^; B1 I
- dma_addr_t dmaphysdest1 = 0;5 \" P4 Z; s9 ~6 u
- dma_addr_t dmaphysdest2 = 0;% p7 I* R; c- v: y" }! _
- 3 W7 w# ?: x0 ]3 z% |; o9 M
- char *dmabufsrc1 = NULL;- t$ a$ I5 m& ~7 K2 U% U
- char *dmabufsrc2 = NULL;
2 _( d) y- g* K+ g6 U - char *dmabufdest1 = NULL;
' b; _4 l _( S$ k, ` - char *dmabufdest2 = NULL;
0 v, X9 F: y" R. v
. ?# f$ ?: U$ x$ e- static int acnt = 512;0 c" M6 n, j- C8 N* t: v
- static int bcnt = 8;) \! c( g: T6 G) K6 S t J8 I
- static int ccnt = 8;6 t* p4 y: w$ K1 I' W
$ z. i- j5 j" h( w- module_param(acnt, int, S_IRUGO);
( p! [9 E4 l: Q8 G% ? - module_param(bcnt, int, S_IRUGO);
. }5 ^. n( K2 D% v+ c1 n - module_param(ccnt, int, S_IRUGO);
复制代码 0 O! I/ R) ^4 p/ D" o- X" s
_4 @% U$ g% S1 s& f 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 n w8 d1 Q/ O4 Y- o, `5 _6 tarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: [5 A! [9 K% `& f7 S
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% @0 s4 [5 x/ E8 F8 F b
8 P/ ^. p6 V7 H4 ~% @( O2 N
6 h( r% {) e' A: m
|
|