|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 \" b! Y; r6 g0 @; ~# L
- [code]EDMA sample test application8 a8 a0 ~1 W9 v! A" n) ]
- /* L! F9 P, w/ ?. Z
- * edma_test.c+ x# H$ ]/ n! Q# S- Y( `" o# X9 u
- *
- _( {/ Q" U( |% y. I - * brief EDMA3 Test Application3 v0 H/ U- R- o; o# ]9 P
- *
1 q& K# k# ^) y& |3 K - * This file contains EDMA3 Test code.
; V: h3 ^2 o7 S7 Y8 x - *
% s' S" `) K9 j) q0 N0 v, ]$ B - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, ~% c3 t$ V) c" Y
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 R) I4 q; V) p% r) @
- * TO CHANGE.
( ~- o0 R+ d$ d7 K/ j. S+ ]1 B - *
. F# `: b; Z- Y2 m4 R7 h - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& F' K# g# f' I, g
- *# Z5 b! L3 X+ l# P2 P, J$ u# f7 c; j
- * This program is free software; you can redistribute it and/or1 G" M: F% E& \& ]& a& N* B: E3 K2 |( b
- * modify it under the terms of the GNU General Public License as
4 Y- |3 a( L% ` - * published by the Free Software Foundation version 2.
4 ?4 R. ]8 [5 S2 a+ `% F9 B - *) x1 i8 E5 p8 m
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
$ z5 _+ o4 f' F$ P. I1 r* M4 ? - * kind, whether express or implied; without even the implied warranty A4 ?! G1 b% O# |3 C
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the3 R! v. k6 B6 e# d
- * GNU General Public License for more details.3 o1 T& m) X8 _; O/ W# E
- */& b" z9 B1 ~" P* t
1 {) L# T1 [. b b* E5 J8 _. W/ V- #include <linux/module.h>% {4 o; v" ]" b+ @. ^
- #include <linux/init.h>
+ X$ h( ?; C7 k" I - #include <linux/errno.h>( X5 Y. q( a& c& E# W, B/ e8 b
- #include <linux/types.h>$ B% L: A7 j3 t6 ~3 d8 |" o' ?
- #include <linux/interrupt.h>
0 f- {1 f# M0 T- W0 {$ y - #include <asm/io.h>
/ B3 R' W2 \: \5 M# [2 I/ Y/ V) ^) H - #include <linux/moduleparam.h>
2 q" @6 d/ Z7 K - #include <linux/sysctl.h>9 ]0 R1 J$ `5 i
- #include <linux/mm.h>
2 K/ G, [$ j; k( g - #include <linux/dma-mapping.h>7 v' |! U. R8 v* F$ b
- 0 v+ g4 F0 |) W6 ]' X) L6 b, _8 ^" i
- #include <mach/memory.h>
7 h$ p0 N* F9 l; Q! U# `8 } - #include <mach/hardware.h>* B/ m+ G+ Q0 @
- #include <mach/irqs.h>+ E% u/ U2 O q# s
- #include <asm/hardware/edma.h>+ ~' g9 W6 a1 g1 R: r$ [' b
- {! Z, `+ r2 ^4 L7 r' l5 v- #undef EDMA3_DEBUG
9 k* k" t0 a( t9 y) d, ` - /*#define EDMA3_DEBUG*/
) A8 B9 C1 h6 K V' v! b - & h+ T! E/ b! [5 G
- #ifdef EDMA3_DEBUG# u) ]5 Z7 m6 S1 K. i- f1 m$ T& K2 `
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS) N1 W& D4 `- i. x/ a7 }
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): I/ Z, _. r2 [2 e( K
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
% A4 O* }0 c: d, D - #else
4 W3 j8 S' C6 P$ B+ m! K: _ - #define DMA_PRINTK( x... )
. i2 X7 v' C, m6 X) G: b; F/ Y; j% W - #define DMA_FN_IN
. X- w4 {) t( ?7 n, i2 a4 x& | - #define DMA_FN_OUT1 }) I+ _( _8 ^' N4 c
- #endif
* Y) Z: }, v$ q6 u4 f; ^* o- [: a; k - 7 t- u" C8 D/ H) T. Q
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
; I: j: X1 A" |3 A+ q - #define STATIC_SHIFT 30 w A( E$ V. f
- #define TCINTEN_SHIFT 202 F1 c; h, A4 z( T, C X. c# @
- #define ITCINTEN_SHIFT 21/ f1 G, J0 h( ^+ u) }* V8 A
- #define TCCHEN_SHIFT 22
! G+ t* D6 P, D/ |9 ~ - #define ITCCHEN_SHIFT 23
|7 q9 p$ S' U - % D2 @4 D3 C; S1 E
- static volatile int irqraised1 = 0;
1 ?0 |" m9 H6 J' u - static volatile int irqraised2 = 0;
% Y* D8 |+ a. W5 k4 W3 e2 b: A - 7 f2 p/ E5 K9 \$ Q
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 ~: e, x# z" I- B0 l1 L9 |
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 G3 F. r- I( W0 O: d. ]; ^
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 T+ u9 r4 @/ Y; t% e
% ]% P4 _) n0 f8 o) j) A- T- dma_addr_t dmaphyssrc1 = 0;
6 D A' l2 L4 d- v( L - dma_addr_t dmaphyssrc2 = 0;, j3 L% g/ z4 v( U4 U5 r; R! i
- dma_addr_t dmaphysdest1 = 0;, r" v- a) D- ? K1 h
- dma_addr_t dmaphysdest2 = 0;
; X% {8 U& H# H2 G
5 a7 v, F3 \4 j. e( v4 g- char *dmabufsrc1 = NULL;
3 H6 b9 a* M+ v- y; Z3 u/ @ - char *dmabufsrc2 = NULL;" T1 E5 V4 d( G: T2 k
- char *dmabufdest1 = NULL;
G, F1 ^+ X1 U3 P; v" x# ~* G - char *dmabufdest2 = NULL;
5 \; A6 h6 W" H# y) F: D1 F9 }
2 v0 f' e3 K7 I' n7 n- static int acnt = 512;
% ^" c) f4 C5 B- s - static int bcnt = 8;; e6 M3 O5 V! x$ E& s& T/ q3 J
- static int ccnt = 8;, o3 Z1 g2 N$ h% ]4 ?( R
- , \! K7 A4 i$ F
- module_param(acnt, int, S_IRUGO);' Z0 l. e& p- ~9 w9 m# v2 ~5 z) `
- module_param(bcnt, int, S_IRUGO);
9 u5 z# W( o. m$ @4 T* | - module_param(ccnt, int, S_IRUGO);
复制代码
8 h O: M2 i5 u$ `+ l
) r1 {+ m% e" G b" [ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* V2 F* i4 f g
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ R2 @! b S# b
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& ]7 i& k1 x9 L2 t
9 F1 s8 F) e% R- ^( \$ q {: i
. |/ Y& P/ ~/ q5 Y* \' L |
|