|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' \9 J k U. F; [
- [code]EDMA sample test application; P, r$ M3 N+ L3 b+ [# u% W, @
- /*4 F+ |) F$ Y: P. c3 |, H
- * edma_test.c
+ \1 l1 _5 ?+ \2 a* M - *3 y& e$ v8 D4 j5 W
- * brief EDMA3 Test Application
4 E; k6 k; ?. Q, [0 ? - *" l% ]$ ~$ z- J- U4 l
- * This file contains EDMA3 Test code.
, b" i8 _9 o4 h# a - *
8 g; O& q2 {& q: ] - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& H4 k0 b* g1 `% j2 {
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
- T$ H$ `( u3 A! A - * TO CHANGE.
! s/ s& s; n4 F- k$ v - ** x6 U% r% M; {4 `" X8 x1 Z) n6 E* p
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
; F) R% _* O' P0 S - *4 {2 c$ l7 _6 q. \2 s! x
- * This program is free software; you can redistribute it and/or
4 X9 A' p2 E7 u7 k3 M% C - * modify it under the terms of the GNU General Public License as4 a6 k, [: p# z; z: H
- * published by the Free Software Foundation version 2.
3 ~5 ^. C& f2 Y4 i - *
; ]% I, U) L# U; ` - * This program is distributed "as is" WITHOUT ANY WARRANTY of any" f2 m# t: \( P$ e3 {# b; _
- * kind, whether express or implied; without even the implied warranty$ [& D' m6 _6 l) O
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* L# M* S0 ?4 }/ J( X - * GNU General Public License for more details.
# x# y0 p/ f0 X) Y - */
8 r* c% O3 ?5 F. Z: g* R6 o9 E - & |( i7 V1 r! ?2 x7 r! c2 g, p
- #include <linux/module.h>+ N6 Y$ ]1 C8 m* V, X
- #include <linux/init.h>
4 F. H1 v1 {6 d( f6 D - #include <linux/errno.h>
% j/ W- T# f4 k7 g; B - #include <linux/types.h>% ?) W7 i5 Y9 Q* ^7 K) \$ S4 j
- #include <linux/interrupt.h>
9 w9 @9 W( ]( ?$ {4 K- h2 g& W' q - #include <asm/io.h>
' J* w) U% x) N7 j9 a8 `& e - #include <linux/moduleparam.h>6 R" L7 [6 u& E: f6 c
- #include <linux/sysctl.h>
p" k j2 [$ N6 R - #include <linux/mm.h>. }8 i$ o% W1 \2 d0 S
- #include <linux/dma-mapping.h>- H: H. P. y1 H6 Q$ B8 N7 y
- & ? j R+ C$ c, `
- #include <mach/memory.h>7 }# F0 K; q. p& I$ H
- #include <mach/hardware.h>: @. W5 \( J4 {/ C# P8 q, d
- #include <mach/irqs.h>1 y4 j9 G# s% X& B0 H- T0 c
- #include <asm/hardware/edma.h>
" x& ?9 G1 K( g( {/ y4 e. G
$ q7 Y8 i! y/ Z6 f9 f- #undef EDMA3_DEBUG! Z+ e$ H* J& D! |8 i+ R
- /*#define EDMA3_DEBUG*/
' Z" `$ |- ?, r
7 |) T4 v! A, p+ i4 m+ k- #ifdef EDMA3_DEBUG
+ Q9 j' D$ H* y2 L - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
) F4 g. J- Y" Z/ W4 ^- E. l2 X0 W& L7 F - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
Y" T8 s5 f: c% E5 W i- g. { - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
! s! ^: A9 ^1 s# }- h! a \! }! ]. K - #else1 G3 A' r( W7 B2 u! z
- #define DMA_PRINTK( x... )
& P6 h5 Z( l3 J - #define DMA_FN_IN
9 n: d) ~! s, a$ |5 Y - #define DMA_FN_OUT
! T; h- w' Z& G A$ w - #endif5 k% B4 x. J. t! r" Z& i
- ; Q5 Z/ C9 C. ^( P
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
6 `- i' c+ b0 [+ H- X - #define STATIC_SHIFT 3
! @* y8 [9 u5 g' M" j - #define TCINTEN_SHIFT 20
3 B- h# G0 ]5 H' J: F - #define ITCINTEN_SHIFT 212 o3 k" G& K7 I* V& ~5 l. e
- #define TCCHEN_SHIFT 22: t' z0 f3 j* Q9 `
- #define ITCCHEN_SHIFT 23
: I& {8 x* _* r+ ^* n - 5 G( S) W/ r6 c: e2 N+ K
- static volatile int irqraised1 = 0;
, G' X+ j1 q: U$ C2 q7 ]% ] - static volatile int irqraised2 = 0;
* ^# w! K5 v# t - & E* g6 J3 O$ L/ x# `0 w2 x4 K
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 a. ^ _3 k# h* b+ V
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& M! C, }0 ]; t6 g - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" |' \ X0 f9 X! \% J
# Q8 X" I$ C3 i- \; C- dma_addr_t dmaphyssrc1 = 0;
6 Q) ~/ @9 o) y, z) B: A9 z$ e - dma_addr_t dmaphyssrc2 = 0; p7 H& e- T' _' Y c" n
- dma_addr_t dmaphysdest1 = 0;
6 b. r7 t2 V3 b! p; I - dma_addr_t dmaphysdest2 = 0;6 {3 v7 n: d4 ~( }) l
! I x3 u0 T' s9 Y5 w4 s- char *dmabufsrc1 = NULL;3 J$ ]" H( D; C; g3 N/ d* M
- char *dmabufsrc2 = NULL;* `" {- F4 J2 z# U% [) A
- char *dmabufdest1 = NULL;
1 y2 Z8 I: J# m7 q# M - char *dmabufdest2 = NULL;7 Q/ }* [; @ @* S) Q1 i$ p
) M; H" E3 R& f8 p: [, z6 [- static int acnt = 512;
) ^2 {) e& T! d. I# p" ` - static int bcnt = 8;
p6 z/ p& W+ L1 c j0 r/ K - static int ccnt = 8;
5 C& n2 v" ~, c2 S9 P; A - : b! A% Y0 G1 ~( ^, b/ r1 X& V
- module_param(acnt, int, S_IRUGO);. ^2 E4 B( z! l3 u
- module_param(bcnt, int, S_IRUGO);% k1 D# a6 [+ u3 A" x5 F# p
- module_param(ccnt, int, S_IRUGO);
复制代码 : Z$ {. L" E$ W& y" G S- T
G$ X I' n, @0 B
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% s: }2 A L! g
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 l" I' C2 b. J6 z | 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# J1 E8 G9 m7 n+ W) H' [
' w) [9 H" J, Q& ?) A" ~$ G
4 W7 |; x3 [) o& [) _3 J& e
|
|