|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & O+ y* s' e( z }) d& L
- [code]EDMA sample test application
: y3 e& ]2 A7 P c3 l - /*
' B6 l' H( b- T* K% d - * edma_test.c
[8 b. R6 M: [+ a - ** m) {# Y& T$ E% n# l
- * brief EDMA3 Test Application" g$ \5 y$ G3 x' S$ h5 j
- *9 Y/ [0 S/ a+ d( |7 Q1 V( s
- * This file contains EDMA3 Test code.) C+ z( `- |1 Z% {) J! v
- *8 w3 m" k. [6 v) k7 [# N a
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
; l2 n' j, w5 [ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
# }8 I, i! P |$ U5 A% i) b, G, J1 D5 k - * TO CHANGE.
8 h9 w% d ~# g - *
. R5 G9 |+ p% U5 U5 E- l# X - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
1 o8 f# C; m/ Z" _/ q' l/ P% ^ - *
6 Q$ R0 ?3 ?* L9 c - * This program is free software; you can redistribute it and/or
9 B2 w9 p) M" q% B7 v9 ` - * modify it under the terms of the GNU General Public License as
# U7 c2 \& T8 `! } - * published by the Free Software Foundation version 2.
4 |6 u- P! h* z' k% B/ Y9 ]. g - * s- Y* V7 |" c8 B( s+ H
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any. {; F" N6 Z$ o( _
- * kind, whether express or implied; without even the implied warranty2 }1 ~: A$ T! C! p w3 _/ @
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the8 r% w8 W, ]2 H
- * GNU General Public License for more details.
$ _. a9 \4 Z4 _. o/ `# n5 N& E# o - */' y8 x6 |- M+ D7 @
- 0 p" V" F6 Y' m6 G
- #include <linux/module.h>
7 @$ B: a- O5 y' {0 H3 f% {- e8 d - #include <linux/init.h>! i! l+ k, X0 w4 r- r' h8 g
- #include <linux/errno.h>$ T1 s* U$ O+ x" V1 d+ a* ]6 c9 p8 F' R/ P
- #include <linux/types.h>
o+ W! r. X8 u Z - #include <linux/interrupt.h>* S9 e6 Y" L1 m' D- d! B7 I5 r; H
- #include <asm/io.h>3 F( K. i0 z/ L. t% t) m* |9 ]
- #include <linux/moduleparam.h>& s8 s5 J# O! ^' X6 c! K
- #include <linux/sysctl.h>
+ r! n( m1 c/ T \9 e' m* j - #include <linux/mm.h>: C* N0 }6 C5 `$ K
- #include <linux/dma-mapping.h>
, h3 h4 | P- \# h. W) M, s. I9 L
" o2 R; {6 N6 W/ k) x- #include <mach/memory.h>
b8 w$ B+ E/ u1 N* m0 x - #include <mach/hardware.h>
* k+ R$ S* O: g - #include <mach/irqs.h>
! R3 T( h/ Z( j" n9 Z2 u* ? - #include <asm/hardware/edma.h>
+ |+ w! t) t6 x9 l
) r; q( f: l* T8 D- #undef EDMA3_DEBUG
, @6 ]9 ?! M1 D. f/ g$ V7 L( P - /*#define EDMA3_DEBUG*/% b0 g3 D' T$ t* `0 n( q
( e! m7 g9 B2 F6 b1 e `0 ^3 }( A- #ifdef EDMA3_DEBUG. c+ C( l* H+ N0 m
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
# l9 g5 U- B- j! r0 S9 t7 ]7 ? - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 C6 B9 }+ b3 {4 k
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
6 i( P' K( R* X! _# f1 J" X) |7 J - #else
$ C/ c* u7 W+ N - #define DMA_PRINTK( x... )
7 Y( M+ N7 o3 n0 e( T - #define DMA_FN_IN: {4 |1 t+ E3 Y( i" Q
- #define DMA_FN_OUT5 R0 w F/ M4 [
- #endif: N/ r& {. \# J! E& B
- ! D; A- @' ~3 h `
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
; k: P3 b& ]% D6 S; { - #define STATIC_SHIFT 3# `. q* p8 t/ `. o8 |0 w* I) l2 w
- #define TCINTEN_SHIFT 20, U, y1 {5 U! _/ f M
- #define ITCINTEN_SHIFT 21+ X R! D3 l4 T; M% i
- #define TCCHEN_SHIFT 22
+ X# A8 m! d! u" m4 t - #define ITCCHEN_SHIFT 23
9 Q. C: o0 q" `( f- M" v
0 S8 ]& h( y4 Y6 {0 R0 O- static volatile int irqraised1 = 0;' e% `5 T& E1 `3 T6 ~1 Z
- static volatile int irqraised2 = 0;# Q0 y1 N( a$ ~9 [
o7 k- x6 v5 y- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 ~; m- U0 \0 b8 I: N% Q* t
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ y$ a3 A1 N1 F* |- f - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 _* g& K; A) F' T8 {2 V* h
$ w. R( l4 F1 }" a _- dma_addr_t dmaphyssrc1 = 0;
% J1 b& S5 l1 K& e6 w' G - dma_addr_t dmaphyssrc2 = 0;
8 M. y& a( ]# v - dma_addr_t dmaphysdest1 = 0;6 X$ u, @2 M) I9 t3 Q
- dma_addr_t dmaphysdest2 = 0;1 z1 m, r( \( G) r: {0 R$ c
- $ a7 i! s8 ]# g
- char *dmabufsrc1 = NULL;
9 S u, ~6 f) S - char *dmabufsrc2 = NULL;
2 R4 \. Y3 L2 E/ T2 _/ ] - char *dmabufdest1 = NULL;- n3 a. V; o4 K
- char *dmabufdest2 = NULL;
9 O1 K* U& f2 m# w6 N9 a: ? - 5 E4 _, p. f7 | S# `
- static int acnt = 512;7 ?2 d, Q* k( c8 S
- static int bcnt = 8;- l7 v2 _& w7 c# w& T2 |
- static int ccnt = 8;1 B' K7 y( q: L4 d
- " ~/ _/ ^4 T+ P7 H; D% S
- module_param(acnt, int, S_IRUGO);
J$ @& P2 v& k" h - module_param(bcnt, int, S_IRUGO);
# l% M; D) K$ i6 Z: a - module_param(ccnt, int, S_IRUGO);
复制代码
# E5 r& f/ S( _3 Q+ J N! v5 _ }
7 B0 i6 S* Y1 D+ N" b) T3 D) q 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* e& h' Z" z1 r7 K# R; 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 v& T$ q' a5 S# t; s 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ a! G; U* l' s6 J' H/ \2 j8 H$ J
+ m9 W" Y) H# M) R: s. o2 i2 K# [) D% s, G/ v
|
|