|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 {6 i2 q) N9 Q& x. D6 b+ m
- [code]EDMA sample test application- J4 k0 }- Z: f
- /*
& f% L6 y s R- J0 k; n2 F - * edma_test.c
# p2 h/ D2 P2 ^& S) S$ m - *0 a2 I) m* d4 z! c; R
- * brief EDMA3 Test Application8 P9 D q; g1 z) h; \
- *
! M- S$ Z+ g+ _% C, X - * This file contains EDMA3 Test code.
$ U5 a m" H4 }0 y: w1 l# }9 k5 \/ X - *9 y$ |1 U. }! M! z! W
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
& D, x7 b0 D6 W4 H6 o( T - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 a4 ]* f- \" n p3 R
- * TO CHANGE.
) R3 y% p7 P$ U- L1 C - *9 a1 y3 o5 ]( @' I, M0 r/ w
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' `2 r* C. T& }- }* h! O
- *
% C! g) d, s# L8 f* V/ n$ ^% I3 ? - * This program is free software; you can redistribute it and/or
J5 e- B* A/ k' k0 x* X1 n5 } - * modify it under the terms of the GNU General Public License as
6 u8 Y) x. ?# i6 o - * published by the Free Software Foundation version 2.* s9 ~+ J! a; T6 V
- *
7 } ?6 n7 }9 V. x9 q# C - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
# R3 K1 `: ?4 C& }6 `3 A - * kind, whether express or implied; without even the implied warranty
7 p% L. q, e5 V$ Q& [ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the! e, e1 K. | V6 m
- * GNU General Public License for more details./ E6 r/ f* ? g0 G' `8 _: b$ E/ I
- */
6 s. {3 d6 d; k5 y7 S) }) L - 0 i( T j2 \ F$ h
- #include <linux/module.h>
6 x' _+ N, ]; G, R* Y$ x# f. p - #include <linux/init.h>
6 r; O- M. g \" y' g: P! ]5 { - #include <linux/errno.h>& V; R" i6 v9 N7 Q
- #include <linux/types.h>
$ D/ U* ?6 @7 d$ x$ t - #include <linux/interrupt.h>
- I# |, ~; h8 o) Z - #include <asm/io.h>
8 Z1 ~% ]% j9 u+ q - #include <linux/moduleparam.h>3 z, S/ C) d% |* L" \
- #include <linux/sysctl.h>7 g# J+ V- e( I5 C9 ?' ?0 v1 G
- #include <linux/mm.h># h% L" u% c c/ l0 x
- #include <linux/dma-mapping.h>
* u7 L6 M- }6 A- s3 H' ^
, O" H7 I; H3 F. ^8 u8 K- L& @5 o- y- #include <mach/memory.h>3 c" m& w+ `2 r7 q9 B9 I$ V6 k
- #include <mach/hardware.h>! f _- U8 c4 h4 j) j4 F
- #include <mach/irqs.h>
, z3 l, K5 ~, I1 _ - #include <asm/hardware/edma.h>8 W2 Q0 F/ c% U. J5 w# B
7 K9 I8 X+ w. t" n5 \4 T- #undef EDMA3_DEBUG
* A7 t9 L7 N9 j1 ?# l# K# n - /*#define EDMA3_DEBUG*/$ R9 S3 R/ G1 \: G/ \, e: D9 Z! K
$ s+ ^: e% E+ K. E- #ifdef EDMA3_DEBUG" s9 X2 q5 {- ]9 l
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
5 P F% J, ~( ] - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
* p' ?. J, G+ X - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
$ h- m7 w+ ?: Q8 E - #else$ m7 q/ l- N& r7 D9 j
- #define DMA_PRINTK( x... )
6 v/ k* a& Q' C; T - #define DMA_FN_IN
5 U7 [/ @3 I0 o+ C3 w - #define DMA_FN_OUT
) g4 J; ?5 l# \1 \+ z% H, R- e - #endif
1 B# m$ n: q% W) c
( T2 J( u0 M- f S- #define MAX_DMA_TRANSFER_IN_BYTES (32768)! p+ P$ u3 z% @: F
- #define STATIC_SHIFT 3
0 B1 q. ]3 \6 W- g, V5 O5 ? - #define TCINTEN_SHIFT 20. F" f+ O, t$ N4 A; m5 c) t* |! u
- #define ITCINTEN_SHIFT 21
* E1 g5 d# a+ t3 }# e1 l3 B1 z - #define TCCHEN_SHIFT 22
0 ^- G+ X. @: O- t& w - #define ITCCHEN_SHIFT 23
8 u/ ^9 U7 |- p# {: B$ ^ - 2 L* [* C3 I% z! o4 d- K( U
- static volatile int irqraised1 = 0;. j& H( m1 t8 c! G! G6 t
- static volatile int irqraised2 = 0;& A. `7 }5 {) k3 f' i3 N
- + M/ y: ?. z n6 P1 [3 h" |
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 D' y2 K Y# ~% R& F: E - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! ]3 r/ [9 o, D7 R - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ z1 i" c+ I+ P J
+ h; k, l7 [; V+ O$ k6 {! {- dma_addr_t dmaphyssrc1 = 0;
$ b* E0 s% t3 |" u4 ~6 d - dma_addr_t dmaphyssrc2 = 0;# D! S) H1 i n9 v9 N2 D
- dma_addr_t dmaphysdest1 = 0;1 v7 w' S M4 i
- dma_addr_t dmaphysdest2 = 0;
- J V$ P% O/ w9 ]: c8 j9 _
c- y/ |7 Y. _. b2 ^5 Y2 _/ B! Z% q- char *dmabufsrc1 = NULL;4 k) J' a: Y% N3 o6 U
- char *dmabufsrc2 = NULL;
$ k6 r. t) h' G- {; I- C - char *dmabufdest1 = NULL;
$ E5 f) {% W \4 G7 J - char *dmabufdest2 = NULL;8 _% P, U1 t# B7 f ?
- , C! J6 g+ _5 U- w. ?
- static int acnt = 512;
- N' x0 h. n8 u1 Q9 \$ e9 v: s - static int bcnt = 8;
8 E& _1 z- F% ?! \% | - static int ccnt = 8;
; O' ]6 i" Q+ p. G3 }7 F
; i$ `. l7 }5 ]8 M1 y2 ~- module_param(acnt, int, S_IRUGO);
, c, f) f! z8 N3 A5 k' q1 l - module_param(bcnt, int, S_IRUGO);
, Z2 ]; X" S$ \ - module_param(ccnt, int, S_IRUGO);
复制代码
2 w) `. N' R }+ _7 g9 S5 c8 Y- O2 m9 H0 w! C% Y4 A8 K
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! @- M" C! N rarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ A0 t; h( c. ?
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" N8 F+ X& I1 B6 o/ X( w
+ F! v0 E9 _; P& a+ o# L% P2 Q
# H! v" m/ e# H4 T* S |
|