|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' {$ N9 g7 n. o7 e! ^7 ~
- [code]EDMA sample test application
* R+ [3 s! q& m - /*! ?6 [3 r# J1 O1 i7 Y: W
- * edma_test.c) L, z! U! B; H; M# A3 p
- *5 |1 [: k' L, }! B4 u# ?
- * brief EDMA3 Test Application
" f* W- K" ]) [ - * h( e/ v0 Q/ c; n: ~: X
- * This file contains EDMA3 Test code.7 H" @$ |9 o) v- R. R2 j5 n" \
- *
C, C) o. \$ g - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
" ?6 \# r9 T* z( J - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
8 j+ {6 ]# ~/ ?8 W+ _ - * TO CHANGE.
; i2 @1 n1 Y2 T# k - *8 C/ z' ~) L, J
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
& z8 b! N5 s* c0 q- G0 ] - *
( V, Z( E: s: h2 m# p( i - * This program is free software; you can redistribute it and/or; e5 V/ `+ N# U% u
- * modify it under the terms of the GNU General Public License as
e. U( Y% z! [1 J - * published by the Free Software Foundation version 2./ y( Y0 `% p" p/ { `" o
- *
- N& w$ f( \- n! [9 _: @9 m7 p - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
) A& _3 w+ }$ ^1 c - * kind, whether express or implied; without even the implied warranty
' ]. M) T+ I# Y3 T8 |4 ^ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4 b" t9 ]$ y1 N3 ~, O1 T3 G$ E" X - * GNU General Public License for more details.- O$ Q: j- N3 Y! }% Q N
- */
, P/ r' ^7 ~& z; @% d" C- j" N
! B2 D& V9 V4 x t/ K6 r; z- #include <linux/module.h>; X; N8 g& J# @* C
- #include <linux/init.h>
& Q9 T' S$ e: m6 I! C7 ^9 l0 F# Z - #include <linux/errno.h>+ h5 d1 K: T1 p5 k
- #include <linux/types.h>
! w4 n2 f1 @3 j( ^0 n3 j - #include <linux/interrupt.h>$ O- Z" {2 r6 b8 W: M
- #include <asm/io.h>
t$ Z$ [" d8 m - #include <linux/moduleparam.h>
5 A; a N+ B) G% h6 i - #include <linux/sysctl.h>6 z- R3 `2 E$ y8 k( z/ N0 T
- #include <linux/mm.h>9 n K: Z7 F) m
- #include <linux/dma-mapping.h>
6 M) n: n7 i, g( A
, d! ~% X, B$ A V) J- #include <mach/memory.h>
1 H5 \( t: k2 ]/ e* Y - #include <mach/hardware.h>
# ?- i: Y' Y3 R4 j$ m1 M1 E7 V - #include <mach/irqs.h>
4 r( O- _9 S/ R5 g9 g, Z! z4 V - #include <asm/hardware/edma.h>) Y' p( Y8 l3 x! ?+ m' Y& I
! L2 T# I3 V( m# `% v) ~) W& b$ ^- #undef EDMA3_DEBUG6 O0 y$ d+ `- h. ` Y( e- F
- /*#define EDMA3_DEBUG*/2 ^7 X0 B1 z; p) O: j/ ^
$ | N0 s" W( ?5 B- F% h: C- #ifdef EDMA3_DEBUG
, h$ o6 i8 K$ }& J, Q3 M- ^, \ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 R2 j$ `4 T0 [. g5 |
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
% E# Z2 g& W3 U - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
* u4 Z& \0 z8 J8 f& D) z - #else
+ ], e& q/ d" @7 k7 s - #define DMA_PRINTK( x... )
! l7 O$ Z& Q) }: a! M5 c - #define DMA_FN_IN
, g4 k5 }' ^* L# c- R6 k - #define DMA_FN_OUT
4 _# h7 c* n4 V! F1 j - #endif
. U( v9 w: y2 j, n9 R
* H) b# s& Y% [: ?- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
0 `' X- v8 F, g! [7 C7 G1 ] - #define STATIC_SHIFT 3, F. r9 V% v# X7 K* S3 C' ~/ \7 B
- #define TCINTEN_SHIFT 20. o# Q2 g. K. b
- #define ITCINTEN_SHIFT 21
0 L" O8 Y. _ n2 }1 R3 ~# g - #define TCCHEN_SHIFT 225 a/ f# T* K; }0 T. P* b+ g
- #define ITCCHEN_SHIFT 23
+ B5 U! ?! C" \6 }" R - k3 d Y( J6 q" ^+ {
- static volatile int irqraised1 = 0;1 T0 X g5 w5 T3 L! D; G: S& e
- static volatile int irqraised2 = 0;! G( ]( R* N4 N- A
& D' j" \& n. _/ Q" Q# x+ m- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 W# @. @0 i6 H$ H% x6 B" V5 J7 } - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& q2 U* c( ]( y; ]7 ~' A - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# i& O1 ? P) q% r1 m. Z( I
) \. X7 o7 U8 @! L" s* h" d- dma_addr_t dmaphyssrc1 = 0;" ]$ F8 q S0 x& Y8 R
- dma_addr_t dmaphyssrc2 = 0;: ]" Z+ J+ A+ \
- dma_addr_t dmaphysdest1 = 0;. E/ D3 Y: D' h( E" \. h7 ~' b
- dma_addr_t dmaphysdest2 = 0;
, j8 q' r( p z$ h - : r. H* t6 y8 G1 s
- char *dmabufsrc1 = NULL;/ D% o5 T$ c$ `8 w; E# n3 W) S
- char *dmabufsrc2 = NULL;# U9 b6 N" T$ u1 D
- char *dmabufdest1 = NULL;
4 ]+ p, p) w. I& A- Z- l2 I" d - char *dmabufdest2 = NULL;
' y. i# t/ z# g9 b4 ] - - n4 t- Y/ Z7 R; M& L5 e6 N& W8 g, j
- static int acnt = 512;: U4 ^, e' d1 n/ i: I: k6 r$ ^
- static int bcnt = 8;
F+ r) H8 `5 g Y$ F! I4 n4 T# z - static int ccnt = 8;1 x( h5 b& R$ q' t6 f4 P
4 ?& O: b# Q/ B: z3 S- module_param(acnt, int, S_IRUGO);9 j1 w$ A0 Q( g; s d' E
- module_param(bcnt, int, S_IRUGO);
5 K6 Z2 p9 u, y" L1 c3 h+ W# C+ h+ @5 X' S* s - module_param(ccnt, int, S_IRUGO);
复制代码
$ m- [* G# j) F$ a2 O* \4 T* X2 M( r. \
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( g4 }- m* k7 B* q
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ S; I% Z0 Z' I) ]4 E
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! p U8 w0 u8 S) \+ c+ L2 h6 R+ o
4 n5 n L# k" c" @) z; _- Z: d& B
6 i4 y' ]2 x8 e; e) g |
|