|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 [! i# P, ]& r& \$ w* q% G
- [code]EDMA sample test application/ [ \8 Q- J2 r# `# X
- /*( Q' v A- z: q- Q6 [5 u: D/ F
- * edma_test.c
6 z# W: w: t6 F* Y; g3 S - *. z! ?9 v l, ~
- * brief EDMA3 Test Application
5 H, N. D& |9 M% p - *
8 N$ o/ j3 ]) }. L g: z7 C, }' i7 L - * This file contains EDMA3 Test code.. E* s0 k+ Z6 J M+ g3 h. D2 g
- *
9 H* k: v$ q7 `& S/ A - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ b2 k8 E5 |! m, l
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
, t! h3 e( `0 r7 t3 x+ C - * TO CHANGE.' d2 p8 C2 n; d( n- {
- *7 ?/ P$ c7 I4 R
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
5 Q( a- H$ b8 X; D) D - *
+ ?& b+ X k( h# o - * This program is free software; you can redistribute it and/or
d/ E, `2 A" X$ Z9 {+ `+ V" T) e - * modify it under the terms of the GNU General Public License as" q; ^5 {/ p: S3 V
- * published by the Free Software Foundation version 2.6 s- c, R' B1 ^; T
- *% \: F6 q& X. W+ S
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
- ^) W6 X1 W: O4 M0 w* B0 ` - * kind, whether express or implied; without even the implied warranty9 E4 ~: v# t0 U* w% L, V
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6 i7 }) J8 `/ P& U - * GNU General Public License for more details.
# b: a! e$ y1 F - */
2 L! S+ \" S) L4 e2 q - & t! r0 Z. U( D, ~4 C- Q% J
- #include <linux/module.h>
4 ~( @, F& K. p) l3 P9 {. @ - #include <linux/init.h>
' O- K5 D" j: E! ^. {; d - #include <linux/errno.h>7 \' F) a7 F7 e3 y9 E6 p
- #include <linux/types.h>
7 P: ]2 l9 g* c1 ?/ J1 P4 ~ - #include <linux/interrupt.h>
) ]) K# [: U3 y6 E1 w9 e - #include <asm/io.h>' R, Y1 Y- x4 m& x" b
- #include <linux/moduleparam.h>
$ D* e5 y( G/ H5 v, W+ Z# `6 e5 N - #include <linux/sysctl.h>+ W$ d5 K5 S& P, B, R/ _! p
- #include <linux/mm.h>2 n8 z" q0 s$ {/ P0 U8 F6 O
- #include <linux/dma-mapping.h>
W; M2 J' Y: H* V5 O ~! u( d
5 @, |- C+ c0 Q- b- #include <mach/memory.h>% O. z+ x2 u/ _
- #include <mach/hardware.h>
e6 [6 @/ V4 x - #include <mach/irqs.h>1 D- }; u+ Y+ ]7 Y. [
- #include <asm/hardware/edma.h>1 E- c! T2 J# N- {) X5 z
" M. ]2 z5 ~; g: ?8 i2 R( n+ z- #undef EDMA3_DEBUG
3 t/ z5 I' ?& K! u5 | - /*#define EDMA3_DEBUG*/
. y2 T% B6 }# M8 P w - 4 H3 |, ], e/ ]) m5 r" ^
- #ifdef EDMA3_DEBUG8 w8 _* y4 c- Y w- H; n& n. g5 ]
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ Y3 k" v1 s, N0 m$ P
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
4 Z4 V( J( d* A - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
6 t I4 v) P, r: T - #else& T$ t+ Q& W" n7 Y' L% g( b
- #define DMA_PRINTK( x... )/ h: {8 F# o* U* X
- #define DMA_FN_IN% W* f+ f2 C' R# i' d
- #define DMA_FN_OUT
2 w0 Y* I- r7 ^: q" @ - #endif
" C R! g, ^0 R7 m5 g: A" C# O1 Q5 Q
6 d# ]4 [$ j6 m* m! U( |" W% e- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
2 H6 ?" T# k4 s1 [ - #define STATIC_SHIFT 38 s n1 y7 Z1 w. G
- #define TCINTEN_SHIFT 20
! w1 ?) u' @( N! ?) T: e - #define ITCINTEN_SHIFT 215 A1 z5 ~8 V8 w3 V' g$ k( d6 I
- #define TCCHEN_SHIFT 22$ b5 G6 j. I* ]% |3 U& P
- #define ITCCHEN_SHIFT 23
. v. v- T7 ^9 _) I - 6 c# Q5 l0 e _) m8 ~+ l/ E
- static volatile int irqraised1 = 0;9 S7 \3 P8 i9 y: V% g$ S
- static volatile int irqraised2 = 0;. T" w$ ?, i2 J7 \& e4 n: f
- $ I5 b- O8 s2 \( j/ v+ U
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ C; V3 G4 _* h5 n& p0 R
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ ]. {, \! v. g! ]7 C P( d8 H7 b - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 q; Y% N: d; S$ V# [$ `% G
+ f, L! c* j0 B& R, h3 i- dma_addr_t dmaphyssrc1 = 0;( T3 F) [" E* O
- dma_addr_t dmaphyssrc2 = 0;
" X: U. U" d1 w$ [ - dma_addr_t dmaphysdest1 = 0;, |7 \# @- _+ k3 h3 U; y! |/ x
- dma_addr_t dmaphysdest2 = 0;8 y% p* g9 y0 j# F# j& s: b: O# V
: o9 p2 l* y" r2 }1 U- char *dmabufsrc1 = NULL;
! C$ J1 }& A2 s* C - char *dmabufsrc2 = NULL;" g' W- E) Q6 P. A
- char *dmabufdest1 = NULL;! l! S ]% P& z9 M! s6 C$ R a
- char *dmabufdest2 = NULL;
- v8 t A/ T4 L: X3 r0 Z0 @. W' Y
1 J! c6 P% G& H7 A7 J+ c. L- static int acnt = 512;
: W" d$ j3 H6 Q% H# V- a" \3 W9 S, u - static int bcnt = 8;8 z5 {% d5 H$ n/ b O _$ }
- static int ccnt = 8;
, L0 }; v& T4 [3 q7 x. W6 Q# n0 N - # d" k7 B0 {( r- U( T
- module_param(acnt, int, S_IRUGO);
( O6 y, p9 H9 J: i3 e - module_param(bcnt, int, S_IRUGO);9 w: |6 E) Z! n8 g- m6 N; J
- module_param(ccnt, int, S_IRUGO);
复制代码
( q8 r$ X4 C, }; D1 \0 D3 O/ N/ {6 M0 c% y2 M
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 \ Z. D# H0 N l
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 W8 V" }4 c: A7 _ o
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 W6 Q) K2 G8 W- u8 K' k @0 n3 x& z6 w w6 Z0 s: W. o/ t
: D$ o" e1 I$ N$ {2 u! k! s, X9 _ |
|