|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 h& c5 _) B) l- \3 G1 r- \7 a- [code]EDMA sample test application
5 {: K! E% i: N! ` - /*
0 _3 V4 m1 ?: y' P- i y - * edma_test.c2 q! H& ?3 d( r0 U
- *
6 ~) B4 E1 Q6 V3 `& Y1 p - * brief EDMA3 Test Application
8 R7 {8 @: a& A - *6 T% s# F" j' ^9 d# o1 ]# `1 u
- * This file contains EDMA3 Test code.
8 D9 q: \: Y/ X5 t9 C. Z1 w - *
, H: [& ?6 W( ~2 \; N! N" \9 B - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: C' ^ n& S& m; W8 A
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 D) m( C1 F6 c
- * TO CHANGE.
: | f! L/ W( U" l - ** L; T# ?5 l4 V: F* j
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; X$ O8 S& S1 ?1 @
- *3 a7 F$ r( i3 i* s7 A0 y
- * This program is free software; you can redistribute it and/or' y) t# B* B; U0 @( A {4 j! s
- * modify it under the terms of the GNU General Public License as
& E- a9 m+ n. [% u3 |" R - * published by the Free Software Foundation version 2.
! Q p3 M; o# r2 r/ z$ L - *
/ W% D- G" U- |$ E - * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 X" A/ T' }# s, i: R& ?$ O
- * kind, whether express or implied; without even the implied warranty! g7 ~& S6 H/ b8 J' @( J
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the) ~8 u, k) j7 K: q& [
- * GNU General Public License for more details.
! c9 m T' P: E* c# f( y0 S0 ] - */
0 N* V. y, j6 c2 i9 S
* H6 A. |, ]6 E, G( `6 N$ e. o- #include <linux/module.h>% Y) ]1 ?' Y# M9 O
- #include <linux/init.h>/ O% n2 s4 |5 H
- #include <linux/errno.h>
$ N6 M; X3 p+ ?( _7 x6 \ - #include <linux/types.h>4 j" T. I2 g3 r# U4 b
- #include <linux/interrupt.h>* H3 `; l/ Q- D7 u' W2 q
- #include <asm/io.h>
" X9 ]; |4 E9 T w# Y6 c5 F - #include <linux/moduleparam.h>
/ k8 u( a2 m% Z. [* e - #include <linux/sysctl.h>
5 B# g& J, j2 X) v9 R/ D0 ~7 ~ - #include <linux/mm.h>
8 x6 a$ {% D$ E8 c/ z7 j2 h - #include <linux/dma-mapping.h>
: C w5 W/ O. n: a! G+ r2 ^
4 m9 |) i3 x# k6 N3 V# \2 s- #include <mach/memory.h>4 n6 k- A* z. s! F
- #include <mach/hardware.h>
" {8 ~" B' A! [ - #include <mach/irqs.h>1 c+ g' M5 f8 R' P
- #include <asm/hardware/edma.h>2 }% k8 Y% Q6 g; M: v
- $ ?' Q- t" b% w5 b# p
- #undef EDMA3_DEBUG
% B: U8 |& ?0 P& h2 I - /*#define EDMA3_DEBUG*/2 P: {3 Y% G" W j2 S
& T4 ~, h2 ^5 z9 D1 ~/ {8 @- #ifdef EDMA3_DEBUG5 w: Q' E: Q) _! n: ?- R @
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
& L- z0 ]6 C# M+ h - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" X% D( [4 M t4 a, v8 o. F. A
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); G0 N0 _" p- \) x; H
- #else
* N" O3 g0 w" m9 v0 S - #define DMA_PRINTK( x... )! F& D& a9 O; `( y6 |) w$ D
- #define DMA_FN_IN
5 P! f& D. A9 U - #define DMA_FN_OUT0 P! Y" \& C( W3 y
- #endif
7 M+ |1 ^9 b0 K8 w8 o N - % h$ O5 A0 l6 a
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)# u6 M- X% b- U: ?
- #define STATIC_SHIFT 3
$ \* \, u( l% g2 S - #define TCINTEN_SHIFT 20
4 ~# y) }- q j& W2 t5 B - #define ITCINTEN_SHIFT 21. x9 R" {5 N9 S8 L. Z7 F
- #define TCCHEN_SHIFT 22
8 k1 ?* l- l2 k8 j - #define ITCCHEN_SHIFT 23! m. _+ H5 c, ~+ e4 F
& E: a# H, E% c. }0 A" Z" k: z7 J- static volatile int irqraised1 = 0;
" Q" S+ N" Y9 _. Y$ E0 p% l - static volatile int irqraised2 = 0;
% g, E8 s! ^ f- E - / L) G. i5 u1 v. q8 J
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
K2 C7 A }4 m7 @$ ]5 `$ j" ^. I - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 ?9 j3 X5 M E: B6 E: [
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! Q) Q2 o, ~' a8 ?' w - ; k% R3 @) n/ o' S- W$ n) ]
- dma_addr_t dmaphyssrc1 = 0;6 z5 I5 X8 D% ^% X
- dma_addr_t dmaphyssrc2 = 0; u! t, g: D, a6 M
- dma_addr_t dmaphysdest1 = 0;) x5 u, ^2 p& j" y- P+ t7 ?
- dma_addr_t dmaphysdest2 = 0;' g6 m( X7 n% Z
/ }5 p2 ~4 E2 f9 @# H- char *dmabufsrc1 = NULL;2 Z. ?. o5 w/ y# G/ _
- char *dmabufsrc2 = NULL;4 N0 O" C( a) V. b% w
- char *dmabufdest1 = NULL;) M6 M# P" _' d* F! w$ j% g4 W7 x
- char *dmabufdest2 = NULL;
3 a3 W" Y0 w7 @( @ - - u" ^) W+ I! s- D7 g
- static int acnt = 512;# ?) j- E8 f6 C# o+ S' l% u
- static int bcnt = 8;
0 ~/ v' W4 x4 z8 M3 c( r5 c+ o - static int ccnt = 8;
4 ^( }: Z) ~+ y$ L1 f- _" I - ; z n* u+ r" D3 N! x) B
- module_param(acnt, int, S_IRUGO);
; L( J! ~/ M4 B1 k. G! H6 V - module_param(bcnt, int, S_IRUGO);+ h* q8 [3 Z% G) o! C- P
- module_param(ccnt, int, S_IRUGO);
复制代码
2 n6 v7 s& X! d0 k
$ u4 q1 T4 I# P 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 x; B8 C+ k7 P. f5 g# {# N
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 D7 j6 Y" l$ M" Q5 {! ~5 J) c2 Y 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- |. ^2 U) {5 e
# m& o2 ]$ l* |* H1 Y, @0 S
9 H/ q3 K& G. F/ ~ |
|