|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 K- ~0 X/ F7 s- C0 a5 R! B! J- [code]EDMA sample test application
) U8 R! a5 z. n/ y7 `7 @6 ] - /*
, Y9 S$ K6 K) @ - * edma_test.c0 ~( X3 t3 c9 u/ _2 p( ~
- *
* _" n2 ~3 B% N \. @ - * brief EDMA3 Test Application
1 P6 s! X% D+ R( f: [4 Z( p5 N - *
6 ~* b% a& J% \+ _+ \ - * This file contains EDMA3 Test code.0 l' j$ u" v1 B% Q; \5 j- o
- *
: |. J6 n; {/ m - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) O6 W" y1 }. H% g$ [1 g
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
9 g& t# R. I* W. q7 @: X. _+ N) x - * TO CHANGE.+ ` S" {% H* S' {1 e' \9 Q8 C: S
- *8 |4 l1 r. i3 v
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
! ?" h+ X7 s4 Z3 s, f. i0 _5 ~1 m - *) O: s; {) v v: j2 `/ _
- * This program is free software; you can redistribute it and/or! T o- F3 d6 Y" C% ~1 J
- * modify it under the terms of the GNU General Public License as
; ]$ _; H0 |2 Y4 A - * published by the Free Software Foundation version 2.
* ]! c' [- O8 y- `, F - *
% _; k# t4 d4 s3 P2 |% Y+ U - * This program is distributed "as is" WITHOUT ANY WARRANTY of any# R k w2 @3 t' K
- * kind, whether express or implied; without even the implied warranty
: A' N. a) j1 `, A T; m - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- h/ ^- S( Q, z) M5 u - * GNU General Public License for more details.4 q+ O: f1 E( D3 P$ D
- */0 z# i& W: v0 G2 `% e0 @
: I% K3 u Q* j- @3 D- #include <linux/module.h>
$ t/ M2 V: b- t, a( C$ q; m - #include <linux/init.h>
9 N* C2 y! U! p1 j+ r- N4 r7 h - #include <linux/errno.h>
: c! \8 _- q7 Q$ |% c% _$ X5 f# S - #include <linux/types.h>- S% v# i/ _3 A4 A- z* M9 C5 V
- #include <linux/interrupt.h>
- i. e% h6 P5 Q! X2 E/ x7 } - #include <asm/io.h>
$ l; J- _- e9 ] - #include <linux/moduleparam.h>7 q2 e6 ?+ }" O5 u+ b9 G
- #include <linux/sysctl.h>) ]; U) W) t6 C
- #include <linux/mm.h>9 d$ f# O0 ] f. R" Q; `8 X
- #include <linux/dma-mapping.h>
' i! Z( {6 ~) B- o# U" {+ E; ~ - - @+ q! `& a: S" G, g
- #include <mach/memory.h>
: K3 L( H5 H/ G3 f0 }2 z - #include <mach/hardware.h>) ]+ T, @$ m6 v
- #include <mach/irqs.h>
/ R8 S# R1 r! O) T/ E' ? x - #include <asm/hardware/edma.h>
& |4 O' C u+ k% j1 r6 d
) x$ N# [2 | n& y; G( T. r- #undef EDMA3_DEBUG( g. M" i$ G9 R L' t% K' _' z
- /*#define EDMA3_DEBUG*/
, A* T3 m- q- ^" r - 8 ^6 w& m+ a4 e: I: j
- #ifdef EDMA3_DEBUG
& P0 o( r5 h! ]8 ?. N8 v# o - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* p: C+ r4 h T. W- j
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# a7 z1 ?. f+ _8 d I9 j+ G
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
* R- H% w! _' Q s N9 a% H - #else* S" \1 Z& O; }$ e; r# `
- #define DMA_PRINTK( x... )! j2 J, C1 D/ @
- #define DMA_FN_IN. R$ x9 E2 d1 c7 R9 d
- #define DMA_FN_OUT2 B, A4 F3 M2 }) j0 j4 i
- #endif5 s- y" R% G# Y7 j! R" U5 n
- & `& _& W. ]% }
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
2 v0 F, d. ^% S. l2 s - #define STATIC_SHIFT 3; h+ @( C1 W+ p( `. d( Y
- #define TCINTEN_SHIFT 20
; F' a9 L U5 }. ]# c% F2 N; _ - #define ITCINTEN_SHIFT 21
9 v( C8 f( f5 [' I3 E - #define TCCHEN_SHIFT 22' H: S9 H; \8 B6 F
- #define ITCCHEN_SHIFT 23
& |; u& M! A0 I/ P0 y
- {. `* U: C! P3 p- static volatile int irqraised1 = 0;+ l7 B( D5 G9 [& y
- static volatile int irqraised2 = 0;% f* e0 G0 _; n' L- O6 V
- % T* ~ O% O3 J' r$ d" S. E$ W
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 r' A; G: }# N8 F, S- v% u
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 g' V S9 X& D
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* J' Y8 o2 c, ]
- x8 o+ Y6 q* K. ^. |- dma_addr_t dmaphyssrc1 = 0;( ~: K) s" X& K: H$ Y
- dma_addr_t dmaphyssrc2 = 0;6 R8 G0 A; T4 s' ]) i0 z: g j0 Y
- dma_addr_t dmaphysdest1 = 0;
B$ @! i+ P* V4 ?. [$ Z' m - dma_addr_t dmaphysdest2 = 0;
, k$ M5 J7 F! K/ p5 Y9 n- z
- E. F1 C: c1 V( p' c0 ]0 _- char *dmabufsrc1 = NULL;
8 y0 w5 I" o. N! w - char *dmabufsrc2 = NULL;8 r- _7 g: }3 {% f- S
- char *dmabufdest1 = NULL;2 l, [" A7 s" P9 q: b" C
- char *dmabufdest2 = NULL;/ y% Y' L9 s' e5 M' v
+ f) P5 e5 g- G, C3 Y' n, f- static int acnt = 512;
+ o; b. u1 `6 ~# Y5 B# S/ n& K - static int bcnt = 8;$ s7 L, n! r; E$ \
- static int ccnt = 8;1 f+ ~3 u4 M6 A# E1 K
! F3 X$ r# U) B; ]% X- module_param(acnt, int, S_IRUGO);3 X' J! J: B+ r' W- g; G
- module_param(bcnt, int, S_IRUGO);
. h) f* k' C- d5 w5 X - module_param(ccnt, int, S_IRUGO);
复制代码
. x7 E/ s/ D4 ~2 F0 I
4 W8 B7 I; G, N 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( z0 ^$ h$ _ P
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。% |: A7 w; Z- s
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 g9 x( k9 d( n* k, T
1 x L/ b/ O# p8 B, a3 L5 Z+ k8 A9 ^) x
|
|