|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. N2 w3 i) z3 t% a- b7 z) v* B- [code]EDMA sample test application6 q7 K9 H+ a6 O0 `6 h
- /*
$ v8 \2 \1 a5 c3 E - * edma_test.c
5 M0 |& J9 x6 n9 P, O/ B- \, L - *
8 u: g6 G* m- ] s3 V# D" w5 \! m - * brief EDMA3 Test Application
! o& } z& U; M6 v& z - *
- E$ f% _5 u$ t! v - * This file contains EDMA3 Test code.9 F" `4 y; x. e& l
- *
2 i; ~4 n! u8 s - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% B3 j/ ~" s3 S9 p9 {
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; E& j, H( P6 X4 n! M) n8 z, o
- * TO CHANGE.3 ?2 A! J% d9 ~6 g8 b
- *
* R) q# q4 X7 e8 U2 V - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
+ p: M3 y# M) \3 H! d - *, \9 e' i6 h3 }) w! X
- * This program is free software; you can redistribute it and/or
2 N3 x3 G8 _% W4 t/ ]. H - * modify it under the terms of the GNU General Public License as
2 h; g" e/ N6 S6 k - * published by the Free Software Foundation version 2.
/ k3 h% U* F- h4 ]3 s" t - *- m4 ?/ N) |, f) S, s8 | _
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
/ f$ o3 R& o; n G) e D4 y! b# @7 M - * kind, whether express or implied; without even the implied warranty
6 _! [- O5 a) r5 H* S4 ~- G - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
) ]1 F0 K/ J6 O R$ z" N0 i, M P - * GNU General Public License for more details.
( I( S2 @+ t# @1 N% @ - */* W& A! M: ~6 Z6 `
- 7 V$ D0 B& |5 _6 U
- #include <linux/module.h>; ~6 V3 `% b% f) b9 i) x
- #include <linux/init.h>7 i. @0 r. X- W6 k% C
- #include <linux/errno.h>* o% T: C; ^/ i+ T( L r
- #include <linux/types.h>2 S( D# w% o0 `$ M
- #include <linux/interrupt.h>
- v# K) m+ `- s3 j5 ?& y - #include <asm/io.h>2 P* l: r$ y6 d" a
- #include <linux/moduleparam.h>1 ?# o, \, q% c
- #include <linux/sysctl.h>
5 i: _/ S( v/ m: o7 l+ E - #include <linux/mm.h>0 ?5 F* N9 ?; C$ \' X4 _* c0 @# M* M; @
- #include <linux/dma-mapping.h>
) t, |0 F6 l% \% |7 {: _3 x
. b$ x+ E4 _1 v+ G3 Y- #include <mach/memory.h>0 ~' y8 F2 t; \/ `( l1 O7 M# p
- #include <mach/hardware.h>
2 H$ b- [: T6 |- C; z - #include <mach/irqs.h>' f. s# R$ _! W( u) F/ M7 }3 d
- #include <asm/hardware/edma.h>
5 E2 |8 S; p5 c
3 a2 E6 A, d' R% H. a) ~7 f2 b7 i) p- #undef EDMA3_DEBUG
, J0 J7 q- H ^ - /*#define EDMA3_DEBUG*/$ \/ `- y+ p% C
- ! d! H; h: F& `8 X& K( u9 n
- #ifdef EDMA3_DEBUG
: z/ `( [8 r0 w$ c d# ^ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" } A2 F: i6 I J) G' i
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
3 n- t6 R3 C" q4 [9 l8 B: \. u4 k, Y" Z - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 Q+ D) W' |0 q" q* T
- #else; n; Q6 |5 z6 X* e
- #define DMA_PRINTK( x... )6 f1 l5 L* H0 h) N# o
- #define DMA_FN_IN8 N' F' K0 M. v- }0 I) r5 H
- #define DMA_FN_OUT
1 Y! o h* M" D+ l \- Z - #endif. o$ R. u1 L+ q" b: w! w& s d3 L
) s% n" T8 r, _2 Z- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
9 |5 K, I& w& P3 \% P! U I" v - #define STATIC_SHIFT 3
$ L W0 u# `8 n: v c; V. `0 H! i - #define TCINTEN_SHIFT 20
6 O4 b% n* g: Q% ]0 t1 o - #define ITCINTEN_SHIFT 21
4 g9 U e. }, A4 U- ^9 L$ \! Q - #define TCCHEN_SHIFT 22
7 z+ K9 Q7 r# L8 }* M- ~ - #define ITCCHEN_SHIFT 23
$ f4 r1 n9 D$ S2 P - 1 h8 s j: x r1 T+ S, Y& e
- static volatile int irqraised1 = 0;
% N5 E, Q: E- L, |/ ^7 r9 i - static volatile int irqraised2 = 0;4 ~$ X% T1 E( d4 j' R% H! J
6 X9 A9 @2 F) \1 u- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 f8 D+ {; c4 H1 G% l - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* b0 ~7 r# [$ t5 E; K7 {8 M: f
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, A, L8 O3 G P: h - 8 j( X. N7 K7 `8 A, J9 r
- dma_addr_t dmaphyssrc1 = 0;
1 B& Z; E' t6 O9 C8 | - dma_addr_t dmaphyssrc2 = 0;1 c# d* L1 ~ d
- dma_addr_t dmaphysdest1 = 0; E' F9 M* X0 j$ v; i
- dma_addr_t dmaphysdest2 = 0;
1 ]7 k7 _2 W7 U, H
$ w" [) z! s5 A6 W; D' t: g- char *dmabufsrc1 = NULL;
9 y" G. d- V! c# ^' ~ - char *dmabufsrc2 = NULL;
# _1 l' ]" m ~3 u - char *dmabufdest1 = NULL;, c" Y/ j1 S3 ^ M8 P' P
- char *dmabufdest2 = NULL;
: V! I2 [ e& {1 N; J/ S
2 c) E# B9 W- B" E- static int acnt = 512;6 q, p& ]) r, h) t! Q
- static int bcnt = 8;: E4 s E, D, [# M, ?- Z
- static int ccnt = 8;
" x8 \5 r( B& _* ^5 N - ' ?4 z1 F7 m& |
- module_param(acnt, int, S_IRUGO);
0 C0 ~7 d/ w: [, d8 S9 ~ - module_param(bcnt, int, S_IRUGO);5 N) `0 L4 ?5 f, E6 R$ Z; F2 e
- module_param(ccnt, int, S_IRUGO);
复制代码
3 s$ H5 x' ~2 G- s x
# L# C9 e- n6 t v3 ? 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用 m7 ~% B- I7 v: U2 P( Z' l; O
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( r2 l2 p) n, A$ g* H$ p
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ {% Z5 w; q) ]$ y$ b( ?
9 p! X. F, ^: O
" a/ h! J- T( Z9 n$ H |
|