|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ ~, R5 M H% g1 t2 q9 R: J- [code]EDMA sample test application
. F* z4 ~& k; [5 Z* \% T( c+ y - /*( a) r9 K, y, g$ a! P
- * edma_test.c/ t1 u) {; e x9 G* Y
- */ g! J8 W! L0 H: v! L- q1 F; ^
- * brief EDMA3 Test Application
6 N s9 K) ?& k! Y1 Q4 W6 B: ? - *
, j# o n- @) c - * This file contains EDMA3 Test code.
# L: j% b a- c+ [" G. a6 f - *
* A; L$ X, U* d' m% W: D - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
9 \+ }3 J6 ]/ I8 ]* M: p! B# Q - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ R4 c9 ]( `0 }! v+ g
- * TO CHANGE.
' s2 T6 e) A7 b- C - *
4 v( G4 X N" L' F0 a( s; J - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ e- e1 q! X$ S( `6 D
- *: H+ L/ j2 v6 ^( J3 I4 `: V, @
- * This program is free software; you can redistribute it and/or( Q7 B' }: \* w4 e; A" E
- * modify it under the terms of the GNU General Public License as
) U K" v% H( `( D" i - * published by the Free Software Foundation version 2.
^: e+ J+ R$ I& Y - *0 Z3 k' ]" O$ H
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
! k3 a# s2 H& r' C - * kind, whether express or implied; without even the implied warranty
+ f; j" O* c6 W - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; X3 H$ B% N* w2 t4 y; | - * GNU General Public License for more details.$ P% t! C6 P* R$ D" B1 ~. Q
- */- I4 _7 e/ l# {' f) r: @
- $ ~1 e7 p0 N2 L, O. E0 h1 s
- #include <linux/module.h>* y; l/ R4 e8 h5 t9 @
- #include <linux/init.h>
8 N, _( X4 h5 Y# _2 t; t - #include <linux/errno.h>
, p N/ N# n+ N6 b4 g: x2 x7 P - #include <linux/types.h>
+ a3 @' Y: y7 R( W8 k$ v6 @$ ^ - #include <linux/interrupt.h>. q( i& n8 m" x
- #include <asm/io.h>: I9 m6 E9 r8 v8 q
- #include <linux/moduleparam.h>
4 g g; M" c5 I* b0 P - #include <linux/sysctl.h>% c7 ]7 R ]9 F* w0 [- g9 e$ y
- #include <linux/mm.h>$ Q* Z$ d% H/ d3 ]! {8 g0 B5 h3 e& K: B
- #include <linux/dma-mapping.h>
+ a, b6 G* w$ {! _6 ? - T: t( E! A6 C5 k: C- y! R
- #include <mach/memory.h>6 k! ], X: v# L! h. g4 K
- #include <mach/hardware.h>' k5 o2 r& v- m# U- [! C2 L) {
- #include <mach/irqs.h>$ U7 H; L# v9 p5 Q I( `
- #include <asm/hardware/edma.h>" b E8 m0 g2 X+ M' I1 Z, |' N# k! G4 p
- ' _8 v9 m4 G( Q$ l2 y" U
- #undef EDMA3_DEBUG
) K) B* F: R8 _ - /*#define EDMA3_DEBUG*/
$ Z. i& ]' c5 o4 K3 n! R
# U" F! z) M* k# G+ {1 I- #ifdef EDMA3_DEBUG
7 _5 l' V9 ^( |; S- d, Z$ C# I& y - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
8 K$ O" d1 |; _/ l - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 M- ^( z7 y- i0 y b2 w
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
; @: H! P7 j# O/ A- n& q: X - #else4 o0 ^. R! I1 ^/ E2 T# Y8 O. |
- #define DMA_PRINTK( x... )5 J: p! P9 X) E2 d4 F" E5 [2 v# v- E2 D
- #define DMA_FN_IN6 }- l7 D1 N' Z
- #define DMA_FN_OUT
M2 I5 e3 I: ?; E - #endif
4 r* B ^7 W0 M3 @+ w' h1 q - / G, h: H# n& k) Y( z, M3 L; V" k
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)4 U3 b; ?6 C: s$ [2 E
- #define STATIC_SHIFT 3
{: {& s- H; Z - #define TCINTEN_SHIFT 20
& b- @$ X" c0 v# B0 t - #define ITCINTEN_SHIFT 216 n, T+ Z0 q/ C) }0 l/ Q
- #define TCCHEN_SHIFT 22
; ~7 }0 d, c; x+ t! ^/ C - #define ITCCHEN_SHIFT 23$ M6 A4 T: B6 a3 \' L
# z1 `' a: S# ^- y% @- static volatile int irqraised1 = 0;
& i% X- @' R/ z- E" C' ~) n - static volatile int irqraised2 = 0;
" [2 `1 t8 c/ U$ n U0 a5 {
, }2 v+ L1 o# \% {+ W5 P- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 a" h0 C6 r9 ~: j' G
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 {$ Y4 B( [+ T0 G
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 P- P) D) g( ]4 d* J
0 m) Y; z) Z% J- `+ c& b- dma_addr_t dmaphyssrc1 = 0;
/ K( r7 I: o) p) D/ M9 n - dma_addr_t dmaphyssrc2 = 0;
, J$ ?# P& ?9 i0 _+ D - dma_addr_t dmaphysdest1 = 0;
0 L5 x+ p; Y# K) B - dma_addr_t dmaphysdest2 = 0;+ [& ^0 g( W u) d+ D
- I2 G; G _, i+ V+ @$ Z: m) Q! p
- char *dmabufsrc1 = NULL;9 U; w3 a+ e. H# T1 U: o
- char *dmabufsrc2 = NULL;
l# Y# {9 l) J0 K1 v9 e5 u - char *dmabufdest1 = NULL;
+ z0 \+ \* }6 X - char *dmabufdest2 = NULL;
) W* V: u8 ]9 x4 z - 3 T7 e3 R6 N: K3 F7 v7 Y4 q
- static int acnt = 512;
( _! F& m& @: |( f! v - static int bcnt = 8;
* }3 m9 E0 r' ~0 J - static int ccnt = 8;# y4 b( M. t( R. ^* B
- - w. b- x9 c) m! S3 w8 x v
- module_param(acnt, int, S_IRUGO);2 X0 o- f9 y2 r* z
- module_param(bcnt, int, S_IRUGO);% O& F2 b0 b* j' P0 R8 ^0 i
- module_param(ccnt, int, S_IRUGO);
复制代码 ) a- S7 x3 k0 F) [/ A% [/ S
) u. v0 H3 p. v7 e5 E2 e2 J 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: A+ q) _' O) E( l) y/ ~
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# k, o2 E! w$ e. \: J& f5 h 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' D7 S% g2 i- @/ p/ c
5 U, t. ~0 Z+ k% A' w3 `( _
9 H; H; t6 K; f6 W |
|