|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) g+ W% b& X O" W% u4 |4 Q- c
- [code]EDMA sample test application
0 e7 O* N0 O: X5 B0 [ - /*
5 C* K$ T8 \* a4 [$ p* ? - * edma_test.c
+ c$ i8 K/ D3 W# K5 W - *$ N1 n9 K6 c. O! Z* i, H. T* l
- * brief EDMA3 Test Application
6 q [# P! E3 K6 k% O - *
1 @8 c0 s2 x5 s' q0 A - * This file contains EDMA3 Test code.
& f3 D8 @% y7 M# q! D0 E8 u. c - *8 C! D8 g+ M* V# L. |' g( y, L8 o
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 g; B7 g" V, M# k
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 X" P8 A; D3 Z4 B* g5 ?
- * TO CHANGE.9 j8 f6 B. _% Z, x
- *+ v) a+ P0 J* G0 M
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
7 U9 N8 _' \! h2 E' ]* r - *
5 @1 y4 u- Y( z2 h) M# S Q% u5 W - * This program is free software; you can redistribute it and/or0 r; D+ m( N. U) k/ m1 w
- * modify it under the terms of the GNU General Public License as/ L5 O9 M; ]* l" N. w6 l- `/ e
- * published by the Free Software Foundation version 2. i9 m) W1 L, E# f4 q
- *2 t9 q; q5 R' n5 q. \6 M
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 f' P. \! b: n& a! J. _
- * kind, whether express or implied; without even the implied warranty0 G2 m# p0 S- {1 g6 ?/ e5 Z; d/ o& x
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the5 c% I% k$ ~- Z( ^& r6 q. J
- * GNU General Public License for more details.
6 n( n" F% k$ `) I+ Z - */
{- w; Q% u+ \ - ; q+ J# x5 W/ }; W/ k- D) c
- #include <linux/module.h>/ ]6 D8 J* s _( w7 z! N5 a% S
- #include <linux/init.h>
/ B9 |+ M* N# o8 z2 G* Q3 p. d - #include <linux/errno.h>& X' q2 O+ z( ^3 z5 C
- #include <linux/types.h>$ c! r* j) b) a8 u4 m
- #include <linux/interrupt.h>
, @5 ^8 y% V9 n8 U - #include <asm/io.h>* V5 s( W! X. K% n. O& h0 K
- #include <linux/moduleparam.h>
0 E# `: q. L+ U0 y; Q: p - #include <linux/sysctl.h>$ i; b; s5 W3 Z6 s; L3 \3 v
- #include <linux/mm.h>! k# h2 x% Z0 k. b, D: p4 U
- #include <linux/dma-mapping.h>
$ | t5 W) S( I8 _8 n1 m& c
+ j- n7 y" P8 [& U3 a& h! i7 i- #include <mach/memory.h>
; @5 A% Y1 W r/ ] - #include <mach/hardware.h>- p v9 G+ }% n1 _3 ?5 k: d
- #include <mach/irqs.h>, J- x7 W* r2 e1 J8 f% u
- #include <asm/hardware/edma.h>
; w! G" R% P/ L. d. O3 U: f - 4 I6 f, t" @" z5 I' X) O
- #undef EDMA3_DEBUG: Q# U4 A: i8 g9 H9 p! F
- /*#define EDMA3_DEBUG*/0 s l8 O- C4 R X1 h2 ^
+ }! t7 d+ a6 h Z! |8 D- #ifdef EDMA3_DEBUG8 `+ I$ F3 s! s
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) @2 ?( Q- |/ {3 }+ V& D6 s- f& I& n+ o
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
- x: k/ }* L: D; Z l6 K+ @1 u - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
7 A/ _; w6 v( o - #else
P# [' r, M( X1 a4 V( { - #define DMA_PRINTK( x... )* I" P* {' r, K' L
- #define DMA_FN_IN8 Q' ]0 R8 ]( y. e7 J0 a( f) ?% R
- #define DMA_FN_OUT
! ~* N4 Z8 O2 C* h+ Q - #endif
" O- Q% R0 S9 F9 Y( o( {
, \ l0 z; ]3 ?- #define MAX_DMA_TRANSFER_IN_BYTES (32768)4 S2 F7 ?1 G3 `9 T
- #define STATIC_SHIFT 3
c7 B5 Q/ Y# q# A3 | ^1 g1 Y - #define TCINTEN_SHIFT 20
" U$ H3 M" j3 B - #define ITCINTEN_SHIFT 21( u/ K3 D8 |& D! G9 ^7 W& {3 m! N" a
- #define TCCHEN_SHIFT 22
7 b! X, c% c! s - #define ITCCHEN_SHIFT 23' M/ Z1 m3 a" c+ a! v
% O' `7 a; b$ `& W. v. R. D; F, o- static volatile int irqraised1 = 0;
/ B) u q9 f) o8 |; z) v - static volatile int irqraised2 = 0;
+ V8 P. s) ]2 Z5 t/ T5 {1 t
/ [* @ V8 |. Z, N F+ t/ ]. q3 l- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 j$ u- l5 Y. G: }
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 G, f5 y( [/ p( d' r - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. X8 V( G& E/ b) @/ I$ @6 Z' u. [& E - 8 |. n$ s0 T$ ~; f2 @
- dma_addr_t dmaphyssrc1 = 0;
5 a0 C& J( Z+ C+ h! H - dma_addr_t dmaphyssrc2 = 0;4 Y, L0 z+ [- x& \
- dma_addr_t dmaphysdest1 = 0;
% C" o5 o8 q9 M F/ d - dma_addr_t dmaphysdest2 = 0;
6 t: l% R) Z" C: d
1 K5 E) s8 a+ d* w* R- c; S- char *dmabufsrc1 = NULL;
2 U0 `; q2 E6 S) z% R9 n - char *dmabufsrc2 = NULL;% v: h+ Y5 D# v' F7 M d. t
- char *dmabufdest1 = NULL;
h# {( f k( C4 z+ f - char *dmabufdest2 = NULL;
; u5 b2 [5 y% U! k, \
. m0 y- a% g/ ?! `4 X- static int acnt = 512;; q/ L0 O6 C5 z; i8 o( ~
- static int bcnt = 8;
' J. h" z0 T. Q" v0 _+ P n2 R - static int ccnt = 8;
) B) Q6 ~6 N. q - % ?6 E% s8 @; \0 a- E" |2 j
- module_param(acnt, int, S_IRUGO);& Y, v" q- k. p/ m1 }# p2 P
- module_param(bcnt, int, S_IRUGO);) p3 R* e9 X+ X- y
- module_param(ccnt, int, S_IRUGO);
复制代码 7 _ P D8 v5 k( u
( A+ I- j/ q) @& y r
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& k3 O" G; w+ A1 e/ 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. ^$ Y" o( {( y% g" {2 a# Z% l! _ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, j. }" |3 b5 Q; N ]2 j2 J% J
6 G- D: [% y$ D1 k* Y9 B
2 f* i( ]- t, F8 a O0 W |
|