|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 Q0 R9 ~: D0 k: e+ V: Q8 u2 ^" a- [code]EDMA sample test application' K& }% h7 f! v7 V3 I
- /** N' z, R' }' L& s* q. @
- * edma_test.c8 R5 \1 o8 n% j# |. `
- *
0 M' h/ @7 i" j' E* N7 a( p0 i - * brief EDMA3 Test Application; S3 F: k: {/ e% {) e' a0 x. T( F+ u
- *
; h/ C4 D6 V, U+ e8 d) }8 S( O# q - * This file contains EDMA3 Test code.9 r3 W+ | T1 b0 u `
- *, [* F) ] p/ j6 S8 G6 \ d
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 M6 |. i6 W( S! R- m
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
( ~: c! k% Y' z5 A - * TO CHANGE.
2 N$ z7 p0 b% ~% Q' z - *
1 x$ d% _6 s: Q" y* k G - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
; S$ Q% v3 m. q- E. u9 t: v - *
7 p% O, l! D/ \; z - * This program is free software; you can redistribute it and/or2 n! ^+ i- f6 Q" A& q
- * modify it under the terms of the GNU General Public License as
2 d$ |6 p+ F7 d' J7 O! H* W3 c2 x% Q6 W - * published by the Free Software Foundation version 2.1 J" b& x3 S+ V/ l0 t e% R* s
- *
' e$ ~. e0 N1 R$ h- E! ?* _ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
& ?7 R% Z- K6 L - * kind, whether express or implied; without even the implied warranty; y" U3 ?. A0 ^& w" ?
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; M+ Q1 w5 m3 R f! B2 j' d - * GNU General Public License for more details.
, m6 D% q; J( z% X8 ^ - */
; m V0 ?" X. f% j# Y# l
3 ^* e( p1 w5 N1 y- #include <linux/module.h>
0 l. A5 Z! F- s7 G- r - #include <linux/init.h>
+ g6 L" t& K' _' p$ I, m" l% n - #include <linux/errno.h>! T2 ^) w) e& @1 z; f
- #include <linux/types.h>0 ^2 D# n% Y2 w# D' z) q+ C
- #include <linux/interrupt.h>0 v- p9 y4 k7 o0 p
- #include <asm/io.h>% M( v& F3 U( _+ V: n
- #include <linux/moduleparam.h>8 j. h1 `/ D- }! v2 g% `8 i
- #include <linux/sysctl.h>4 s2 q I% m# F4 [5 g6 P
- #include <linux/mm.h>) ^: d* L; M6 @3 v6 ?( |
- #include <linux/dma-mapping.h>- t6 q" T0 B9 `! |; r
0 j! ~2 B" P0 `/ Z1 h9 t0 Z1 m- #include <mach/memory.h>
$ ?# h) v$ `2 w5 S- B+ P, `; y - #include <mach/hardware.h>
+ J& Q7 [0 j6 s ?/ S. r - #include <mach/irqs.h>
9 X. w/ @# u4 W e# d6 Y - #include <asm/hardware/edma.h>9 X; q% B( p; J# P
- ! `9 q8 A6 p# ^( @! ^
- #undef EDMA3_DEBUG
5 k( l# t a3 P - /*#define EDMA3_DEBUG*/
5 w$ N0 I8 o9 _! H$ c
/ N( ]' c7 m% D9 b. ^/ C- #ifdef EDMA3_DEBUG) G4 F% g" _4 Z% M% g [4 s
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( c: f \$ K/ p0 T1 u0 M
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
4 `/ N- q2 J6 o* d: d - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& i) w$ r+ u& j
- #else
3 ]( G- j" i! S7 u9 X - #define DMA_PRINTK( x... )' h0 c1 Q1 A) |9 ^, ?
- #define DMA_FN_IN
! ~- j. H) e7 d3 P, q* R+ Z - #define DMA_FN_OUT
6 I2 z" @1 f# \3 I+ r0 Q0 L" m @) O" _ - #endif. W4 f0 w4 H) F- X& h2 N1 c
- 1 M* R2 G4 O! ^! T, c; H5 o1 ^1 a
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
$ i; d* l1 g1 W. }. o - #define STATIC_SHIFT 3" B! h4 G( @* Q$ c+ ?1 h
- #define TCINTEN_SHIFT 20
7 E5 d/ z1 ~- R1 l) l4 y - #define ITCINTEN_SHIFT 21
+ E" a' p# P% N2 W8 v+ p% t - #define TCCHEN_SHIFT 220 S5 o* N* T8 ~% ~
- #define ITCCHEN_SHIFT 23
3 T9 G6 \7 }) p+ M4 L a; u8 O
9 g, x- b. p: l$ p5 y- static volatile int irqraised1 = 0;
; b1 r" F8 F- b2 E3 Y [ - static volatile int irqraised2 = 0;+ ~. g8 O4 s' t+ s6 @ X: e
! E. l( A) f1 w( ?, l n+ D; ~- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 I' B# d! _4 U7 }! w - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- v8 X. D. w5 b8 X8 `* [. N
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 k1 p) F& Z) n1 u* v% j6 Z
- ?; ~5 i2 ^4 N+ r' S- dma_addr_t dmaphyssrc1 = 0;
; K# c3 x! i# ~" ]7 |( A4 N - dma_addr_t dmaphyssrc2 = 0;2 g0 b& j7 F+ Q3 Y! H7 ]& N% F
- dma_addr_t dmaphysdest1 = 0;
% {. J" |6 a. A \7 h - dma_addr_t dmaphysdest2 = 0;
5 U* i' [5 C' U9 c& H# ^0 l
+ J; e1 N) X! U ~3 ^4 W- char *dmabufsrc1 = NULL;! L2 P0 z; D* J H* C
- char *dmabufsrc2 = NULL;
+ ?9 U% w& H9 g( v - char *dmabufdest1 = NULL;+ b5 R3 v0 b' j% N; J
- char *dmabufdest2 = NULL;
- @7 X' Q+ }8 ~' a J; c: {
7 {! o( ? a. M w- static int acnt = 512;
0 b0 w* Q& o3 ^: [4 t' i8 Q - static int bcnt = 8;
5 ^7 @ v. e9 ^2 @& A/ n - static int ccnt = 8;
0 F' {7 Y+ C! G
. ]8 f! n) B. A% M% y; F" K- module_param(acnt, int, S_IRUGO);
. E* R- I# t0 D) Z( r1 Y5 y4 v) c: _6 i - module_param(bcnt, int, S_IRUGO);2 E2 ~! ~; R# `: t$ x$ g) W, q
- module_param(ccnt, int, S_IRUGO);
复制代码
/ ^) D: k- I3 Q9 i* L1 e+ Z- a( d3 C$ E& K; v5 H4 w0 O1 X" S$ w1 C
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. e* F) a5 _4 s- M4 b9 Qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
3 h7 ? V: v q: K* S 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" d0 L* w3 u6 c9 P) Q; Q g: i/ S, }% C4 [$ b6 i0 v. [! z1 l6 \! K
/ c( o; X$ p, r8 h ^$ N* ~1 x
|
|