|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 q9 J6 U5 U+ V" Y. q$ y0 W- [code]EDMA sample test application
* o9 o% @- E2 H { - /*% `5 t+ Q1 \5 z6 U5 w
- * edma_test.c7 C; n9 H1 ^4 x2 a* q# G
- *7 Y: D' y0 Y# X3 E0 A i0 x
- * brief EDMA3 Test Application
" U& V9 n+ n' [1 C6 [! ] - *
, M1 G3 m. s, u1 B- h - * This file contains EDMA3 Test code.. n2 l3 P8 B* l3 I/ D$ a+ c. ~ E( q
- *5 P4 V1 {9 o7 [
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
& d- \8 f4 [" z7 Q4 u. x - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 j; v6 R( X+ ^, [9 g( D: K$ g& i
- * TO CHANGE.$ m7 K( {! L ]# w' f8 B
- *# s( d7 `' X9 N4 c- Q) x- U% W
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( e# q7 ~1 V/ H- K( s% o/ n
- *" c* @4 i& G! n$ f/ A
- * This program is free software; you can redistribute it and/or
2 ?( m! c# o1 [: |; p; W, ^ - * modify it under the terms of the GNU General Public License as' {+ Y. L3 l2 R O1 D% l
- * published by the Free Software Foundation version 2.1 Q$ g7 \/ }2 X* K- V
- *
G+ R* g6 B ~! E" n6 y F - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
$ s% S3 s0 n2 p - * kind, whether express or implied; without even the implied warranty4 }' f. O& d' C3 l2 B
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
: Z/ `4 i; U! O, f - * GNU General Public License for more details.& `; `$ E V+ Y( b
- */ g7 }- T1 m# s+ S
( j) Z* @( v7 S/ Q* ]- #include <linux/module.h>
( @5 ?0 ?1 ^% r& s5 |* m - #include <linux/init.h>- b5 o$ p2 f9 c- t& S
- #include <linux/errno.h>* a- h3 t; C3 w; G* z! f3 i1 [) Y( o7 J
- #include <linux/types.h>& R) h; P* w" i' Q5 h+ {# z# v1 N
- #include <linux/interrupt.h>7 q5 q5 [4 T5 W( |
- #include <asm/io.h>0 @) R* V5 r3 |* ^9 {! i G% u
- #include <linux/moduleparam.h>
2 t5 z# F( W+ l1 L, Z. s8 r4 ? - #include <linux/sysctl.h>6 ~8 w5 o6 E4 q8 u9 Z7 X
- #include <linux/mm.h>8 N- N' z% v! R# l& E* O$ {
- #include <linux/dma-mapping.h>
( C" g [$ N6 T' }9 M* Y
1 ]" g6 t6 c% l2 ]! d- #include <mach/memory.h>, R8 b2 [1 L0 d8 `: u8 `
- #include <mach/hardware.h>
P3 o M- k$ P0 x) v: p+ M - #include <mach/irqs.h>
& }' f }0 w* h, C4 K+ T - #include <asm/hardware/edma.h># C) S7 T8 `3 J3 U K
* u5 n* ~- w- p- e4 S, I( r: X- #undef EDMA3_DEBUG) ^, ]# H$ Q6 \7 S' H/ \
- /*#define EDMA3_DEBUG*/
& C% k9 t! G4 t1 b5 h - $ C, }' T9 ]) y# d( I' p
- #ifdef EDMA3_DEBUG' j$ q! p0 c5 p" a& m
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
1 _8 ~, y4 ?& v/ m2 _1 s# u3 N - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
3 [# P9 }( R- D% N- z - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
4 E: Q2 Q8 T. F" O, k0 F - #else
7 U& r1 X* w5 ] - #define DMA_PRINTK( x... )
7 Z: R0 H# r! z* d7 L& \9 R - #define DMA_FN_IN0 S# z; X4 r0 p" c
- #define DMA_FN_OUT
. O5 X6 I; m$ p$ R2 h - #endif
7 J4 m3 o+ W$ b' H - 5 w. D9 m: g2 O0 S& P1 F
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
- t( y2 s- ^$ e7 I8 _ - #define STATIC_SHIFT 3! U* r4 X* i+ n" Y5 C9 L/ a) J/ k
- #define TCINTEN_SHIFT 20) D8 z; x P# p- }! |& A$ P# I. v
- #define ITCINTEN_SHIFT 217 G6 X6 q: Q! H/ u
- #define TCCHEN_SHIFT 22% H- l' c+ X& z+ O
- #define ITCCHEN_SHIFT 23
, r5 I* D- P/ @4 D6 b1 t - 6 {/ }3 F6 |2 A! {+ h
- static volatile int irqraised1 = 0;8 E/ y+ G5 l, ~/ J) W- U% ?
- static volatile int irqraised2 = 0;! [! O7 i, r" q7 l9 W) I+ ]
- 2 D/ E# n' Y1 D) L
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 s" z4 e8 N# W( C" i- r - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' H9 M) M5 e, M- ]* A - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% Y2 c$ i, q! H: Q8 G9 L - 8 l$ M9 M6 c+ J/ ]2 e0 T
- dma_addr_t dmaphyssrc1 = 0;2 j- g- i+ y+ }$ q( |: z
- dma_addr_t dmaphyssrc2 = 0;# O# `6 s5 x4 X) w F3 J" O! o |* F# _4 s
- dma_addr_t dmaphysdest1 = 0;
2 r4 p7 F9 p! E9 w - dma_addr_t dmaphysdest2 = 0;) j2 V1 k- R( I, D2 v2 k3 D
- + m z" N: R: |* \: D C9 R
- char *dmabufsrc1 = NULL;# j* S1 S5 X: z# B$ y
- char *dmabufsrc2 = NULL;
) u$ x' `- Q( O4 |1 A# G% K - char *dmabufdest1 = NULL;
5 t+ b# ]: q7 c0 m' w - char *dmabufdest2 = NULL;
# E+ y# C% Q5 P1 K0 U) D - " w2 D* @) T+ o2 |. e, Z* `0 _
- static int acnt = 512;
; _4 P: f" h, G - static int bcnt = 8;
3 ^" W3 h/ S9 O7 I/ T - static int ccnt = 8;* c4 W3 k$ K" e! n( {
) r3 E) m2 F, a t' J( S' N3 B- module_param(acnt, int, S_IRUGO);
& G0 c% r& q7 m$ M. d3 N/ x3 G9 S - module_param(bcnt, int, S_IRUGO);& ?1 D6 Q' T$ k* z! N
- module_param(ccnt, int, S_IRUGO);
复制代码 $ @+ c& K* ?$ p! d8 p. _
p) _" ]8 p8 h' y: l* x
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: V# Z2 N: F, U5 T$ O1 uarm-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/ f4 o- f( h3 C2 |1 p( X. N T 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' d5 v/ l$ \3 E2 g+ u
; j/ x7 j8 b/ V: p6 i. X7 I: ?; m( o/ s! ~5 ]) N$ D* d3 P
|
|