|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ s3 M8 Q9 @4 a% A0 ~- [code]EDMA sample test application4 C4 p2 C- q, X+ L* V1 n* L
- /*
* y- _2 o0 q7 H- M - * edma_test.c9 X4 T6 j: r) I/ \* C& J7 {
- *
( B2 g: z5 U7 q - * brief EDMA3 Test Application o h7 ^" M/ ?
- *" r2 n2 c+ O; U% z
- * This file contains EDMA3 Test code.
, @1 i& p6 B6 ]1 A$ w+ ?' q - *- s% J- u. U* [( E
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
5 h0 W; @8 w/ r! z! V% q - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
* f$ Q1 r9 O4 W" z1 p - * TO CHANGE.
+ M/ m; K% }: s- r. I9 b0 R - *) G# Z* P: t0 g9 K! x* T
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 |0 l! Q1 B% _0 A( ]3 `9 o7 |+ I
- *9 p4 s& B8 ^0 ^. }$ C
- * This program is free software; you can redistribute it and/or$ K( E1 {1 M0 j2 r4 j& ]
- * modify it under the terms of the GNU General Public License as* v5 h6 u5 ^4 d" o0 @1 Q
- * published by the Free Software Foundation version 2." |+ S0 ^/ }' U4 ~5 @7 e
- *. c# H# N3 z& y% U1 V+ K
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
. D/ j7 H U8 V$ j- ^7 |7 H - * kind, whether express or implied; without even the implied warranty
& W9 w+ V/ q8 R6 k3 k - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7 j! ?4 U% V0 @" H ^, A" H" D* O' l - * GNU General Public License for more details.9 b' r* n2 @/ ?) X% m
- */
+ e j( z7 a& L# N' m O0 N - ' n6 W9 E5 |0 u. \
- #include <linux/module.h>
3 e( |: n& l6 m3 V! v3 b5 H4 c/ x - #include <linux/init.h>
c! j' y' y! Q - #include <linux/errno.h>, D( M, Q# z" k& i; N5 Z1 ^2 z6 Y3 N
- #include <linux/types.h>
3 P. V# j2 o: V; s; L - #include <linux/interrupt.h>
4 ]6 Z5 r0 I- K c - #include <asm/io.h>, n& r8 `9 V. U. `) O/ F+ |/ x
- #include <linux/moduleparam.h>; T/ Y. R% ~! w) |6 u- i' e2 J
- #include <linux/sysctl.h>
6 Y; q, i: A- }% m+ D+ }. b - #include <linux/mm.h>
# I7 s1 |, F+ y - #include <linux/dma-mapping.h>
9 @9 ^) ~ x" j - ! S2 e+ p# E \7 Y1 e5 x+ y% \% q
- #include <mach/memory.h>
6 B' R8 T: N7 O& Z R: z - #include <mach/hardware.h>
1 L: m0 s$ e! g& H6 ]" g - #include <mach/irqs.h>) l, H1 y/ D5 F( ^9 @' i( H
- #include <asm/hardware/edma.h>& G( @# y4 U n9 j- f
5 _' S' E* k0 @ H, w6 F* L* s( X3 a- #undef EDMA3_DEBUG
% M; a# I& s) A9 h& K) k# h: \ - /*#define EDMA3_DEBUG*/
; H5 ^' [+ G, D3 ~8 j" l
( G' r0 j& e- T9 M- #ifdef EDMA3_DEBUG
. H: t- |3 X* \3 ^5 I! g4 h$ b - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) }/ C5 C0 `0 \9 y0 ~2 s4 g
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
* \3 {) j; T$ D, Z2 ^ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
; E+ X9 B* p$ f+ k3 D - #else
! b+ c% m* { ^. y7 ]% C. s - #define DMA_PRINTK( x... )
4 k0 u# ^* ^- e# h - #define DMA_FN_IN
6 C2 U2 p# g5 N4 w, D6 c' V - #define DMA_FN_OUT
}! `2 L5 {) z: X' ^5 C - #endif
. \& \' E4 N7 K" \ - & ]! f7 |: ? r& A7 n
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)3 C# \: r6 Q l5 O- v
- #define STATIC_SHIFT 3
3 Z# x+ |6 L0 o4 q - #define TCINTEN_SHIFT 20
6 t+ L2 h" Z% p - #define ITCINTEN_SHIFT 21
* m( t. ~1 C; `. | - #define TCCHEN_SHIFT 227 V" U( S5 `6 Q
- #define ITCCHEN_SHIFT 23. ~+ H. Q+ p# b$ u* S0 z g
- j9 T' ?* G; D! T- ^. f/ P- static volatile int irqraised1 = 0;
- B" Y) L: _* u5 c- ~& Q! @! i - static volatile int irqraised2 = 0;6 Y. \' E" b# E
# G& P: S& [' V# p& p) \1 n% ~- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ N2 N6 x+ {) E5 d/ A4 C& T+ h - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 [& L, l N! O: ^, B - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 Q& { b! t& p& _; C. T6 c+ N6 r
* M! ^6 e( {0 S+ u, Y' H( n- dma_addr_t dmaphyssrc1 = 0;
7 O9 L( J5 w: I) N - dma_addr_t dmaphyssrc2 = 0;
; B | a. Q! N6 X - dma_addr_t dmaphysdest1 = 0;
$ J" Z: Z: Q+ r" e8 F - dma_addr_t dmaphysdest2 = 0;% G8 q Z% {5 ~0 h: W9 k
- 9 p# l9 \* P# _0 a
- char *dmabufsrc1 = NULL;! t6 K' }# L! \. B# Q) `
- char *dmabufsrc2 = NULL;. `- i) P& t) Y9 A
- char *dmabufdest1 = NULL;
7 q8 S8 {1 K2 [5 e) n2 L6 \ - char *dmabufdest2 = NULL;
: E: U# r! y! n4 q, U! q( Z
% {+ v8 \" k# z" x# B6 M/ P9 m- static int acnt = 512;
! E0 ?! N8 |9 E4 Q6 ` - static int bcnt = 8;
- a+ m9 t. W; l1 M' N k d) R2 B3 S - static int ccnt = 8;7 r# |4 ~4 x6 v* k3 N+ W* A
- 6 Y/ W3 Z: m# f& ]# X
- module_param(acnt, int, S_IRUGO);+ y' u8 c" P0 R4 r/ v
- module_param(bcnt, int, S_IRUGO);) y( [' P( O9 V! G0 a
- module_param(ccnt, int, S_IRUGO);
复制代码
: r0 }6 z' I% T2 J# Y" q. A+ U7 L7 I# b6 |/ P& Y& n0 H
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( k' W0 z& F3 d$ O% k& J
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
F6 t. v+ A0 I, |3 i 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 D3 F" S8 p4 _# R) W4 L
9 b9 r$ r4 {4 X
' l$ B2 m; M3 h) }2 F |
|