|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ T' a) d0 S R. T/ M- [code]EDMA sample test application
& t9 y( C1 [6 r - /*; ?2 t, y1 @& E E
- * edma_test.c
9 B, n. d+ V9 r, ~. u - *: G. o2 J2 q: s# U0 `6 \% |9 Y6 c) X
- * brief EDMA3 Test Application
: Z! ~; a7 a7 ]* E - *
9 Y' y" a: F( I0 n' o - * This file contains EDMA3 Test code.* E/ B( @. r9 g3 n% E
- *
9 f" V3 ^1 y+ f+ `9 d* q8 k s/ E - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# }! O( X" l6 d ~/ r! U
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 N3 v+ n3 o O8 u6 }* ^
- * TO CHANGE.
* D* n: `3 P2 ^$ G% |( ?0 m - *
' E2 I" x7 r/ P/ h - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- L. h! q6 \, C, s/ H
- *! z6 s& B. h0 N/ o ?% g
- * This program is free software; you can redistribute it and/or. }8 W' w; J$ B* w, i6 T
- * modify it under the terms of the GNU General Public License as
, i' H* M$ Y {' {9 b% S - * published by the Free Software Foundation version 2.
; t: t b; g6 L8 e+ i - *. y" h% h! I+ ?* B. A; \6 ^
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
& i% k) s6 b% T - * kind, whether express or implied; without even the implied warranty& h4 F' A! \5 J( X1 L7 O
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
) z6 V6 b( A' h8 K, C - * GNU General Public License for more details.
9 ]3 S/ M4 S# o' w - */# f. ~5 f, f5 \" o0 r% [8 t3 `
- 0 r/ ]; s% d. a# {2 K
- #include <linux/module.h>2 \, Y2 _& ?' e/ W! R
- #include <linux/init.h>
4 R. d" ^- N: \+ J, c ` - #include <linux/errno.h>
! J" Q+ h2 @( P$ V - #include <linux/types.h>
9 D6 t9 |! s7 d: q" b1 y! \: L - #include <linux/interrupt.h>
% T" [3 @! v. U0 C, h! Q - #include <asm/io.h>+ _% N; }- p$ v
- #include <linux/moduleparam.h>
# F$ ?- R' v N& K - #include <linux/sysctl.h>
: n6 l8 o2 j5 a& B/ ^5 c/ N3 v - #include <linux/mm.h> s2 j6 p& ^9 c5 \$ P) C
- #include <linux/dma-mapping.h>
& `) u7 u8 Q1 R: g6 C- ^ - ( J1 m ^6 Q3 ?
- #include <mach/memory.h>
" J# A( V8 \( t1 { - #include <mach/hardware.h>
, |8 V: Z1 }& ]; M; S9 G - #include <mach/irqs.h>
/ n4 m' D; @. b( Z. C( H% | - #include <asm/hardware/edma.h>+ m# i% s: |/ t' r
- $ `) [; K; z8 f( f8 Z
- #undef EDMA3_DEBUG# `+ E+ N' @) P
- /*#define EDMA3_DEBUG*/
# b) l w' R; n9 M: s/ e0 }3 t - ! B; x- k6 b0 w! Y! b, w
- #ifdef EDMA3_DEBUG8 G5 m. H4 O' }1 p% Q
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
1 T# i1 B+ |$ m - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 ^/ \1 [0 j% L9 _! e
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 ^0 n/ B& Z7 M/ g; u X: Y4 I
- #else: X- X( C4 N$ ]
- #define DMA_PRINTK( x... )9 u" b) w! s, |0 D
- #define DMA_FN_IN
* r- e& V# n* y - #define DMA_FN_OUT
% Y8 I' w# R# a- h: Y) F9 Q - #endif
9 Z0 I: ^, o6 ^) ^, ? - ' Q1 q8 H+ q+ b6 D
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
8 e* y# ` [( i9 w - #define STATIC_SHIFT 3
3 t# i7 \; F! K, \ - #define TCINTEN_SHIFT 20
3 O7 w- \ I9 X - #define ITCINTEN_SHIFT 215 ?* L" i4 T2 l# R8 R" L" s8 L% u
- #define TCCHEN_SHIFT 22: q- n2 y$ ~, J8 v5 C/ ]- A& V6 V' A" A
- #define ITCCHEN_SHIFT 231 g8 G% _) X; X; M0 B* @; U0 w+ C
- 9 Z8 ~0 b" r |2 ^" Y& Y# }2 d
- static volatile int irqraised1 = 0;
: h5 ^& }4 |5 T - static volatile int irqraised2 = 0;
/ [" h% ?" f- E* h3 d/ X
9 C* P/ t: i" {' u1 @- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% y7 z8 [. `/ ?, Z# N, n: Z# i1 a
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 L3 |: t5 a/ h - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# R2 ^1 M* V6 l2 ?. c+ T
% r0 i1 @6 ^' M# X T- dma_addr_t dmaphyssrc1 = 0;' c$ u+ l2 o" D$ ^8 i$ {
- dma_addr_t dmaphyssrc2 = 0;' T' x' j& q! {6 d' D1 h8 l! M
- dma_addr_t dmaphysdest1 = 0;$ c8 O9 l6 c7 }4 ~. F: {+ f
- dma_addr_t dmaphysdest2 = 0;4 q1 y8 g4 [) H7 X
- + L, l/ X8 X# C/ t* i' Y4 N8 W6 G
- char *dmabufsrc1 = NULL;2 p) F. C* b. n
- char *dmabufsrc2 = NULL;
8 c0 r6 ~7 D: ~& g& _5 ]' C - char *dmabufdest1 = NULL;
0 |2 F( P3 Q& d) M6 _( T - char *dmabufdest2 = NULL;5 H2 p0 e2 L6 Z2 ?2 g/ P1 Z: t
- , D6 f; U3 t4 K8 m6 b
- static int acnt = 512;
6 Y; T# o Z+ H: ? x ~ - static int bcnt = 8;' W! R" n6 {% q5 j ^( ?
- static int ccnt = 8;
& U) t* Z+ \9 Z5 l
' @4 L3 T' A2 j% V8 W5 B* l- module_param(acnt, int, S_IRUGO);
; }; X, m* L" [. L - module_param(bcnt, int, S_IRUGO);
* U/ N5 B% s' ~3 s4 Q- c$ L - module_param(ccnt, int, S_IRUGO);
复制代码 & |- x# S- D8 T6 m4 K6 v2 U; V
# B8 a) d" o0 ~9 E* d2 D 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 N3 n) U0 A' K5 q- W" k- M2 yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ o# U4 w; D7 y' C3 y% c5 X 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) Z5 {/ N7 `% v
% S$ i% @, D' T+ E
! n, w l8 g" ~% q0 a9 Z, r
|
|