|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 {4 ^6 m1 I% ]4 j1 V: j4 n) W- [code]EDMA sample test application
. E/ s1 D. N6 D' G, W+ U - /*! I! B% M/ R! a. M. F
- * edma_test.c8 o3 o+ r* ^ O! x2 Q1 `
- *
3 p' ^ ^* R# p& t- Y* e* C - * brief EDMA3 Test Application
. v1 H3 p! J# X: f1 W/ x c) `8 z - *% k1 X; g8 e/ @) t1 P# K
- * This file contains EDMA3 Test code.
, k% c% s/ a' H6 E5 L" P2 D - *
7 r, c' T/ O* g - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 Y1 l$ K+ u! L7 ]
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
! u/ \ ^3 Q& P+ k H - * TO CHANGE.
# c' ?3 ~3 M8 V* h7 W7 @$ y - *
) ^ g! A0 z/ I& S- n; s - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
' m- K7 W! q" q& [8 v7 }. o - *
8 Y l9 K7 T0 \, r - * This program is free software; you can redistribute it and/or& {, d2 F/ O: a
- * modify it under the terms of the GNU General Public License as1 s0 D( @. @7 z9 J
- * published by the Free Software Foundation version 2.
( j& j+ S1 O( t3 Y A* @7 \0 P - *
+ G, h6 |0 p7 w8 s9 I2 y( } - * This program is distributed "as is" WITHOUT ANY WARRANTY of any, w; [$ B' S6 U) ^, g2 E) m
- * kind, whether express or implied; without even the implied warranty: D. [/ C7 U2 B/ I; d6 `
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 o, q$ O6 o9 O - * GNU General Public License for more details.
5 S) z2 _2 d( p; N - */
* S) ]& C% Z B( _/ z" X' E - % G+ A: @7 ]; z/ G( L
- #include <linux/module.h>
2 l3 N8 X) h* b+ j, N5 k4 f! b' i - #include <linux/init.h>8 o0 d) R5 M( V0 M$ W$ x
- #include <linux/errno.h>5 z/ Y! ^9 d4 L0 X c
- #include <linux/types.h>
4 N2 r9 L$ G1 o+ p - #include <linux/interrupt.h>
8 o7 }1 P0 M: q% q! `$ ~& B - #include <asm/io.h>8 a3 j5 c; m2 F2 t( g. m5 C
- #include <linux/moduleparam.h>
* Q, L0 y7 \" u$ g: R2 [ - #include <linux/sysctl.h>
% Q- V4 k( _ G6 Y% Q4 Y: A+ X - #include <linux/mm.h>3 U, `5 _- l$ ~
- #include <linux/dma-mapping.h>
3 M+ K* x+ Q4 c6 M2 Z - + Y8 ~6 M, g) K
- #include <mach/memory.h>
0 h4 F& s3 J! P; W0 M; F - #include <mach/hardware.h>% R0 r7 R3 z$ ^& H0 U1 ^$ E
- #include <mach/irqs.h>, w+ Q% f/ P1 e
- #include <asm/hardware/edma.h>
! M9 x+ e* ?% `0 f" U - ; H( m) H3 {2 L y
- #undef EDMA3_DEBUG9 l. X) x( v/ [1 J/ y# _5 c
- /*#define EDMA3_DEBUG*/; P8 {* d9 e, R2 B! k
7 x6 k" U8 A. ^1 D) Z- #ifdef EDMA3_DEBUG$ O& O0 R; Y& G1 l
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); _. d% C. [. I6 b, q2 I5 G
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): Y- \% {, U3 L8 k3 \
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 l& g7 H3 {2 ~! @* ]* b+ Z, D
- #else4 n* I k0 c- V. v4 U( l
- #define DMA_PRINTK( x... )
- k% n9 G" x7 R, i4 Y- Q- {: U* ^ - #define DMA_FN_IN
; F7 d5 l# l3 j) T. s6 q - #define DMA_FN_OUT
" K! z, c) c2 n- R- @ - #endif
9 Q9 B* ~+ @) O
* H5 ^/ b) T4 ~7 M2 |4 t S* w- #define MAX_DMA_TRANSFER_IN_BYTES (32768)8 x5 K8 r0 |0 L( x
- #define STATIC_SHIFT 3
) ^* G' ~% A7 i% f% d5 l - #define TCINTEN_SHIFT 20
6 x$ S( F5 t. E: P& i% K4 ?/ x - #define ITCINTEN_SHIFT 21
; _( @! Z# i9 d. C9 ] - #define TCCHEN_SHIFT 22
7 P, y9 I5 s, w& K, T - #define ITCCHEN_SHIFT 232 X( d% h0 d; M5 ^$ a1 D/ @7 `
* q% p9 E, C1 X: m7 ~; N4 h- static volatile int irqraised1 = 0;
- K* T- B3 l6 V# v, H$ K4 J9 b" L% b - static volatile int irqraised2 = 0;: d4 i9 T6 c9 j, m
- t W* l3 y+ O# Y9 O/ U( `5 |+ ~, a- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: @. ?& P! p( {1 c$ }/ \0 I* W - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: i% s8 D( _; |% N6 |: _
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& }7 f* }2 V& D
- # x3 E# c5 \8 D; k$ |
- dma_addr_t dmaphyssrc1 = 0;
" M# E9 M$ j* b. W8 E - dma_addr_t dmaphyssrc2 = 0;
2 R" A( J7 j1 E: T5 d- l# T - dma_addr_t dmaphysdest1 = 0;. b" X3 w/ [: |3 N: n, ^/ C3 ^
- dma_addr_t dmaphysdest2 = 0;
% L1 e# ]+ y" m' a) L: x/ g* [5 R - & Z& Z: y4 D2 }3 R( n
- char *dmabufsrc1 = NULL;
" { B; R3 g0 m8 P* k2 N# D8 Q - char *dmabufsrc2 = NULL;
8 w- I/ R7 P" {. t0 [8 p0 z - char *dmabufdest1 = NULL;
- h k! Z$ I1 {& j* c - char *dmabufdest2 = NULL;
! ]# a. A' p. X0 T& ]% H6 R' o
; ^ r8 T; m2 O$ W7 R- static int acnt = 512;& a% g" g. F4 f3 S
- static int bcnt = 8;
& ?" M. d% L; u% ? - static int ccnt = 8;: s+ w9 y5 \# k# V. A& _8 E: O
- ' X/ S% e" L" B2 c& s6 e
- module_param(acnt, int, S_IRUGO);# l. p; c3 X( d
- module_param(bcnt, int, S_IRUGO);
+ S0 `$ q3 ^ m5 J* N( y( Y - module_param(ccnt, int, S_IRUGO);
复制代码 0 D; b1 b5 d& l7 W
! e9 d1 B8 H5 h4 t) \- N: ?7 p1 I 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 E6 J2 `3 R9 e* v
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* m' S, }4 A- t4 b6 y1 ~7 C 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: h9 G, v, A1 ?" p
& V/ q: a: ]6 u# A. @# ~" I. C% T" J2 U0 r; ^! {
|
|