|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 O: f9 j# S" l0 \( }: X
- [code]EDMA sample test application
* i% V# `# y* d; G* {) u X& z - /*$ K4 T# s: H7 t% K' w
- * edma_test.c5 I( j ~9 B5 r. x* u3 M
- *
5 f% l2 _7 m! o - * brief EDMA3 Test Application
! S3 R: O/ G$ b/ `: E - *
4 d1 r5 U, J5 }; A, M - * This file contains EDMA3 Test code.
$ T0 S# l( ~. I& d - *
0 \) a, d K( K6 Y. r& W - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" S9 @9 z! t3 @0 _
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 }0 B' p, y0 j; l2 {/ j% ]( t
- * TO CHANGE.
# Y% B/ ~: r% ?1 a2 D1 h4 ?' P - *7 X) M# A% o) m+ T3 |
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: \1 ?3 X; t% Y$ N
- *
2 E0 K \2 n, G1 H - * This program is free software; you can redistribute it and/or/ R* `; r7 l! f: v
- * modify it under the terms of the GNU General Public License as4 K# {( w& L+ z
- * published by the Free Software Foundation version 2.
! S5 y7 z+ A& r7 p5 a# A; | - *
8 a1 Q; A6 L$ ^5 H8 `' m# s - * This program is distributed "as is" WITHOUT ANY WARRANTY of any& ~! T+ p9 } K* ~% N/ Q* t& i
- * kind, whether express or implied; without even the implied warranty
4 F! ]* t& o0 N/ _3 K% @7 \) h - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 C _+ ?! V7 e* X- o5 E - * GNU General Public License for more details.
; F4 t) F( Q# m' [; h; L% G - *// K$ W: e9 q9 @
, k! Q* H) a# G$ p1 Q8 O- #include <linux/module.h>" O1 M6 i3 L- t0 y$ D) ~
- #include <linux/init.h>
& @3 V* u! G6 w$ s7 j* r# R- ?% n6 O - #include <linux/errno.h>
' q5 D; h+ ?8 d3 L _ - #include <linux/types.h>! `* v/ C* ?+ a. J6 Z) B; o- x
- #include <linux/interrupt.h>) `- j! c. j1 G% s
- #include <asm/io.h>
; z1 B! e4 C1 n. ~0 O0 O$ x' A - #include <linux/moduleparam.h>1 }. K9 s0 \8 J$ d
- #include <linux/sysctl.h>/ p# E$ I6 A( e# k& Z: l: m: B
- #include <linux/mm.h>
$ S n1 G2 n, V+ { - #include <linux/dma-mapping.h>
0 X; {8 r$ ]" T" Q N# B% c
4 p2 h! [$ T( k, J7 N) s+ `$ f- #include <mach/memory.h>+ E. P% m& p9 b1 v
- #include <mach/hardware.h>1 c8 H( Z+ C J& v; _$ B/ W$ n3 K
- #include <mach/irqs.h>
0 |* z9 N* \/ o - #include <asm/hardware/edma.h>
& @2 @: `% H) e' a- U& R0 B6 R - % u9 b" w9 _4 E
- #undef EDMA3_DEBUG
6 a- c& g$ V/ q6 O0 F5 E9 C - /*#define EDMA3_DEBUG*/1 \3 f) }0 ~2 x
- 7 E1 Q; v, t4 e, J3 p U: T1 q
- #ifdef EDMA3_DEBUG
8 M8 @. |/ W6 U+ O* ^4 k - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 X/ u- [$ U! q' ` R; B5 U
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" r: q: `7 {1 G q
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' N$ m) y$ o6 i" C
- #else
: H6 Y3 W; v! s - #define DMA_PRINTK( x... )1 z9 u. L) Y2 H/ Z6 w2 K1 U1 g% V
- #define DMA_FN_IN( \+ ]% U+ Y7 O" c
- #define DMA_FN_OUT
. z0 g) L1 ^& R8 H - #endif
4 L) Z% q) s" q) x4 x) e. R7 U/ U - ( ]4 \; ` Z' F3 f
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)$ g5 c7 s9 [& v4 F+ ~4 r
- #define STATIC_SHIFT 3
* i4 {9 E/ M. p - #define TCINTEN_SHIFT 20
& @# G9 w s. y - #define ITCINTEN_SHIFT 21
+ A @) m, o0 E1 \( m& F - #define TCCHEN_SHIFT 22
& b# w& K' v3 X( Z3 f! _ - #define ITCCHEN_SHIFT 23: Z1 |" X# b$ ]7 U4 r! T0 @
- v C' m" l Y. W# m
- static volatile int irqraised1 = 0;( K! I% u# W1 w+ Z. v* n
- static volatile int irqraised2 = 0;
7 f* |: P& K" w. M# o9 [ - 1 Y- e2 R5 y8 G& r8 ?! e" A
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" u( N# v8 I% q; H7 ]: n4 g
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 I/ R; c, F3 q- k$ n' g - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); Z- ?6 v H/ J# O% I: ]7 s- S. w
- . H) o# U' u* F6 Z. v P/ ^
- dma_addr_t dmaphyssrc1 = 0;
" `, |0 n! |2 x& Z3 ~# B9 j - dma_addr_t dmaphyssrc2 = 0;% P" e# a) o8 ^8 p
- dma_addr_t dmaphysdest1 = 0;
+ h6 s3 M M# y$ ~6 r. a ^ - dma_addr_t dmaphysdest2 = 0;4 ?; I+ ]+ T Q$ L! J4 y' s$ L
- . f$ G1 j* T$ C7 u; I
- char *dmabufsrc1 = NULL;
, k; A, i) m* K$ x+ r; [ - char *dmabufsrc2 = NULL;6 K$ N9 a* V- S* g. N- _
- char *dmabufdest1 = NULL;* I5 q( U, H* ]! O0 i! _
- char *dmabufdest2 = NULL;3 i+ u# m6 v+ a0 E# v, V& {! a
) ^6 S I( a' |; {' p) ^4 W- static int acnt = 512; a0 ~* S8 r- I. k/ e4 H- J& R5 P- R) m
- static int bcnt = 8;
; \7 p$ k% i2 W T - static int ccnt = 8;$ q6 | a9 G7 R7 d: R% J
- ; |0 g7 G% |8 J7 D5 A
- module_param(acnt, int, S_IRUGO);
+ R. r6 W; X2 y7 n. W8 w) \ - module_param(bcnt, int, S_IRUGO);
' X! ]6 j4 u; L3 y - module_param(ccnt, int, S_IRUGO);
复制代码 % w- k+ M; V% d6 W5 i* y* e# e
% |) T d& Q3 I) I2 b L" E 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用 F& V1 P Y0 a0 `
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# E1 B4 {# B/ c5 r3 b( Q
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: V' c+ t7 \8 I4 b1 f
# s1 |! Y h. {! a1 G6 C: L; j2 ~' S2 j2 o& A3 b' I; ^: ]! B
|
|