|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; {4 k# q# ~# M. m4 P8 I( U4 y
- [code]EDMA sample test application
$ z$ x& P; V" t5 H - /*. ~7 A, c+ ^% |. f# R! o
- * edma_test.c( K5 K! _+ W4 T, _( a7 x/ D6 A& `! \
- *
; n" O" v% K1 r% l- O2 O - * brief EDMA3 Test Application
% e* g( k n8 t# G - *
1 E+ G8 R% H( D: Y - * This file contains EDMA3 Test code.
, D3 f7 c0 _; ] j4 R4 r' \ - *
: Q* D I% ]5 J! e$ \ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 c# N Z/ s) X z
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
# q/ \! \. J; {7 _* X - * TO CHANGE.
5 n A/ w' w: M0 ^0 q3 n - *7 v: u2 a5 i# d o6 K+ z; i
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
" v' k: ]# e0 M& \: c/ Q - *
8 }: T! v9 l/ K$ l# B - * This program is free software; you can redistribute it and/or5 x0 q& V+ e/ j% [! g" D
- * modify it under the terms of the GNU General Public License as
8 B: r8 G7 f' W' N3 M - * published by the Free Software Foundation version 2.* _" J! f1 |" H% n1 b$ k' j
- *9 N- [& R# I/ ]; y" \
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
. H% [, e6 a- s7 { - * kind, whether express or implied; without even the implied warranty
$ v# R$ ~$ O9 r! ]5 S* a) D - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4 V# M# l; L8 E- u5 v5 j. @ - * GNU General Public License for more details.
0 [( l) T' G$ D9 r; e - */9 V# }- @1 F" M1 T, I: j- D# c
2 H5 N: z2 d4 v% C( }' ]- #include <linux/module.h>" ~: i# M& w9 Y. n; N
- #include <linux/init.h>
; Q0 ]/ w7 N, W - #include <linux/errno.h>
! i% v8 [! O! ^ - #include <linux/types.h>3 r* s9 P1 U) R c: O; k
- #include <linux/interrupt.h>
5 P5 q. Y8 D f- ^0 Z. Y - #include <asm/io.h>0 I2 ]: a& K; \9 v# W( C# q
- #include <linux/moduleparam.h>/ L8 N9 y N' y2 O o
- #include <linux/sysctl.h>) X( n' ]" V7 m' V+ H6 q
- #include <linux/mm.h>
3 [7 {& ], C( V, A& T - #include <linux/dma-mapping.h>
/ `4 ~! R; }2 s9 b( _: c& I
' P" D& f) T0 O/ y5 s1 A- #include <mach/memory.h>
7 n1 M+ |, V- _; o9 v8 k - #include <mach/hardware.h>
, S) V/ u% k3 u2 p - #include <mach/irqs.h>/ n+ g3 @+ | K3 n s
- #include <asm/hardware/edma.h>
' E. @, y& c+ Y% F/ @* R
1 Y. I. z, Y3 t; s: ]6 t- #undef EDMA3_DEBUG" t" s5 \6 E! m' Q0 V8 q, e
- /*#define EDMA3_DEBUG*/! c& ]- \$ U# ^5 R( u( v: ^ k
9 a" ?. _! C! B/ ]. d" ]4 {- #ifdef EDMA3_DEBUG: z) i' ]* N9 t' \( t2 Z
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
+ ~9 _7 T I* n0 P, u6 e9 u; Z! |$ C - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
% W8 v. M0 ~; k0 x( r - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ x E% K5 W; T( r) r
- #else
" v1 J0 f3 G) J5 F( B3 `$ S - #define DMA_PRINTK( x... ): e$ O3 |/ j3 t0 ~
- #define DMA_FN_IN" r, Z- b# F- \/ j
- #define DMA_FN_OUT3 R5 e) Y' `9 C9 [
- #endif4 `- l+ v" {7 U; @
* ? t0 H( q7 n$ }; `; o% u- #define MAX_DMA_TRANSFER_IN_BYTES (32768)7 `: F% U; L: [* g2 p5 x
- #define STATIC_SHIFT 3" U. I/ m+ S( C( S8 a( _
- #define TCINTEN_SHIFT 20; }8 Q) e9 E; r
- #define ITCINTEN_SHIFT 210 D# o/ \2 ^$ |( E. b( c
- #define TCCHEN_SHIFT 22, f6 P8 O/ p+ |2 I2 ^& x7 ?
- #define ITCCHEN_SHIFT 23
+ F6 J! T* X& b5 ^; X: l
' ^9 @" y" K0 Z9 r/ J- static volatile int irqraised1 = 0;) ?+ ^0 T3 Y2 L
- static volatile int irqraised2 = 0;
0 g/ E7 I( @! J/ h! ?0 I - ; t$ ]. i- {) p
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ y: Y9 _6 ?1 p: ~$ Q0 Q% C- n - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) ?) D6 D5 \' C- @
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
S2 p w4 j- I9 } - 6 W& `' W9 s" ~' V; g- A
- dma_addr_t dmaphyssrc1 = 0;
4 V" f6 M/ y+ A6 l) I3 r6 B- j0 x - dma_addr_t dmaphyssrc2 = 0;, h9 |0 r( B' S2 ]$ v
- dma_addr_t dmaphysdest1 = 0;: q* y* V- E+ E4 a* E: s5 S q% A
- dma_addr_t dmaphysdest2 = 0;
) {' O7 E; r; ~! X( h9 n - . y9 Z, f+ Z6 y3 ^- Q
- char *dmabufsrc1 = NULL;
2 ] z7 K7 W( P) O- M6 ]5 d - char *dmabufsrc2 = NULL;) j2 M: k. @: \4 ^& y; z# ?
- char *dmabufdest1 = NULL;% O" H+ T: d% `( P
- char *dmabufdest2 = NULL;
; }+ p" V2 C) k6 u% ~ - - H" e- {' O- |4 K$ w% ~( `& c. Z
- static int acnt = 512;
$ y5 R; ?$ l" i i - static int bcnt = 8;; D9 W& ~7 a. L/ s) v0 `$ B9 Y0 e
- static int ccnt = 8;
- M' o, l9 t4 j' X - % c4 M/ [0 P4 \# S7 G" P S
- module_param(acnt, int, S_IRUGO);
4 t# {7 p$ o& F! l# \ - module_param(bcnt, int, S_IRUGO);
) t6 B5 P' ~, ?& D5 Z - module_param(ccnt, int, S_IRUGO);
复制代码 $ n) ~' E$ L' a. Y. j7 g5 v- d
! F9 H( G H7 o/ @/ G6 f! Y
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. x) J9 V6 Y( v: L, P) e1 marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ U6 d( X$ I! i% i# D' m 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( f6 S; s# m2 f
, o# _ a7 Y* f7 t' l# _# f
7 R; a( W8 d: q c/ i1 ? |
|