|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " o/ y) {& N& z' O5 r2 ?
- [code]EDMA sample test application5 F8 n. B& ]/ d7 x V3 y7 O. O
- /*
# M7 J0 y9 T- r; f& i% m - * edma_test.c
; N. f9 l2 Y: i( n5 w3 p - *1 N' v! f) J" m1 s) _+ L
- * brief EDMA3 Test Application+ L- g: P6 H! G1 u
- *
4 U( {2 r/ X3 J; \ - * This file contains EDMA3 Test code.; V6 a/ G' m6 |
- *' D: a1 n: U& J6 E8 j# ~! v
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
4 u% O- b' }, e% R% @ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& ?* E) M) B' o$ f! x9 x
- * TO CHANGE.
; H- u0 E7 z6 t - *
7 c! K0 V2 o1 w2 X - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
& x( _1 {3 L8 n; Q6 ]" l( Y - *" t7 Y% ^6 V9 f8 C' l
- * This program is free software; you can redistribute it and/or
/ f9 J u# X; e6 n) | - * modify it under the terms of the GNU General Public License as
9 `1 L9 Q) r. O2 Y6 [$ t - * published by the Free Software Foundation version 2.. Y: y) K5 M/ g ~- g
- *
* K8 y8 `! }3 y- O - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
3 S3 [( R+ d2 |% E9 G2 a! o - * kind, whether express or implied; without even the implied warranty
/ F6 b' {6 k4 @& M! F( [. h" u, \. ` - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the& u& {3 ^4 r7 _! F' u
- * GNU General Public License for more details.
/ A% c0 h; F1 j W9 t - */' x, w3 a/ ] F0 p( Y' w
" C0 J6 ]/ O$ H+ X- I- #include <linux/module.h>
7 {2 v7 T! _- @: n: P+ a - #include <linux/init.h>
: r8 I( j$ h2 A' ^/ B - #include <linux/errno.h>
' O3 p- S% f2 g% I3 H# a - #include <linux/types.h>6 Z4 W: l. W% X0 g
- #include <linux/interrupt.h>
@4 V0 X* Y$ f& v. [0 o - #include <asm/io.h>
8 z8 w1 k1 H5 F! M" Z5 Y$ Q5 ?! B - #include <linux/moduleparam.h>4 i9 B# C8 _! h/ n8 U* W1 ^
- #include <linux/sysctl.h>
+ q; c: Q; r! _+ E1 H0 A' t& w- [! U - #include <linux/mm.h>4 u: s/ }6 A9 }5 B! ]8 x- u4 U |
- #include <linux/dma-mapping.h>7 ^% l0 x) q& ^2 S
# h. I, V3 x4 G, k3 z- #include <mach/memory.h>6 R* B" T. C; `
- #include <mach/hardware.h>
4 T" `6 b$ R9 C& C - #include <mach/irqs.h>
w! W6 `! M# S+ a - #include <asm/hardware/edma.h>
- M% y$ a1 R" d. O( g& `
+ ~4 G, t# l K0 Z- #undef EDMA3_DEBUG/ a" i2 {) `. M6 o; ~
- /*#define EDMA3_DEBUG*/
; G1 W2 D! W, @# \" y- c# K, w - ) O% r% d9 _8 ~/ B
- #ifdef EDMA3_DEBUG" l! c6 @) [0 d( g
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 r7 X2 d0 j" r6 r9 @% B
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
! a* w8 q( V$ o9 P6 X0 g - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 U' g: T" X6 F8 L Y# F
- #else
* ^ D$ ]2 A2 H! G( V5 W - #define DMA_PRINTK( x... )
# [, h( b. z" B - #define DMA_FN_IN/ u( o& K: T; r$ D
- #define DMA_FN_OUT
8 m, F+ z& o- K$ a - #endif( E5 G1 Y& K* u- B5 o) J
* @$ e8 U$ ?* }# m {, g# j8 C- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
& t; p. z3 X/ k' n' { - #define STATIC_SHIFT 3- c, U! F: [( l% j! {
- #define TCINTEN_SHIFT 20; t* K( Q! s0 [0 V9 N5 Q2 u
- #define ITCINTEN_SHIFT 218 t: l- j( S* c- ?! m
- #define TCCHEN_SHIFT 22$ Y2 [: r2 c" x/ ^0 g7 b
- #define ITCCHEN_SHIFT 23- l9 p8 g9 O h k( U
- # l* M* T" J7 t( w
- static volatile int irqraised1 = 0;) C' `0 ]8 P4 o; O' j
- static volatile int irqraised2 = 0;
1 v5 d S& s! X- }) y - ' p9 n. v# x' }3 s; O p4 A
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 n6 H {7 n5 x - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% M; C( c5 w) W( K - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' Z. L; C) E# i6 `
, n* ~ X7 Q; [' n+ l7 ^; b- dma_addr_t dmaphyssrc1 = 0; Z' x$ y2 H( _( W; @) _. n
- dma_addr_t dmaphyssrc2 = 0;7 W7 t, {$ U$ @$ X; u3 u6 o; P# f. Q
- dma_addr_t dmaphysdest1 = 0;3 e3 A F9 n8 P% N) f" o& t
- dma_addr_t dmaphysdest2 = 0;
) p& ~5 f3 e1 E) P0 i( a& K' r - + P* Q3 b4 d" M" ^0 K9 o$ R
- char *dmabufsrc1 = NULL;' z. Y7 N e; s5 ^6 N# K! _
- char *dmabufsrc2 = NULL;7 A( y. E2 Y5 ?, H5 W) ^% i
- char *dmabufdest1 = NULL;
+ {2 n! M9 r K# p - char *dmabufdest2 = NULL;
' n4 p6 p" d0 R- n8 `0 ?
! i# b4 w3 S. g; r- static int acnt = 512;
6 J" P; x) Y4 \$ | - static int bcnt = 8;
4 y$ p: Y. G9 ]; [ - static int ccnt = 8;' |7 T2 v: ]7 K
- d' H" Z/ L, w. {6 I3 [4 D
- module_param(acnt, int, S_IRUGO);, J3 d7 c5 \- a+ l1 V
- module_param(bcnt, int, S_IRUGO);
3 F0 F" c. Q4 { - module_param(ccnt, int, S_IRUGO);
复制代码
! s( X5 E, W2 v# t
8 o! j9 h9 Q, Y# L' e" H/ v# h 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 m0 i' R- z- ]' Q8 F9 |$ Y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; R7 \" v+ j% s: ~( ~
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ M+ i+ W2 ]# V, ^# c0 }
' a0 E' v: ^4 D/ I! h l" U8 E G2 x& c, F8 C
|
|