|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 W. a, y9 M% }! q* J
- [code]EDMA sample test application
6 r# }4 W( F7 a" R9 ?' B - /*" e( T3 p0 \, i$ r- O5 V: J
- * edma_test.c% K2 \3 U) |6 g8 _( ?
- *8 g8 C* S! @' h6 [2 V$ X5 ]
- * brief EDMA3 Test Application
2 f7 i3 T# P& B5 M8 S - *, @6 O: h4 m$ V/ n
- * This file contains EDMA3 Test code.% d+ w5 z) X: Q
- *
# J* i/ e5 x+ V. Y - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
- L7 X6 v% {( i$ L - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 X- ^6 c/ k8 B1 E6 ]4 [; E6 ]
- * TO CHANGE., B7 N0 ~! B( d% J$ d+ J
- *
" ^- f1 j% V$ T- u7 w, d - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 P8 M2 D# q0 B& o' H
- *' V/ {5 a0 K a! G& k
- * This program is free software; you can redistribute it and/or, W4 B) B; a+ w
- * modify it under the terms of the GNU General Public License as
5 N9 @' M7 f0 t9 n2 Z: c) V- y - * published by the Free Software Foundation version 2.
5 Y4 {2 n) }) M! f! P% q6 g. Y - * | f7 i. V: _: Y
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
# {2 }9 x& z1 o1 X9 T0 \# E - * kind, whether express or implied; without even the implied warranty" v/ E' M+ f5 b1 u6 B M# a. e' {
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! U- p7 T4 R9 } - * GNU General Public License for more details.
0 \6 M H1 y, B; a8 H - */8 f" A2 `8 a. N8 q, B6 \) T
- . }; I8 F4 [4 b7 ?1 S8 F; P; D
- #include <linux/module.h>% r4 y0 z3 l+ ~8 Z
- #include <linux/init.h>
3 h% p g9 z* e/ F" U1 c: {6 I7 j - #include <linux/errno.h>, A. h, N7 P1 ^' O
- #include <linux/types.h>2 e$ G& m% V6 \4 e) k
- #include <linux/interrupt.h>' ] `. m' B/ t: Q# ?! }
- #include <asm/io.h>1 w( g) z- R: {3 ^ }
- #include <linux/moduleparam.h>
% k: _2 V1 Z$ N: W" }2 z - #include <linux/sysctl.h>& X( m& A% C" r. r" v2 k5 A/ Z
- #include <linux/mm.h>* \! R" M; U7 E! \: k2 z
- #include <linux/dma-mapping.h>* X* s' a, h5 m
r- Q/ E4 k6 c( ~- #include <mach/memory.h>
6 U! u7 t% M- u - #include <mach/hardware.h>
6 p! P( Z1 A8 H) w Q4 c. n - #include <mach/irqs.h>
( F( l# p, G" z: Y p - #include <asm/hardware/edma.h>
! i: g4 C1 R: p: h1 H - ( {5 _1 P0 b& T" Z, v' F
- #undef EDMA3_DEBUG
1 s1 A, j |8 ]7 Z - /*#define EDMA3_DEBUG*/. f/ t4 w& i5 E9 v, v( q" I
- * T" D2 a: |( s; K" d
- #ifdef EDMA3_DEBUG
* x$ G7 d8 g0 y' P$ V9 ? - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 v: o" u! {0 @/ B7 q& S
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
4 W! s' C/ d2 m Z9 ~8 p - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): u: n0 l: j# ?
- #else1 q7 N& A; x% K
- #define DMA_PRINTK( x... )& N, u- f" @$ K: r
- #define DMA_FN_IN
6 M3 q2 ^# a0 K* n9 }7 A9 s - #define DMA_FN_OUT
) X) U% h/ s# l, ` - #endif: @1 O! {$ {7 j% G/ _ v& v! D
- + N3 T1 ~1 Y. g1 e5 }% F' V
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
2 h& R9 t9 e/ B - #define STATIC_SHIFT 3, V, P+ Q7 [4 T' F$ L
- #define TCINTEN_SHIFT 20) N6 p* o' v4 z$ S9 F0 W1 d4 {
- #define ITCINTEN_SHIFT 21
+ i/ _& u$ L7 T; j - #define TCCHEN_SHIFT 22
. ~$ G% A5 P7 k3 _; E# @: y9 x - #define ITCCHEN_SHIFT 23
6 p: o. o, i, n2 P
* Z# Q( B0 c" D, ~- static volatile int irqraised1 = 0;# U' ?2 v* x4 M" S4 W3 S# ?! [
- static volatile int irqraised2 = 0;# h1 ^& [9 U$ H
6 q- F) g; [1 U0 v9 h- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 u" t8 V* h3 ]" \" H
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 L, i0 [7 {$ d3 T O1 J+ e/ b - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( B5 h* C& k5 I+ T* g" T6 \1 K P
8 d% N8 }% R& e. b$ [% f- dma_addr_t dmaphyssrc1 = 0;
; M& R1 Y" i8 [( R! {/ ^ - dma_addr_t dmaphyssrc2 = 0;
6 \( p; J* M6 ]' W1 h- \ - dma_addr_t dmaphysdest1 = 0;9 h# B" U( e0 t5 J9 O0 p0 u
- dma_addr_t dmaphysdest2 = 0;
$ |9 Q( Z6 h1 U8 [/ V - 6 K5 A& s- v- @% o' R) ~0 X
- char *dmabufsrc1 = NULL;% a& L0 e3 {! b- e( K s
- char *dmabufsrc2 = NULL;
/ q2 ]9 H) v) p, t3 W - char *dmabufdest1 = NULL;) E( _5 I3 D+ N
- char *dmabufdest2 = NULL;
, O& ?1 \: m% n- @+ ~/ U - ! h" p% F, b* {+ Z- h
- static int acnt = 512;# s% D: v; z1 A& |; z* h
- static int bcnt = 8;
0 g. Z D& A2 l$ n4 T9 _" e - static int ccnt = 8;4 O' J: s+ h* m
1 o+ d( X) J0 h1 V! t3 E( H( y) C- module_param(acnt, int, S_IRUGO);
7 g0 t7 _$ `: k! \ - module_param(bcnt, int, S_IRUGO);7 x, J l+ g1 p7 e- a& e' ?# {
- module_param(ccnt, int, S_IRUGO);
复制代码
2 I7 R9 w. Y: j1 v2 m# a0 D8 R/ Q* O* p
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 ]( ]$ M% D" X) i' q2 T" _
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 r" \. g5 v" L0 f7 t3 \ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 `2 {7 _2 w/ n; s: u( B4 z% X8 c: [! |& j4 Y; W B
6 Y5 s6 p. j; s5 x7 }+ V
|
|