|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 d7 Q% G7 f" \- [code]EDMA sample test application
3 q, z3 W! y$ l6 y- j; G - /*
1 a$ b) [1 l( Q( Z7 z4 W - * edma_test.c
; r; V5 a; `$ v7 S - *
0 ^8 g |- i" N6 h - * brief EDMA3 Test Application/ S, k) z2 v/ d2 C: g8 t2 W H
- *
" l" _0 l( t( e - * This file contains EDMA3 Test code., X6 g% j1 Y9 ]% f, S! K
- *% r( }4 t& {" P) D
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
$ J$ [# Y( ]' `* y5 W8 j9 z - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ J2 H. T: M4 E8 r) ^$ r h' U
- * TO CHANGE." e8 E4 ]1 }7 ?6 P# K/ Q
- *
- a& ?# y! w1 G - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ W& e: I# o3 d S* e0 b
- *
# z m- e1 I m# f. r, j! m* E, H6 [% q - * This program is free software; you can redistribute it and/or
! I6 M2 d" j% u; i- }; S! C - * modify it under the terms of the GNU General Public License as& @+ F1 [! z" N$ g- g4 P! M! l3 z
- * published by the Free Software Foundation version 2.
! w" i5 Y! _$ C$ M8 A- G3 t - *
3 m+ n# V2 @, p - * This program is distributed "as is" WITHOUT ANY WARRANTY of any' p; w' t8 M6 W
- * kind, whether express or implied; without even the implied warranty% F6 p) v: w4 {8 |8 K* l$ ]
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0 l6 }- Z$ \$ h1 f4 R, `# T' n0 y - * GNU General Public License for more details.( _; ^5 c/ \3 {% X. W+ W5 \
- */' q8 W! s; `$ |' R
% |; @% B: [; m! L, ~# h- #include <linux/module.h>7 U: R5 x; L, `' t# _; w
- #include <linux/init.h>
" a, [) O) V; t9 ~* N: Z+ A1 I+ ]. U - #include <linux/errno.h>6 ~2 B& {# U9 q1 z( T
- #include <linux/types.h>3 W) h. C8 j8 Y$ R8 e& C! ^* H
- #include <linux/interrupt.h>7 C+ L( G8 A, J( D# ^$ r7 M. _
- #include <asm/io.h>
% @. i7 Q7 M/ a - #include <linux/moduleparam.h>9 q/ b* X, \' l8 b$ T
- #include <linux/sysctl.h>9 u& P w2 x! b& X- n, J
- #include <linux/mm.h>
, u6 |9 q7 g5 w' ]7 @1 H" U! v# C3 J - #include <linux/dma-mapping.h>
, x+ M$ e0 N/ C& g' s0 A - 7 ^+ t4 k! d. X" Y, u6 _6 s7 `
- #include <mach/memory.h>
" E! m0 B- [# | - #include <mach/hardware.h>; f6 d8 P# V! m) k! M2 p
- #include <mach/irqs.h>3 X; }5 o3 @5 o% B, S
- #include <asm/hardware/edma.h>
- V9 h8 d% O5 i/ w5 }3 H - ' l7 ?" ~6 x. a" Q
- #undef EDMA3_DEBUG
9 W) D% _' a# L3 M6 |, N - /*#define EDMA3_DEBUG*/
: m' z& k2 E9 p# p( b3 U - 0 [: J2 N$ p- T% w( s* j
- #ifdef EDMA3_DEBUG3 Z+ }9 A. y5 X4 U
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): m0 T6 ~6 ]! Y/ \7 R& `
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
* Z e. p, l0 X$ L6 Y0 w8 H - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
. R( H. H* u3 l' s$ r9 p; v - #else
N; ?5 t. H v/ ]. t - #define DMA_PRINTK( x... ). r# P5 g! U& {+ r1 a
- #define DMA_FN_IN
0 T# b1 B4 x2 ?& a( S. Y- ?$ _ - #define DMA_FN_OUT
) F8 T- e/ w6 _' C - #endif
6 O2 U7 e) l6 E) r/ W1 K - 8 H3 C6 M4 S! R% E
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)2 }( P; `. Z& P) D' M5 j
- #define STATIC_SHIFT 3
9 V* H+ ]5 V$ y - #define TCINTEN_SHIFT 20
. Z: l7 g- b* k8 _. x - #define ITCINTEN_SHIFT 212 h- f/ R5 D0 k: e# _# B- g
- #define TCCHEN_SHIFT 22
; ?$ K( Y4 k9 ], V/ I3 N - #define ITCCHEN_SHIFT 23
; W: n& ?6 {5 ~2 _ - 0 U6 j1 I) s6 K+ _/ G2 M9 `
- static volatile int irqraised1 = 0;
3 |% l0 \) k8 ?, d) O' g; o$ I - static volatile int irqraised2 = 0;
8 M7 U- J, a8 G& k [ - ' C/ ] J' N! S" I u
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( q) N4 B8 U& O% {. p% N/ t
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% h/ p1 `( U' K4 Z4 R, Z - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- x% O2 o( G1 }; W* N( t
9 y# J s$ D9 I# ~- dma_addr_t dmaphyssrc1 = 0;
9 u$ ~' d$ e+ }, M4 P - dma_addr_t dmaphyssrc2 = 0;
2 N1 H- q% c* y2 D7 p - dma_addr_t dmaphysdest1 = 0;
* p. Z1 e1 S( B) l( @3 @ - dma_addr_t dmaphysdest2 = 0;' ^5 N, ~3 v" m/ L* R6 t$ w4 e, x9 }
- - \' Y6 m8 f5 f3 b7 M
- char *dmabufsrc1 = NULL;- ]7 G5 A' c {! l# V/ `6 u
- char *dmabufsrc2 = NULL;' h e6 r- j, Y
- char *dmabufdest1 = NULL;4 Y( {) |( _$ S$ X$ u; w
- char *dmabufdest2 = NULL;$ r7 q) S$ `) K' R+ z F \1 c% F
4 P X7 K' S( O9 X: f- x8 d- static int acnt = 512;
8 [# H6 ]3 ~+ p% e/ c; [3 K - static int bcnt = 8;
) A0 V Y( t9 x- L8 J" k( d - static int ccnt = 8;
6 ?5 f: |; |1 l& l% K5 C. V - 4 t, K$ B) H) l9 \* _9 S3 ~
- module_param(acnt, int, S_IRUGO);
' W; g2 U. B* K3 C - module_param(bcnt, int, S_IRUGO);- R& p/ D6 h8 M% k( E
- module_param(ccnt, int, S_IRUGO);
复制代码
: q$ |! O: C G
! H7 G( C9 c/ t! O! v 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 r( z0 ]! C9 z- N/ x2 H( C6 J
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/ B E# p4 O6 p( z$ u1 z$ y( Q
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& M1 _) p* q- V) v- V& _
) Y4 q' @; h& Y' C
( ?# p6 z C5 a+ [8 p1 K2 h |
|