|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* |" Z, }. X9 K6 o8 n0 t- [code]EDMA sample test application/ w5 _$ p$ l8 q" c; ]2 K. ^8 m
- /*
1 R3 P; x/ p( F; N, b - * edma_test.c
- w0 w) u; h4 X" U - *
9 v8 S3 [2 I7 h; f% u- c2 z - * brief EDMA3 Test Application
1 N& m* c1 l1 a; e7 }+ @$ \" `' Y - *! u- R: u9 r" ~& E$ q1 }
- * This file contains EDMA3 Test code.
9 c* V, `! \" N- l" Z - *# k& g$ e6 a( g& ?: [
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
' e4 d8 b2 C$ A/ v - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
# ~7 D/ r" H$ T$ U - * TO CHANGE.
9 ~' S2 }' W* j! ]5 A7 O - *
& M8 x$ [* N5 r3 L, k2 j - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
. ]$ K6 d% X/ h; M - *0 C. [9 N; c4 l! T* K
- * This program is free software; you can redistribute it and/or
8 P9 P$ |9 K' B% W. ~0 m - * modify it under the terms of the GNU General Public License as
& C# W1 R! ?! y - * published by the Free Software Foundation version 2.
% t- p2 ^5 x0 X1 H! { m( q - *
, M. |# f) n3 w - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
3 w3 Z& T" C* v& r: d$ n% f - * kind, whether express or implied; without even the implied warranty
8 Y W! H0 |: c4 \4 s7 G! a - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% v; _6 F) x3 N( A c - * GNU General Public License for more details.
) p* U% n2 s- [2 e - */
# [+ E4 L: H8 R: t0 O+ J( g - ( ?- H; E% S6 O, r$ C) r _5 H0 v
- #include <linux/module.h>
I9 G- T% ?0 {6 O4 C$ S - #include <linux/init.h>
& v: ~/ p o0 u1 y/ B/ | - #include <linux/errno.h>
d0 m; n. v0 o3 x! `/ c& [* `+ R - #include <linux/types.h>9 ?3 j: I" j6 t8 U8 e0 b, w' M4 ^
- #include <linux/interrupt.h>
8 q- \4 N/ \7 |3 }0 Z7 R8 T9 M - #include <asm/io.h>
; A I: @8 b6 X - #include <linux/moduleparam.h>
) D& g3 W1 N% t, {2 L - #include <linux/sysctl.h># d1 O$ [3 M, Z: ^- E7 d, F4 F
- #include <linux/mm.h>5 N. F) b9 `# S: A
- #include <linux/dma-mapping.h>
$ [: A* {( j3 i7 ?' J# D" ]3 t - 0 k& D! n i/ @/ |; h
- #include <mach/memory.h>
: {6 {. x8 Y/ A( e! m - #include <mach/hardware.h>
5 A/ Z) H+ |- l2 A+ W - #include <mach/irqs.h>6 j# ]9 v3 M: m& Y
- #include <asm/hardware/edma.h>
0 C- Q4 J; W" A. C - - H" @6 m! j# e, p' [4 b
- #undef EDMA3_DEBUG
. G: p2 q# Z2 K! [8 l* j+ J n+ R - /*#define EDMA3_DEBUG*/1 {/ Q, V" X- B& W
- ( d, g' W1 F& n0 f
- #ifdef EDMA3_DEBUG0 X: V# E( Q: v
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
1 m. _9 c, p! @) M, ` - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
9 u- ?, b$ a) {( N5 _ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
" u: A5 A4 @+ n - #else
# A( K( k$ i, K6 J4 S2 L - #define DMA_PRINTK( x... ). h/ h7 @1 ~, U! T" U4 K
- #define DMA_FN_IN
3 n3 Q6 ]% c% j0 X# g: { - #define DMA_FN_OUT* E# h h1 \% F7 V3 j
- #endif
5 E) a) ^: _, d( |5 s
& h' z) A7 m& n* H+ X$ S8 }. X1 j% r3 w- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
D7 x# B* F- Y; A - #define STATIC_SHIFT 3/ o; a1 L& f9 O9 K' p
- #define TCINTEN_SHIFT 20+ u% D: s' e7 y: _, k& V9 I N& d/ T0 k
- #define ITCINTEN_SHIFT 21( C3 z. {# F7 h: }# W
- #define TCCHEN_SHIFT 22
/ S1 M3 `8 f) g. ]9 y - #define ITCCHEN_SHIFT 23
5 n B. ?( N; O; } - 7 o' P/ q/ P- l" Y
- static volatile int irqraised1 = 0;3 t! g/ [& A# @, A% q
- static volatile int irqraised2 = 0;5 \1 Q3 S: e. q% T
- ! X7 o0 }0 A3 N2 J. |
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- f0 F0 ~: q2 Y8 F& F# B# c/ C
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 t* B2 ~3 J) k9 E( F$ Z" `5 r0 |
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: D3 E2 _$ }4 e8 j( m
- 5 X. s) a. l; ^5 T3 }6 K- {. }
- dma_addr_t dmaphyssrc1 = 0;( [$ R- }0 L" i
- dma_addr_t dmaphyssrc2 = 0;
9 Q- ` @* }. n, `! o* G, ? - dma_addr_t dmaphysdest1 = 0;
# z5 V$ X' u8 s; h% L! Z - dma_addr_t dmaphysdest2 = 0;) |2 }/ t* Q h2 V/ L
8 D0 F- V* M* v/ w. f3 _0 V- char *dmabufsrc1 = NULL;! S x' L7 w" u& N6 E/ o8 w
- char *dmabufsrc2 = NULL;4 l d- {" `! g/ |( h' X
- char *dmabufdest1 = NULL;
* V3 O0 i+ b/ s - char *dmabufdest2 = NULL;% k& b9 f' z$ b: B$ c# F
( R3 M) N! T% c6 `1 ^3 q- static int acnt = 512;
2 M7 G& ~6 X# _1 d, C1 U9 K- { L - static int bcnt = 8;
m& k- o" q& h7 q - static int ccnt = 8;
# D1 E$ k/ K8 ]7 k, V7 h. g! [ - . q4 R' R8 @4 y% ]1 M2 n
- module_param(acnt, int, S_IRUGO);6 e6 @: B3 l5 U. Y& |- D' h5 v- O
- module_param(bcnt, int, S_IRUGO);: l7 T7 E0 n6 t X
- module_param(ccnt, int, S_IRUGO);
复制代码
1 {; U. w+ _0 G+ [7 M, U
6 H0 r% ^0 F# N2 S: R 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 R5 C/ T( J! c' q& ]; ]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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 V7 }5 ^3 N! E/ k0 S 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。 F7 m8 w8 x# V; l) n0 |
& i* `- D# m0 T
1 ] }* ^. U9 L m5 f |
|