|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * |* ]" d% T6 A. e
- [code]EDMA sample test application4 F, I4 ~8 L) w0 k' r9 ]; G
- /*, m( n4 `) L5 u! b5 u, ?
- * edma_test.c
! d4 ~+ _* T6 i; m - *) w5 T5 {9 q/ h. }, a
- * brief EDMA3 Test Application
7 v: U: N, j4 O0 J2 l - *1 {/ G$ q" A0 B
- * This file contains EDMA3 Test code.
9 G( E1 ?% }" G! Y% \8 g - *
0 M2 E# f, Y* V. k/ b - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 M4 b$ F# c- N a7 ~/ X/ {
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
, {8 Q" \6 C8 w7 X5 Q& j - * TO CHANGE.2 ]$ x! C6 w2 {) Y- w
- *
/ G! k1 C+ L/ K- N' M3 y* P* ? - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
, b0 L* t P" L" Q1 Z - *
6 U' \- o' o& t8 i& X1 G7 [ - * This program is free software; you can redistribute it and/or$ o' y8 [8 _/ ~2 j+ P
- * modify it under the terms of the GNU General Public License as# K$ T% ]' L N: W! M4 [- l! B
- * published by the Free Software Foundation version 2.
& @' `/ L5 z/ i9 K& K4 Q4 l7 O B! O - *$ F& e: v L* g& l7 ^
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ a# E6 A7 Q* T9 ]! g8 v4 t
- * kind, whether express or implied; without even the implied warranty
6 s$ e+ X1 Y6 m - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3 n% i- l0 v$ E: X& @( F - * GNU General Public License for more details.- l# M& {. e" ~. @2 f
- */
2 U8 c; O9 x. R+ a2 E - * }3 y5 v& n9 A7 y2 O. l% s$ A
- #include <linux/module.h>5 N1 i3 Z( F! {/ g3 p
- #include <linux/init.h>+ `2 ?4 H0 e2 {1 C; p
- #include <linux/errno.h>
5 J! s+ g7 j/ m7 r3 ]+ k' r - #include <linux/types.h>
, a9 p% j! H0 y) X4 j - #include <linux/interrupt.h>5 A# I, K" c: g' ?- ^& s$ T
- #include <asm/io.h>
' A! p8 o7 p, F$ @$ ~7 _% u% t - #include <linux/moduleparam.h>
* I3 T% O! Z, K4 v4 _% @2 _- I - #include <linux/sysctl.h>
2 a# A! t; h5 t' K" ?( g - #include <linux/mm.h>. q9 _* ~0 F5 z" }
- #include <linux/dma-mapping.h>
' `) L3 ]( r( w7 H9 j0 ?9 U
; n0 ?4 y) ^3 H* |3 R- #include <mach/memory.h>
9 O, s. Z% L/ V/ b+ w. U - #include <mach/hardware.h>+ G ?$ f% y- B3 ?) T
- #include <mach/irqs.h>4 [' O5 i4 U) O2 @0 o
- #include <asm/hardware/edma.h>
* ?4 S) [5 F, \* P; V
' ]- R: ]6 U4 O$ Y7 }- #undef EDMA3_DEBUG3 T; A% d8 Y; k4 `4 j
- /*#define EDMA3_DEBUG*/
2 T2 ?5 n8 F8 J2 { - " f. C; p6 X0 {
- #ifdef EDMA3_DEBUG+ G& k+ H3 `8 L' V2 ?' c
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
4 h* x- }3 N6 O - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), D+ I; w c M$ n6 f7 ?( C
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). o" {; y! `7 S# G6 Q8 \' ]
- #else
`- r& F. V6 F2 H( m& X - #define DMA_PRINTK( x... )
4 t' e; Z3 r9 D m - #define DMA_FN_IN
" B" b# D$ m2 P) U1 \' f6 N - #define DMA_FN_OUT1 `# I8 o$ j0 u# I
- #endif3 V0 w! A8 {- `& z, B
- - W: m% T+ b' p
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
. }' o4 z8 [" z! G H - #define STATIC_SHIFT 3
+ w4 i& S2 h0 }+ s - #define TCINTEN_SHIFT 20
+ i4 H" J% `# L8 b - #define ITCINTEN_SHIFT 217 T4 Q' t6 @ I7 ~
- #define TCCHEN_SHIFT 22
# s7 z: L! x. } - #define ITCCHEN_SHIFT 23
7 C- W% z0 s5 o3 b) c
" e* o1 o% Q6 h* Z6 e& f! O- static volatile int irqraised1 = 0;( |+ x! g. ^( Y& Q" N. t- ^
- static volatile int irqraised2 = 0;
$ y. W5 x7 {* x" q, u7 G
' D- J# ?+ f3 S2 K* P- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 \0 B6 t- C" ]2 A1 C
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 t; m0 p( X9 @: C - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. b r6 ~; H p Q2 `0 M - 4 V& f* d D' [( {3 v! N/ v, @0 `
- dma_addr_t dmaphyssrc1 = 0;
! w9 R, o0 n) v$ Z! C# q' @1 y9 k7 L - dma_addr_t dmaphyssrc2 = 0;2 y7 }% w+ `8 f5 G
- dma_addr_t dmaphysdest1 = 0;
" e2 E, H8 A; A/ n - dma_addr_t dmaphysdest2 = 0;3 r% Z/ ~" `3 D0 I" f- z
. e% B8 o% L4 k6 k- char *dmabufsrc1 = NULL;
# M/ Y( K" R: H! `# v - char *dmabufsrc2 = NULL;
+ X( e1 Y9 }& |9 o - char *dmabufdest1 = NULL;; @- Z& S! A" B5 y
- char *dmabufdest2 = NULL;4 l+ B3 Z8 o' b1 L5 Z5 d; k* z
- - K# a. w( ]; T5 j* ?% p; J
- static int acnt = 512;
$ w/ d5 z+ }2 `4 h5 |8 k5 w - static int bcnt = 8;
! v8 Z% `/ N; D7 V/ q V- ^" G - static int ccnt = 8;. ~4 k: k% m. e* B. H3 x
% i- Q. X3 {+ O6 U0 G- r; Q- module_param(acnt, int, S_IRUGO);
0 S2 T# {8 @* A% g- f- n - module_param(bcnt, int, S_IRUGO);. h. b8 a$ c6 f( [6 B9 }( H
- module_param(ccnt, int, S_IRUGO);
复制代码
: S5 J0 y& [* ]- R" A/ ^6 s* M. N9 T/ r
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, U9 }) [4 A* V$ p# m4 Z/ H; M
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 I7 R- n* n4 `- Z 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; ^: ] c1 I8 n% C ~3 ]( n, Y8 a3 b) z0 @6 \
8 |' G& Y2 P& W! f
|
|