|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: y1 O" O/ Y- f- [code]EDMA sample test application4 X& Z4 u" h% Y7 K
- /*/ J1 e' t# c7 p4 }
- * edma_test.c
- A8 z( _6 O# i# y2 | - *
) I4 P2 w* X' k6 j: R% [" N - * brief EDMA3 Test Application
7 K' J, p# L6 G4 e$ B" Q& U - *0 Z: |4 {: Z/ H
- * This file contains EDMA3 Test code.
! X/ p$ z% f6 R7 o1 `9 d: F+ A - *
7 X) B5 }% r; E: P - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
5 M2 K. e. Y# y: s6 f( W - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
) h/ V( W4 v! ^ - * TO CHANGE.+ a4 c! a7 a+ V5 A# M; ]1 i
- *
. a! A' M$ e0 c - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ V$ S4 }! G) Y1 s: T: F: }9 S
- *$ O" b! P: j4 v i g5 s4 m
- * This program is free software; you can redistribute it and/or
1 }7 ^) p% q% \; S$ p# O5 ^3 V5 X - * modify it under the terms of the GNU General Public License as& j1 m; O0 b& e1 D* C9 p
- * published by the Free Software Foundation version 2.
9 M8 ?& `( B- O# ]* \) @: ? - *
, l) |: Y4 {) } - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
0 M" {+ L' u4 m1 X r a$ a2 j- C; ? - * kind, whether express or implied; without even the implied warranty
3 z8 c) N; ?" U+ a$ o9 a - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the) n' {# ~: q* J$ n5 u; M- }" R+ e( n
- * GNU General Public License for more details.+ H0 |2 d( W& t/ j, z: @
- */8 m) Z( v. \9 H. c8 f
- J! @- t" T2 ]- #include <linux/module.h>* g4 U0 O" F" e+ n1 J, N& }' i Q
- #include <linux/init.h>! I$ K ]$ b4 @. L, C0 S1 R) [
- #include <linux/errno.h>
/ V: z3 }8 Q( g$ ~3 b2 J0 j7 v - #include <linux/types.h>6 v! z* `+ ]/ n7 y: l2 \
- #include <linux/interrupt.h>
! [9 o' h, N! A4 c1 C7 k - #include <asm/io.h>
5 Q0 S! F) b0 a# O4 c! g+ u - #include <linux/moduleparam.h>1 Z1 @& h' M. j Z. ?* T
- #include <linux/sysctl.h># V$ j( H. a) ~: I$ @+ z
- #include <linux/mm.h>
# G- o- ^7 s a; O) _ - #include <linux/dma-mapping.h>
4 q8 Y; L( ]3 W' ?
2 g9 I: T W/ _' _; O+ t- #include <mach/memory.h>
{/ w2 n8 n: x$ ^% d. M - #include <mach/hardware.h>' U4 M* x. H) G9 o
- #include <mach/irqs.h>8 d" y- R0 B* `# X8 V/ ]
- #include <asm/hardware/edma.h>) g) ]$ T, u% X5 W% C6 n8 z
- - _% p% r, n" y/ ^0 N* B+ K5 X
- #undef EDMA3_DEBUG
9 ^2 v+ e, {* a - /*#define EDMA3_DEBUG*/
! ^; P5 R* u, {+ E# |( @: }
& T3 k3 o; V }% s- ?- #ifdef EDMA3_DEBUG
1 g0 t( @) I1 V) l2 b - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
4 w4 A& R3 e7 S - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
: R* t7 W8 z, g4 ?. g6 ]9 O5 x) W - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) Y: @* a J+ d$ x
- #else
) H5 G4 J$ o: P4 a7 r - #define DMA_PRINTK( x... )
- m% m7 z% ?. |0 e - #define DMA_FN_IN2 j, l$ N! ]% ]
- #define DMA_FN_OUT- |# j* Y/ B7 P4 _% ?8 O
- #endif
& i1 j# y2 i! X& f/ f ] - 4 x# [3 ]; X5 S
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
# {$ i) q; H$ _1 J( p - #define STATIC_SHIFT 37 J5 W# p9 p. i4 u2 R
- #define TCINTEN_SHIFT 205 a$ M; W: N1 C* S
- #define ITCINTEN_SHIFT 21, ^' [0 R9 P) g c: P5 e7 p
- #define TCCHEN_SHIFT 22
, \* r/ c4 v% D1 h$ ~# ] V - #define ITCCHEN_SHIFT 237 R! W4 [* E2 z ?" d
- & [6 g; F" C) t% y
- static volatile int irqraised1 = 0;
0 k0 }, I! }7 f" O3 A - static volatile int irqraised2 = 0;7 P3 k4 W7 h' D
9 m- _, B' Z5 g$ K8 G" P/ P- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 K' ^7 M8 A0 H/ t& ^ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% X, C* o& P" N, \0 a - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. H8 X+ j! u4 D0 }, s( f
. q( L& h4 I4 w v4 U- dma_addr_t dmaphyssrc1 = 0;% x5 l# R2 [& @7 _ q, D. t" D2 y
- dma_addr_t dmaphyssrc2 = 0;
$ f/ i6 X0 @% b; J& @# I" R: b - dma_addr_t dmaphysdest1 = 0; [# F- ?" `4 @1 m3 t
- dma_addr_t dmaphysdest2 = 0;% ]# D1 ?% P& \# u) t& {) a
- 1 i0 a& r4 R4 c+ |
- char *dmabufsrc1 = NULL;% j! l4 [- F& d* L! D
- char *dmabufsrc2 = NULL;
I. t" v, [( _1 }( Z4 R - char *dmabufdest1 = NULL;
0 I! b. m1 T6 R3 U" H - char *dmabufdest2 = NULL;
/ |4 n/ ]7 v0 W5 [4 L- S i
9 m( `5 c2 H, L- static int acnt = 512;* o; s0 w3 [- }) ]/ x
- static int bcnt = 8;; I9 U, ?0 R$ o# L6 I. o! @9 x% x
- static int ccnt = 8;# v: |1 Z! O# l* ]( B
- - B5 J; \) ]$ ?5 L M
- module_param(acnt, int, S_IRUGO);3 ` I% q4 m$ W* e8 T
- module_param(bcnt, int, S_IRUGO);3 Q% y5 Q& @4 t! f% n2 q. [0 Z
- module_param(ccnt, int, S_IRUGO);
复制代码
7 S U; G: N4 h! X' z. ^
- F) f3 K. i9 u) j. b. l9 J 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# |# i. I# t( S% R# W" {( }
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 ]( q7 ^5 N9 o7 S" e. W1 v
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 F8 w( M4 u1 \, h# X7 z8 t: \ _2 x$ v& G+ I1 ^
) z' Z9 K f: q( [' N
|
|