|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ ]+ |7 P8 S: e: f* R8 U- [code]EDMA sample test application, R: {) W% L d% q
- /*2 x x! q, t5 Z8 ]7 V. P6 D/ x
- * edma_test.c
5 u7 l q1 i8 w- l3 l - *
$ H; \: _+ h) U f l# O# i. R - * brief EDMA3 Test Application
0 W/ b9 R5 j; W( E: n0 w% N: {7 j - *
# {' l* T6 v3 b: X( S; G - * This file contains EDMA3 Test code.* o8 {: W7 D9 t3 @; ~
- * t8 ~6 N* X. R4 c) b
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
8 F2 y, E' x7 e5 x% C/ z) k |& z - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 q; y4 ^1 s0 ]0 _4 p6 d i$ o
- * TO CHANGE.
7 s& }+ x% B$ I3 c) R - *. X# V h: D% y/ [) v6 E4 X& e. Q2 l
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
; T* ^! X# i! o$ R3 }/ O# ^6 T - * C' \, w2 r% j4 N& x
- * This program is free software; you can redistribute it and/or
; H) S8 a X! W, m5 p - * modify it under the terms of the GNU General Public License as5 X: b. y3 O/ P
- * published by the Free Software Foundation version 2.4 Z' R n' n4 z
- *
9 w0 {) w/ Y, o1 i+ z1 M' z" i - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
- \, |) r+ u H9 b9 F - * kind, whether express or implied; without even the implied warranty& f: @' l, K7 O# B4 U( F' Q( b
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the/ ?/ y! H( J: b n+ o
- * GNU General Public License for more details.
( M0 N4 d2 K9 L# Z$ i - */; o% C% g/ r4 X" N8 c! A
- 7 ~) t$ f% a1 c4 \4 K4 E, n( V& H
- #include <linux/module.h>
7 i+ c0 }: X j - #include <linux/init.h>8 A( ~8 f6 c: v9 z
- #include <linux/errno.h>
: f, z8 W& |: ~7 k% g) ^ - #include <linux/types.h>9 H, |4 T" p1 F: m4 T
- #include <linux/interrupt.h>
7 O9 h. s, b* x9 | - #include <asm/io.h>
: n- a1 w! b) S* l1 @ U - #include <linux/moduleparam.h>) r% R) S, L6 Z) X
- #include <linux/sysctl.h>$ V/ R$ u1 N0 z8 C! L" P" e1 h, m9 H
- #include <linux/mm.h>0 r% g" `) C; ?5 ^% |
- #include <linux/dma-mapping.h>: G6 x6 W7 P$ R
- * |7 `* Q3 e! `* ~: t" W1 E
- #include <mach/memory.h>
- I' L% U3 |, a- j - #include <mach/hardware.h>
- k( P/ P0 v g$ Y9 Q - #include <mach/irqs.h>: [0 W5 a7 V! ?$ R5 W( M
- #include <asm/hardware/edma.h>
! r. [# q0 R7 x
& I6 e% r5 \3 H7 A U5 y- #undef EDMA3_DEBUG6 x( \2 W* o( O, b$ f/ F* q0 n
- /*#define EDMA3_DEBUG*/6 x$ @+ U1 \ f6 _! z @
& H) l* r/ `$ \ \, e- #ifdef EDMA3_DEBUG& @# D) J2 f/ B6 {: D
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# n% Q _" ~; A2 ~/ g' M
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
- `) k6 w9 a) R( p: w5 J! ? - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
: i7 b, D& c6 V - #else, x& O) k% k% k
- #define DMA_PRINTK( x... )' Y) [& \% h7 Q7 O: ~
- #define DMA_FN_IN2 V K* X/ ?3 R' R
- #define DMA_FN_OUT
8 F$ u' @- W) Q% F* S' ]% V - #endif
3 J- H/ _ U" _, ? i - 9 |' d# a1 C. a! I/ K% z" a
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)( f: D! G! o+ @: m U9 b
- #define STATIC_SHIFT 3
+ k& {/ i3 A5 \( z$ [' x - #define TCINTEN_SHIFT 20* H- \, T. Q" _: Q, g
- #define ITCINTEN_SHIFT 219 ]# P" b5 V. m( g8 @
- #define TCCHEN_SHIFT 22
" X3 a! P5 L6 d% j - #define ITCCHEN_SHIFT 23/ [( D* @& G3 e$ o* B! p
" F* @ K# g( P; A) K- static volatile int irqraised1 = 0;
3 T- u; [ ^$ l, O( ^ - static volatile int irqraised2 = 0;, D* A+ s0 \, |' r7 Z" i3 J
- # g q. C, |: D# t
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! i! c( ^6 f# R) B, a
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, u* f& Z9 \( n# P0 E2 R8 I$ W - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 k. K! H/ R- W, m5 ~+ T
& D y3 T5 N! Y, G I- S8 p- dma_addr_t dmaphyssrc1 = 0;% h; g, @# [2 ?$ X
- dma_addr_t dmaphyssrc2 = 0;; Y' v1 I* r' N
- dma_addr_t dmaphysdest1 = 0;
" s5 Q2 ]$ C, g/ o - dma_addr_t dmaphysdest2 = 0;: Z. ?. Q0 D5 R7 W2 ~. o2 h
- 9 n: T% w7 _- G
- char *dmabufsrc1 = NULL; _& O1 a: v+ E9 K2 d: m) n+ M7 E
- char *dmabufsrc2 = NULL; T/ o1 U3 g# j) ^
- char *dmabufdest1 = NULL;: D+ F' t& w& Z+ l! C. W! x& h
- char *dmabufdest2 = NULL;# i, I0 ~# u1 H0 D' c
- 5 r* B! v/ b/ x- }9 _7 L2 C v* ]! W
- static int acnt = 512;! o7 C5 A+ j u9 @
- static int bcnt = 8;
7 N/ P7 k" Y5 o p: n- N5 I3 ]. y4 R4 N - static int ccnt = 8;
1 R! |- P6 y( N' w" H - 0 d) K+ z3 T% X* S9 T
- module_param(acnt, int, S_IRUGO);
% {# Z' E2 \5 T- e: K - module_param(bcnt, int, S_IRUGO);- G9 M4 W% u. z2 n0 p$ u; M
- module_param(ccnt, int, S_IRUGO);
复制代码 }$ @4 x5 Q. c2 j7 y+ a1 D
* E8 L, n# i, ^ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 E8 \. F9 G: g5 J1 V1 D$ ?: m2 ?
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! i! b& j4 Z6 k$ K. @; U& t$ T 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, L g0 W/ ?1 j2 i. S2 {, r8 _0 [
# p9 s2 p. D$ K' { u9 v% f' f" \. u* e5 m1 { q6 M0 _1 R& r+ H
|
|