|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 b& e8 J* ]; R- [code]EDMA sample test application
' v0 l1 s5 T& e1 k - /*/ T: E( i; Y, R
- * edma_test.c
) H0 ~3 m2 d1 C0 M - *" E" ^5 n+ ~. i% O9 {5 w
- * brief EDMA3 Test Application
0 Y: _# N1 @5 ?9 @! u& G' N/ K - *, q' C( O- T; \
- * This file contains EDMA3 Test code.
- ~( Q; {# f* T) ]8 _' p+ | - *
: {8 {$ ?5 ?: X: X0 g& ] - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, t3 }0 S$ T& R$ W$ S% ] |5 x& k
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
3 b- T* j+ a6 ^" D - * TO CHANGE.
0 z! r" G+ E' a0 y8 E* P, s* ~ - ** _0 h5 L: u: v$ Q. j
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
# B0 a0 P) ^/ z3 L% C9 M: e - *
1 N; t1 x- k) ?2 L1 j+ } - * This program is free software; you can redistribute it and/or
' C) i1 X& m2 Y; e4 w - * modify it under the terms of the GNU General Public License as5 w6 v& a6 C! a) q' z
- * published by the Free Software Foundation version 2.
% I* t" j! ]. y8 h+ J" j5 }& R, E - *. z9 H: U+ G% f8 |$ f. `
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any, E, L" b) c- d) ]- v/ d, r8 q
- * kind, whether express or implied; without even the implied warranty, R; `0 u8 j1 M% e
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
, }6 ]. t) o, a6 x- L$ g! y8 Q - * GNU General Public License for more details.
! c( U w( Y: T! E - */5 g' u. z* O2 m' H
# e. t* l, e: }' A- #include <linux/module.h># e$ f+ L9 J0 I
- #include <linux/init.h>
9 z" ?; {8 m7 C: d3 y5 K# ?" a4 W D3 E - #include <linux/errno.h>" d6 v, d: z, y* B) }" P$ ]" {
- #include <linux/types.h>- F! b- q: l/ J: B. E+ x4 a" [
- #include <linux/interrupt.h>
" J6 T u- |5 {/ u0 P - #include <asm/io.h>7 [3 @/ i, i* `. f6 i0 A
- #include <linux/moduleparam.h>
/ a' u$ l4 f4 t- C3 { - #include <linux/sysctl.h>
/ h# ~' a [. P$ M: {" c - #include <linux/mm.h>
: ?& Z* Z8 O) e8 a* y3 q - #include <linux/dma-mapping.h>
5 [4 ]; o/ ?4 L" K; d ` - 0 o- \5 ?3 n. G) e
- #include <mach/memory.h># T- Q# F3 p% W m) r9 A% K9 b
- #include <mach/hardware.h>/ L1 m8 T2 P2 m
- #include <mach/irqs.h> e/ n. I) j- ?) u R& Z
- #include <asm/hardware/edma.h>
1 y; _8 e7 h4 K \* o/ b - , H, G4 X: z) @1 @% A; Q, R9 o
- #undef EDMA3_DEBUG
' c5 R2 W. Z+ @. V; _3 ^ ]7 Y4 ]+ K3 a - /*#define EDMA3_DEBUG*/' m# ^8 q$ Q+ x
- & u: K8 Z# t. S- }4 R
- #ifdef EDMA3_DEBUG% Q0 ]0 a) P9 K) E4 _
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 k3 H" N* T2 }; z r$ G, J2 }/ Z
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
8 {( C) c+ ?! C L - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& a5 s. R. \8 |/ S. I" ]8 w7 Y( W
- #else
o: ?% L" S0 A8 a0 p - #define DMA_PRINTK( x... )) H" P5 S7 \( H, O# Q/ I, f3 u
- #define DMA_FN_IN8 k9 y/ {2 P. L6 }2 Y. Z% `
- #define DMA_FN_OUT
" g$ x1 `: S; F, [$ [0 y& o- R8 A - #endif y0 W* K/ {' U1 T1 W! J) s
- / f- X) l/ n x- g
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)6 s4 C1 M3 f! }7 G
- #define STATIC_SHIFT 36 f# t/ M. T5 u3 a0 f: H' C. g0 Y$ ^
- #define TCINTEN_SHIFT 207 f; l5 A9 [4 ^' }" K- X" Y0 a1 M
- #define ITCINTEN_SHIFT 21- Z+ Z5 b: D" B7 u; Q, i
- #define TCCHEN_SHIFT 221 q' Q+ i3 n, J( @$ j& ~ V
- #define ITCCHEN_SHIFT 23
. g4 o, I; x# W0 ?" z5 X2 C" M
( ?, Y w: e% f% U$ P' w( k- static volatile int irqraised1 = 0;
3 {3 {8 f) N3 O0 g( s* B6 u* i' { - static volatile int irqraised2 = 0;
" e, _0 z8 E" F5 T) K- E' T - ( C+ [' V3 ^3 f- ?1 ?
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
T- J* A% p: V) ~ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) A" D& R' P' k2 z! F
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ R- K3 L( h7 s - 1 e; d% ]* {' P
- dma_addr_t dmaphyssrc1 = 0;+ h" c' t" V, j% Y+ _: q+ s
- dma_addr_t dmaphyssrc2 = 0;" d" p; C$ H$ W$ X6 z6 w: R
- dma_addr_t dmaphysdest1 = 0;0 q8 c: u* M6 h0 H' u1 i
- dma_addr_t dmaphysdest2 = 0;- g5 `% i5 j6 ^3 N/ Q' K
9 A+ d4 P3 v( ^9 b% G+ [9 I- char *dmabufsrc1 = NULL;6 w' \4 F8 y+ z4 ]% u# ]% C2 @2 r# f
- char *dmabufsrc2 = NULL;
" G$ U2 M$ ^& @ - char *dmabufdest1 = NULL;
: i% T& w0 F2 \8 I8 m3 ` - char *dmabufdest2 = NULL;
* a8 I9 z" n; @0 p5 m - 9 L: |" w+ d$ I! @/ @3 U" Q
- static int acnt = 512;
3 G6 B, s8 }; k! G# p - static int bcnt = 8;
( H8 H& s2 {2 X, e( [( v6 \' _ - static int ccnt = 8;
, Q& f1 [- D7 i5 c! D - 3 \7 ]* ?2 P3 A# l
- module_param(acnt, int, S_IRUGO);
X: s% L, M' p - module_param(bcnt, int, S_IRUGO);% {- M+ `# N, o6 D( d6 G
- module_param(ccnt, int, S_IRUGO);
复制代码
2 ]/ _0 F* L4 @: Z
" s" @0 Z, K$ J9 Y$ x: Z 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 i# `- \. {: i$ X8 x; \+ U1 G0 |& Farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* w" D7 M# }) C+ o2 f
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- B% s3 n) h# L+ Z4 v
9 z, T- M8 j! N ]6 }5 |. P0 k7 r
|
|