|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ m K% `& j! a) b& q# O3 z3 e$ v- [code]EDMA sample test application* b, k7 m4 |: F% q
- /*
* Q6 ]/ Y/ b3 V) ]* [2 f+ I - * edma_test.c
+ p! U3 C2 E3 D! @: Z8 W+ p - *8 T4 V4 s$ t6 ^. c% z) v! ?* B
- * brief EDMA3 Test Application
" w3 v9 F/ t# t& u U$ I - *
+ @6 V S" q' v( s - * This file contains EDMA3 Test code.- @ h1 g7 d( ^
- *
) q' ~" ~1 T" D- O/ n4 W - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) u Y- _# ^' _' M7 R9 E
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
4 g6 y* i5 c- d5 m8 L - * TO CHANGE.
' f0 j% g* f1 e! Z0 w2 Y% S- A! d - *- W5 F0 Q# [( ?* s# [0 }
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 b l8 ^# D6 N, g; [8 P
- *
2 F0 y0 ]2 T# R - * This program is free software; you can redistribute it and/or0 }: q$ \8 ~' ?
- * modify it under the terms of the GNU General Public License as
7 p5 Y0 U/ J& C7 {' Q - * published by the Free Software Foundation version 2.
" r. \# n6 M) G; _' d! @ - *0 ]2 ?* t k6 y( O
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
2 U* l- E6 y- d( G1 s3 x - * kind, whether express or implied; without even the implied warranty
" r/ c6 J" B% g0 N - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% w$ p. D2 U5 j$ O! s - * GNU General Public License for more details.3 o0 ]7 l; o' j4 {2 b2 I! f
- */
. J8 y2 H$ F) Z, m6 d - / a+ {+ ?% E n2 ]: M% C: q( j
- #include <linux/module.h>
7 Q% ?( a% d& M4 G - #include <linux/init.h>
. f9 r5 v, ~( F7 w - #include <linux/errno.h>; L: C! J! B7 d8 f: r0 F5 }6 M
- #include <linux/types.h>& y5 u6 H5 r% `% D% ?
- #include <linux/interrupt.h>0 u8 A" W: z" x5 q; x
- #include <asm/io.h>0 T. l3 X/ q8 m* k1 R! b6 W8 c B
- #include <linux/moduleparam.h>
5 g6 @3 F! Z5 i% H- o+ O - #include <linux/sysctl.h>/ c& [, d6 n* f, i
- #include <linux/mm.h>( k$ @% J* e. P
- #include <linux/dma-mapping.h>" h3 m6 p) ^! L. Q# t" D1 ?4 _ F" c
: d. r; w2 V+ m8 P* E; E7 a- #include <mach/memory.h>
/ V9 h* C% t! c/ \+ F0 D4 a - #include <mach/hardware.h>
5 {: [- ^& `0 `9 r' w - #include <mach/irqs.h>' G, W/ L0 ~7 J. s Z% N
- #include <asm/hardware/edma.h>5 m6 ~/ @' c) o0 K C
- 5 P4 F- Q$ Y _: K% B
- #undef EDMA3_DEBUG
# U' _, ~! c5 V - /*#define EDMA3_DEBUG*/; C1 [/ j' y$ o! U7 R4 j8 H7 K6 }
- % P) E f- S# P9 X- ?+ R
- #ifdef EDMA3_DEBUG
$ M m$ H, C5 y1 ^, @5 u - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 V! g& z1 ~6 b) s" E0 g
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
1 A4 T8 i& U# Q9 d3 z4 V$ j# d - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 G5 D2 ]- F4 }8 ^
- #else9 n% _" m3 @0 S$ m7 e1 Q+ s7 Q
- #define DMA_PRINTK( x... )
3 C% Q8 a5 W4 _ - #define DMA_FN_IN
2 w. e( u. p7 k# D! U0 Q9 D - #define DMA_FN_OUT) ]& ^9 K. J# I) d
- #endif
! Q4 S8 e2 y' {0 ~' P9 \8 [ - V, [9 q. F. W$ B$ n6 P# i2 H) b
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)5 ^5 H: A$ T. s" e4 M' r
- #define STATIC_SHIFT 3
8 Q7 {! `/ ~9 s# I/ b - #define TCINTEN_SHIFT 20. x4 g3 _8 l8 r: b! ?% L& {
- #define ITCINTEN_SHIFT 213 c5 ^4 G( y+ K: X7 u
- #define TCCHEN_SHIFT 22
1 g' ~% w- J/ H! j - #define ITCCHEN_SHIFT 23
. T! _2 k, u. l( y2 U! A0 N
Y7 `* i& {2 U1 {* Y% p- static volatile int irqraised1 = 0;
$ _* ?: n- B4 q; i" w - static volatile int irqraised2 = 0;3 p* Q4 T. [% p& u* I( ~. I. a4 @
- Y R5 a: a% e3 k% u2 K& G- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" M3 ]* v9 A' O9 t - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 Z% g6 n9 F8 H, z7 u* z; A - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 `2 g5 R) H: o, t, {0 i# _5 d5 L; @& x
- % q9 R5 Q) e# ^. D7 P
- dma_addr_t dmaphyssrc1 = 0;$ A$ e' E2 N- H- F6 n' n: V
- dma_addr_t dmaphyssrc2 = 0;! g, P* W0 B0 `- w7 P3 k# w9 {! a
- dma_addr_t dmaphysdest1 = 0;( e G8 g8 r0 ?! r# a0 M
- dma_addr_t dmaphysdest2 = 0;$ ~0 \; @0 H% v# x( w8 t- o
- : k8 Z) O4 n% Q( z
- char *dmabufsrc1 = NULL;
$ M7 {, R6 |! f1 x& z - char *dmabufsrc2 = NULL;
5 f# S" G/ E `% h# S b2 o2 R - char *dmabufdest1 = NULL;
$ j" \ O+ `% a, C) A - char *dmabufdest2 = NULL;$ L5 ?; b$ |' x8 L& X8 ?' e) c
- ! y _& `, g$ C5 j' J
- static int acnt = 512;
3 ?5 X, C9 n/ r3 } - static int bcnt = 8;9 P# S3 i2 K. J
- static int ccnt = 8;
N0 f2 \, B- m% @
5 n3 C7 E( S `3 a& {- module_param(acnt, int, S_IRUGO);) t( R, ]" s7 q. L6 g" J4 h
- module_param(bcnt, int, S_IRUGO);
# n P2 V) F2 U: c1 u! g - module_param(ccnt, int, S_IRUGO);
复制代码 r1 Q1 n0 E9 X* _9 S& v! T
2 U9 i: d8 A4 W+ e
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, E/ U" r5 n8 ~) h+ ^$ b2 w- }
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 B5 S* `- N9 [( L 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- l" p0 c$ W$ @2 v1 F- n( _5 q6 W9 [
& N4 [# F: W( F; V
7 s3 A) I5 E6 U/ D( X |
|