|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : ~# x# X5 S" J
- [code]EDMA sample test application& _8 {6 V/ Z+ c3 h
- /** ?- a+ [" a* T9 x6 B. q) d' c
- * edma_test.c
' V: z5 K) ^2 o9 G: R - *" s! Y; r" ^6 X0 t6 y! r" W2 u$ W9 k
- * brief EDMA3 Test Application
' d9 q0 T0 X4 R3 q& B5 ]3 o - *
$ D7 C8 U& R ?3 d+ C& v: a+ ` - * This file contains EDMA3 Test code.
w6 S) Z( V, P* }4 @, R - *
. i- l; {5 `9 Z9 O* i" B3 R - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# T( \8 L w! O3 c
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
; d' {: P Y4 G7 v - * TO CHANGE.
' B, F8 S) b, H* Y$ e' b( H - *
, e, z( u R$ ~+ X, ^- i - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
4 Z+ p4 x& o, @ - *
( k2 N$ b+ k, t) f - * This program is free software; you can redistribute it and/or+ z4 l. q' @" t1 Z& k* B
- * modify it under the terms of the GNU General Public License as' v2 `9 B! j, E
- * published by the Free Software Foundation version 2.
6 h( R7 B( e3 ~2 {" S - *
2 A. J/ P/ k: V1 ^' c) ~5 a; J - * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 }, e. [: `1 i' {/ g5 k. Q" B$ y
- * kind, whether express or implied; without even the implied warranty9 ?8 t5 s* O. N6 @4 I8 R
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1 _8 W8 g' e6 R1 s( _
- * GNU General Public License for more details.( p6 f9 [3 b- {# }8 n
- */( |3 F# k0 @1 w* x
- # k, P$ f7 p8 Y5 _0 {
- #include <linux/module.h>
, ?- _) S0 E2 I6 {& S) ~; M0 J - #include <linux/init.h>
, }$ v7 i; R5 {7 S6 R - #include <linux/errno.h>
; x. H5 a0 x. k. H# y - #include <linux/types.h>
3 f: V# \" R0 @' k0 a7 d1 z& O - #include <linux/interrupt.h>
P- j j S0 [. j0 t; C - #include <asm/io.h>; |$ S) ^$ O1 k2 [* q! e: r/ T3 N
- #include <linux/moduleparam.h> }; S: ~; D2 U, r& n8 F* U
- #include <linux/sysctl.h>/ J7 \( g9 C" k) I7 |2 f5 s0 A
- #include <linux/mm.h>
: f; U, A5 p+ T - #include <linux/dma-mapping.h>
0 Y5 J- G' j! W/ K( W9 G
, v/ `& T2 a( [& Y5 [- #include <mach/memory.h>
) I( ~1 b- p6 X4 q/ q4 q - #include <mach/hardware.h>7 r. \6 H5 e( S' Y* k
- #include <mach/irqs.h>$ D+ J5 }3 y) R
- #include <asm/hardware/edma.h>5 N9 b n: W7 h/ r6 N7 P8 b
- 5 V* D1 O+ ~ S- B5 R
- #undef EDMA3_DEBUG& g2 W. e+ D; \" z" E0 O3 H8 f8 S
- /*#define EDMA3_DEBUG*/
& C- O" H, k6 M) F - : B2 C5 G% V; [+ p
- #ifdef EDMA3_DEBUG5 |# g. C) j% _2 ^) ~0 ~
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
2 i3 j4 O% t/ L) a' S* j - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
. S3 l, s2 M3 `9 ]. M" B - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
( k6 d! v9 c8 Y C9 ]# b( g7 l" O - #else
( f ~% S9 l# R6 C+ | - #define DMA_PRINTK( x... )* g" o% n4 g( p4 g0 i8 `
- #define DMA_FN_IN
$ D2 ^, g" }( h) y - #define DMA_FN_OUT
" z3 Q1 |* I! H9 n; ~: c/ k - #endif
' E0 ^/ p h/ u) A - & E/ X K* D0 c' b% Z* M
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
5 c0 _; [& A( t) O, C% `: C - #define STATIC_SHIFT 3( w; n% p5 M) v8 g. E7 Q8 @# w# s
- #define TCINTEN_SHIFT 20$ _" Q; l3 p" l: K% L0 @! I% A
- #define ITCINTEN_SHIFT 21
0 \ [$ j4 f0 ~5 D% E - #define TCCHEN_SHIFT 22
1 X1 U$ U5 M& ?8 V2 Z& A - #define ITCCHEN_SHIFT 23
@' w; R+ a& I1 S' G0 @
! q# _' I/ ^+ N l- static volatile int irqraised1 = 0;
1 {8 {6 X$ F4 w8 g4 @( h - static volatile int irqraised2 = 0;4 M u6 t0 b; U# X
( A( B9 G6 G. ?6 w& T. [+ F2 O- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 P( l! r# D" g% J' j' m: T
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: Q2 L, J. J7 Z/ b - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' z; R+ s1 ^- @. c% H
- : J* Z' R/ r; ^! L* s' a P0 c, p9 Y6 r& [
- dma_addr_t dmaphyssrc1 = 0;
1 N$ q( F4 _* i8 w- [ - dma_addr_t dmaphyssrc2 = 0;0 i& U# k) U2 Z d D& R
- dma_addr_t dmaphysdest1 = 0;
# n2 F! m- W' }! H- k; A, x! n - dma_addr_t dmaphysdest2 = 0;
9 X3 y* R% l; r- s6 P) q% p% J - 1 }, o! p1 @7 X" V7 m% T4 n
- char *dmabufsrc1 = NULL;
5 C/ o9 h$ k9 Y; M9 F) n6 i% n G - char *dmabufsrc2 = NULL;+ T+ x! j+ g! Y* F. T& \
- char *dmabufdest1 = NULL;4 o* K3 L3 j* P' O- |( h$ P
- char *dmabufdest2 = NULL;6 M0 X: ~, y+ o+ C1 E' N9 t6 U( j8 _
- ! K y& n6 x+ |5 c0 c: r
- static int acnt = 512;
2 D. t. O# l; ~5 @% u6 U - static int bcnt = 8;0 p8 h8 P5 p& S7 Y& {) m
- static int ccnt = 8;
) R( }, q" `2 _. m
# R/ Y9 Z4 T. z3 J5 @- module_param(acnt, int, S_IRUGO);; P G: P" B' g9 Z
- module_param(bcnt, int, S_IRUGO);
* } }% f3 A, y* S - module_param(ccnt, int, S_IRUGO);
复制代码
/ z- l5 i8 H9 _2 r: m, y. Q$ ?8 P8 ?( }7 L0 i* K" x" T
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
9 E) j9 u5 U; b' B3 q5 g# Tarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ h. ^9 e3 G$ S% F
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 w# p1 Y0 G0 P( _. z( F, I
, ]; v- n0 g" x2 Y7 o9 q3 r4 z
) y$ ]9 g* w7 j# G |
|