|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + r Z& v# G7 M
- [code]EDMA sample test application
! r$ c# U! ?& F; J% Y - /*7 x: {( _. q! S
- * edma_test.c
! v" y4 I0 n9 y. Q6 i$ _ - *
2 f# d- S. F9 a4 d8 \& F. P4 t - * brief EDMA3 Test Application7 g% C( x4 M0 S, ] ]+ A' z/ o* e) q
- *
7 @ J. N! G- a; o. Y - * This file contains EDMA3 Test code.
9 b c& N" i5 g. j% j6 s- |0 n - *1 F2 i$ N7 I- T" [$ f! V6 R" e3 X# D
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. x. ^9 ]3 S. ~
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
3 i5 p6 w. X8 d, x" ? - * TO CHANGE.$ Q1 C- U; N6 Q& O
- *! L, ]5 |' }9 }9 M0 g
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* d2 w* P# ^& S' ^
- *
+ d0 W# K; J/ x o$ { } - * This program is free software; you can redistribute it and/or- z) L: S; U- N9 w4 ~- J( O! v
- * modify it under the terms of the GNU General Public License as
& d; G4 p6 p2 b4 B5 j1 _' Z% | - * published by the Free Software Foundation version 2.. H3 a! L$ O! A; U- z8 W i2 n
- *
- T1 b- i+ J% F( X9 N6 r - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
/ a4 m5 A# T) v Y) j - * kind, whether express or implied; without even the implied warranty
! ?! m5 S) s: O3 n; y4 _1 b, p& g - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/ K. b6 u: ^: d& I - * GNU General Public License for more details.
2 s; f1 j' b+ \0 ? - */
: O* m6 ?6 _( i/ ]5 W+ r; `7 K, R# S - $ O) h+ D5 A# G( E* @
- #include <linux/module.h>
7 G5 G- V+ {7 D6 n3 N2 P - #include <linux/init.h>7 X: @0 I* O, H/ [- S; r
- #include <linux/errno.h>
" n( `# @( A/ b - #include <linux/types.h>
" Z c( C& g8 g# A - #include <linux/interrupt.h>" O$ o, l* | w5 w. f5 f) E, k+ Z
- #include <asm/io.h>% ?8 `& [# P7 N/ |
- #include <linux/moduleparam.h>
: R# L; s1 v0 A6 ~) _7 ` - #include <linux/sysctl.h>( y; X) c; g6 C% \- l% P
- #include <linux/mm.h>
0 e \1 I6 |1 L% I! D' c+ p! D - #include <linux/dma-mapping.h>
- Z: |" ?# W" e h% O
6 f9 u: V8 _5 ^- h2 X- #include <mach/memory.h>, ]* T7 @) s# s: X& K% g' J3 D( ]: ^
- #include <mach/hardware.h>
: F- B6 x& m/ {! U8 | ^# E - #include <mach/irqs.h> \1 v+ J$ }0 U `
- #include <asm/hardware/edma.h>
+ E: U+ P5 G+ U. e- z
2 M' D6 X) O: Y8 }; q) F3 \& l \- #undef EDMA3_DEBUG$ f% r9 s9 ?3 ~, a
- /*#define EDMA3_DEBUG*/ o+ U. F+ h# H* |1 g; y
9 V: m$ _' N: H- #ifdef EDMA3_DEBUG
+ o' D; P% k0 d+ V! m0 ?7 }5 c7 {9 d; } - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
# ]7 D! B7 K& _' D9 b* B - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). W* K0 m5 i: T- k4 ]* B! v
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
5 g' v$ h( J+ K6 [8 t - #else
3 n6 k: F8 R$ h) f+ L - #define DMA_PRINTK( x... )
+ g6 I( X" @7 r - #define DMA_FN_IN
/ P$ b, H* R# Y - #define DMA_FN_OUT
, c, N: Z2 ?+ }# ~5 m1 U - #endif
5 }7 {. h5 x9 T, A v, r/ ~ - . B; W0 X s6 q" r/ W
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
' O- A" S9 U# }9 j! j - #define STATIC_SHIFT 39 U" d! X# p6 ?7 M
- #define TCINTEN_SHIFT 20
4 U- K. J1 Z- Q* u - #define ITCINTEN_SHIFT 21
5 e- u s. T% m9 V& f1 J$ b - #define TCCHEN_SHIFT 22
8 O/ j1 _5 G, ^( X( F - #define ITCCHEN_SHIFT 235 ?2 K4 E9 S* F# G( d g( `* A
- 2 |0 L8 i: u+ T- e I
- static volatile int irqraised1 = 0;
; S7 T; @; m; D7 K - static volatile int irqraised2 = 0;
" T1 k0 k7 z8 N% `) @- P' {4 K) ` - 5 `6 K( [- ]3 E1 A' L$ M" V7 _
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 C q7 m7 t6 F& L" }* E8 N - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 a: D. R, P" C5 g* T7 O7 y' x+ I1 }
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 \# _! X0 e% b% D8 ?
- : x. k8 f- a, I5 c; e0 p" ~
- dma_addr_t dmaphyssrc1 = 0;
8 j4 p- T, F2 a; i' f - dma_addr_t dmaphyssrc2 = 0;; d! {: a C% e! ^) u* \' d }
- dma_addr_t dmaphysdest1 = 0;( T% I+ C* T3 s. K7 Z' I
- dma_addr_t dmaphysdest2 = 0;
' g+ [9 C* R7 |2 f! y) h - # q( Y6 D6 L) Z* Z0 M7 D. L4 Z2 F) m
- char *dmabufsrc1 = NULL;6 O5 _4 I9 @, _( M. {* h
- char *dmabufsrc2 = NULL;" s5 U* D- A% W3 j. I
- char *dmabufdest1 = NULL;
- Q$ d& Y7 z, r - char *dmabufdest2 = NULL;2 }5 Q# {' U4 Z6 Q5 D6 H+ u3 k
o4 z q4 X0 {" u5 J3 a- static int acnt = 512;
- S; {4 \: a7 y4 o# I4 y4 U - static int bcnt = 8;
; {; l8 X z+ b1 f ? - static int ccnt = 8;8 F& z3 k, @- K+ i0 `
2 ~, P2 `3 X3 b# X, v5 W- module_param(acnt, int, S_IRUGO);
* R% [7 H$ q7 n* Q' d& X, w - module_param(bcnt, int, S_IRUGO);9 N& D4 X6 G7 D2 Y: T$ W
- module_param(ccnt, int, S_IRUGO);
复制代码 1 Z2 l4 m; H$ F g( F
" _" K9 P3 U+ }! P' a5 s, N) o6 p 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 L% u! H- f8 n6 J
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) U" r: q d6 w
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。 h: [) k3 |+ @" ~2 a
. C' A% d1 g2 j8 K" }6 _! p
# r$ Q) R H3 m: W$ ? |
|