|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 ?4 ?; K- C0 I0 t- [code]EDMA sample test application
$ m4 P, {. d+ J* _: z1 x - /*+ F3 t$ ^7 |8 S# i B
- * edma_test.c
1 j' C) ]; D, Q4 ^; L# L+ ^ - *
. T. r1 Z- J6 ~( N4 z - * brief EDMA3 Test Application0 U$ ~. R2 o9 P, S% J
- *
' C1 d, h0 ?3 C0 i1 y+ J - * This file contains EDMA3 Test code.; a j+ N2 v! m" {
- *
5 f) t [+ @4 Y1 V5 ~, a6 o - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 c3 W- t) B4 @# M
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" A& d, E2 B# T
- * TO CHANGE.$ s% w: Y9 P( ~1 c; J4 m6 u
- *
8 Q. G, g. r: M+ S0 S - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
) d+ C+ n. b$ D# @5 B3 i - *
% Y7 B! Y/ C1 J: N- b - * This program is free software; you can redistribute it and/or6 E9 \% t) E, n
- * modify it under the terms of the GNU General Public License as# }! z: D+ z: @
- * published by the Free Software Foundation version 2.; Y0 O! y0 F) t6 `
- *, t5 _# Y% j2 C9 f
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any! m0 s! Z( x/ U' U- \0 k0 {3 k2 q
- * kind, whether express or implied; without even the implied warranty
& Q' G/ O7 e3 m { - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
) m6 b; m& I7 R - * GNU General Public License for more details.
+ a2 d0 v' c+ l0 y( ? - */# E! ^: _) n/ x
7 H0 P* U; p+ ^; T+ ?8 m- #include <linux/module.h>
9 b' U) F1 M! C0 y - #include <linux/init.h>, S2 r4 e. M+ c2 {/ Z# x$ N2 I
- #include <linux/errno.h>
3 ~( |: H& J% {1 s2 T2 F7 D, B - #include <linux/types.h>
5 n) V, J8 B v; i3 M+ Y - #include <linux/interrupt.h>* m. m% W. W8 l2 ^
- #include <asm/io.h># v/ Z5 U% m2 F5 j* h* s1 k+ y
- #include <linux/moduleparam.h>/ r+ F& v4 m0 J7 f: J8 {+ `4 q
- #include <linux/sysctl.h>
0 t s6 |, l/ @* ~$ n - #include <linux/mm.h>- {% ^. @+ @8 g# w# V8 F F1 j* x O
- #include <linux/dma-mapping.h>! W4 ]. I5 x9 c* D
X2 V1 a1 y; _4 Q# d3 g: L- #include <mach/memory.h>. v0 d. I2 }/ k) k2 I* `; M
- #include <mach/hardware.h>$ y& V- r+ Q {; t) n3 X. K5 b
- #include <mach/irqs.h>
/ E9 f3 b; n$ A# w, A8 A, _6 a/ } - #include <asm/hardware/edma.h>8 G( z" U3 W; E) U
- ; p" T4 b5 T! }$ q3 E) A6 e6 l
- #undef EDMA3_DEBUG4 C# S' Q0 H$ t
- /*#define EDMA3_DEBUG*/
2 k7 k( H& [6 K' e/ H& A
( c) v! t( h! l2 T. X2 r- #ifdef EDMA3_DEBUG" J+ d# y+ P; @2 z
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
/ T$ q4 ]' Y' a5 @2 C& m5 w - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): x: f, Q- f: @+ N- }8 b% H
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' [# E2 [0 H# p7 }, O" _, G
- #else: K; l3 b% d9 K2 P% p% i
- #define DMA_PRINTK( x... )1 k5 F0 I) b, T5 s6 S. n
- #define DMA_FN_IN3 _$ K! l3 F Z7 e4 _6 O. Q( m
- #define DMA_FN_OUT" A# Q: {1 O _
- #endif/ i# f2 o2 |0 a, a) T4 ^# H3 U/ K, d
8 c+ U" R0 L; r5 K- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
. j6 d. k& J" N7 E - #define STATIC_SHIFT 3
3 r2 ?' ?9 w! X; x3 F4 y0 m" j; j - #define TCINTEN_SHIFT 20
. Z6 w( N( w& g7 `5 A - #define ITCINTEN_SHIFT 21: U$ @2 p2 z5 x: s% E' M3 n
- #define TCCHEN_SHIFT 22
5 l5 O {* y6 P; @' Y - #define ITCCHEN_SHIFT 237 P$ V1 {" F, U9 l( J
7 O4 F# F1 v( Z; M. Z. c- static volatile int irqraised1 = 0;
( H- v$ j# B) u( V. s$ M- R7 m! `" ^ - static volatile int irqraised2 = 0;
- H: t' l* A; Q6 ^( I0 `7 h - : M3 f: N% T3 y5 E$ |9 L7 [, a
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ C# m) H0 N C: J. h- z0 n) f" c
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 |- m/ @& O" u
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% f% q+ a3 J* t' t% w - + }! X7 e: {" {9 A# X) \1 n
- dma_addr_t dmaphyssrc1 = 0;- t" O/ k9 T5 \" \0 v
- dma_addr_t dmaphyssrc2 = 0;
) C" z% r( j; g- l# {, Y - dma_addr_t dmaphysdest1 = 0;* N& x( ^7 {# ~! G. X9 ~+ j
- dma_addr_t dmaphysdest2 = 0;# E! T8 Y9 \+ g
- 2 I; |' H5 U: A+ F6 v
- char *dmabufsrc1 = NULL;
; p- k0 Y$ ^5 Q' \: {% i - char *dmabufsrc2 = NULL;( c$ [6 p2 V1 M, i; ^7 @
- char *dmabufdest1 = NULL;
. m" u1 @9 T, T, Y' Q - char *dmabufdest2 = NULL;8 v; _, G. U8 c
]2 J% b" n' l6 q/ j# H) k- static int acnt = 512;
( z8 Z9 W' L) U; ~- U1 r9 n- s/ j - static int bcnt = 8;
6 h( r9 V; X" |9 j- ]8 `0 U - static int ccnt = 8;
8 I7 F z+ [ t& [! m - X7 L7 N$ r) I' @. r* z
- module_param(acnt, int, S_IRUGO);6 b2 L. e/ j% E
- module_param(bcnt, int, S_IRUGO);
! @1 o5 e2 k# C: _; @ - module_param(ccnt, int, S_IRUGO);
复制代码
' O: F. S3 T) d9 M: e I# j) Q; F3 O5 H6 O& S1 F8 x7 W; M- d# G
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 s1 {8 _$ `- S. f5 `$ @
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' U3 ` d9 r1 D% R2 q7 [
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 w) J7 T6 y7 N6 A6 d% Q6 V6 v
5 n) |& u2 P1 y. l' P& y2 j3 t/ x4 K3 y
|
|