|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 b( L6 n% D9 [( N0 ~- [code]EDMA sample test application
5 T: J2 J) x8 x$ ]: k - /* x; G* J" ]9 v4 s# @
- * edma_test.c5 w2 K2 ^3 @- `2 V9 O, z' \/ _; J
- *
$ d8 B3 s3 a+ u2 j5 r$ \ - * brief EDMA3 Test Application- O& Q$ m9 U$ u m0 C
- *
' \, A3 P e F) I% p" D4 n, k: } - * This file contains EDMA3 Test code.& x# @! H5 A1 z( g
- *
. V# h# }5 e% y! D - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
4 E; ^; a+ q+ T: P" g: T - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
$ M# s% t; J" @4 X - * TO CHANGE.- m' F" k9 y) [- S
- *1 d" f/ U( B. m( f+ m" ~
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 m. X6 |' y, l; Y) ]& c
- *7 N# Q4 @1 D9 y$ H. v. A* ]- t
- * This program is free software; you can redistribute it and/or
p2 X# J& W/ g) g; y; L0 V - * modify it under the terms of the GNU General Public License as
3 U& f3 a- w, A - * published by the Free Software Foundation version 2.
8 j* J7 d8 X0 ]: z, k4 h$ D( O7 ~+ U - *
1 k( O7 z5 Y, z( ]) u - * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 ~; o& u' W7 K. W2 G# n
- * kind, whether express or implied; without even the implied warranty
' ~4 O4 ~ l6 M3 R% ^ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1 x8 q1 G+ X I9 O7 a$ C& \2 e
- * GNU General Public License for more details.
3 [8 K: |9 p) |( Q - */5 A# h/ l2 Y% R: o F) \4 f. H
- 2 K7 p, @8 e+ p# v- _% P
- #include <linux/module.h>7 T1 n- @9 } _' F* \- o
- #include <linux/init.h> |; d! c# t% {2 g
- #include <linux/errno.h>$ c. J2 S+ G$ S: G: M
- #include <linux/types.h>. J3 y) d0 _! o% s* x; [
- #include <linux/interrupt.h>; }5 d/ `' @7 V- O$ x+ h8 b0 [
- #include <asm/io.h>/ N4 I, ]# u! t# G/ G" E1 h+ h. g& W! R
- #include <linux/moduleparam.h>6 u! J. X: j" F3 ]* h. {* D
- #include <linux/sysctl.h>
0 y8 |1 b! E; [' y- t# u% e - #include <linux/mm.h>
: O. a1 u4 x+ U' e7 J - #include <linux/dma-mapping.h>, t O0 J% g; c4 W: n
- 8 c7 j w3 E; H8 o p
- #include <mach/memory.h>; S" [' c* \/ s: q: T9 Y9 g
- #include <mach/hardware.h>
- d9 m& P- L& c: p* T! n% j - #include <mach/irqs.h>+ a8 t8 Y# G) `! s" `
- #include <asm/hardware/edma.h>* w } s! ^' Y, k- q" F: n4 w6 D, I
- 0 D* m' m; W' c* R
- #undef EDMA3_DEBUG7 c! A& j Q( g% L
- /*#define EDMA3_DEBUG*/& x5 k/ V2 e" N- X. p
$ R7 i: ^0 w9 z4 O) z/ ~: [- #ifdef EDMA3_DEBUG
1 u5 C* g. p/ j8 @9 N - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
7 E: _. B- V2 \2 ?- r4 ~# b( g - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
# ]! ?: ^; C- x - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
' b4 A" W+ u; T4 i - #else
! F9 v- F4 ]. ]8 T4 g: l+ l - #define DMA_PRINTK( x... )
' g& P+ B" c Z - #define DMA_FN_IN2 D8 I5 k4 n$ B* V4 F
- #define DMA_FN_OUT2 T7 E' `# Z- {! q C+ [( Q
- #endif2 Z6 @+ g( J$ Z% F/ [$ d- e
- + L/ M0 r6 A8 C8 N/ r1 L( H
- #define MAX_DMA_TRANSFER_IN_BYTES (32768); P3 {% D# f+ m
- #define STATIC_SHIFT 3! @: S) O. [6 Q: z: T( I, M# e
- #define TCINTEN_SHIFT 20- V: S I) R) Q$ o, e
- #define ITCINTEN_SHIFT 214 j; G K ~9 j+ c
- #define TCCHEN_SHIFT 227 v5 \! t. D/ b8 v
- #define ITCCHEN_SHIFT 23% r6 o, n2 i* n1 e9 Y9 ~
- ( g. }& A+ B" `# q
- static volatile int irqraised1 = 0;! E+ |+ K/ ?- d# b3 I; w% T( U
- static volatile int irqraised2 = 0;
0 Q0 i9 W9 o" l! S6 z4 g; O3 u - ) V# M. d( }* F
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- m7 S2 l& _: D" a6 [, u& N
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 U0 O' _; O4 N( \( H) T - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; ]; t' q$ w* W - 6 r9 w$ d- e) a! V! ?0 P
- dma_addr_t dmaphyssrc1 = 0;
4 b. e# M' ?4 o- ^+ e0 v - dma_addr_t dmaphyssrc2 = 0;
y' m, o- s; a. Z: O4 w% s - dma_addr_t dmaphysdest1 = 0;# I, E' _& Q# l
- dma_addr_t dmaphysdest2 = 0;
# s* f$ s( ~$ \$ |0 C - % f: E5 [& n! J' z. f4 q; S
- char *dmabufsrc1 = NULL;, ~6 N5 H; N. e. L$ j
- char *dmabufsrc2 = NULL;
# o7 q3 U: R- V6 z3 o1 Q g - char *dmabufdest1 = NULL;
- f/ o8 U" w& s2 W - char *dmabufdest2 = NULL;
$ F+ F" r1 ?3 q+ e9 L6 \- H - + B2 o' N4 b" Y7 B2 Q
- static int acnt = 512;
* v7 b1 k% r: g' t' F9 j - static int bcnt = 8;* q) ^8 l% Q, R0 J0 d
- static int ccnt = 8; B; x# S5 R" R$ M: ]/ U3 u- w
- 0 ~" E1 K# T6 d; M) C- ?. v7 N
- module_param(acnt, int, S_IRUGO);$ p. K' a/ P5 `: t9 \6 E
- module_param(bcnt, int, S_IRUGO);8 u/ x" s, B" `' S" e
- module_param(ccnt, int, S_IRUGO);
复制代码 , q0 G: g/ V. k, F8 \
w# G9 _. o0 e" p" V2 m; w8 S; s7 e
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" o4 K# L- ^. T- t3 @/ n) w9 S2 H
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 t' J! ^9 {; _( u+ E- {) Q
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- t! z6 C! ]- T9 }4 w. E
3 C- H4 K) w# ^3 \
& g* T5 N5 A! C9 I; X1 U
|
|