|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' D0 E; H. |( ]' @; D
- [code]EDMA sample test application- A: w9 ?, I( h j9 T: N. r
- /*% \/ y: _2 c4 U+ ?# O
- * edma_test.c5 L! w& W7 r9 }! N S5 I
- *% ]& E5 l0 N n q+ ^/ E
- * brief EDMA3 Test Application
5 ?: c$ a6 D! ?9 Y9 Q |* ^ - *
; j. O3 N; p6 M" c - * This file contains EDMA3 Test code.' v' j; f- s2 D. |' m
- *
3 K2 c! u0 z$ P9 _3 W2 Z - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
9 i# E3 @. J4 m2 [" C! s% x - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
5 U1 Z' H, }' T - * TO CHANGE.. B" k4 x8 R) X/ i
- */ _; k q9 |; c! J7 |$ E
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ @2 I; w, A' k- A
- *
+ {5 W. ?& c, }5 R. [$ X - * This program is free software; you can redistribute it and/or
. L) P6 g2 ~9 g( o: ^; E& H* | - * modify it under the terms of the GNU General Public License as
% b$ L% ]6 n) o# j2 M4 r - * published by the Free Software Foundation version 2.
- e4 I" {3 M1 W- A" H( Y0 i0 N - *3 ~! k% z H/ j6 J- c+ a* X$ W
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
4 N6 q, P2 u+ \3 m+ y - * kind, whether express or implied; without even the implied warranty
! ~0 B# b$ u+ B3 x& e7 U" j; F+ b - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
$ T' f1 C9 K9 {; J0 g - * GNU General Public License for more details.
3 C7 @' F8 q) z3 S. `, f/ o3 {4 Y" H - */
3 V2 L/ e- I: P4 G
, P0 R* W% s. Z# |- #include <linux/module.h>: v+ S% ]9 x% t
- #include <linux/init.h>
( a: K# \: r, a. r. v - #include <linux/errno.h>
* T& k: Z" b3 h6 {2 Q - #include <linux/types.h>
: ]( _9 t9 P# d7 y/ W - #include <linux/interrupt.h>
5 ` w: Z @# k: ^: W8 k8 \ - #include <asm/io.h>
& f) j# K ~7 Q4 W" U - #include <linux/moduleparam.h>
; C6 \9 t, m8 X7 N5 R - #include <linux/sysctl.h>5 v* n3 N7 ?$ A
- #include <linux/mm.h>& y' t- k* }9 X
- #include <linux/dma-mapping.h>
6 q+ M; J1 D0 ] B; @- S* s - - f' e- H4 i3 U% T
- #include <mach/memory.h>% Y/ q4 O: H. F
- #include <mach/hardware.h>5 M% U+ X* Q* ?3 T/ W+ l8 f
- #include <mach/irqs.h>- c, }4 D; N( [4 M/ C8 c
- #include <asm/hardware/edma.h>
s6 a, s Q+ g2 d* Y. q
: N. h% O# }- O! \) T) w; Z+ i% Z- #undef EDMA3_DEBUG
# ~( t; K e% |. f9 E - /*#define EDMA3_DEBUG*/' q6 [# ?- V: Z: A
# C, k4 Y4 H' U8 ^, G8 v8 v9 \- #ifdef EDMA3_DEBUG
$ K* u! \. T' g$ Y% ^5 O+ ~ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS) X2 {8 S0 O8 }7 o6 w- Y7 v
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
) u9 w0 u f$ u) @ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
) Z7 d; v! T% V) G+ n - #else2 u4 }( m E" f+ G+ m$ G; s7 p
- #define DMA_PRINTK( x... )
& m+ H0 P8 }2 Y) p) {' k: V5 ~ - #define DMA_FN_IN
7 O1 t9 e0 Q& D7 @! y - #define DMA_FN_OUT4 @' }9 [" H, U ^
- #endif( j/ _) o' C( X0 X, O
9 q0 C( ?+ `) l$ W0 z- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
. k* g2 t" I2 r F( I+ l W- a - #define STATIC_SHIFT 3
M7 n. K4 o9 A. e - #define TCINTEN_SHIFT 20
% p- [; N2 y5 h2 O5 R9 U - #define ITCINTEN_SHIFT 21% [+ o8 r8 E7 q" a
- #define TCCHEN_SHIFT 22
# G4 f; j4 I# @6 {7 f6 l, m8 p - #define ITCCHEN_SHIFT 23
4 s- U. D- C2 D5 Y( j( J - ! E6 r, h) O2 [/ S3 d& H
- static volatile int irqraised1 = 0;. D5 j; g6 s& S: g5 [
- static volatile int irqraised2 = 0;2 G0 Z$ G. l& ^) s( x
- : K8 y; x; V5 w4 L- w4 ?8 D" @
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) g! d# z; X5 [( t
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 x A6 }5 W- c0 K! [% N% t+ S' c
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ `+ m' W1 Z- \6 P+ c: B X
9 A( `9 o. _2 a5 ~. q- dma_addr_t dmaphyssrc1 = 0;* ~$ A: Q5 w. p) O3 U7 m* v
- dma_addr_t dmaphyssrc2 = 0;/ ]* j2 w+ Y3 f: t9 b; |
- dma_addr_t dmaphysdest1 = 0;
6 l, t, ]' p: l4 y, n: U - dma_addr_t dmaphysdest2 = 0;
1 w: z: }- \# y$ j4 t
+ U# ^+ [5 B- W& ]+ Z8 c7 G- char *dmabufsrc1 = NULL;
" c5 P# C4 b' U" n! x& w8 I( \ - char *dmabufsrc2 = NULL;& }, S- L* ?+ Y' U; @3 p4 u' {
- char *dmabufdest1 = NULL;
( `' E, M M4 z) M8 m - char *dmabufdest2 = NULL;$ W4 D7 M$ Q/ [' C( h: Q
- % Y. Y) g- }4 L
- static int acnt = 512;
, S* I" i# U, o( x+ S& E" e - static int bcnt = 8;
0 v) k/ n3 ~, q# t' \9 A' a - static int ccnt = 8;
7 g5 ]" o: G# C1 b - 6 V! c. Y6 D+ q) M& _& C% h- [/ w
- module_param(acnt, int, S_IRUGO);
+ u! d1 i. M2 |% G+ t) H - module_param(bcnt, int, S_IRUGO);
9 ^9 I7 ]: e! w/ @7 r - module_param(ccnt, int, S_IRUGO);
复制代码
" M( {( D+ W2 t- }* a6 ~
! X. @% y$ J/ C 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ I7 M! P6 m- s; y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. q! L& m ?! z9 y. _ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 T) n' s% w; _, ^- J6 N5 [9 t" q y' a) `* a/ O4 N
7 `% H0 f) Q" d+ [% `) B5 p
|
|