|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) e8 ~* O, i+ d" U% P# t3 S- [code]EDMA sample test application
3 I/ W' w# O4 F: w2 d - /*# \1 ~6 }# m, H+ i( s1 T( A
- * edma_test.c6 u9 B: @( H3 f! `/ M7 n; E
- *5 k' T5 i J4 v4 }1 `2 Z6 L( h5 E
- * brief EDMA3 Test Application
& B- k P$ G' ^8 C. t8 J* }' T. _ - *
4 X1 V+ ^& b3 L2 D. j7 C7 V - * This file contains EDMA3 Test code.& E+ ], ^. }, Q/ s+ N- V9 ]- c
- *+ e1 K% L6 J- G) h; P( ^
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
2 g0 O, w& Y+ `9 q3 O, _( y! G0 o2 a - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" w9 o& n5 k& D
- * TO CHANGE.
# C. {' D; p/ c) ]- \ - *
; U* c2 B5 y$ a! }! b0 F& Z* r - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 X; A7 z; X; W
- ** B7 L8 v- J; F( E) _" X) E2 c# P
- * This program is free software; you can redistribute it and/or
* E$ l' D& Y) e, l - * modify it under the terms of the GNU General Public License as
9 z7 T1 c: S1 h' L8 x, N - * published by the Free Software Foundation version 2.( F" B% U1 Z6 V6 U' l S
- *, j2 D* T6 B6 C6 x5 I
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 a' i: T0 ~6 ^9 I9 T1 }! M8 a
- * kind, whether express or implied; without even the implied warranty
* T# \+ Z1 p7 U9 J2 |& Q' a - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the* C/ O6 x2 E. f- K+ n, b
- * GNU General Public License for more details.4 S9 A+ g% [. k: l7 ~
- */2 c. U) ]6 t2 s5 u
- " h% q1 N" J: b! K
- #include <linux/module.h>
* y) a: I3 `- ~' T' m; W9 L! @ - #include <linux/init.h>/ I/ e1 L) X2 n: Y1 }! X
- #include <linux/errno.h>- p( T+ D# S, r' g
- #include <linux/types.h>( ^% d. U: J( t0 G$ g3 ^! Q- p! U0 s
- #include <linux/interrupt.h>
7 t3 }- V# Y4 Q - #include <asm/io.h>
3 J! M8 w1 Q$ a7 F5 x - #include <linux/moduleparam.h>
6 d% B" l& j) y0 f! k; u - #include <linux/sysctl.h>
% z6 q1 f- \& f; ^ - #include <linux/mm.h>
0 z/ @: w* S! {$ S - #include <linux/dma-mapping.h>( @2 U' m8 e# l9 V" [
. ?+ O1 [4 j# R5 y+ J- #include <mach/memory.h>3 P- q# a; t4 L% t9 P0 i# ?
- #include <mach/hardware.h>; a% ]2 b0 V V; v
- #include <mach/irqs.h>
^# [7 d. ^! C, c. F. W& s7 s - #include <asm/hardware/edma.h>7 f. d7 ^2 z0 l0 l% V/ g' r/ k3 `2 s( y
- + I- c1 o) C( L; S
- #undef EDMA3_DEBUG. { D$ i) B* H. G' M$ @
- /*#define EDMA3_DEBUG*/, L9 ?* @* P. E4 _% ]0 {
- ; ]# @( x. P2 j, p1 `
- #ifdef EDMA3_DEBUG: X" j# k3 V/ H
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ I) r" Q. [$ K3 B4 @; [
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); d; p" r% _/ H) j0 \0 d
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( p" z: o p3 A8 _4 q! M$ \
- #else
. {9 k2 b. o, }1 } - #define DMA_PRINTK( x... )
( E4 x0 e+ L8 N! h; z! g - #define DMA_FN_IN7 w# F: ^, C3 f* l; f" l/ `9 K
- #define DMA_FN_OUT( E$ y! }- r3 T- p" j
- #endif
! e1 I. T4 R, b. V$ y% ^ - ( m" {1 |6 \& p6 m
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
" ]$ J& M: e$ ~; L7 A% S* d4 i+ S - #define STATIC_SHIFT 3; o1 A( Y/ e D5 Y2 a% b
- #define TCINTEN_SHIFT 20
6 l' G2 p8 y3 E& K2 B! a5 _+ D - #define ITCINTEN_SHIFT 21' \, [* L8 X; q5 ^* F+ Y7 Q7 o! a
- #define TCCHEN_SHIFT 22; T/ Q* i* t/ D- V* b
- #define ITCCHEN_SHIFT 23( z& D4 K, z) O% i
- " u4 w7 m. |1 A! v5 y7 m
- static volatile int irqraised1 = 0;
( X% v; V# k5 x- ^2 ? - static volatile int irqraised2 = 0;
( O: T3 g+ s F! S2 | - + Q2 u+ ]# U: w1 E" ]( v- q" K
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 c- {' s' r. ]* `5 K
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( ~! R+ M# J; a7 i - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% _; p6 V# c% \, B- O: [' T
- 9 v7 S" f4 i) Z3 {
- dma_addr_t dmaphyssrc1 = 0;
6 u* Q1 Y' N( B; Z- v! { - dma_addr_t dmaphyssrc2 = 0;
3 r) A0 |0 m3 r; ^( o. B9 Y/ f' w9 a# B$ Q - dma_addr_t dmaphysdest1 = 0;
0 o0 Z" Y5 g; Q. A1 ]' J" h - dma_addr_t dmaphysdest2 = 0;
8 X! [: f$ P4 Q4 Y0 e
+ F! R% V, e- _2 G. u: P- char *dmabufsrc1 = NULL;- j1 ^% T8 w3 C1 B/ P3 e
- char *dmabufsrc2 = NULL;' |: X- r y" w# k, b, v* ]5 U$ E0 {
- char *dmabufdest1 = NULL;& L& s: c) x6 N/ F: L
- char *dmabufdest2 = NULL;
8 x2 G, L: ~5 f/ p& P( [, u; E- b ?
. P \2 V. P, L; Z- static int acnt = 512;7 h. f$ `! Y1 e, h) D1 _
- static int bcnt = 8;9 _1 U+ ?; p3 @+ `- S; r$ M
- static int ccnt = 8;
4 h5 v$ t2 O$ _- x
* x# \8 m% L ~2 H: ]* I- module_param(acnt, int, S_IRUGO);) W8 A/ Q$ N- R7 w5 S, g
- module_param(bcnt, int, S_IRUGO);" X Y7 {9 A5 M. ~3 x/ t" v' o
- module_param(ccnt, int, S_IRUGO);
复制代码 - O O8 ~* u0 A# H
+ C0 o: X% b. a
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 `% g6 @/ I2 M. ?: qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 J; ~0 l( D3 l3 w 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 U T) k# i1 W; Y* h
- h- o! D' F1 {9 [0 z& z8 r6 e3 u8 F+ X" v- h6 A& ]
|
|