|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% w" f' `1 s! b- [code]EDMA sample test application E1 I( E1 P9 U, V5 C, k$ N) M
- /*& q+ v' w) m+ w0 J( D
- * edma_test.c( T# [/ W2 f1 C. V6 d$ m3 o
- *6 E- \( f3 @, r
- * brief EDMA3 Test Application
' n6 t& `) V- {5 \% I+ C" I. h - *1 Y3 R7 M7 _# _/ q* n
- * This file contains EDMA3 Test code.' I" _/ W2 T. u' u
- *' H" e* ^7 @5 T! N" V" P% Q
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: a+ s& K1 z5 W$ l; O" t
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
8 F; r; u( s0 S2 A4 U( Q; \1 y8 _ - * TO CHANGE. u8 y) T a5 X- R
- *
3 ~; t6 z. j. Y3 U - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' [( [+ Y# d$ l, g
- *" c: A) Y* U0 @, h' V! x
- * This program is free software; you can redistribute it and/or
# f0 n& v$ ], `: P) e - * modify it under the terms of the GNU General Public License as
# W4 w- F3 `" N - * published by the Free Software Foundation version 2.' j) q! d4 U6 i* |! W* y$ E ?& M8 ~
- *. Y+ x7 N: u2 v6 z! E
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any; t9 N: G, S% [$ C/ h7 |
- * kind, whether express or implied; without even the implied warranty
$ X, \) k2 H5 h( _' C7 l8 x" Q - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the( O$ Z1 ]5 L# j7 ?
- * GNU General Public License for more details.9 _! S6 ]' ?' j- a" J) E; H6 f V6 p
- */
$ L5 S, K" w4 `% r. ~
- h% H# p0 Y; b) H! M. o- #include <linux/module.h>" h* C) w+ \3 A# S$ d
- #include <linux/init.h>; b: G0 u! t" }1 G# x
- #include <linux/errno.h>
8 X D& ?; S, ` - #include <linux/types.h>2 K; Y+ O( N$ q# x2 V% V$ Z: v
- #include <linux/interrupt.h>
! ?7 U: k! j% b- L7 p - #include <asm/io.h>8 ^; l! \- w( b, M e H8 T
- #include <linux/moduleparam.h>% p9 v+ G( l# j+ U
- #include <linux/sysctl.h>/ f* Z, g2 f1 J$ R
- #include <linux/mm.h>
( m" R0 ]" {) r. x$ ?3 j1 o8 d - #include <linux/dma-mapping.h>
. u4 z! a4 E$ X, B8 S6 x: _ - ' O8 N$ T/ Q$ l b1 H2 p7 E1 }0 D
- #include <mach/memory.h>7 f; D( t* X0 z/ W
- #include <mach/hardware.h>8 j. V1 v0 E2 w+ \6 M5 p3 ?4 z9 E0 Z
- #include <mach/irqs.h>! s) ~& q0 \ [4 [
- #include <asm/hardware/edma.h>- t) n" p) E4 [! N
- 5 }% J" M _0 m/ P5 O$ [
- #undef EDMA3_DEBUG
' |/ w1 {+ L, f% D6 U. Q& R4 s; Q - /*#define EDMA3_DEBUG*/6 t' k, S2 C- ] t: }* N- E
. |- o6 W! y" d- #ifdef EDMA3_DEBUG2 n' ?. z) T# g; M) o" l2 ]
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
6 @4 v5 j( {1 \+ v: `* T - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
0 ] a9 Y% H# N) N6 Z - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
p. V' t% I/ v/ u4 R - #else
6 W6 l7 Z" G1 \9 E5 \ - #define DMA_PRINTK( x... )1 V; X/ Y: R1 d( S, E3 u
- #define DMA_FN_IN
* O" q. t0 F. t, i/ t2 D - #define DMA_FN_OUT
: i! n. i h& z7 Y5 K - #endif
6 @, d! R+ `9 R3 x - ! y. I1 s5 \7 y9 B
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
+ _& O J4 f+ \ - #define STATIC_SHIFT 3
" | N, O: s3 b [ - #define TCINTEN_SHIFT 200 ]2 _# a: ^! X
- #define ITCINTEN_SHIFT 21
R0 \, k: K+ z5 B" H5 N - #define TCCHEN_SHIFT 22
& \: ]! D+ E8 l$ J8 n: F - #define ITCCHEN_SHIFT 238 p- z- C- y% \9 I0 S; B6 f, S
' S3 y! [$ g- |* d7 O/ O$ Y% a) L$ k- static volatile int irqraised1 = 0;) [$ m* U3 i6 _7 [" r8 r3 \
- static volatile int irqraised2 = 0;6 D$ C; s r9 ^3 m) |
- ; F3 d0 X" I: f1 |1 t
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* J, ~7 C# K( j7 g - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ P7 u( q. r. m' u! T; b8 y
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ \) X. l4 h F* E# l$ e - 8 J8 d- c/ c4 R- `! w* r6 _
- dma_addr_t dmaphyssrc1 = 0;
/ ?5 u d* R; E! d- M% T - dma_addr_t dmaphyssrc2 = 0;( d* Q7 ^( L3 h; w& O
- dma_addr_t dmaphysdest1 = 0;" g& |2 Y5 |/ K( H) g
- dma_addr_t dmaphysdest2 = 0;$ W' m0 Z7 T( G0 C& n+ I
* t- k8 Y4 s3 C+ x- char *dmabufsrc1 = NULL;& {' E2 J; @2 P i; [8 s3 l
- char *dmabufsrc2 = NULL;
# }- |, g- H& l; X& C9 X - char *dmabufdest1 = NULL;
2 \- ]# Q4 m" l9 @ - char *dmabufdest2 = NULL;6 \% X+ ^/ J; |) N& e
- . d0 w! T+ R7 T0 e: f) W
- static int acnt = 512;
$ H3 `/ I+ F" ]- Q - static int bcnt = 8;6 | F6 y! h4 L& B' T: ]
- static int ccnt = 8;
( J0 T5 ]- N8 m6 U$ }# I2 ]- c - , \# r9 E2 X9 E2 h3 E7 c! z
- module_param(acnt, int, S_IRUGO);
+ S: V* o. t" x0 r1 s8 O: M - module_param(bcnt, int, S_IRUGO);' v4 u& H9 b! T+ Y+ L+ ~2 x" b
- module_param(ccnt, int, S_IRUGO);
复制代码 5 s8 ^- B( ?* E5 Q
1 |) l) Z9 {8 b) n7 V' v' l( _/ k 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 |+ ?5 c9 `" K3 i" A
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ @7 D9 R) ~. r: F3 h9 f# U
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( q% n. x- D, v+ q" t8 P
7 y. L3 B7 Y* [) x+ A; _
9 p# K A ^ \- w W7 v( j |
|