|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " E# s: C" C: L
- [code]EDMA sample test application
. i( j/ m5 f6 E. O8 R( o1 \; e - /*3 h; P( \5 O& k# E6 p' G, ?! r
- * edma_test.c
! _( h3 F* G6 J4 V - *" F9 [- ]# ]/ F; I. J
- * brief EDMA3 Test Application9 n# `3 a8 W5 N2 d
- *3 m0 M4 e+ G' \! ?3 j+ p* l& ?$ i$ ?
- * This file contains EDMA3 Test code.
4 `) A' v1 f" u6 \- D - *0 {& b( I5 ~! K' v' d# q" ]
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) M$ N" o$ U0 [, T: n3 J9 S
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT k p) g4 b& y" I. u* H) @
- * TO CHANGE.. @' e) H9 N7 y7 \/ S3 e3 S
- * X3 X! d* D+ A z" y6 Q6 Z
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
8 I* {7 U$ C9 b* T( ~8 _ - *+ C0 ?) x- D# F" |
- * This program is free software; you can redistribute it and/or
& A x5 L3 _. D, h8 F% B( u - * modify it under the terms of the GNU General Public License as
. q3 L/ }* m8 l1 t - * published by the Free Software Foundation version 2.! o/ h6 Y3 V" B+ x
- *
2 k# f. L# c* M3 R& B0 Z# \8 F2 @, M - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
# M1 Q) H" i5 J5 o6 w* X& K. j - * kind, whether express or implied; without even the implied warranty
% g- f0 D) i! ~# k( V - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
( \, F m q! v) T3 C- {) R - * GNU General Public License for more details.6 d# M% ^% i9 s: _
- */$ ^% B$ W' P3 D$ q2 W/ i! c( u
- 9 m w1 C0 a: @7 F
- #include <linux/module.h>
3 ?7 J4 Q2 A! J l - #include <linux/init.h>
# b% e) c& i; a" G5 r8 j - #include <linux/errno.h>5 h, r: E* I8 J0 L
- #include <linux/types.h>1 i: _, p' l* X* }/ P
- #include <linux/interrupt.h>! s. P& [" B. [8 m
- #include <asm/io.h>: m3 A# j2 l. `2 p
- #include <linux/moduleparam.h>
; I0 N! N9 ]0 a - #include <linux/sysctl.h>) N" L4 ~3 x4 R. J& I2 k7 X. n+ }
- #include <linux/mm.h>4 U4 z* j/ r4 L) i
- #include <linux/dma-mapping.h># }4 o% u D, E/ D* T
3 z5 C( v* }' N' K7 ?# X- #include <mach/memory.h>' P8 @; a' q. Y y; F* V/ k
- #include <mach/hardware.h>
3 o. U- A" o) }6 n" s - #include <mach/irqs.h>
0 S7 B# t! l3 q- j% h - #include <asm/hardware/edma.h>. f0 h7 C4 A; R# k
& F- ]6 K m' M/ R2 ~( Z& s- #undef EDMA3_DEBUG9 J- q% ^- O0 R& {
- /*#define EDMA3_DEBUG*/5 G7 @5 J! v4 A+ H, A# [
, X$ ~6 m3 ^, p" ]- q- #ifdef EDMA3_DEBUG1 T4 V/ \) j& D: ~
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
3 u% @! d) a. \! b+ C - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
' c0 \! a6 H$ x; q! c u. M8 D8 _ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
. q8 B' \* F8 I( a2 n) j, ~ - #else
& V8 b% T. `2 v/ R; z2 G - #define DMA_PRINTK( x... )5 i- i( [5 F9 B( m% z2 t5 j+ l9 ~2 V
- #define DMA_FN_IN$ }* U/ n! Q" j1 p( r1 y
- #define DMA_FN_OUT
]9 V- D {! I7 z. V5 U+ u - #endif1 L2 w, |' E5 Z7 }2 w* F# Q
- y9 |. ^3 J4 k) n6 O9 O- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
1 v. r1 J( R' [$ r$ l, l2 x; R- s - #define STATIC_SHIFT 3! h8 Y5 [9 y$ R5 i: f& r1 E: |
- #define TCINTEN_SHIFT 20! U& k! @& ~4 t: p' O
- #define ITCINTEN_SHIFT 21
# A$ }/ }; u3 L) C% Z - #define TCCHEN_SHIFT 22
2 N) w( D8 T3 I$ R' U" z) k. o2 C - #define ITCCHEN_SHIFT 23& q7 k1 M% M8 X5 C+ h7 D
9 n& K; [: w, f+ j* W- static volatile int irqraised1 = 0;7 Z% l: I, |+ k5 l
- static volatile int irqraised2 = 0;
9 ], i- ~( u) t1 G2 O6 x! m* L1 u
. S" b2 R: |2 v- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% F* G8 I" [3 C) @/ ] - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# j8 D n/ Z5 m2 k, M, B - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# i1 P* o1 u, I) f: u - 6 k( p1 w4 w/ b( x
- dma_addr_t dmaphyssrc1 = 0;
" B: ~1 ]" d$ F- L1 r/ Z5 r5 t - dma_addr_t dmaphyssrc2 = 0;8 E! [; g' `- K9 N6 ~8 X/ C. D7 s
- dma_addr_t dmaphysdest1 = 0;7 O! b9 \5 v8 ?: l- U( G" R
- dma_addr_t dmaphysdest2 = 0;- T+ ]& j! y" K" @# `8 W
- 7 o. P" ]! q1 a: t0 }
- char *dmabufsrc1 = NULL;
, {# R; v% J, }0 C1 L# q - char *dmabufsrc2 = NULL;
{" t+ |& C3 U1 D - char *dmabufdest1 = NULL;
+ b8 U7 \. R) S: j) A ]4 u - char *dmabufdest2 = NULL;
' y3 d" a& X5 @1 D0 o
" N o( w. K8 D2 y- static int acnt = 512;3 C$ O2 C: H; o) w+ O
- static int bcnt = 8;1 n3 ^$ s' a" @ f! c
- static int ccnt = 8;
' l* M( x( @: w) p7 m3 H+ B
; C7 y" Y* k( Z* G9 Z C/ U- module_param(acnt, int, S_IRUGO);4 v( f( K0 ?+ V. i8 V5 S# ~) I
- module_param(bcnt, int, S_IRUGO);1 J( o7 T5 v3 E+ L9 ]
- module_param(ccnt, int, S_IRUGO);
复制代码
- \9 r% l, L& Q" F$ o2 ~2 L3 y$ K' h9 M7 s& D7 {# c" `
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# N! w, ]% b) B+ p' T/ e( z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. m4 A7 s1 y1 i8 M# M* D) W
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 d/ F' {! F; A: N% Y3 V* B9 }& b
, n4 X- {2 M& w4 `5 o0 ]& m. `
7 g7 X* }+ y4 m' B
|
|