|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- ?- X; f9 _% n7 u- [code]EDMA sample test application' n: y; N( p$ o" {; W
- /*- E% I" K4 v" _+ T" M6 F g F" Z
- * edma_test.c
0 }, A+ a. Y; d2 b8 C8 B+ L8 s - *
# D3 T4 F7 e. ?4 v9 M( r - * brief EDMA3 Test Application
: C# b S9 S- ^* l) V - * E2 {; F7 z/ g2 _
- * This file contains EDMA3 Test code.+ B3 X4 ?8 g& I. Z
- *! \ l3 i+ ^0 r M
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 B2 z2 D0 q8 D+ i' H+ t+ `
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 O) t! Q7 M" h8 l; ]" N/ G
- * TO CHANGE.6 p8 c9 v2 M* w* Q) _
- *
j! Z1 Q. ]1 b5 G - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
$ T0 E& q5 l- [1 z: [$ E - *
2 X/ {5 @, R: f - * This program is free software; you can redistribute it and/or) s+ |/ O$ k9 {
- * modify it under the terms of the GNU General Public License as( D7 A* y- W; h
- * published by the Free Software Foundation version 2." O# y) `) S& }: V8 g
- *; d5 Z, j! ~# z9 P6 J
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ x* W5 p* b3 J
- * kind, whether express or implied; without even the implied warranty( ~- C5 p: @: H, f' P( Q8 }
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6 v* U. X u' y- t, ]) ~ - * GNU General Public License for more details.
1 L& L; @# s! N( }' J - */
7 G y* k$ o' i) z! G0 ^ - 3 m" Q) L% H7 I: ^1 c% n4 r6 `% F
- #include <linux/module.h>
6 v& b) t2 F9 p' {1 H; O Q* M, x - #include <linux/init.h>
" W O' [. l) S$ g# l - #include <linux/errno.h>
# ?1 A3 Y6 l& Q4 f# M - #include <linux/types.h>
+ Z2 D7 R+ c4 Q3 k3 W% | - #include <linux/interrupt.h>/ X( U; k6 I7 d6 V z, X2 p+ ^
- #include <asm/io.h>
/ W8 H. Z! V) I7 W - #include <linux/moduleparam.h>* b9 P- C2 m0 L) ?$ k# F, h
- #include <linux/sysctl.h>
% I; G1 A, P8 J( }: r1 Q - #include <linux/mm.h>
, M6 t' a }, i+ s2 G; o - #include <linux/dma-mapping.h>
7 @' U9 J: ^# n8 M6 C5 s+ `
* i/ Z! n' M5 m- H: O7 w; G- #include <mach/memory.h>
1 `- o+ e3 O7 L: |7 a+ s - #include <mach/hardware.h>- j. f7 Z' _5 `: ?* a A
- #include <mach/irqs.h>0 s+ l. L! W& `- ~, A. W9 w+ K
- #include <asm/hardware/edma.h>2 h* r" T2 [1 M1 H1 Q. X2 `2 H
; j8 a" d Y( b+ `' u- #undef EDMA3_DEBUG7 Y1 I6 @, C+ }2 e! H5 W
- /*#define EDMA3_DEBUG*/5 y# @. [% o7 X- @9 {
, e; J) f* R" F5 g! S- #ifdef EDMA3_DEBUG
9 ^6 | T: \; o3 x. y. ? - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
6 i* X8 n+ v- p$ Z c6 D - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 ^5 [. t( I3 h; {, Q
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
. D" q0 K( P+ q - #else
2 U3 Y. _" D- p' `& Y - #define DMA_PRINTK( x... )
4 c: c" x0 ]) Z K3 r - #define DMA_FN_IN3 p6 B, \0 @5 C
- #define DMA_FN_OUT: V. |* y) ]: g; L- x
- #endif
( E8 f3 a6 Q( G) N6 [ - / }$ S& n- H! Z! e7 b& i
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)1 |: L8 P6 N6 F& e, U
- #define STATIC_SHIFT 3
% n9 Q |) l3 r2 h N/ _ - #define TCINTEN_SHIFT 20
9 \# X1 }1 ?+ X - #define ITCINTEN_SHIFT 21
5 ?% c! x- }# {2 Z - #define TCCHEN_SHIFT 22
! N* W2 F: k* y0 E - #define ITCCHEN_SHIFT 23% T B# M% N- a; `# H4 W, E5 T3 Z
- : @" a9 J# K- d9 _+ `' |* c& G1 x% D
- static volatile int irqraised1 = 0;
9 j/ G. G; y& X4 s5 r - static volatile int irqraised2 = 0;5 C7 C6 i* M7 ]2 _, @
- - q5 R) M2 x6 x# f" R6 h
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ i* c; ^, P8 w - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); e: G, k2 K5 y
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( P$ P7 f2 K& n* \/ p: ~# U - 6 ?8 ^$ q( s% @- z5 \2 ^0 ^ {
- dma_addr_t dmaphyssrc1 = 0;/ ?$ t: }) t. R7 j8 ]- A9 I8 C5 e
- dma_addr_t dmaphyssrc2 = 0;5 B) B; m5 F/ |& p4 q
- dma_addr_t dmaphysdest1 = 0;# p" l6 U% n! X; I6 B& |) ~& F
- dma_addr_t dmaphysdest2 = 0;9 r0 G, k/ O. s: {1 }
8 C: C% [3 B& B0 I/ d- char *dmabufsrc1 = NULL;. l3 r) j; L1 b0 W. v
- char *dmabufsrc2 = NULL;
" l9 h" l- |' M% d" X4 N. Z* G- H3 c - char *dmabufdest1 = NULL;' L: f& [) k7 y0 b
- char *dmabufdest2 = NULL;4 r' y/ M( n9 M5 a9 T* w0 }* U6 D
- v1 }) q& O. i" k) j
- static int acnt = 512;" C2 G8 t4 I' n {" i+ g) \. x3 L
- static int bcnt = 8;
$ z1 [6 y8 J2 Y5 B" Y' J - static int ccnt = 8;
; R1 _! j$ Q0 o$ Q: x5 } U* u - `8 u3 X0 u; \; Y, ^$ n
- module_param(acnt, int, S_IRUGO);
# @. ?& ]4 F" ^! E - module_param(bcnt, int, S_IRUGO);, X7 @9 m% g: P- V
- module_param(ccnt, int, S_IRUGO);
复制代码
+ H& f1 z' \' D) F2 U% z0 x: l9 b1 Q' V& k, ^, G
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 V# v3 S& |; @( v( d1 O1 varm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: y" ^6 _( ^! T! W% `0 h4 s! ^8 o 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 j0 K2 h/ T/ I2 s) T0 P; A! b J' b) s1 ^+ I! `0 |8 B
$ J1 k4 |% V# I/ ^: Q; X. E |
|