|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 C3 s. m ~: S" s) Q, d6 G- [code]EDMA sample test application; l5 {! [ p) k. r; G
- /*/ Z6 `4 I5 E" `, ~9 G
- * edma_test.c
8 ]5 ]' E. k: a2 O8 `" S/ W9 ^9 Z - *7 G5 x( M3 O6 d% z8 K
- * brief EDMA3 Test Application
8 }6 M: e$ ?( U7 U. L' }9 { - *
& N* E+ L& q4 }0 M2 t) | - * This file contains EDMA3 Test code.
2 t- u" ~! h1 Z+ d4 U - *
4 Z: W2 N$ v! \" a - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
9 {% ~3 k3 y, G9 r - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( N5 S5 C8 ?* C1 \
- * TO CHANGE./ F' h! j; o6 n& ?) Q$ J3 j
- *! p4 ]# Z1 n: i7 g- B# i& w! Z
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
" _ K; R! A7 N6 {" b. S. }4 ] - ** m" \. _- \; v4 K8 ~
- * This program is free software; you can redistribute it and/or
7 o2 g( }- {4 F* _6 s. F - * modify it under the terms of the GNU General Public License as: C* g0 V: ]% e# @1 M# N; i+ N2 a
- * published by the Free Software Foundation version 2.
( B, C( U+ S+ N3 g: L2 Q! y - *) c" n" i% s# l; V! N, H
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
) V% S; w( P) L1 F$ n7 t4 U9 O+ e - * kind, whether express or implied; without even the implied warranty8 e5 B; p; T& r4 }/ |9 s
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0 q' m+ ~* s5 j" ] - * GNU General Public License for more details.
$ D+ I5 J' M0 a$ ^8 O+ ~ - */5 V! A7 C3 X" n: ?) r0 s
; C8 o; y8 ?! w- #include <linux/module.h>
" ~8 x* F. ]$ Q v3 I, w8 Q; E0 s6 d: u - #include <linux/init.h>
- g8 ~7 t4 _% v' w8 a0 e% W - #include <linux/errno.h>
# @5 ]& |; y7 f9 B& k1 h; U - #include <linux/types.h>0 ^, m' P9 R; F" L5 T
- #include <linux/interrupt.h>3 l* `" |+ O) H7 l( Y) L
- #include <asm/io.h>. E6 J: t9 L# R; {$ `
- #include <linux/moduleparam.h>2 |9 S2 z8 W3 ] G! ~2 F
- #include <linux/sysctl.h>
j( v3 d8 ?! A" i3 T - #include <linux/mm.h>
/ z: d; y f$ q4 N N$ |/ w3 C( F - #include <linux/dma-mapping.h>5 g" [. H& a/ `# W% a! v; s0 X
% {9 ?, X5 v( U- #include <mach/memory.h>( l( [/ j; u/ z2 b0 p& D
- #include <mach/hardware.h>! U* B. P; ]% x/ j3 J2 S/ M
- #include <mach/irqs.h>7 j }# P3 Y( K% I, x( M; D
- #include <asm/hardware/edma.h>
6 Y4 |( S# o; d& Z - % l9 L7 l( [8 S$ ^0 L0 C
- #undef EDMA3_DEBUG
2 [: V, ]/ ?: E2 s) ?$ [ - /*#define EDMA3_DEBUG*/
" q. C- D9 H& P0 E; I( ~
1 R2 Q* k& v; d7 j" c. `- #ifdef EDMA3_DEBUG
% M5 l& R" B; }: h1 a - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
* l& ~" \3 N/ b1 T5 e4 X: X ^ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), x1 }& s6 C; W7 X: p$ T" e7 i3 |
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 b2 T' |# b9 a: o
- #else
5 q% ]8 g# F0 v0 Y6 q - #define DMA_PRINTK( x... )
$ ?7 @# H$ k( D# u8 L7 V. F: t - #define DMA_FN_IN
) c- `" b ~. K0 E6 x - #define DMA_FN_OUT/ V( o* z% ~, d# e$ P9 S9 K
- #endif2 R. I! n5 A, {) ^$ d: U1 g, ^+ C# V
- 2 J, z% U$ W: M I. |
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)/ S& l0 }6 C: l% ]9 w7 Y/ ?' E
- #define STATIC_SHIFT 3
( u9 K% i+ `; N; K7 Q+ n! w - #define TCINTEN_SHIFT 20, ~9 B _5 v: u8 \: M' f
- #define ITCINTEN_SHIFT 21' _$ Z. d) K* {6 t$ f6 A* a: P- `
- #define TCCHEN_SHIFT 22
5 R: w k, [1 K - #define ITCCHEN_SHIFT 23) }# T! V1 }( k
- & v0 ]# m! V Y) N8 {
- static volatile int irqraised1 = 0;
* A* S/ \, K% h( L# r/ q% ^5 O - static volatile int irqraised2 = 0;( I' U- t% `1 x1 C
- % L: e& m+ s% a+ n g
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, M6 N) E- U& s6 x9 f7 ]) H4 q1 y
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 R7 v3 ~8 E z0 U, W! B! p
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% p( N1 S4 c% v+ I* Y0 l; Z - / }# e6 ^ q/ D/ V9 |9 o4 p
- dma_addr_t dmaphyssrc1 = 0;
! p7 A% ~$ k# R4 J0 N* |. y - dma_addr_t dmaphyssrc2 = 0;, C1 v" E" w5 b! K, k
- dma_addr_t dmaphysdest1 = 0;& k, ^- c, D3 t9 K0 O
- dma_addr_t dmaphysdest2 = 0;
. G1 G7 T" f1 i" b, y4 A$ u- S - " h( b) _1 f, @; W" b( P6 B
- char *dmabufsrc1 = NULL;. I- y; y- h4 r- r
- char *dmabufsrc2 = NULL;
8 h( C' X8 T" c$ @( r) O - char *dmabufdest1 = NULL;% C0 J" v% y: m/ H+ y* _9 q8 ]. e
- char *dmabufdest2 = NULL;8 @: B4 }5 b8 H( |- K. m9 s8 m0 \
9 u8 _& p! c) u# s- static int acnt = 512;* a: H P, @. x' q. w) D
- static int bcnt = 8;
2 h4 U% {* h w! i3 P* v( Y) ? - static int ccnt = 8;$ F0 {) s+ x. i
5 w; V( ^, E" I. t- module_param(acnt, int, S_IRUGO);# t3 Z" D8 V; ~3 Y9 K, z. }1 }! r: K* ~ S$ T
- module_param(bcnt, int, S_IRUGO);' S( R# j! E, M3 t5 S
- module_param(ccnt, int, S_IRUGO);
复制代码 3 P7 X2 n! l0 a, x
+ r+ P6 a: F$ R. X8 X. c7 X* N 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* g0 `5 l6 {1 Q) Sarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 s; c0 ^1 @. H6 O! g( R 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' M1 ]6 `) F8 E: o7 E
$ W# v7 ?/ {5 m& s w. j! N/ `) D( H* w) Q
|
|