|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 o4 }, l3 f2 {, }- [code]EDMA sample test application- X1 _$ I" ?; _1 i9 D
- /*
7 I. {. W8 N4 P& _- k" I3 d - * edma_test.c$ W- u9 U& Y" |$ r4 D N
- *4 W& m8 _" l; e; N6 z
- * brief EDMA3 Test Application
y9 C. ]4 v( E' W2 [3 z5 b# R - *
3 U9 m U* X; t' C. u) u - * This file contains EDMA3 Test code.- v& e9 B. B% o5 k' O4 A* G6 W
- *
& \. e" q6 q W - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
9 [& {, e; i+ V - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. x' f# L5 O5 z( H! i
- * TO CHANGE.; Y" L6 O7 ]; l8 H1 o
- *
: @/ K1 v I3 ^! l5 C& _! } - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ g7 d" \+ {- V: w: D+ L, s# r" J
- *
. y6 Y" p- A7 F0 }6 H - * This program is free software; you can redistribute it and/or7 E% y/ P( K9 O' d2 J j: a. [" l. A
- * modify it under the terms of the GNU General Public License as
/ {6 {+ l/ j( ~9 }0 U: f - * published by the Free Software Foundation version 2.
$ X/ W2 ?* N% `( Q# W ^7 \ - *
! n7 e$ R I4 U n7 W - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
4 w6 U. s$ J4 l( X - * kind, whether express or implied; without even the implied warranty+ U" m0 R9 x. ]7 a' v0 U0 v
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the, F) A$ D+ Z7 |; K! d7 q" \
- * GNU General Public License for more details.
% k( h2 U1 ]' x L" M* V9 U - */
: I# L# Q! N6 y7 N. D/ E$ P
' L$ O# T. P) J- #include <linux/module.h>
$ n9 n7 ?* u' q O7 y# L3 M - #include <linux/init.h>! e0 Z4 F1 e6 G7 }* M5 J0 ^0 V
- #include <linux/errno.h>
% Q4 f, u X8 W- S' O- g - #include <linux/types.h>6 h* a8 i: r V$ r7 S
- #include <linux/interrupt.h>
( e; r! h# n) d* F - #include <asm/io.h>4 O) ?* j/ J2 ^$ x, }
- #include <linux/moduleparam.h>
# I& |8 Q1 H0 |' S; F: ?$ E; K - #include <linux/sysctl.h>
8 h# v9 X v: t3 O7 x; m - #include <linux/mm.h>
2 H' o5 S' x5 X: Q - #include <linux/dma-mapping.h>
7 D" K4 v/ S- M# v* U& P
6 s) G9 v) f6 K" @. |' X, v- #include <mach/memory.h>" y7 t, h4 Q! `3 e
- #include <mach/hardware.h>
5 N. g" @4 o. h+ g: ^& Y. Y - #include <mach/irqs.h>7 n) O6 I$ Q0 W4 G, {) O7 o
- #include <asm/hardware/edma.h>3 P+ ]1 s6 c" ~ M+ s9 u5 q/ ?/ p
' Q- T/ x/ O5 e! `# T0 U+ r3 W8 R- #undef EDMA3_DEBUG6 i# e/ L! k% ~, K7 C
- /*#define EDMA3_DEBUG*/
7 B* I3 _$ `# R6 ^- q* U Q6 `
( \4 v) L) Q4 K# g& T- #ifdef EDMA3_DEBUG$ q I0 ~% w) `8 X
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 a# S1 j( Z( g" J' _+ c1 s
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
$ h% s6 p0 E! A - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# T; I5 F0 c; N
- #else
) N( x# z) Y, e0 T/ O) r - #define DMA_PRINTK( x... )9 j @6 _0 R# A
- #define DMA_FN_IN. e6 d* S& y; a, `' T* I
- #define DMA_FN_OUT
- @5 H3 i5 N% r3 ~7 \1 b, @! R- ` - #endif1 Q: |- f1 t* }! Y% e3 Y# U0 r
- 0 S! \ f# J2 ~) }
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
+ d% m! c$ U! T# ~+ N8 Y- d - #define STATIC_SHIFT 3
/ `5 o& [: F" P* z9 B) ` - #define TCINTEN_SHIFT 20 Q' D/ Q* y' G
- #define ITCINTEN_SHIFT 21
% n5 l8 {1 B# w9 Y - #define TCCHEN_SHIFT 220 t, t8 X! n1 K9 o/ n! H
- #define ITCCHEN_SHIFT 23# Q# N6 D7 p7 A: z2 M. k
6 g1 ^' R$ ^5 D, r" U7 i! T- static volatile int irqraised1 = 0;
* x2 T$ O) W: L$ Q% R0 Y - static volatile int irqraised2 = 0;
$ A" R5 L3 h7 \5 C0 J - . M7 U- X+ T7 s, |
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 B% i" ]* v! f" R- N - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( Q6 |8 \3 T- I: P% @) z - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 {% K5 P1 p) w- v9 m) h1 j8 ^
4 t0 U1 E( A3 i U1 i! ^- dma_addr_t dmaphyssrc1 = 0;
& M T: Z) C" S N% y - dma_addr_t dmaphyssrc2 = 0;
/ b2 s. g4 ~4 G0 n7 u- S, z - dma_addr_t dmaphysdest1 = 0;/ @) F/ v" q8 P9 J2 n9 b5 Y# D
- dma_addr_t dmaphysdest2 = 0;1 x$ ?" E9 [3 A# e- O* G3 h
9 F3 d* @; a/ T- ^- char *dmabufsrc1 = NULL;$ p" W8 T$ ]+ L. x0 d
- char *dmabufsrc2 = NULL;5 ~* v+ e) d: N
- char *dmabufdest1 = NULL;4 X q0 T) L0 V# P) D' ?1 P8 J. ?7 x
- char *dmabufdest2 = NULL;# e4 W; s) L. e- z- \$ w5 o" _
- ' [* H% r( I0 M# L7 X7 H
- static int acnt = 512;$ U7 h. Q' I R3 L+ j
- static int bcnt = 8;. w% Y6 w6 R( y% ?7 l" U* A% T
- static int ccnt = 8;( z G- i2 ?1 [ O$ O+ \
- v2 F' b* h: @4 G0 P. E- module_param(acnt, int, S_IRUGO);
4 u( F2 \$ Y7 M! R# N0 J - module_param(bcnt, int, S_IRUGO);
( Z+ F% q" T( O1 E, A: U, \ - module_param(ccnt, int, S_IRUGO);
复制代码 / v( J' B3 b* D" s/ }/ P
' m v. A$ W. A7 L$ b- j. x* Q0 w
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: t0 X, H9 f- b$ @1 b; W( l* ^2 }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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ ^# e4 _- {, J7 o F6 Y 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 q" @, |! I3 W& q) J6 Y) G
; \* g7 b4 i: }
0 j2 y' a K$ ~$ Q/ ^ |
|