|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . p: R q3 }* n1 `
- [code]EDMA sample test application
- f) o7 M: K1 ]* ], T - /*
; ^# l" a! M2 t" ^$ X - * edma_test.c
8 W3 v. v% j* ]% I3 K) u K, [$ R) J+ E - *
! M8 X3 `" a3 ~. M+ ~ - * brief EDMA3 Test Application
& n; s6 A( T _. j7 J% S" E - *
6 x( ^3 K* i( K' Q+ B, E/ N; | - * This file contains EDMA3 Test code.
, n% t; J7 s, J0 L - *
; R; [# \9 K: |1 N0 O# U/ M: P - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
H% F( a7 \6 K - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
$ u/ }, E: }8 [: i# L, N - * TO CHANGE.3 D. i+ c% v7 O# g5 ^# a
- *
- X" x# t/ m0 ]4 @* R0 ` - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ j0 X* M' {1 c0 `! k* I
- *
( ]- i1 K& r; e - * This program is free software; you can redistribute it and/or5 i% E; b! P7 Y- s. V5 p
- * modify it under the terms of the GNU General Public License as
) I3 I% I- e( J- }* D2 S; H - * published by the Free Software Foundation version 2.
! j& z9 u5 o I$ Y4 e8 g( \ i - *
" w% F6 y @4 M' | - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
4 e. g+ O2 f6 R; u; @( a3 ` - * kind, whether express or implied; without even the implied warranty
X; ^4 Y8 p% t% h3 J& f - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ s2 c" e5 X$ L+ l5 P* I - * GNU General Public License for more details.1 S& e8 x. l; E
- */( P' K8 A) R& L1 i, I4 f
- $ u: {$ j ^; U; Z K# r7 g
- #include <linux/module.h>
; K& I, ^6 E8 [# b* z7 C - #include <linux/init.h>
; C) H- ~* a+ ~" N' z - #include <linux/errno.h>
+ b) q, F$ V2 A- A - #include <linux/types.h>
. O' G; {& `) ~7 \+ b2 c - #include <linux/interrupt.h>. q; N |' p; o- U6 ?, e/ b3 o
- #include <asm/io.h>
( B: i% Y) D' t' Y& J$ z - #include <linux/moduleparam.h>4 j4 N: A2 c; W. F8 K8 G, \
- #include <linux/sysctl.h>* w) x: U3 X, o3 i
- #include <linux/mm.h>
. j. s* g7 j1 ]$ z# m* g* c" f - #include <linux/dma-mapping.h>
! t: i4 H( V- K( a$ x - 9 m/ e. ?/ H3 N. O9 D
- #include <mach/memory.h>- X0 @6 k+ a6 E5 |
- #include <mach/hardware.h>+ v! z2 g/ B) k* e& d" T$ c
- #include <mach/irqs.h>
# ~ G) F) b2 b: Z, h - #include <asm/hardware/edma.h>, L5 z& P- W3 }! o* I7 g% ^
- . @: `: Q- u. @) S$ |2 a+ \
- #undef EDMA3_DEBUG
+ W7 x, }% W" O8 R: W - /*#define EDMA3_DEBUG*/
4 ~3 u5 C/ M T% V- f- D - 8 o, {: ^+ O7 ~/ \
- #ifdef EDMA3_DEBUG
# C+ p0 V" i5 Z, V3 q - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 M' _3 ?& H- n% Q$ {1 w
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ P; ~& J1 A& o( ?4 M* O
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( T) v+ }, n% \/ X4 `! z1 H+ X- x
- #else
5 l1 F( B x& A* S9 C# L - #define DMA_PRINTK( x... )
1 L4 m7 f" k+ z2 H - #define DMA_FN_IN8 t4 m, q2 }0 u
- #define DMA_FN_OUT" y# g! V. W: ?
- #endif
. K5 P$ r( [$ w, j, T" C3 G! _
; a8 K7 E0 z4 x3 | ], j1 h- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
, I2 E2 F" \( E) _ - #define STATIC_SHIFT 39 \: r" W. W9 O4 ?8 [
- #define TCINTEN_SHIFT 20
7 g& Z9 Y1 o5 k7 x9 k- G7 m9 }% j - #define ITCINTEN_SHIFT 214 n+ T: O" w) W X- g' h7 L4 N$ }
- #define TCCHEN_SHIFT 22& y' ?/ E' x5 e2 t
- #define ITCCHEN_SHIFT 23# r z. ]. |0 [4 F
/ r. L, S. S6 T, F- static volatile int irqraised1 = 0;
5 F1 Y# }: m% [ - static volatile int irqraised2 = 0;
& `7 Y$ {; f7 J6 P" b" l - 8 C8 v6 t( {! x4 n
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; A: n* K- J/ X) Q) e4 O: l - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" U; C6 ?3 o& B- Y) u - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! t0 z W9 X4 F0 M
) u" F+ d9 {- O4 d c. t- dma_addr_t dmaphyssrc1 = 0;5 Y6 J$ n2 ]- Q0 {( T. J: Q
- dma_addr_t dmaphyssrc2 = 0;
- D ^" K/ {2 F" \; D. {$ H1 i - dma_addr_t dmaphysdest1 = 0;
: V* C7 ]" M! ^- L7 a - dma_addr_t dmaphysdest2 = 0;
; n6 g3 M, |( ?# K" R% y4 o - 9 |" w" G* B+ w% ]
- char *dmabufsrc1 = NULL;6 G; M8 g! J9 Q5 u: C% V
- char *dmabufsrc2 = NULL;$ l( _( @0 ]! y" B2 Y* f1 M# R0 ^
- char *dmabufdest1 = NULL;
! J# {& Q; l: X: i4 b+ U - char *dmabufdest2 = NULL;
( ~- l$ p4 s+ F" z& X3 j$ X! v# X0 X
- J/ l5 \. v# M! e! E8 y- static int acnt = 512;
4 w) n- [7 |/ h4 E! x - static int bcnt = 8;
1 Y- a6 \6 C( k2 f' d, Y5 q- D5 [4 M - static int ccnt = 8;: Z$ b$ w6 q: w) Q
+ E2 U, G0 B3 I# J0 J w. g5 |# h: ^5 C- module_param(acnt, int, S_IRUGO);+ F; k4 `8 G+ i$ ], f; w" `
- module_param(bcnt, int, S_IRUGO);- ?; \" Y9 X% t3 [
- module_param(ccnt, int, S_IRUGO);
复制代码
, \. s1 A$ }/ x' y) H
: ~0 y2 @- ]" s) s6 a: Z+ B 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# ^, K( R( A; H6 A
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* x/ T4 p9 @# P5 P0 K5 ]5 i/ s; d
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( { z& K: M7 Z+ Z: r2 d$ j# h4 ]% Q7 F* ?
0 ?& T5 P, o+ `' K- T
|
|