|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' Z1 @7 W# N5 J7 R' R, z9 n) Q( L
- [code]EDMA sample test application
s# {9 {( b B! q4 {$ T1 Q- ` - /*: R5 F$ ]0 D' `) b/ \2 i& P r3 d
- * edma_test.c
" J/ x3 X# {- N) n - *
, v4 i- x% A! A! R$ @6 E - * brief EDMA3 Test Application
# ~* X; p" h" Z: B - *
" B' B0 V( S9 }# A2 _9 b - * This file contains EDMA3 Test code.5 `) A, G# W+ j. M$ |; X4 w s: M+ y
- *. W9 _1 @/ f4 v: x9 l$ B
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
, G. `& K" d9 P0 G2 l8 d0 p - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
+ m; z( m: b( E+ K! c; D: e) e: J5 D - * TO CHANGE.
. Q+ |2 Y% v5 K6 s1 a6 G& C - *$ Z* ~$ z( C+ p/ O
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
1 |& }" v; N2 m - *
8 W9 v! V* t& | - * This program is free software; you can redistribute it and/or' w6 i9 t. ?) g/ e7 H" X7 Q
- * modify it under the terms of the GNU General Public License as
3 Q4 X3 D% X2 t' q - * published by the Free Software Foundation version 2.
' c8 V( [5 m" Q8 f - *
- c8 S0 ~" j3 r - * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 C4 q" i8 m* P) b
- * kind, whether express or implied; without even the implied warranty
6 h& w3 m" l+ H3 R7 y - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the7 [4 V8 R# W4 H9 M E
- * GNU General Public License for more details.
3 i# \3 \% S- I - *// B- z" T8 d, h G+ A) B
- 8 c( ?9 t# }7 r2 v) H( U+ _; z
- #include <linux/module.h>4 R+ q' U+ y/ ]& Z
- #include <linux/init.h>
: }. n8 X, ?: j0 n- V. w$ a! D - #include <linux/errno.h>
6 t7 d! ~4 y6 H2 U - #include <linux/types.h>
: V: `7 l& T5 h5 k* i: O! T - #include <linux/interrupt.h>8 F6 }: f7 G0 r. e9 m+ g
- #include <asm/io.h>" o; o0 Y2 ]7 `! O9 b
- #include <linux/moduleparam.h>1 ~; c7 z$ f9 l/ ~% K0 Q9 e
- #include <linux/sysctl.h>$ g0 y8 V% I% u Y$ l
- #include <linux/mm.h>
8 S, C8 [- b0 Q+ G' n6 f - #include <linux/dma-mapping.h>
3 |2 a4 s6 @0 X; h9 T2 H
: z2 E% i9 ~# U% e. N: ~, m# y8 |- #include <mach/memory.h>) d* D h" U1 P/ M5 W
- #include <mach/hardware.h>) K+ Y; o: J+ M" b* b
- #include <mach/irqs.h>9 d. @+ I# R' `
- #include <asm/hardware/edma.h>/ F# g9 u1 a+ D) N/ j0 S# j3 G; r. N
- 6 u) c u9 u# b+ N% o0 A* s
- #undef EDMA3_DEBUG
! b" |9 w- ], i* B7 T, Y - /*#define EDMA3_DEBUG*/
/ _+ \( j/ J# _5 F
8 K: J* o2 {+ m5 S* b! a9 X8 |- #ifdef EDMA3_DEBUG
' [) i4 O: f# W# [ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). I+ d. ]$ I/ d* k1 P8 ~
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 S% W |" p) L: m M5 G- q
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 F e2 Y2 @9 R6 S- S! t. |1 P
- #else
% M! ?7 w' E4 z+ |5 b7 e% p - #define DMA_PRINTK( x... )
2 k n: b+ v9 N+ C- P3 Z - #define DMA_FN_IN
3 }& p( v) O7 v' V' y# G [0 N/ } - #define DMA_FN_OUT9 D4 ^, Q+ K: t8 v; P8 v1 M
- #endif
- _1 {; r* g+ d: f. M5 ]0 Y: B
- v. h6 N8 C% Z1 H) ^4 V/ n- #define MAX_DMA_TRANSFER_IN_BYTES (32768)$ W2 m! K O4 I) f
- #define STATIC_SHIFT 3, A3 A( v1 D5 o0 X) m( h, v
- #define TCINTEN_SHIFT 20& X0 Y' Z. y) Y
- #define ITCINTEN_SHIFT 21
[# @' T; D# v. C5 {. }3 e8 P - #define TCCHEN_SHIFT 22' J& J& F# F1 E8 {
- #define ITCCHEN_SHIFT 23+ S3 m- ^+ ]2 c. i9 }3 [
# \% b5 S7 e4 o0 v- static volatile int irqraised1 = 0;5 ]7 o; Q" w$ z! k! P. c# T3 T
- static volatile int irqraised2 = 0;
( ?- U1 T, S+ e% L
6 j; G# p" j3 _. v' {- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 I5 `& s1 Y; q3 n
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ J/ D+ J. _, W" A$ _
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); ^% v7 `% m5 r& u$ O6 v# g
/ C& v9 N* h: R# S6 O f" k/ X- dma_addr_t dmaphyssrc1 = 0;( ~% \: Z# u, i& R. R
- dma_addr_t dmaphyssrc2 = 0;% T: E, m! E. U
- dma_addr_t dmaphysdest1 = 0;4 Q7 N- q! k+ R( P: O7 b
- dma_addr_t dmaphysdest2 = 0;) }' A; M7 y# p. k/ }3 u! u
- 5 O7 W# R' [8 O# d6 Y
- char *dmabufsrc1 = NULL;" m+ e* T. x- C; T; P' _9 m
- char *dmabufsrc2 = NULL;
7 X1 ~( @7 J. N - char *dmabufdest1 = NULL;" a4 B' i- g: v% s' k/ b
- char *dmabufdest2 = NULL;$ i/ v6 l$ `: \7 i5 j u% r6 {
3 t7 X- S; A z: O! H- static int acnt = 512;
5 \% N/ C& x: o( P - static int bcnt = 8;
9 H. [' z0 e: z/ g - static int ccnt = 8;
3 u6 o# N! v m1 T5 q - ; X* j+ L9 o3 H+ p! h+ k* V
- module_param(acnt, int, S_IRUGO);
) q5 {, |0 v9 Z# C" b: Y( N" H- L - module_param(bcnt, int, S_IRUGO);
: l% j% @+ h& `5 C3 ? - module_param(ccnt, int, S_IRUGO);
复制代码
+ n! X8 E1 i' C' |! t L
! e; k; ~ J7 m# o, P9 s' f% s 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 h5 j q. ^$ n' c, t. e6 P, L
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ d! H! C1 v3 A+ i2 N. n+ D6 [0 d
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) q! O& y+ x4 J. Y5 q- k
6 b, t' ^1 G" K9 F1 L8 i
! H! O! ]! B+ j2 F; J: ]% B |
|