|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + C+ B$ ^% \& R
- [code]EDMA sample test application
8 H& {6 ~" Z" C. U6 A8 C: n2 L - /*
2 }: F* F# `" p. D - * edma_test.c
% \; n, Z3 L3 Y. K& J - *6 O* `( J% n1 |- B
- * brief EDMA3 Test Application* E9 G' _! S7 v$ }- O, c: @
- *4 w! e6 \+ U, U3 w
- * This file contains EDMA3 Test code.
" G+ u8 C& n6 L" [; N - *$ l$ W: l- H5 c' y1 Q3 N$ @) B
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 ^" I1 v& B, e+ _) p
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 K+ D; a: Q8 [) ]1 _. ^
- * TO CHANGE.
1 h3 a% b h+ v - *
4 _% Q4 R% J! I9 z - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( ?& R+ _$ ]& ]2 s1 ?$ f
- *
- M/ G6 ~/ }9 i5 _" z - * This program is free software; you can redistribute it and/or8 V( V3 N6 j* {4 k1 b
- * modify it under the terms of the GNU General Public License as
6 x/ d; b3 G9 F. g/ c - * published by the Free Software Foundation version 2.
6 S( \$ O+ L& z; Z( `$ m! x - *
/ [ i$ p% X" U6 x - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
& k& y: w, D" u! m/ M% w- Q - * kind, whether express or implied; without even the implied warranty7 C9 Y# N7 O# a% k
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ c/ `% r% J0 y, X) P$ P
- * GNU General Public License for more details.
! a1 J- C& c v8 x; x - */
; D8 I1 s' S: U - 3 c4 l8 f+ {9 }! T9 V
- #include <linux/module.h>
$ F# S3 r6 |* }$ R4 o+ D - #include <linux/init.h>% ^' g0 ~" r; B2 L3 n2 s' H) @6 f
- #include <linux/errno.h>- [; c. c) _1 `) `7 h
- #include <linux/types.h>7 [0 f. ~5 D) u& {* r- Q; l% P
- #include <linux/interrupt.h>. ^4 t2 h- G$ [5 n1 N
- #include <asm/io.h>
: m2 ?& p% |: P8 j1 z - #include <linux/moduleparam.h>9 C. d9 l' L2 e9 A! o! @
- #include <linux/sysctl.h>4 W; S7 E. b; _( b
- #include <linux/mm.h>7 f4 k" n2 y5 m
- #include <linux/dma-mapping.h>
" ^& d9 N( K0 T1 H/ Q# I- g
, S; m* Z3 N/ M% h& j- #include <mach/memory.h>
( C$ G4 [$ |5 t3 o8 i, L1 ~6 q - #include <mach/hardware.h>
8 E1 m! t8 J/ A5 | Q - #include <mach/irqs.h>
& M ]7 S' L8 ~ - #include <asm/hardware/edma.h>
$ v! f7 I K+ y+ }6 p3 w% P& u
; O# b1 F, _8 H3 p1 V4 W: x- #undef EDMA3_DEBUG* ^: M, D( {. E9 o
- /*#define EDMA3_DEBUG*/' ^' h9 G! v' f0 N2 I, m
- 9 D, T& {0 _- U# ~* T0 T# G
- #ifdef EDMA3_DEBUG
2 ~; G- i R0 Q+ \2 M' W - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), X/ _. s# ]3 v4 d. |
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
% F+ X+ Y/ p% q) q - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 Z9 A7 Y1 G% z
- #else
& S7 k: ]8 m) }6 u1 F4 G/ b& E, m - #define DMA_PRINTK( x... )0 k: }9 [4 ?" p/ y( }7 R
- #define DMA_FN_IN
) S+ _0 ^1 r4 X( F& X - #define DMA_FN_OUT0 F1 }1 c4 U( V" I* K' q
- #endif; P# [! @1 t/ p+ g- X, q; T
- $ F/ n, I) s* o6 j6 v
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
+ }5 n0 m8 b i' C( D3 B' t - #define STATIC_SHIFT 3
7 W6 D4 F2 L- c - #define TCINTEN_SHIFT 20
Y, `9 ^* S4 C8 S2 E - #define ITCINTEN_SHIFT 21
& \: A$ ~9 @6 j, p2 L - #define TCCHEN_SHIFT 22
0 N* {6 u1 u# C+ y' Y - #define ITCCHEN_SHIFT 23
0 ~( \5 q6 t7 s6 B - ' o8 D: j9 A0 J" J" L+ r$ m
- static volatile int irqraised1 = 0;& d" _& h ?; x6 y0 W
- static volatile int irqraised2 = 0;8 i1 f7 W0 x( I0 H. @" j. [
9 ^8 \( ]5 R! [3 A- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! c% r. X0 c1 s& v5 B0 O1 T
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% }4 D& h0 q8 y6 K8 _; N - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 V6 o% L" n4 B* f8 G' z
: R. K5 E/ ]) q- c1 x1 v- dma_addr_t dmaphyssrc1 = 0;
; _: S! X( D( o& x - dma_addr_t dmaphyssrc2 = 0;
( Y7 H f- s5 l# K0 Q- |1 Z. P - dma_addr_t dmaphysdest1 = 0;
3 M; r# o( O4 m0 [* q - dma_addr_t dmaphysdest2 = 0;
( C: @; _" Q* O
/ O+ G/ f. ]/ J+ b8 Y- char *dmabufsrc1 = NULL;; b6 S, v' p6 Q7 }& d7 {0 ]: D
- char *dmabufsrc2 = NULL;
* S q) r; Q. e, f+ }# _8 z+ m - char *dmabufdest1 = NULL;7 y7 A4 X; o; T1 ?7 s
- char *dmabufdest2 = NULL;( u! z J2 D g: r) d3 l- d
% }: g9 W4 f# s' D c- static int acnt = 512;2 D4 B! v1 I9 T, x m( C
- static int bcnt = 8;8 `( Y) J1 m0 }& p, M
- static int ccnt = 8;$ Y4 p g" d5 k$ R
! o/ V+ D/ T+ o- y5 m% {4 \- K2 S- module_param(acnt, int, S_IRUGO);( ?6 |9 W6 n* ]' i/ E A9 g- ]2 D; I
- module_param(bcnt, int, S_IRUGO);
& j4 x- [" j5 ?9 Y; t% Q - module_param(ccnt, int, S_IRUGO);
复制代码
3 [- R- Z5 f3 s9 W# ]: q6 F4 L0 W& Z, h$ M
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& s, n; F s9 z* O4 S8 e# E) A& X
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; Q8 m6 r7 `2 r
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 d7 g7 t- t. g2 P5 W* y% U
7 a# e$ b6 U. S/ e: j3 E
# u [ K! |& _* s |
|