|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 R7 ~4 [7 _( L+ G3 r# ]4 F
- [code]EDMA sample test application. i* O0 V) r* V) Y5 D# d5 {
- /*- a; o- y% P; @
- * edma_test.c
/ n+ {2 f& c- n3 a' m. e+ j% i - *
+ Z. p) F: J9 a9 m8 \9 } - * brief EDMA3 Test Application K) T _" L- Q2 L7 P# n/ D
- *; X$ O) q- b8 m# H" R
- * This file contains EDMA3 Test code.
( h5 ~- H; i$ V- o, N3 E - *
( K6 ?* h! m% i2 P0 E4 E+ Z - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( U% ~( z' P3 F+ I
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* ~: n: [6 _1 P$ N
- * TO CHANGE.% }4 t# m# I7 A0 g5 j' ~6 K0 @
- *
" |' l/ L2 c$ Q; p# q - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 Y- Q3 ?! ?* m8 c
- *
+ G4 o9 r' X5 o' K3 x - * This program is free software; you can redistribute it and/or
: D5 y8 c2 \) O9 `7 [% @- Z, Z - * modify it under the terms of the GNU General Public License as! a, i2 |. Z8 o k. ^( u. Q
- * published by the Free Software Foundation version 2.2 n* W' S' }. e7 Z6 l5 k% ~
- * K0 q2 J' M6 l% ^* {
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
5 `: G5 h5 W. T% k - * kind, whether express or implied; without even the implied warranty; j6 N# y* I8 V0 j) [. n
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
& P1 \% j: L# U& [. ] - * GNU General Public License for more details.9 Z3 n7 h) k0 B5 Q
- */0 l! o( a% L: \; S+ U# I
- 4 T2 ~ ], e0 ], l) [$ v
- #include <linux/module.h>5 G$ A6 }* A( Z$ k* j5 ^4 P
- #include <linux/init.h># x" Y3 t/ U/ J+ ]
- #include <linux/errno.h>0 c0 v+ I1 L" j" p
- #include <linux/types.h>7 e5 w7 L3 v9 h* k: Z$ X5 m1 Q& W
- #include <linux/interrupt.h>
! x5 `! t8 F2 s3 J% } - #include <asm/io.h>' _/ b' s- E7 d+ _1 a; W4 ]
- #include <linux/moduleparam.h>4 r( x0 y: b! r2 p2 B
- #include <linux/sysctl.h>9 v. z( X9 e; K5 t4 s
- #include <linux/mm.h>
1 C# t4 w( i- U' { - #include <linux/dma-mapping.h> q) D' C; ~9 S1 _0 ~
1 u6 O/ t# J! d7 v- #include <mach/memory.h>
7 _/ L; R- B* Z$ j+ w, \- | - #include <mach/hardware.h>2 d6 f( i4 m; l' d8 L1 M' K% d& X
- #include <mach/irqs.h>
0 H3 G6 S" E1 ]9 T4 w/ h# f - #include <asm/hardware/edma.h>
4 m _5 u1 @6 O7 m4 }7 K' `! d+ `
, R Y) _$ O; f% `: ^, M' G2 `0 b- #undef EDMA3_DEBUG3 u+ R' y3 S |$ ^- j, v* q
- /*#define EDMA3_DEBUG*/& r1 W) ?- S3 f5 R7 S% ^' h
7 ?( Z# w8 V, S- t" j% V$ s- #ifdef EDMA3_DEBUG
* y0 ~( G. {$ J( r* d - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
1 N. ?6 ]& i) @8 ~4 ]5 @+ R - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
: I% @) T/ D. Y! S, T. ] - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
$ t+ _* D: Q. N8 D& S# J0 T: c - #else
' A! X5 y" ?8 @ - #define DMA_PRINTK( x... )
w. t! _, |3 f% o5 F& q - #define DMA_FN_IN
- u1 P0 L6 G/ V/ h3 e - #define DMA_FN_OUT' V! W2 @3 U R, |
- #endif
* x; g+ ?2 V- ?" r - / R5 |( A& L& a1 H- `2 }$ n/ |
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
# h2 C7 Y+ v1 }$ I - #define STATIC_SHIFT 3, J6 e2 a' v2 y4 N8 }
- #define TCINTEN_SHIFT 20$ m) ^; E" J+ V9 U Q( x
- #define ITCINTEN_SHIFT 21
3 g0 s, N8 V; z - #define TCCHEN_SHIFT 22
! V5 y' r) q, i - #define ITCCHEN_SHIFT 23# @8 d1 ]2 P' D# `
- ) }5 }" Q4 ^6 P% S4 W: M5 m
- static volatile int irqraised1 = 0;. ?' Z2 [3 u- C- M
- static volatile int irqraised2 = 0;. q) q+ m. b }6 f
( ^/ Z+ j! n5 l7 W- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. N) F2 O# B' G% A& | - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* E: D1 ?- G% L% l P4 Z
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 u2 [, o" p& R& i/ M' ^8 E
- }/ X7 l T9 v+ y, r* M- dma_addr_t dmaphyssrc1 = 0;
; T! {+ D G2 v1 e - dma_addr_t dmaphyssrc2 = 0;
- T$ Y) D9 X7 x- S( ^ - dma_addr_t dmaphysdest1 = 0;
/ p1 ?/ i& u& e( p8 m/ \) J: y - dma_addr_t dmaphysdest2 = 0;/ \. G- s1 u5 z% ~: K' S
- M0 [3 I( G6 i$ B8 {$ q- char *dmabufsrc1 = NULL;
3 T# I6 N' n+ ^# |, q1 @, Z - char *dmabufsrc2 = NULL; { n" g& X ~- r- a
- char *dmabufdest1 = NULL;
( B7 _6 e' r! ^/ h |' K- t - char *dmabufdest2 = NULL;& w. H/ W" ]# ]' V7 M1 m" l
- $ |# t. ]+ C4 l% d Y+ n
- static int acnt = 512;
, w& z. q- ^& A! r" Z+ |3 g7 t - static int bcnt = 8;
" `3 n) ~. `, C$ {* ~ G5 m( w - static int ccnt = 8;
7 } x* M) M! c) {
" d( R& V' O5 O+ o5 r: O- module_param(acnt, int, S_IRUGO);+ K' X" F3 ]% F
- module_param(bcnt, int, S_IRUGO);7 V# T' [ y" `) Z5 b% N
- module_param(ccnt, int, S_IRUGO);
复制代码 $ T, p* |6 H3 g
; [* X0 ]2 |5 \- o7 r, I 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ j# m( g* _3 ~3 r2 m" I* z2 E4 L, Xarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 ?/ t) \1 y' D! w9 _1 ]: |; c
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ r* i: E* p N$ Y' N& @5 j$ c
- Q2 ]% F0 x/ J# B4 G: ~( C
1 l+ M/ {/ `5 e+ D9 s |
|