|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 _" `. O: S2 V8 _: m) c1 q- [code]EDMA sample test application/ U) t$ m( R3 l9 a
- /*5 C6 E1 }6 q' l: s; t% T0 B% R
- * edma_test.c1 u9 q9 c% L& E7 O8 s. S8 F7 L
- *, R7 g- z; D, z: E
- * brief EDMA3 Test Application
4 p- A6 X1 J' p+ d - ** r+ w5 n# N; M3 l
- * This file contains EDMA3 Test code.& ~( L& {* y! \% p& f& d8 E
- *1 D; y3 V2 \2 d( f8 L/ Z# i
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
4 e% H7 e) J3 J. @ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
- j& D6 |( q8 M6 x% ?# E" k& f - * TO CHANGE." i* H2 K" e* ~ }9 |
- *
) v, X, m# J2 j0 J g Z4 `( |+ k! r - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
7 X4 [: `6 w: l" P$ Q }6 v - *' T: t6 j+ A+ X0 O; @* @6 n& B
- * This program is free software; you can redistribute it and/or
7 K& O" F/ ~- \% @1 p2 H - * modify it under the terms of the GNU General Public License as7 s/ [' e" P) ^. Y3 ~) R
- * published by the Free Software Foundation version 2.
0 J8 j2 c( o! E+ i1 T - *# D } Y4 y* u9 x5 }' L; a0 n9 i
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
! X2 k/ I. P4 b5 s n( o7 h - * kind, whether express or implied; without even the implied warranty
7 B' P! Y6 _3 P& @ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
" E( {1 k0 \1 [) L/ z; c- i+ {8 m - * GNU General Public License for more details.
$ G- u/ F" Z. r U- M/ ]4 i - */
$ M0 k) f' ^7 z; Y5 ~7 l, O1 c
$ z: i1 Y& c6 |4 P/ }- #include <linux/module.h>) k1 J6 Y. q# s5 F& k
- #include <linux/init.h>. {, m0 o6 M- }) s1 T( R
- #include <linux/errno.h>$ e) f% B* U/ Z! ~2 w
- #include <linux/types.h>
: }: x4 g) J, _6 g( i - #include <linux/interrupt.h>
9 } C& R( L0 j! _# d - #include <asm/io.h>
M0 H, L7 ]- J: o! N - #include <linux/moduleparam.h># k/ ]+ `2 E' C: Y/ W$ j
- #include <linux/sysctl.h>+ P7 r; l$ k9 ]! b/ y, S- V; n4 n/ {
- #include <linux/mm.h>" u4 U# `& I. C3 z m& R
- #include <linux/dma-mapping.h>
) P% x% s0 A N% Y; z
6 F7 w& v! f4 M$ ~( F# a- #include <mach/memory.h>
' ^1 l1 m! Q/ f: _( R t$ x - #include <mach/hardware.h>/ s- P1 I! _1 k _2 r5 h/ b. t
- #include <mach/irqs.h>
/ P# {" q5 [/ i+ Q - #include <asm/hardware/edma.h>( M3 n4 o5 X. h9 ]- B8 |: x
- 4 q8 N$ R S3 F/ ]6 E( L0 h2 U
- #undef EDMA3_DEBUG
/ E9 c8 Z9 H/ w2 F1 X [3 g- j* b - /*#define EDMA3_DEBUG*/( e' s5 @8 }/ \4 C. D" _+ g! v
# M. }& N/ G( Y- #ifdef EDMA3_DEBUG
6 n3 O0 S8 g4 _# n4 s - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); v; N, D1 _. @3 |5 L9 W
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
7 Y4 u9 u0 c# O; @0 p! x! q9 ` - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# Y8 z- i/ {8 S. F0 e( C
- #else
6 n; V. m/ j% }0 W! T K+ e - #define DMA_PRINTK( x... )* G+ u8 ~. {/ Q2 j/ |" R
- #define DMA_FN_IN
8 _7 _* i& {3 X9 I( e5 B% I9 j' [* T7 k - #define DMA_FN_OUT" |6 P0 H) I8 W
- #endif
# ^5 C* U2 t' A0 {2 @7 m! w
* P/ c! V: _: @6 f' M- #define MAX_DMA_TRANSFER_IN_BYTES (32768)8 j1 W1 n [5 M5 b7 R) J; z( Y1 m
- #define STATIC_SHIFT 3& a1 V) B6 ?, ?+ P
- #define TCINTEN_SHIFT 20
! ?: n: u3 F3 y. U& z - #define ITCINTEN_SHIFT 21( N& e; x _& [& |: ]1 p9 U1 A
- #define TCCHEN_SHIFT 22
4 _" _. Q! p# }' d& @3 `% M3 g - #define ITCCHEN_SHIFT 235 ?6 j' U C$ X, H' V! b
9 ?0 o* P/ p* U" \* g9 X( G) K, a- f- static volatile int irqraised1 = 0;+ [* _$ Q; N& |0 o$ S
- static volatile int irqraised2 = 0;- v- l6 R7 F' M. I" S( r
- % {* h: h) f5 X* u( q
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% o7 d. `' d1 E8 G+ l - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ ^2 O. d% e0 z
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 d- s7 F; [1 h& q9 Y
1 G* I, n+ ^) e1 Q/ f- N- dma_addr_t dmaphyssrc1 = 0;
! }, `7 t( ~$ Z - dma_addr_t dmaphyssrc2 = 0;
' n: G% E B$ L" L* a1 ~' ]0 T- x1 Z - dma_addr_t dmaphysdest1 = 0;5 e' W0 A, e% K3 I9 k5 F8 P
- dma_addr_t dmaphysdest2 = 0;! X! D& P: @0 Q+ c/ r
- 8 p) q4 s7 P r) q& R9 \1 C
- char *dmabufsrc1 = NULL;* O4 n& T: V$ {7 c* A- U0 f
- char *dmabufsrc2 = NULL;& ~5 ^) w) [: `* R9 W
- char *dmabufdest1 = NULL;7 k( K+ G- m! j4 k U
- char *dmabufdest2 = NULL;# S; F/ [5 B2 T# H( l0 ]. J
- 7 b) W, g6 m0 U, T4 I
- static int acnt = 512;3 o" l6 \8 N" ~9 l2 K5 G0 C
- static int bcnt = 8;
+ A$ g) r: ], y9 k, y; d* } - static int ccnt = 8;
2 ^6 w: z8 |1 s
7 o8 P" {1 d% p' h5 c& g/ X; h- module_param(acnt, int, S_IRUGO);6 j* @. c7 f! h8 W2 X
- module_param(bcnt, int, S_IRUGO);2 L9 S9 n8 g: h% J* z. a4 }
- module_param(ccnt, int, S_IRUGO);
复制代码 5 J8 t; i4 |* @" g- J1 q J! S
; U8 |) x2 E" i# p- g% v
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
Z: P* S& u7 F% k: ?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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) }4 C" L5 x5 Y
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 f/ r; q) L! R5 \. V
# H; W0 t$ D8 _1 E
; n; l2 f# j) H0 O, B( E
|
|