|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" l8 y: {5 P& {( T p+ [; v; A q3 [- [code]EDMA sample test application
9 b; a3 v z7 W8 B% H% U - /*) _. f- \1 Q$ C
- * edma_test.c
9 s) E( U8 r( l0 b7 j# f2 ^! s - *7 |! l# k* ^3 W I$ b4 M
- * brief EDMA3 Test Application
0 C! I' n+ h/ b6 l. G& Z0 G. T9 e - *) M! o+ Y3 F/ }9 v! Z
- * This file contains EDMA3 Test code.
* t6 n' p: V; X - *; C; U/ N! x) J
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
1 A# x: U4 G& U3 \* X, p4 ~ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
7 h9 |5 `6 W! ^ - * TO CHANGE.) J+ {; D# f' s* [0 z" [8 t* y3 ?
- *' P" @# z5 _1 Q4 h4 p4 Q
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* y) r; a$ ]1 n' r [8 {
- *
1 B3 K7 L+ D8 B" K- `3 I6 x - * This program is free software; you can redistribute it and/or
( a6 k, E7 L+ J e: x - * modify it under the terms of the GNU General Public License as; W" G' {: p6 o) m
- * published by the Free Software Foundation version 2.: t! o# z9 g+ z: J: q! i* p% ^
- *
2 F) W7 _. P3 z - * This program is distributed "as is" WITHOUT ANY WARRANTY of any& v% |" W) c) q4 u" p( R
- * kind, whether express or implied; without even the implied warranty: E- O4 Y9 p8 G8 L
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% b0 [1 e- ?7 b6 h - * GNU General Public License for more details.
# R3 O" N% g9 O5 b - */" [9 H5 Z; _6 ?6 e; A% z
- 5 Z) T' E+ X, Y2 Y. J: N
- #include <linux/module.h>
B0 r1 E* O) ?% U - #include <linux/init.h>* y1 h( Z9 |2 P2 d
- #include <linux/errno.h>
2 _& N) ~& H4 N: u- `0 M a$ Q) `7 w9 b - #include <linux/types.h>
; c5 n6 k% B. L5 h' K% ~ - #include <linux/interrupt.h> ~! m$ o% g4 m) _9 Z
- #include <asm/io.h>
8 ~( c( Y# ^3 m9 b( Q2 h& N - #include <linux/moduleparam.h>
7 L' o0 f/ \2 y0 e4 q! {+ D3 h - #include <linux/sysctl.h>
+ i$ P* u/ ^2 I/ L* J - #include <linux/mm.h>$ ]. K7 G" h' ?, i F: l+ V
- #include <linux/dma-mapping.h>
; t! u* F/ I* ?2 _
# v. v6 m/ @2 v9 ~9 e* T& N7 n- #include <mach/memory.h>
3 \7 B }' j( K# \1 e8 Q, V - #include <mach/hardware.h>
% v0 M) f( C7 b7 V9 d% {$ o# K - #include <mach/irqs.h>
& \) [0 z$ V7 l3 m( ]/ r7 ` - #include <asm/hardware/edma.h>
, _) Y! t( q5 s/ P6 V
$ n, c: ~2 g4 }0 n0 d5 q- #undef EDMA3_DEBUG
: i$ V5 a" @& [6 t$ g5 J5 N - /*#define EDMA3_DEBUG*// y; O' M4 L3 ?2 m, |
- 6 H& b' E( [) M9 y
- #ifdef EDMA3_DEBUG+ h: _! W4 ]% x0 `8 |- X
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 N: o H: m7 a( l6 k( l% |
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
8 E% U# b q% c( n* n% N" l - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): T7 u/ U" k8 A* S' B2 T5 c4 I* E+ J
- #else7 I0 o1 d& k% J( | t, A" n& Y
- #define DMA_PRINTK( x... )! E" j( B% u) b
- #define DMA_FN_IN
% b; h0 U$ B$ T/ g - #define DMA_FN_OUT
5 q! B( ]9 e! O! i6 X# G - #endif# c$ g; @3 ^: A* K2 }6 b; n1 d# Z2 \
- * R# r" Z$ U, d" y1 k* e: Y
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)/ d5 ?- x0 \ V- G, Y
- #define STATIC_SHIFT 3
1 N$ J$ ~/ R& V ~& y7 y4 ~/ T3 M - #define TCINTEN_SHIFT 20
; c1 w c0 v. @1 [+ | - #define ITCINTEN_SHIFT 21
; W6 J/ H! ?3 A7 B* [: B6 q - #define TCCHEN_SHIFT 22
9 t3 h0 x( ^: v7 F+ n - #define ITCCHEN_SHIFT 23* Y: Z% b" I" k7 N$ E3 q& a3 S
- 4 @: y, ]- V# ~- \
- static volatile int irqraised1 = 0; Q4 c7 I8 s/ P+ P. a3 N
- static volatile int irqraised2 = 0;2 X1 j( i# r) Y' A. K; ^
/ s( K& z' p2 n0 x/ h; W6 }- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) V' h& e+ g! y7 O" w; G2 A, {2 S
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 T8 O. ]! r) z1 }$ G) s E W2 C - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- s( {0 e+ ?; m/ t8 S/ k
) |. G' `' W3 B, [7 F. M4 ~* ^- dma_addr_t dmaphyssrc1 = 0;4 D: }, h: W) o) k. W
- dma_addr_t dmaphyssrc2 = 0;
1 v- {( v) n( Z - dma_addr_t dmaphysdest1 = 0;% Y- W9 r; ~$ l( O" X
- dma_addr_t dmaphysdest2 = 0;
+ `( a) h2 ?. Z: A2 A% y - # U T: t& A7 x3 i7 M
- char *dmabufsrc1 = NULL;% [$ l- |5 Z$ L9 Y, j
- char *dmabufsrc2 = NULL; |+ n! H$ J+ u6 V5 V, n
- char *dmabufdest1 = NULL;
- i0 F' O! H5 X! f: k. k. |6 c - char *dmabufdest2 = NULL;
* S) v% V8 v3 l; Q
4 o- ]. _# O# L7 W. P5 U) g- static int acnt = 512;
* \% ]0 O B& j' A0 a. o1 x: M - static int bcnt = 8;$ Y. i. w" V" O: n; }; L
- static int ccnt = 8;
2 `- h+ d) A( f4 E* z - 6 I6 U( N# [+ `0 r
- module_param(acnt, int, S_IRUGO);
+ J) X+ ~: `* R) Z1 D' E. f - module_param(bcnt, int, S_IRUGO);2 `/ O# @* D3 `/ x
- module_param(ccnt, int, S_IRUGO);
复制代码 / u. |8 ^, Z, D" b, Z& n7 U' A: g
7 k+ O1 P; I, ?* g
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ b n9 L1 ~- b f8 Q/ h
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 \+ A& A1 Y+ N) Z) s$ [1 G 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% x0 Y" a! o( O2 g& Y0 D8 z: G: L7 V% k2 M1 q! E# M$ k0 f
v0 t$ p; v( N3 p2 t9 V
|
|