|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ Z$ \' w0 C q& |3 c4 V- [code]EDMA sample test application0 o* \1 W4 d# D2 I, ?! t) @4 u
- /*% j( f' Y; m7 V; k; p/ i X
- * edma_test.c
) O2 Z0 L1 E B3 Z! o% U. I - *1 W/ H& V! L6 X$ b) A* Y. x
- * brief EDMA3 Test Application
: j9 @4 E: ?. z7 x: E! D - *; W; |& p5 y3 m
- * This file contains EDMA3 Test code.- l) H" s! ^/ ?. o
- *
! X3 o4 b7 f. R' O - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
0 n( _* W$ c) N# J - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 n( x, m0 q {& \, A
- * TO CHANGE./ J8 P4 P/ j f: L
- *
* t" p* Q& X, F1 `* [ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
, \6 x% [. G( V* Q1 R - *- k7 \# f* P/ g4 ^
- * This program is free software; you can redistribute it and/or
( t6 ^# [( M( _% k6 u V" Y4 Z - * modify it under the terms of the GNU General Public License as
8 {' Z2 x( V. X5 p# a - * published by the Free Software Foundation version 2.
3 o0 [8 R5 C5 r! @# w- X - *
& f2 l: n* s6 M. b# `: ? Z- Y - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
& V3 ?( C8 q# p- v7 |4 i - * kind, whether express or implied; without even the implied warranty+ ?! ~5 r+ ^" q9 p6 w9 Q
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the/ ]) F0 G0 i: B, t
- * GNU General Public License for more details.6 O# f c H- s$ c2 l
- *// m# C9 ~: [1 ^% J
- % ]1 }% q; n: H$ Q3 |
- #include <linux/module.h>2 z$ B/ {1 |4 x, g7 f; o
- #include <linux/init.h>
, z, R& e8 S$ r% ?: U - #include <linux/errno.h>2 @+ K/ y% l4 g
- #include <linux/types.h>
% ]% \9 {4 z# m- q5 Y - #include <linux/interrupt.h>) J# `( w7 a+ v& k4 }8 n" p
- #include <asm/io.h>
2 g1 F* f. }% J! l, Z4 M% O - #include <linux/moduleparam.h>6 E2 o' j/ w# M- f* h
- #include <linux/sysctl.h>. J# Z i+ O. J3 W
- #include <linux/mm.h>
0 G/ q1 |6 K# Q/ e B2 P) [5 l - #include <linux/dma-mapping.h>% Q; E$ U$ i( G! r
- ( c/ D, _) P4 p. m, p; X
- #include <mach/memory.h>
& m5 E3 G+ H% v - #include <mach/hardware.h>
# v; j% x" w A! @ - #include <mach/irqs.h>
% T1 l5 D7 j) l, o - #include <asm/hardware/edma.h># E' J- o2 C! ?
- 9 T* N; H/ b& r1 R* r2 L9 k( ]6 D
- #undef EDMA3_DEBUG
5 h) P+ b3 w0 Z! f) E. F8 W$ @& J8 X - /*#define EDMA3_DEBUG*/7 k! A; [! i5 h- @/ n
9 G: f* A3 {6 O$ M9 W, F% S- #ifdef EDMA3_DEBUG$ g2 a( y \9 |' c+ m0 q# T& e
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), Z( p0 j& v: K: ~6 o
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
. f; z* r( o+ e! Q9 C - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
/ s, o; G, |1 o1 T - #else
- H$ _0 i4 c& j3 Q - #define DMA_PRINTK( x... )
7 W* w! Y: |9 U$ g m9 p - #define DMA_FN_IN4 x6 m& A. c$ u% F" q7 N
- #define DMA_FN_OUT
! Z R6 G% j5 _! m - #endif
( u) p, U9 L# Q: j - ' H+ z1 ~4 M C) @* X) p5 v
- #define MAX_DMA_TRANSFER_IN_BYTES (32768); C5 J' w1 t6 L5 I
- #define STATIC_SHIFT 3+ l0 C; |5 l: x7 W3 l0 h u* `+ q
- #define TCINTEN_SHIFT 20) }! b4 @8 I- }& i
- #define ITCINTEN_SHIFT 21
% q8 |: Y* X% a4 o5 w& v2 j r - #define TCCHEN_SHIFT 22
8 D5 i# T( |# t1 s: L2 \ - #define ITCCHEN_SHIFT 23
1 y3 j3 e1 _' D+ b9 I - - g- k/ r! u4 ?8 P
- static volatile int irqraised1 = 0;8 O4 A4 l# ~( G
- static volatile int irqraised2 = 0;
5 A- \ N; Z/ i/ @, ]; \
" |, G* H2 x$ Z" B4 t' [5 W1 M- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 }# I! Y" G+ S8 D# R4 _# \ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' d# `% U ?: f" _+ e$ I
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 }5 o6 h) f$ y( V/ W' l# p G - ' F, N9 Q: v0 J0 C6 q% G
- dma_addr_t dmaphyssrc1 = 0;
& b# [7 t4 o7 r: y: }; _5 t0 p/ v - dma_addr_t dmaphyssrc2 = 0;' r' }3 E4 b9 A, W# o: N% T
- dma_addr_t dmaphysdest1 = 0;
- n, k% n; T1 z - dma_addr_t dmaphysdest2 = 0;
& e, s9 i& `2 e - K# f6 j& k4 K3 Q. N h
- char *dmabufsrc1 = NULL;
$ ?. \! h2 L) k O" ?. J - char *dmabufsrc2 = NULL;/ u/ y, o$ U {/ J8 b
- char *dmabufdest1 = NULL;
6 D0 K6 J T& P$ [ - char *dmabufdest2 = NULL;5 h" [9 x. } W
- & [/ ?, n" A% a, i4 O. c
- static int acnt = 512;/ H8 P9 S7 r$ {9 \
- static int bcnt = 8;
" I: u. `& S5 k: x m - static int ccnt = 8;& [) |9 k" t7 t1 W( Q6 O# G
- 9 Z' C/ r' U% Z* u
- module_param(acnt, int, S_IRUGO);* Q6 M" {! k7 X6 E1 l
- module_param(bcnt, int, S_IRUGO);
; Q" i, \, ^' s. U3 R# }: k - module_param(ccnt, int, S_IRUGO);
复制代码
/ e6 d1 @; H1 S$ `4 y# S2 D, l- [" m4 O
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 N% {3 P! q4 I' i$ Z& D5 z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 I+ |5 l+ s' p' s0 \* ~ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( K! [( \% d; Q, O, _" a) E4 t
; ~* m! j8 J: {0 t4 B2 d
K3 f- _+ F7 X* ]: [$ z* `9 Y |
|