|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# r. K2 |# U" l- [code]EDMA sample test application& z: N4 v% ^8 a5 o' i* i- ?
- /*0 y' x t; |. R
- * edma_test.c0 n' `) {5 Y+ u8 }
- *
6 E$ m1 |8 E4 B+ o2 G& D9 | - * brief EDMA3 Test Application1 L- V s0 S7 v4 Q: ]
- *8 v: t' p* o( H- f# t1 }$ F, s7 N
- * This file contains EDMA3 Test code.
; Y2 b/ H2 e7 U3 \8 f$ m7 a8 W - *
/ t4 r# F5 C) l! |% | h - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 b( h* \# y, }; k
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ p. `+ K$ A5 t6 O3 Q3 K9 N
- * TO CHANGE.
1 z( q* l% |; Q! h - *
" e$ X* D; F8 W8 b* O - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
+ R {& G9 q, j$ J" u+ G9 Z - *7 M& j" O/ t; w9 g2 }9 k
- * This program is free software; you can redistribute it and/or6 d5 `; D+ q( @1 q3 F3 m
- * modify it under the terms of the GNU General Public License as8 K. ?9 p) b) b* _. ]/ M
- * published by the Free Software Foundation version 2.
8 n. R2 ]7 v+ ?9 B# H - *
3 ?. j- Y$ o- N x - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
$ x5 c. }1 V' \' N6 S - * kind, whether express or implied; without even the implied warranty
6 k8 G- [- S |/ q" _( r - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
' H2 Z1 P% f; I5 b. S4 ]5 K - * GNU General Public License for more details.
1 \. Q5 Q4 A" N0 n - */
! T( v& s0 D' J& k2 E+ b
$ }6 g9 i- C5 r: B/ m n* i# {/ Y- #include <linux/module.h>: x+ p" G' ^' g& |, Q
- #include <linux/init.h>
5 n& h. x1 w3 x: V- R* a M - #include <linux/errno.h>
; x' h5 w& b$ F& e* T7 W - #include <linux/types.h># t& q t0 o3 M6 D4 y
- #include <linux/interrupt.h>
# t: [3 w0 @: x5 L$ ^ - #include <asm/io.h>' }; `5 t. g7 c4 j: q0 V& U5 T" l4 O
- #include <linux/moduleparam.h>
" f. |3 x9 {; Z% R# \ - #include <linux/sysctl.h>
. o. q3 H9 N" V& y! l - #include <linux/mm.h>& X$ C/ e$ y3 k3 H
- #include <linux/dma-mapping.h> [( v9 E- Y- \: h, t5 H0 x
6 O5 A- n& O3 O- #include <mach/memory.h>; F" o1 @$ f! q9 l8 m- a$ F* E4 o
- #include <mach/hardware.h>
1 O; B" t& f' ^) x& y0 J4 G - #include <mach/irqs.h>; d" n$ o) o& g2 r
- #include <asm/hardware/edma.h>
m. W0 ~' r" h' M - ; x6 D% S; g- r9 J3 v3 b1 H3 i
- #undef EDMA3_DEBUG
1 v' b8 b$ q7 F8 L C { - /*#define EDMA3_DEBUG*/1 z5 c, M2 h7 M/ e: S; p
, g+ M( e6 s+ [! t: `: u- #ifdef EDMA3_DEBUG5 y9 v5 k: f$ {4 i f# Q' |* c" G
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). b# }! H8 u( J) @/ e2 R
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 h) H! J/ K7 @- I) W9 P
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
5 F8 V7 e' l1 O8 d: q - #else1 e. h3 b5 S4 j
- #define DMA_PRINTK( x... )
0 Q/ c1 R- f, R6 h m - #define DMA_FN_IN
2 v( f D1 n# c8 a0 S1 ] - #define DMA_FN_OUT
8 Z6 K. l0 Z2 n& { - #endif. E! ~! z4 E4 A* u$ l _
$ f7 }, P0 |% x& R6 T- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
' O+ I. C8 D8 b" l) }. z - #define STATIC_SHIFT 3
9 e3 c7 c3 e' G" Z - #define TCINTEN_SHIFT 20# R% i8 c) E9 l& I$ D, C9 ]1 b- k$ [
- #define ITCINTEN_SHIFT 21) ]3 { ]' M0 Z* X. }6 F* r3 Z5 o! M% `
- #define TCCHEN_SHIFT 22 e+ ^0 w) e4 h7 a
- #define ITCCHEN_SHIFT 23
' Q8 c# t8 p' d% C* Z; D4 T) \ - % ?% X7 i' E! H. {/ }
- static volatile int irqraised1 = 0;
8 ?$ ]) W4 J: V& r2 u1 ^, o. A - static volatile int irqraised2 = 0;- U: V2 S# m0 j- r. l
- - p+ K' f) M9 t- {1 ?
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" \, x3 C! _5 w ^- F - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( o$ G2 j2 N$ ]* _8 Y - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" c/ r: b; Z+ _% F3 d( |
. [+ e/ I4 g8 J `9 `- |3 q- dma_addr_t dmaphyssrc1 = 0;
( e2 J- N" z% ?: _: w7 W2 W - dma_addr_t dmaphyssrc2 = 0;6 z, o" c2 v) `1 b7 ^9 P3 X9 ~
- dma_addr_t dmaphysdest1 = 0;/ `+ I8 ^1 {* t0 M/ w8 l2 B2 R5 h
- dma_addr_t dmaphysdest2 = 0;5 Q+ t( _5 m1 j/ U+ u
- $ Y( @) Z' p5 V5 n9 i0 R/ [0 ^
- char *dmabufsrc1 = NULL;
( ~8 {: l& b7 W R3 ]& y- E4 J) x - char *dmabufsrc2 = NULL;( ~ b7 o; {4 `, q1 d
- char *dmabufdest1 = NULL;
9 e t3 `1 \" q2 h5 ~. X. J - char *dmabufdest2 = NULL;$ P u7 x3 y, s" R
7 k' X6 e# c" B. v+ t. [- static int acnt = 512;
: B5 I- \) {- m- W9 D) ~4 D2 o - static int bcnt = 8;
9 `5 P$ M- t/ u: x; |- F - static int ccnt = 8;1 x) \+ p. s4 \3 m3 A
- $ e% t: i, U# P; A( Y% `! L
- module_param(acnt, int, S_IRUGO);# l2 \' T, T, U* E- s. D/ |
- module_param(bcnt, int, S_IRUGO);
( N2 }- c& n- o+ s0 Y' `% G1 D - module_param(ccnt, int, S_IRUGO);
复制代码 ! q# N! A6 z* k8 N! j. Q- \
% V/ @# e# [; C! K/ ?- ^
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 G4 B2 u- O5 W8 J8 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; X8 y5 p1 w" a7 }* w$ S0 m% v
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 t2 k% F6 [& o+ E! Q2 ~! P, C& j ~5 }! E! `' ^, K* C. u9 F
5 x1 c: O1 z* P9 m
|
|