|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- p# E! ?8 o- T @, S0 Z* M V- [code]EDMA sample test application7 T' [0 h5 Q. e& n: R- w2 `
- /*& S7 O* C' Y, C: b L% T( P" U
- * edma_test.c+ f* z8 t3 f* O7 Y2 q
- *2 c0 x0 L$ C2 X6 q `1 `
- * brief EDMA3 Test Application% r0 }+ o' I _2 v: i# S
- *& y3 w, n! V' a! k& k4 G# ?* b
- * This file contains EDMA3 Test code.
& P* K3 a0 Z2 M+ J7 Y. T' m - *
( b' b/ L! X: R" r0 l9 F - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ L @; c4 D' l8 F L }
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 O% C0 G& M3 a* p
- * TO CHANGE.1 x& ]7 D+ R; T7 G
- *
) w2 v: r6 C6 u/ v8 p - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
S4 t0 q! S5 t' d7 D7 Z2 V - *8 d2 i7 C1 G+ c* }! E, e2 Q. K
- * This program is free software; you can redistribute it and/or
# b1 k$ r; t. z! [" y5 {8 c - * modify it under the terms of the GNU General Public License as, B' A2 I3 }$ z- N( N
- * published by the Free Software Foundation version 2.
$ @! n( M- J' U; ?. a - *
Q) i3 P% v- A, e! o# O - * This program is distributed "as is" WITHOUT ANY WARRANTY of any' F) t, m. }& L. V2 J+ C1 W
- * kind, whether express or implied; without even the implied warranty
1 M" L. L' q& @% e+ D - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the0 u5 j8 m0 W* {/ x1 P+ v
- * GNU General Public License for more details., E. ?$ n. h: C9 d8 g8 Y# R
- */) C$ ~$ V7 a$ T: A4 d
. D8 W) e# I. i8 Y- #include <linux/module.h>0 T* S/ ?5 M7 D3 e1 f
- #include <linux/init.h>6 R( E) v }4 P5 w
- #include <linux/errno.h>
" Z- u8 G& U- n' J6 T. ` - #include <linux/types.h>- D b2 e5 j: v/ {
- #include <linux/interrupt.h>
: s7 C8 f4 ~% [) [8 M" J - #include <asm/io.h>
1 F% H7 ~% L0 X1 y4 l - #include <linux/moduleparam.h>
1 P e6 t+ S. y q: j - #include <linux/sysctl.h>) N; [1 j) @4 u4 w( |
- #include <linux/mm.h>2 m8 i. s5 X# r) Y# i
- #include <linux/dma-mapping.h>
7 i& s J, W4 _9 e& q - ' J' U& I& p8 n$ e$ U3 f1 ^
- #include <mach/memory.h>
# D; e" R4 M9 a" s @8 R - #include <mach/hardware.h>
+ z. M# k4 w# y. \( A - #include <mach/irqs.h>/ a% S' R( _ k" _6 w: i2 _
- #include <asm/hardware/edma.h>
% |; z* i4 @- o - % K8 I3 \5 o9 H* j5 K. H0 D y
- #undef EDMA3_DEBUG
, {/ W! F2 Z- H5 A; }1 V1 B - /*#define EDMA3_DEBUG*/5 z/ L% K2 L2 j' }
6 [0 J. o" Y6 L- #ifdef EDMA3_DEBUG2 ?6 H% X( W2 l! j' F
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% m7 H: v2 B, c1 l( S& F: c
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). I6 l E# u) a6 R: @ V
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 ^% P0 l0 K5 `4 I. U7 z- @
- #else+ W- a7 b5 m* t1 w( ^& K& f+ M
- #define DMA_PRINTK( x... )
5 ~% R8 {5 c+ z( D1 B6 e/ s - #define DMA_FN_IN. E/ w3 {2 o' d( N N
- #define DMA_FN_OUT
2 B0 O. J! b/ q* K7 { - #endif
) v" i7 ] N; o6 W9 y
3 t1 V8 `* X% ~3 @ E0 A: {- #define MAX_DMA_TRANSFER_IN_BYTES (32768)% K4 }; s& e; ~+ ]$ M1 D
- #define STATIC_SHIFT 35 t1 g, |& J. q- w! G( z
- #define TCINTEN_SHIFT 20
) z: R$ p, g/ O9 a0 r- y" n$ b& q - #define ITCINTEN_SHIFT 21% @. Y! @8 c* E3 E
- #define TCCHEN_SHIFT 22
: x0 A0 F3 K2 ^( u - #define ITCCHEN_SHIFT 23
) R7 R3 U( e( x2 I
3 w U! n0 |, i) x# \: p/ q5 q6 V- static volatile int irqraised1 = 0;2 |# N+ b9 {* |# `! E9 r
- static volatile int irqraised2 = 0;
$ e. Y, g" Y; q$ W# v: A - 6 \, n3 T2 ]1 [9 L# w5 ~
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ J) D% y/ Y* [* E, r2 q7 E
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
`3 S( l! a+ ? b1 X$ p: ^* Q - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& p" \4 S! b' H
! u8 v! r9 }9 Q4 |8 y6 d% w- dma_addr_t dmaphyssrc1 = 0;6 Q8 K; E+ e, r4 v, @! Z
- dma_addr_t dmaphyssrc2 = 0;2 e, i4 X* F* K: ^
- dma_addr_t dmaphysdest1 = 0;
# F' Z& a+ X( g! p3 {( d7 v - dma_addr_t dmaphysdest2 = 0;" u/ d% g5 H. ~) w0 @( {
( T; p, f% }# y7 _% I- char *dmabufsrc1 = NULL;
# q0 X4 V7 G' }& ~1 w - char *dmabufsrc2 = NULL;; [5 [* A) g! W
- char *dmabufdest1 = NULL;- G/ u Y; A/ \& J
- char *dmabufdest2 = NULL;. E! f+ n6 Q1 |
- 7 d7 @2 T' r& p* @, U* o; [- V% Z
- static int acnt = 512;
" r4 Y* y+ V j2 a! l - static int bcnt = 8; B) C4 t7 j* H- a5 a9 r/ h
- static int ccnt = 8;
- \% |6 A) A4 R3 P
0 m, V0 Z4 S Y) Q8 g) t! L+ Q/ r* q- module_param(acnt, int, S_IRUGO);0 K! i! v$ d( C; ?2 h4 J, C5 H
- module_param(bcnt, int, S_IRUGO);
6 w# _6 o* N0 ^0 E; u! Q; } - module_param(ccnt, int, S_IRUGO);
复制代码 6 i4 _+ E9 P5 Z, f# p9 y1 D) P
7 q F# G% d7 h 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 ~! g0 R' R& t; y1 c$ a
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ A" R' M/ s9 v( [0 C2 V 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
L4 k7 h) S5 s, S: f3 k
V& U* ?& F/ E8 Q- h: F k5 r# x2 Y. j: O$ x4 ~4 X
|
|