|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; L9 x$ n5 C& v' ?! ~, g- [code]EDMA sample test application
: t* x0 E) F p( a* a$ l, p - /*3 ~$ L. g! V! i9 w% P
- * edma_test.c" Z$ j) v/ a. Y, u
- * f: y/ q/ {/ `5 f6 w3 X! ^/ P, |
- * brief EDMA3 Test Application
_4 i3 N' E* _8 }' D% M - *3 c* K4 b" @5 `( ~+ g' X
- * This file contains EDMA3 Test code.
: |) X8 h5 w9 c" \, N: Z - * C5 V9 W. F4 w' }7 H C
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
! z- @* N' L/ F I7 c H - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
1 s# m6 Y' O1 G y. @( C& e - * TO CHANGE.
$ \9 f6 b/ E; h9 x/ z6 t" t; I - *
4 X1 K" w3 P, @2 P$ t$ Z! i2 p( j8 _ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# `7 V! q7 S* q9 N7 \. L& _ _6 G L
- *# f3 g/ R0 }/ y
- * This program is free software; you can redistribute it and/or
) N& p! L" @; \ - * modify it under the terms of the GNU General Public License as
, y: Q5 i! A W& S" l8 L5 x - * published by the Free Software Foundation version 2.
3 g6 y- x1 m0 ~- a4 t& c) y - *
b! e- O' w3 Y( u3 K$ x - * This program is distributed "as is" WITHOUT ANY WARRANTY of any- j; N; d6 G4 O
- * kind, whether express or implied; without even the implied warranty8 q' K8 v, v. l' y
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the8 q; [7 y& v& v8 S* X# p
- * GNU General Public License for more details.
' S4 H+ E) w) P! i% X% @. P+ O - */
) r( i+ @2 Q1 K8 [) V, E& q - 9 t3 i: Q* O7 w! U
- #include <linux/module.h>
: W* o( N* s% Z7 _" ] - #include <linux/init.h>
; f. N' M9 p- @" K: F n0 G5 m E& C - #include <linux/errno.h>: H2 P2 [" K+ F
- #include <linux/types.h>
) L: M; `4 z# b! k9 P' p6 e - #include <linux/interrupt.h>) B k2 o- X* F0 u- r
- #include <asm/io.h>6 g; N% b1 \5 K* w$ y9 z
- #include <linux/moduleparam.h>% E r5 Z; X& {5 d+ F2 s! R
- #include <linux/sysctl.h>) Z& W* s8 U, {, e
- #include <linux/mm.h>
; D3 ?: ]' `4 V0 s3 [ - #include <linux/dma-mapping.h>
$ O( h- m5 j3 b5 L: v; a( i
3 l4 g2 M, T# s- #include <mach/memory.h>
+ f9 |1 h( l) D1 O - #include <mach/hardware.h>
$ ^) K7 P4 x& K. e* m; T/ p: i' _ - #include <mach/irqs.h>
- W- v7 B, Z4 Z3 s7 n - #include <asm/hardware/edma.h>) C5 f0 k- Q5 s* j2 Y% _
( x0 A$ ^) {; E/ U2 ~/ ^( t- #undef EDMA3_DEBUG
; V- @( W. _* h/ m9 s - /*#define EDMA3_DEBUG*/1 X! S6 H; U) A5 K1 q! _2 M! M
- 3 ~% T; b7 _1 ]" j/ \8 i
- #ifdef EDMA3_DEBUG
) t1 J/ a0 S" e; Y/ z! w - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
# o) n% d. {9 V( M - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! f' z( u7 {! q' L3 T
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
2 f& S5 j! [2 I. N* m - #else7 E2 X" _. V$ s& z, z9 ]- p9 e, Q
- #define DMA_PRINTK( x... )
: j9 d7 y' b5 L - #define DMA_FN_IN
' m5 p3 v9 {, w) N0 M - #define DMA_FN_OUT
# j; e$ v% ~& J$ G. H0 O; Y3 I - #endif
. d/ z" r1 `& v# n1 J3 i$ `6 S
/ I- @1 R! {+ |- ~" S: k! Z- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
( V! A- Z- b7 Q$ Q! N" @ - #define STATIC_SHIFT 3. F h" Y, E' A) D S& E
- #define TCINTEN_SHIFT 20
. q- S% T3 ^# w* q8 ?5 @; f - #define ITCINTEN_SHIFT 213 p) V" f. _8 e( a* M6 m
- #define TCCHEN_SHIFT 22& I1 }$ [( ?8 D+ g- a$ U6 P# u
- #define ITCCHEN_SHIFT 230 D9 C2 ^$ y( F' S5 e8 l
2 s% u7 e' N% j7 ` w6 O* A- static volatile int irqraised1 = 0;' F" v, f* o+ x
- static volatile int irqraised2 = 0;; \9 g% p0 H( r0 |
- 6 u$ f' z/ Y6 V$ _4 r0 ^
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. \- q: ^) H. v# W) Z
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, C, |% M8 j" E, s# U0 k - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( V' j8 Z6 G! I8 V7 |
- + s# v7 c* Y7 l: I1 g
- dma_addr_t dmaphyssrc1 = 0;
! {. P2 K2 U6 Q2 s6 z - dma_addr_t dmaphyssrc2 = 0;
. r( _5 k; V R. t" } - dma_addr_t dmaphysdest1 = 0;
/ E& |: N4 _7 {$ e' T! w! v: t - dma_addr_t dmaphysdest2 = 0;
+ w0 V( n3 Z4 R2 l c - 2 u) k. X, l9 }, E2 D3 L& B
- char *dmabufsrc1 = NULL;
8 t2 [; u, s7 \! |: }8 {5 i4 P - char *dmabufsrc2 = NULL;8 I$ P9 n4 b* I
- char *dmabufdest1 = NULL;$ q$ c" v' `$ B& j3 \$ R: C; F
- char *dmabufdest2 = NULL;) V! [# _# z* g1 [8 I
7 @; E2 m! A& s W& l0 d- static int acnt = 512;5 Y" k+ F4 @9 z0 P: `
- static int bcnt = 8;
8 n, |* h. l7 r9 z- S( k - static int ccnt = 8;
# j3 P8 a- k5 c- [( d- y
: K8 E- ^6 W3 A9 n; F% k" z+ V- module_param(acnt, int, S_IRUGO);
! {- [' Z0 g( Q9 e( z - module_param(bcnt, int, S_IRUGO);
, {7 d4 [( ^: E J& ~# W- ]9 A% q - module_param(ccnt, int, S_IRUGO);
复制代码 8 w& R2 u8 r. p) y0 P
, D2 O2 ~9 {; e. {
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 x; U2 O& `8 h1 R
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( t% c# y) S8 A* s8 c3 @7 o) c3 G) L
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( f& L+ \! u& _( N/ h0 H5 m0 L! t- u6 Q' W
1 ]7 X @/ h6 G" @1 q0 X% ` |
|