|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 d, h8 j$ p% W o- [code]EDMA sample test application
- N+ i7 S+ F+ B K6 ^8 _ - /** E1 N4 e! Y% n1 [
- * edma_test.c3 M6 x- R+ M( A3 J) B8 J4 N
- *( ]- l3 F0 z' p! W5 U$ O
- * brief EDMA3 Test Application: Q$ v- v" v6 L- W# {2 A5 {3 s; m
- *
: Y& [. G& ~0 M6 X: {# B - * This file contains EDMA3 Test code.
4 Y( v8 K& ~8 M6 k1 K - *
- L1 V/ Y' q/ T$ a+ d - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
' W1 |+ M1 d9 Z) u9 O3 m - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; F* f( ^4 u0 G% P4 N7 _% Z8 y1 v
- * TO CHANGE.* R! i+ q2 ^: ^, v! A. g# u
- *
& c# W0 A9 Z4 k - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 r; R9 j4 L. v: }, h9 d+ d
- *
* y6 U9 I& C! `5 p" _ - * This program is free software; you can redistribute it and/or
# \5 P" W$ k% b& V8 B - * modify it under the terms of the GNU General Public License as
$ i$ W u. l+ u$ q- l) h - * published by the Free Software Foundation version 2., b7 R( ]' B5 M2 O; ]- a
- *
$ ^( b3 X& W. a' k - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
: H0 G6 T1 m8 O! b - * kind, whether express or implied; without even the implied warranty$ [" s* |- m- j8 d z
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1 o' X& r- N! e& @
- * GNU General Public License for more details.$ _# b6 A/ Y* e; a
- */2 b6 I; @, b7 b6 g2 H7 |
- # k9 C4 w( w" t. l0 Z- V* P3 P
- #include <linux/module.h>
8 p5 ^* U; V% f' R( ? - #include <linux/init.h>
* w9 E8 X! p6 f) v" ^ - #include <linux/errno.h>2 ]6 B0 q- [$ H. ?" y f
- #include <linux/types.h>
: A) N& y* r' ^ - #include <linux/interrupt.h>
! ~4 R( I8 k [) {9 G6 K! m - #include <asm/io.h>
& M8 L+ \0 V: E" \% v" y: Z - #include <linux/moduleparam.h>6 F8 P0 H8 C- p0 n
- #include <linux/sysctl.h>3 j) P2 {; ~* z4 ^
- #include <linux/mm.h>+ q+ y6 C$ A6 }2 K2 J r9 Y+ p
- #include <linux/dma-mapping.h>
: [3 T9 V2 |$ f- M# o
+ _. P m* W2 T x0 A& }/ ^8 C2 f( ~- #include <mach/memory.h>
4 t, t) H# d, L3 o0 M% | d - #include <mach/hardware.h>
/ a( v3 Z/ T6 E$ U1 @. O+ B - #include <mach/irqs.h>
! k0 E) S6 ?- | - #include <asm/hardware/edma.h>! n0 w. j: ?1 Q( M9 o+ k. i1 ]
- 1 I$ m! E# l* O; X- v/ \
- #undef EDMA3_DEBUG
$ b) x3 v; Q( v4 a - /*#define EDMA3_DEBUG*/
/ H$ I! K( |3 }! g - : J& E$ }' F2 D! a \* {
- #ifdef EDMA3_DEBUG0 L: i& D F! n& \
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ p( x1 e! j, \& o% v9 b
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
/ {, J5 f% Z" z5 d/ h$ Q$ p - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
- z- ]+ N2 O$ I - #else
" O) r o0 k c& [9 I8 O- V( d - #define DMA_PRINTK( x... )- ]) [, M- E8 g }& Q( O# q# g
- #define DMA_FN_IN* Z) i$ k- b4 l6 i5 h9 A
- #define DMA_FN_OUT, G* K" s- Q9 K; B
- #endif: F* m: n9 ?6 v9 z( I
3 f3 M5 W; C) G- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
) T' r( X$ E# x) \$ H' P - #define STATIC_SHIFT 3
( M+ ` p( ?7 ]$ K - #define TCINTEN_SHIFT 20
. N' s2 Y' n, o# I% {4 G - #define ITCINTEN_SHIFT 215 A& d) l0 t N; E. R
- #define TCCHEN_SHIFT 22
$ U8 c% L6 L( ~3 m. R) \2 Q - #define ITCCHEN_SHIFT 231 ^ k0 S) G K l" L
- 2 c$ T4 h* C) }+ u( b
- static volatile int irqraised1 = 0;
7 W6 \! G2 c. c4 a M2 Y - static volatile int irqraised2 = 0;
4 q+ T3 `& ~) u$ _) m - 3 y* B" U$ J2 T, Y3 `- N1 D
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 W. z; P, c- ^ g7 }9 r
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 Z$ s. h3 T( P" j- C- F$ A# v
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 P0 S7 t' B4 L, B& g B
- N: G. H4 Q$ c7 L9 a- dma_addr_t dmaphyssrc1 = 0;
3 R. M3 `! K( q* T0 W8 a% R - dma_addr_t dmaphyssrc2 = 0;6 U2 d/ c7 C, R6 H: K- ~
- dma_addr_t dmaphysdest1 = 0;
$ x2 t6 b, W& l; x; y - dma_addr_t dmaphysdest2 = 0;$ F8 p2 m* Q3 ?( Y
- 0 q; f% D T! c) f8 ~
- char *dmabufsrc1 = NULL;
d- |0 L' J, ]) G6 @ - char *dmabufsrc2 = NULL;
2 r- l" P' I" H, w8 L - char *dmabufdest1 = NULL;$ f+ j+ n! B8 c3 g) W+ R' ~
- char *dmabufdest2 = NULL;- B' ]. _5 Y) A/ Z
- $ c6 Q/ l! ~+ b% B/ h }. z- {
- static int acnt = 512;2 N2 l/ @2 q) [; S
- static int bcnt = 8;
9 `" ]4 `% z: l' B - static int ccnt = 8;9 y2 k8 a: |: i" w9 }! K3 @+ ^. b
* F# @! {8 p* J# k( K% I2 E- module_param(acnt, int, S_IRUGO);; { ^% N+ r) V: ]
- module_param(bcnt, int, S_IRUGO);1 [: X' L @( H
- module_param(ccnt, int, S_IRUGO);
复制代码
; i: l E: b# i" x" N- R$ Q# ?% I
0 N2 J8 k% J1 V9 X- G7 n4 W 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: p6 @8 y+ ^. f1 earm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; R4 }4 w- T: H) X9 F 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. `( F" z6 H3 {: [+ o9 y' B& c
, C4 T: m9 C2 b& P" u5 V
" ^" F( M, T4 `+ | |
|