|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 R+ m4 I% r, b' T$ t4 ?
- [code]EDMA sample test application) \# I% |: E- A1 K* [
- /*
2 r/ o/ K/ D) g: |/ D6 K0 @ - * edma_test.c
$ {1 |' E; e1 c: N+ l' I+ t3 j - *
o- c" c9 J4 F8 ^7 m+ U* d9 q0 A - * brief EDMA3 Test Application ]8 s! H2 N) {) U' e
- *0 D9 V3 m% d- G n1 ^! t
- * This file contains EDMA3 Test code.: Z4 J+ w6 C+ ?# ~' |
- *8 j2 |- s7 a, F8 X1 \
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
: g% m# _8 B, S7 k x - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( ?; c; N: b& Q) B$ j6 B8 T
- * TO CHANGE.
& J6 |% b7 E* T. T; @0 z G" I - *
9 w$ Q. u* E" q/ [5 y - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
5 _& w( b7 k5 g) w - *, u4 `, H/ e2 l2 }; O; F
- * This program is free software; you can redistribute it and/or
8 U! A( [ ~1 r+ I4 r - * modify it under the terms of the GNU General Public License as
: s `0 [! y+ { m) d4 y - * published by the Free Software Foundation version 2.
8 F- R( H* X) s w; c, Y) O% X - *
9 ^+ h7 r: G, o6 u! l3 j* D& k - * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 V; B7 u# v+ g
- * kind, whether express or implied; without even the implied warranty
2 z9 B- h3 e- d0 w$ e5 ~ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
) r# @; w' O% h3 P# t6 x5 H) R - * GNU General Public License for more details.# n( i6 G2 `- {
- */
( b% ^$ E- r5 t1 f* p) }' p/ j - ) z ~9 o' ^- R& p: M" Q
- #include <linux/module.h>
: F3 x6 @% r: x - #include <linux/init.h>* u/ q% B4 \) a& h3 U9 G
- #include <linux/errno.h>
$ `" U- z7 m# w0 S - #include <linux/types.h>. `0 N9 v+ E7 c y% {9 @* l
- #include <linux/interrupt.h>
8 t. W% b8 E5 X+ g. U" I2 { - #include <asm/io.h>6 l* y5 |3 y- D. V! E) n* n: J3 e& s
- #include <linux/moduleparam.h>0 s L L* d+ K6 U
- #include <linux/sysctl.h>8 Y9 ^2 ~5 E1 v) W
- #include <linux/mm.h>
# [& B* y, W8 F4 k8 C - #include <linux/dma-mapping.h>3 \5 b4 Y& I _( q
- / Y: w% Z: l4 ?( {% W
- #include <mach/memory.h>* g$ T4 p( {. \% T6 J! ?2 O7 V4 @/ ^
- #include <mach/hardware.h>
, U1 f; u8 B3 Q- {! v2 S/ D - #include <mach/irqs.h>4 | u1 [6 E! ^5 H
- #include <asm/hardware/edma.h>
2 I3 M+ F# |2 Y B" M - + r+ m0 A, u' f% g9 ^3 O3 j
- #undef EDMA3_DEBUG
' I: {% e5 ^% ]$ J9 w' n' R1 p - /*#define EDMA3_DEBUG*// Y# v# w& {7 G
- * J9 T3 x7 ^! G2 }7 E
- #ifdef EDMA3_DEBUG) i; o* t7 J6 t/ |& ?6 n$ m
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ k% h, s* L! b: b' `3 R4 A
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
! N) i2 q+ K, t, D `: g - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
$ G* G7 i) C) Q- U- m1 u5 ~6 p - #else j9 ~# b4 E7 }: c9 x
- #define DMA_PRINTK( x... ) w; n: X* z; s7 X$ A2 x9 y
- #define DMA_FN_IN
S) O8 @' o( i- [0 D4 K - #define DMA_FN_OUT$ W. |' q" v5 v( i5 \$ C
- #endif
$ w/ ]# K! c0 O( b" e5 l
2 X r" `4 r" a( }- #define MAX_DMA_TRANSFER_IN_BYTES (32768)1 `- S) s: {% b) y9 k; e, @: N
- #define STATIC_SHIFT 3" g# a% J u7 B; X R) |
- #define TCINTEN_SHIFT 20
, [2 S, [9 I$ `# H6 |4 ]7 c - #define ITCINTEN_SHIFT 21
4 M+ c% e5 {% r, F1 R+ Q* Z% m - #define TCCHEN_SHIFT 22& d4 K8 u) A1 ]- e# R1 [
- #define ITCCHEN_SHIFT 232 f, }, b, N4 A9 C# {! d
! J3 n) n% j0 B. L3 {5 S' b7 Y- static volatile int irqraised1 = 0;$ a" j) @; Z/ e
- static volatile int irqraised2 = 0;
4 v) [7 d3 B" Z' R8 r( V0 N! |9 \2 l - 6 x* ]0 @) M) t7 f- C3 H
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) M2 G. r0 P* ~
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% h) L, i6 Z( D! v/ M* E - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 ?3 T" k: X ~, K7 T3 } p - # ^$ f3 V7 g1 w( f& P
- dma_addr_t dmaphyssrc1 = 0;
5 ~: y8 D' t3 ? - dma_addr_t dmaphyssrc2 = 0;9 g, ~! O7 U% s, Y7 k
- dma_addr_t dmaphysdest1 = 0;2 t' F8 m% ^! [& O
- dma_addr_t dmaphysdest2 = 0;4 B; C8 L6 V2 ~7 W
- ) D7 y( S* q! E9 u4 f J b9 ~
- char *dmabufsrc1 = NULL;
9 m2 V3 j: K% x7 V - char *dmabufsrc2 = NULL;% F/ q2 s. h8 ]- h+ ^. x P( Z
- char *dmabufdest1 = NULL;+ ]. C, G) C5 h, f, g" t/ S
- char *dmabufdest2 = NULL;
/ u% \" ~: Q2 F6 p( n
& O7 F/ r& I; t: x- a8 ?- static int acnt = 512;
' S+ p6 ?. t. C, ` - static int bcnt = 8;
: n4 o% W: m6 p% b - static int ccnt = 8;
. T5 W* a+ P D1 \) T0 d: @
5 w0 J! f/ Q: e. n$ U' D/ i% R4 Y- module_param(acnt, int, S_IRUGO);& L: g' L. V1 e/ ^: g: P; V
- module_param(bcnt, int, S_IRUGO);
" z' \2 N3 Z' h8 `) Z% T9 m - module_param(ccnt, int, S_IRUGO);
复制代码
, A8 v7 @; n' l& Q5 [; n0 Z" g+ H% n0 U+ ]/ i9 @9 n4 f
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" X) p5 L2 u5 P" O+ {
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" V8 v. O' M6 h& ~. S5 t 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# v/ \) C5 K) M
7 O9 D- S5 }) i) V) `+ R/ C+ {8 R
|
|