|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ s- c7 e5 m) x+ E$ n! d- [code]EDMA sample test application) {( A0 o# A) p9 a: ~! \* z% t) h
- /*1 K# U; O: _+ p# ^
- * edma_test.c
: r- G( U0 J/ L& n" } - ** L+ b; N- k' o& t* `
- * brief EDMA3 Test Application3 K9 l; B8 J# ^0 {
- *
+ m4 q# E. j5 B \. Q - * This file contains EDMA3 Test code.
* S- D3 G! R1 | - *
( Z% A! T. a& t( K' O; r1 I* D3 T - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" [2 f. x) C- T9 o! n! x
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( Q* T( A; W5 g2 t# F8 n0 [
- * TO CHANGE.
4 D2 ^% W' \5 { - *
" K8 n9 V) Y( K - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
' l: ?$ X4 R' M- i, K; x - *& {5 O: n& t; U- y, q4 N
- * This program is free software; you can redistribute it and/or
& \8 @* h" s# m6 B% z5 i - * modify it under the terms of the GNU General Public License as
( q: v3 V8 J1 } - * published by the Free Software Foundation version 2.
4 b! ?; Q& [& k& T* n: [6 y; n - *
! \6 w5 S; }( `( A - * This program is distributed "as is" WITHOUT ANY WARRANTY of any% J8 c/ p) {# \: K' u7 N
- * kind, whether express or implied; without even the implied warranty, q/ S# t0 f; E9 V) M9 t
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the$ l. s0 `& P2 B4 W( C p9 ]
- * GNU General Public License for more details.
9 E' b. V3 p% a8 I3 Z1 @ - */$ z( e9 [. D$ |. l6 y5 I0 M
9 M( K1 a" {% C- #include <linux/module.h># V# F5 o/ f6 [9 G1 F
- #include <linux/init.h>5 y0 H" O8 k) i- [, r( S% U5 z1 }
- #include <linux/errno.h>7 ~4 v2 L# v& w5 D
- #include <linux/types.h>( N- Y, W$ X. a6 r/ E
- #include <linux/interrupt.h>- w- Y9 G' S- L8 s* J$ c) G
- #include <asm/io.h>
3 p; H5 F0 \; u( d - #include <linux/moduleparam.h>
" b7 Y3 N2 t3 Z: m! E- F" h - #include <linux/sysctl.h>: l8 L% O, L3 S2 a% v+ F
- #include <linux/mm.h>
5 ?/ o7 s, m: {/ {' [ - #include <linux/dma-mapping.h>5 L5 y4 |. h( P
$ y; b9 I: A' w) Y' l; _' Z- k6 X8 R! H- #include <mach/memory.h>0 p/ q; |. p- _ S- Y
- #include <mach/hardware.h>5 n. o: |6 m% u+ y) z
- #include <mach/irqs.h>3 ?: G1 v& y2 T* C: G/ ?( X
- #include <asm/hardware/edma.h>6 q R% t. @- p' X
- 3 x+ j- C( ~5 l- e( G) J
- #undef EDMA3_DEBUG4 N4 V: s$ {. i- h2 \
- /*#define EDMA3_DEBUG*/
' k' d3 l' n, k5 c: y+ X - ( ?, n* K4 v3 h5 w1 f: ~* Z' D9 k0 B
- #ifdef EDMA3_DEBUG! S7 M, E7 T* h; y: o& O# S& J
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
. O. T0 U. {6 H) f! J& ` - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
4 b% `6 R, }1 G$ z - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
& @1 Y% ^6 W7 M' k9 @% X - #else' D. J' \. U' G9 L4 x7 ~: z
- #define DMA_PRINTK( x... )
! a' z! `( X! r; D! |! u( I/ _3 G - #define DMA_FN_IN
. E9 ~4 ^5 I2 L' o. x' i - #define DMA_FN_OUT. A# ~+ r5 W& \9 B$ r: f/ D
- #endif( e8 @9 L9 Z5 W9 E; J
; W' H, b2 I" T, q' r1 F- #define MAX_DMA_TRANSFER_IN_BYTES (32768)7 g2 F' |: U5 ?& I- Z+ ?% U% o( i: T7 K
- #define STATIC_SHIFT 3 _' n: N$ L2 c1 O1 D" F) U5 q7 b
- #define TCINTEN_SHIFT 201 a2 i' a& P0 U/ \- [3 J2 e
- #define ITCINTEN_SHIFT 21 d1 [$ J" O5 L3 X
- #define TCCHEN_SHIFT 229 L! c0 n& y( c# D! w' S
- #define ITCCHEN_SHIFT 23
+ Y! r$ }" [7 [( l8 F+ @& I$ z - 4 N3 O) R! q" {( `( @& [
- static volatile int irqraised1 = 0;
) n- k& X C ^ - static volatile int irqraised2 = 0;9 X2 k, T: Y4 {. t$ d
0 ~9 _" ^$ u1 G. [- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ U4 A0 b& [& f, k
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& I# k0 ^# C5 E7 N
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ @( B# v2 D( G, h - 1 m" T$ @# a" q( n$ X
- dma_addr_t dmaphyssrc1 = 0;8 y$ O5 B0 Y r: F' N7 T
- dma_addr_t dmaphyssrc2 = 0;* m, G S3 J1 |- Y8 M1 Q
- dma_addr_t dmaphysdest1 = 0;
$ m- T( c) {2 C) F - dma_addr_t dmaphysdest2 = 0;% a6 O# l' U+ v z% H2 i: \5 H
/ i& t J! A1 n) J+ ?- char *dmabufsrc1 = NULL;
, J. r7 I: T7 P$ _ - char *dmabufsrc2 = NULL;0 J' ~- f5 N+ s" X* x# E! v
- char *dmabufdest1 = NULL;9 a; O- }- P/ D$ i
- char *dmabufdest2 = NULL;
- \# j# m! X' q/ k/ O3 B! I/ t - ( \- l$ q0 S. Q" I E, W9 w" h5 h* n
- static int acnt = 512;
1 i; U: Q2 V! S5 v0 u. Q - static int bcnt = 8;
: P8 B+ v4 L3 O7 f" E - static int ccnt = 8;
7 t5 S* G) @7 f$ n; P - $ G# q b% g; \1 O& L8 m" a1 F" V$ r4 a$ ]
- module_param(acnt, int, S_IRUGO);: a8 b( y* G( [/ B# \: c' o
- module_param(bcnt, int, S_IRUGO);
$ W+ K1 H4 ^# q( I - module_param(ccnt, int, S_IRUGO);
复制代码 3 j& J" }# E3 G
6 B; K# O- e% _: K- e6 }" r
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; q1 p9 f" _$ y; G e, B1 O* }+ D
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ v( }! L% u, ^6 H6 U+ [ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: K( y5 W- H& m F3 B7 Z
; J. E. V* n9 Q' i% X' K' S& z, K6 i/ B, C8 q
|
|