|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * H0 o3 ?( Q+ @( d+ \
- [code]EDMA sample test application
3 U% J/ [. Q0 O1 j6 Y# @! @+ D$ a - /*0 n" G5 {( t Z+ G4 e) M8 {% Y
- * edma_test.c
, N. Q4 F3 ]" x. v- [) J7 o3 w6 _ - *
9 f5 u! z& ~! b3 ` - * brief EDMA3 Test Application
; X B6 F. m; u2 E/ ~6 x; |. R - *
4 ^' t3 g1 g$ F8 l0 D8 @ - * This file contains EDMA3 Test code.
$ n6 w# X* k8 P8 A/ O8 `0 S, }5 V - *
0 h k8 o k* q3 T$ d) I+ @ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
) v" d ~3 y$ ~4 ]1 X- M - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 A0 I- C4 C: a' ]5 d
- * TO CHANGE., @/ p4 H: M7 O& f; b0 i% r
- *% w9 w* z! A2 _
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
5 m5 V$ m1 @1 S/ g8 m3 o! y$ D - *- V- _& H3 [$ d* ]4 H) B: x
- * This program is free software; you can redistribute it and/or5 j, R/ y9 F* ^- {7 g
- * modify it under the terms of the GNU General Public License as: y6 |1 Q& n$ \3 M% j# l/ B
- * published by the Free Software Foundation version 2.
3 [! t' G4 u6 J$ V H3 S - *1 C& O# Q% o% I/ @
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
! a7 i: }! X. b - * kind, whether express or implied; without even the implied warranty
' m0 W/ f7 j$ {) t/ ]/ \$ O - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
$ H, u* ]' g1 t8 J8 K - * GNU General Public License for more details.. d1 X- ~8 Y4 L' _8 L' U6 x/ E
- */
: @( X3 @( f2 K: B7 D- R. W
3 f6 |$ R5 B! |/ @% p; D- #include <linux/module.h>
) L4 Y9 b% I( q - #include <linux/init.h>5 b! B0 x. S# f& p$ F! F; R/ V9 Q
- #include <linux/errno.h>1 g j* Z; Z3 M' C6 ]
- #include <linux/types.h>& t1 |( Y- O& J- ~" v# C
- #include <linux/interrupt.h>
9 f% Y4 @: x7 t& G" S - #include <asm/io.h>" Q( Y1 {& b! V- \
- #include <linux/moduleparam.h>
6 I8 k0 Q$ {' [3 D6 u - #include <linux/sysctl.h>
1 n6 @* f! e/ \8 z; `8 y - #include <linux/mm.h>
: T! a& Z0 {) ] - #include <linux/dma-mapping.h>( r; J/ i, H+ O' {' M
- * b; y) R+ y: o5 o$ |- K7 w
- #include <mach/memory.h>
7 H8 g0 a/ N2 X, @# R4 } - #include <mach/hardware.h>: o9 C$ T9 {8 C9 r5 h3 o s
- #include <mach/irqs.h>3 a4 Q& U; t% l/ ?, s- h/ U
- #include <asm/hardware/edma.h>9 p" ]( s( D( W" n: S9 ?( M8 J
8 t, n g8 x l# `4 V- E- #undef EDMA3_DEBUG
% e- v8 h2 V) @6 d, I4 D - /*#define EDMA3_DEBUG*/
% `- C3 f3 i" E' w
! w0 B3 O* W; m; S: U1 i- #ifdef EDMA3_DEBUG6 `. _3 [# _& D5 ]2 e0 k+ X! k
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): V3 ]4 n' X6 h5 y
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 E$ |4 ~7 c" S+ _: h( d, u
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# o( D3 T/ \7 R/ s5 s
- #else
- ?3 ?/ m, T7 o: m2 d- }8 O) S - #define DMA_PRINTK( x... )
! l e K/ Z' y3 S3 ^0 }6 D# K6 U8 B - #define DMA_FN_IN
/ y# v8 b" W1 W - #define DMA_FN_OUT
' k7 W8 j# B, f/ W - #endif7 X/ P1 O# @% ?' j- b
% X2 x6 u# j+ {" H3 l1 m$ Y! M- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
+ Z. p P$ }* M, w - #define STATIC_SHIFT 3: W. O0 P& E3 I" r7 ~ {
- #define TCINTEN_SHIFT 20
7 z S$ U* `7 {; V. E8 ? - #define ITCINTEN_SHIFT 21+ f, l5 P' q6 _! L0 V% O
- #define TCCHEN_SHIFT 22
' t& _6 ^- u) D7 ]' o* J0 { - #define ITCCHEN_SHIFT 23
4 C6 ?. U& y' _2 l6 p5 y7 ~ - ! x/ h+ b# m# a8 I# S4 X$ Z
- static volatile int irqraised1 = 0;; }7 O+ x2 X" A( s
- static volatile int irqraised2 = 0;
7 i& c1 B' l9 Q7 k1 b
0 v9 v4 L$ b/ G- Z- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 E3 F; o. A; r( T
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" ^' Q& c7 P: R) e+ h, n" l( o
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 y5 R9 Y4 H" r( w, L H4 s- J
8 o( T- }5 T) L- x4 Z. z, r- dma_addr_t dmaphyssrc1 = 0;, G- |% ?( V- D( K y
- dma_addr_t dmaphyssrc2 = 0;
; n4 v* ^1 l2 E2 f9 N! K - dma_addr_t dmaphysdest1 = 0;( Y9 V) y7 p8 `# o ~7 A
- dma_addr_t dmaphysdest2 = 0;/ U7 Z+ ~8 n H6 J* n* o
, X1 K' c4 J/ i% f- char *dmabufsrc1 = NULL;& b% L+ [, C% [& d6 {
- char *dmabufsrc2 = NULL;
& Q' Q: U/ z! n9 K0 `1 J" ?, k - char *dmabufdest1 = NULL;
$ U- W, A0 ?: k6 C - char *dmabufdest2 = NULL;: ], c4 O2 e' R2 S4 Y
5 O- k6 W0 j" j+ x- static int acnt = 512;7 A6 L+ F5 ]4 T5 D% o U G
- static int bcnt = 8; q# P$ S L1 K, O
- static int ccnt = 8;
% c( c5 Z; B# ]* m; m - 2 v+ B$ ~! c: I! J3 `: W
- module_param(acnt, int, S_IRUGO);
% B x6 K) ]+ K - module_param(bcnt, int, S_IRUGO);
: L' a7 P' s6 `. | - module_param(ccnt, int, S_IRUGO);
复制代码 & U" v! w/ g' Z* R
5 A+ W1 T: \2 o! l d& }/ K
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, Y" b; D& W& Y* Y# o: earm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 X; E8 ^( B) r( C; S4 H6 z+ ~
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ y: m8 K' q2 H, X+ a- k" x
4 {9 {- ]' r5 }* M* R1 J; F( p
) }6 ~4 q: q( Q" I0 d4 q) t2 h4 Q6 l |
|