|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " J0 K: O8 A: D. c9 q
- [code]EDMA sample test application( h# |4 v; ^: ^% V# _6 n9 C3 m# I
- /*
+ t0 m, d2 R B3 j2 G9 ?* g - * edma_test.c3 k9 [2 c W% s, U- ^
- *# ?* T) _4 a, v9 G
- * brief EDMA3 Test Application' E! {4 m' l; G+ |
- *
) W; H# N1 @( c3 d& L - * This file contains EDMA3 Test code.' Y4 O% N! I. s4 F% ^, R5 s! e
- *; Q8 v$ Y8 @- [) a+ v
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ j! b) @ z, k8 S- x
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: B% R5 {9 t+ Z, E; O+ L
- * TO CHANGE.
3 a! ]. ]& B$ |) C. v - *
! X/ R8 G1 Y' i0 E - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
! V9 b. ]- a% x l1 F/ T - *4 y Q, j) g9 ~( }0 L' K1 p, t: s+ Z
- * This program is free software; you can redistribute it and/or% K- E0 @ C: r* e5 s
- * modify it under the terms of the GNU General Public License as8 J( M9 l5 s8 a4 r
- * published by the Free Software Foundation version 2.
5 d8 h* l2 `3 _3 _0 J - *0 f+ `" h" [8 u5 [7 I' ]% v
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any' A: J9 P5 r( h% Q/ o
- * kind, whether express or implied; without even the implied warranty
) p' |" r" V- X+ g, g; e! { - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the7 C& T1 x% X7 n+ a! ~# r( h
- * GNU General Public License for more details.
5 S- M1 Y9 b/ t- a, s0 n4 ~5 H3 p - */
- h! s0 R! [# @: [- L K; Z
1 I$ O3 a7 v/ z0 f- #include <linux/module.h>
4 c, i9 |, `& a - #include <linux/init.h>
) D: g5 x. D1 W - #include <linux/errno.h>
- T6 P" F, Y% r, } - #include <linux/types.h>
- a/ w& g; y* Y3 w - #include <linux/interrupt.h>& j" I! R5 r! U" Z' R" A& I
- #include <asm/io.h>" s8 N' J) j. ^8 h `& @0 S2 V
- #include <linux/moduleparam.h>/ H$ C. J7 _5 I+ q* c1 L( C7 c
- #include <linux/sysctl.h>' k% m. a! v% z! ]7 f
- #include <linux/mm.h>7 b3 C8 S% N! `0 J& B
- #include <linux/dma-mapping.h>/ @& g9 I" H9 m0 ~4 m
1 A) p' u. V- u- #include <mach/memory.h>
* X% G* i5 E2 G/ I0 n: O - #include <mach/hardware.h>: X0 R3 m( \3 f
- #include <mach/irqs.h> Q0 Q2 o' j2 \( I+ m- @+ _- l
- #include <asm/hardware/edma.h>7 W9 w6 [. @& `( O( H2 w$ o" D3 Q
- : |' U: [( u1 z) w/ o
- #undef EDMA3_DEBUG
( ]% o P. @& _; ] - /*#define EDMA3_DEBUG*/
3 I+ E" E8 J# w @: K4 s - / z% R, `, k4 v
- #ifdef EDMA3_DEBUG
8 ]: Y# ]+ Q' a9 h' ~7 p. {5 N/ R - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
, m, E. v% {; u- { - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* o3 Y2 M0 i u/ s
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( K ?7 Q0 p9 ~5 w# K
- #else
. s1 v. [0 B7 ?7 w% x% b: X - #define DMA_PRINTK( x... )
- y3 M8 B3 O. P - #define DMA_FN_IN$ W. Q3 A" O# C5 U( P4 C$ v
- #define DMA_FN_OUT
/ V( b. Y7 [' v1 p0 U1 k - #endif
. e3 B6 J! f( ?; T
& d, \& \# n6 d* @( T+ m( S* C* c- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
4 h: B- l* r; g - #define STATIC_SHIFT 38 @ j: E% Q( ]! P2 J1 O
- #define TCINTEN_SHIFT 20* l0 v7 O1 Q2 i
- #define ITCINTEN_SHIFT 210 y9 `7 |9 r6 c# F. p% U7 S
- #define TCCHEN_SHIFT 228 x, e, Q; E5 l& @9 Y! S/ |1 Z2 a
- #define ITCCHEN_SHIFT 236 V0 {7 T8 J9 V0 ?$ S
- 9 @5 m" K3 h( G# E. f
- static volatile int irqraised1 = 0;
) L1 y0 d1 \3 g0 C; d. C% i( r - static volatile int irqraised2 = 0;/ T- @) F$ P% j7 R* d1 F2 w/ R
- ; k* K1 k7 e& d. g" q1 |8 Q- T
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; h% X" U1 Z0 X/ a8 g/ o
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 O+ D2 a: y D; I* M0 j1 M6 i! _5 `
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 d2 ~" u% V7 i( r i
- c9 L5 P$ K8 E. T" N- dma_addr_t dmaphyssrc1 = 0;. G! \- Y# `& w t
- dma_addr_t dmaphyssrc2 = 0;% u/ N4 W, }! u/ E
- dma_addr_t dmaphysdest1 = 0;
1 o( U) M9 n" i1 u4 ^0 _* E# [4 F - dma_addr_t dmaphysdest2 = 0;' H( \/ Q6 e. u2 Q
! ~- Z& S8 K' g3 P) I- char *dmabufsrc1 = NULL;
! }2 K$ C" t; m; F& [: w - char *dmabufsrc2 = NULL;
5 N4 F, U( _+ D - char *dmabufdest1 = NULL;: H2 R; w6 C7 A, I: e
- char *dmabufdest2 = NULL;
* Z$ g6 [( {$ m# i - + ?+ S; A( i4 p) L
- static int acnt = 512;
5 Z/ {; C1 S; B6 d - static int bcnt = 8;' P; _1 r+ k& G) Z
- static int ccnt = 8;
$ l0 @, z! v' ^: A9 J
) U8 t+ [& f% V! Y2 c, Y5 {7 Y: T8 v- module_param(acnt, int, S_IRUGO);
3 h0 X0 @; D, ^, v- Y - module_param(bcnt, int, S_IRUGO);8 r4 U* n/ }% U6 }0 }- A' ?
- module_param(ccnt, int, S_IRUGO);
复制代码 4 @$ V+ T8 t0 P$ {
) X/ N" L- |; W 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 K* b3 H% ?# Uarm-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 r9 }, A0 O8 w) _* G$ P0 w2 R& a( Z
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# Y& \ I. d h2 w
4 d6 K2 R% B6 s
% X- W7 j. s" c |
|