|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 K+ J5 S) W# f5 o# L& `
- [code]EDMA sample test application
# ] H4 ]7 q* i; D - /*8 {1 q6 E/ y7 O: v( ?" t. o5 E2 A4 h7 f
- * edma_test.c
1 X% J6 Z' s2 w' B7 ]7 { - *
M; n9 g+ ^. X" u! h t! w/ F - * brief EDMA3 Test Application
& M8 j3 D" a' n% ~. {1 X - *0 N* `, F7 v, T5 f
- * This file contains EDMA3 Test code.
( D0 O- b' z+ G3 D( J+ A - *
' w4 i& Q3 J6 Y+ X/ H7 W W e - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ @: g6 ]5 _% P! A5 R! [6 k
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" i! }7 J) v' i& {. d: R$ ~, P
- * TO CHANGE.3 R) h3 ~6 R& O' Y0 ?
- *
. A! W$ s" f3 }4 a - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
7 B6 [9 p* |- R8 E - *
. i' F# H9 @- A1 f, ~ - * This program is free software; you can redistribute it and/or! M1 X" E7 K9 M5 w
- * modify it under the terms of the GNU General Public License as
4 W' s" q: L- s - * published by the Free Software Foundation version 2." c* K* I: J) |3 [5 P' _: B; x
- *
. X |/ f# u8 e) m7 l1 l# p0 a) m - * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 j4 `2 b. `2 f% V( W" F
- * kind, whether express or implied; without even the implied warranty
7 E! }0 q4 [4 D5 k - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3 T9 n( j/ ^0 ]! y; P) a; B - * GNU General Public License for more details.
, m& `5 e1 }: {) M. b - */
) n& j* p8 P% {3 T2 C% o+ j1 f8 w - ; s/ @4 F1 T0 l
- #include <linux/module.h>0 J( Z* D6 Y2 g
- #include <linux/init.h>: U G3 K6 R5 o8 k& b6 {5 T+ X1 y4 E& t( p* A
- #include <linux/errno.h>
% v1 U6 N/ _% R - #include <linux/types.h>) X# r4 T$ t: F& x6 H5 q
- #include <linux/interrupt.h>; r5 J3 E( C, c0 d6 x
- #include <asm/io.h>
+ A. `- B/ ]8 W - #include <linux/moduleparam.h>7 R6 J# ]1 D" s: b9 S: j7 {
- #include <linux/sysctl.h>
1 G% F4 P( `' f0 L: C - #include <linux/mm.h>' e* k' P0 O/ v: N
- #include <linux/dma-mapping.h>
1 r$ {& v6 A* T- C0 F
( W2 k$ a* @" b1 O- #include <mach/memory.h>2 @4 R% D- ? K. K3 @# [
- #include <mach/hardware.h>
& l- F* L7 s( F6 t8 N( u5 h: `4 n" J - #include <mach/irqs.h>
$ }6 f: N2 ]. A2 ~( B: O - #include <asm/hardware/edma.h>
: Q% ]$ k1 B* @$ W
4 c7 v0 j, o$ Y$ N, A- Z0 K- #undef EDMA3_DEBUG
1 d1 K5 v$ |& s+ {3 w# |! }; v - /*#define EDMA3_DEBUG*/
$ H# V( S8 ]# h$ k9 Z( A
3 A: A! g0 E8 [# i$ L ?- #ifdef EDMA3_DEBUG
- E3 A# U$ b2 M& B$ w( a - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" W. g' S/ s2 T; S3 O6 N2 H
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
+ m8 [+ D* L" Q- j - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 q) w7 c# W) _- i" V
- #else* T% H% W% J: J- z1 Z
- #define DMA_PRINTK( x... )
& z6 o+ V* z& q0 g) z - #define DMA_FN_IN5 v) d/ s% K/ [& k
- #define DMA_FN_OUT% x4 t5 I: Y& F" V, Z5 d5 B" n m
- #endif
: O. T- F; ^/ U6 X6 C" D- ?; p
9 b* ^- Z! s5 w- #define MAX_DMA_TRANSFER_IN_BYTES (32768) V# U3 B& w5 w! c
- #define STATIC_SHIFT 38 Y* K) C+ P! L+ _0 P q
- #define TCINTEN_SHIFT 20& P0 E# l. ^ ]) U6 m2 R/ W
- #define ITCINTEN_SHIFT 21. M3 K( f- A6 a
- #define TCCHEN_SHIFT 22- c1 ^. @" D1 t
- #define ITCCHEN_SHIFT 23
! ~4 g, K- _- h) n: B6 D! M9 ^ - 3 K# J, `6 _! h/ Z$ i' n
- static volatile int irqraised1 = 0;6 W6 }% G8 j3 Z3 X$ l7 M. _
- static volatile int irqraised2 = 0;* ]* c5 K0 G$ H5 D9 S5 g3 O
- 6 U' v, R! X5 W, o4 C: S. q
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 q. b/ Q* i( f' B; O& j - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, f6 u! `+ Z! e$ R6 Z/ K
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" M! v: e& v% L- g/ [6 d% R! O - 7 j5 Q0 u6 S6 P+ |2 k, e
- dma_addr_t dmaphyssrc1 = 0;
; d/ J" G! o# `- ]5 L4 v/ n - dma_addr_t dmaphyssrc2 = 0;- w* ^0 c6 L8 m' ^- F. e
- dma_addr_t dmaphysdest1 = 0;
! M0 U5 E, v. G2 W - dma_addr_t dmaphysdest2 = 0;: h" g% b$ w7 }+ d; I
# {, s$ h7 m! c0 m+ u+ Z- _- char *dmabufsrc1 = NULL;
" i3 `2 X V3 y - char *dmabufsrc2 = NULL;" H& o0 P4 `7 E6 W
- char *dmabufdest1 = NULL;
$ h* `; F. _. z6 G D, c - char *dmabufdest2 = NULL;) M+ \/ A3 B# T7 L; q
- - Q% B# r4 ?+ z7 Z% U
- static int acnt = 512;; }& z: W& |8 j
- static int bcnt = 8;
8 i5 F# V0 Z8 ~/ g - static int ccnt = 8;7 W9 ]3 H F6 L9 Q' t* z e
' Z) Y0 {# E/ Y5 s- module_param(acnt, int, S_IRUGO);8 v+ ]# i8 d& O4 ~9 M
- module_param(bcnt, int, S_IRUGO);
( Y9 v* C6 v9 g4 G& ? - module_param(ccnt, int, S_IRUGO);
复制代码
: `* `) Y9 I Q% X2 W) D, E p, c/ w& G$ B# P+ e1 z) R6 X
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 i+ i- B, t+ _% d; ]
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ S' O' M" g: |4 s1 O 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' g" w r d2 C' F+ T& u
) r8 W1 @( K, Z+ E/ e3 |7 j, ^6 |1 j' X" d) I% a' {# U* Q
|
|