|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 V1 s0 v: h8 d* s( P- [code]EDMA sample test application" T+ r2 X1 A8 K' {+ |1 ^$ }% o$ M
- /*6 E- g1 N1 h' |( [8 `
- * edma_test.c9 t" A4 ]$ @; M) z2 w8 J/ p
- *% t K% `% X; c) I
- * brief EDMA3 Test Application
& R2 r4 B) j9 M$ n& s! O d - *, g/ b# X. n& u& J. W/ o
- * This file contains EDMA3 Test code.
% D) _9 _! j v- X4 e3 j3 q - *
# t3 C# A' W0 X - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
9 \5 D6 d; P! I. g) a4 |8 e7 I - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
8 j9 L2 q' j) a- W( c6 i6 O - * TO CHANGE.
: E( I' M% {% C( t8 Z1 _ - *2 {( x0 O& I1 u2 v k W
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
) X* J) P, q2 T5 o+ [ B - * ?2 i' \3 o4 r, r" X
- * This program is free software; you can redistribute it and/or
' z F' i& A. v; \5 r1 }+ j l0 H - * modify it under the terms of the GNU General Public License as' M, O3 V' e/ f' j1 l( ^; h
- * published by the Free Software Foundation version 2.
7 D0 S3 Z9 v8 ] - *
E& S. @8 y. O! b) R: v; {% I0 n* A - * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ {2 j0 I/ Z9 R& b! U
- * kind, whether express or implied; without even the implied warranty
6 e F& n, \# @+ ?: X6 Q - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the7 b2 ~6 {$ ^3 j4 c. p \
- * GNU General Public License for more details.
0 M- M0 S- g5 n. L% ^$ I, T, m - */
; e( K! z) E4 f+ l2 [
5 u' K( y9 x* B$ g8 S- #include <linux/module.h>
8 I: F! ]9 X( \& e; E+ T% y9 e5 x - #include <linux/init.h>
- ^$ a. x1 r0 R4 U7 E - #include <linux/errno.h>9 i2 s$ M# d4 X' b
- #include <linux/types.h>6 L% Z; O( `8 M- |' {! D: ^( ~
- #include <linux/interrupt.h>
/ |* N- p% B0 D: ]9 m _" U5 ^ - #include <asm/io.h>
; r' T+ t' _8 X* o% @2 i2 X6 F - #include <linux/moduleparam.h>) N8 e5 e1 j# O7 N! t) \, M/ G w" d
- #include <linux/sysctl.h>
; [! P3 R5 ^( b2 J7 n - #include <linux/mm.h>
% [8 ~. l+ a" X/ f& D2 c - #include <linux/dma-mapping.h>6 l# w+ Q( q6 H9 X" Y7 I" U
3 f8 m) q0 J: j) s& e- #include <mach/memory.h>
k' h2 z& W4 C; r: H% x6 t - #include <mach/hardware.h>
% X7 z$ [! M; ~" Z - #include <mach/irqs.h>
2 ^# e0 k3 x9 F% p' m( u0 b0 {) y - #include <asm/hardware/edma.h>
# s$ V$ d% w; ?" _ - , f& X- G2 u& s5 n/ R+ p
- #undef EDMA3_DEBUG
+ m3 y3 q. r) g1 z F% R - /*#define EDMA3_DEBUG*/* E+ N9 e5 `/ j: o
" M0 |, q+ N0 b, ]- H/ d- #ifdef EDMA3_DEBUG5 h( T# }# N2 n; V1 l
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! V9 M H: G X3 D3 N& Y5 J
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__) H8 T7 V& h) k; k7 x# R& K
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* z$ A0 }* |& P# u) ^+ {
- #else4 [" c! M/ f/ Z8 q8 U
- #define DMA_PRINTK( x... ), D8 ]; o" c q$ F7 W3 A
- #define DMA_FN_IN
; H$ K8 \" Q7 \8 R! E" W5 d" N9 } - #define DMA_FN_OUT4 q9 v) }( @/ _# W& f5 |
- #endif
: d, ~9 X g- k: m' {
) y* M( m% g4 Z1 F, D3 s- #define MAX_DMA_TRANSFER_IN_BYTES (32768)" i. ^4 h) b0 X" B' u0 x
- #define STATIC_SHIFT 3
9 ~' M" z! R3 R+ V# g - #define TCINTEN_SHIFT 207 h9 P& Y `2 {
- #define ITCINTEN_SHIFT 21
/ h D/ \/ H2 t1 X4 {. @8 m - #define TCCHEN_SHIFT 22: W' z" X) n# o' F
- #define ITCCHEN_SHIFT 23
! {% ?" a# v- K5 R3 G- P
. ^5 {8 s4 A& m h( v- static volatile int irqraised1 = 0;
3 q! W- w. E( k) s - static volatile int irqraised2 = 0;3 M, V6 o1 C+ [
. V" J) V# [% L6 \- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 X+ M6 o! W0 Y0 V- _# a& ^ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- ]5 c$ u! v& P; M" k - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, ?) ~/ y' h& `6 W
/ j+ N3 G- x' Z5 D- O& i- dma_addr_t dmaphyssrc1 = 0;
$ a. w: t9 R9 Y) y% b - dma_addr_t dmaphyssrc2 = 0;
% w' ~$ q; ?6 \8 v, Q - dma_addr_t dmaphysdest1 = 0;, _! _- y7 d+ h( ?5 L+ C- P
- dma_addr_t dmaphysdest2 = 0;
6 D$ ^; x" f2 @4 a3 [ - 5 P. V! X1 @9 n3 K. C
- char *dmabufsrc1 = NULL;6 ] [$ w8 w+ N8 G6 @( Q: x& n
- char *dmabufsrc2 = NULL;
# C+ V/ ?8 b6 w) R9 K1 d3 _% y - char *dmabufdest1 = NULL;
1 D8 t! |6 ~& m - char *dmabufdest2 = NULL;
: `' e3 @6 S" p
+ }5 F9 q# J4 z- static int acnt = 512;8 r" ~& z. c' D: r, X
- static int bcnt = 8;* [, ], z `$ a! x! c5 P% u
- static int ccnt = 8;2 m9 V& [1 p* O+ {$ L1 P, |
7 S3 ^3 l j0 B# J" Q `2 {- module_param(acnt, int, S_IRUGO);
5 Y3 `' E; l8 J. f! _. Z+ V; o3 f - module_param(bcnt, int, S_IRUGO);
; m: N/ |$ x" h+ R; ~' u8 ~0 P - module_param(ccnt, int, S_IRUGO);
复制代码 3 P/ D4 A; ^9 ]7 ]4 x0 o! ]
0 g+ \' ?* X1 K% f' h' j
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 S$ ]2 |* f, Y! d( e; }5 b
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. K: k$ P0 K, Z2 g6 x8 _
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- P2 `2 T, ~8 U* [1 w/ [& m
" W* q" L; A/ I& M6 c
- b$ C; L; Q+ @ |
|