|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 i8 r& a- R+ p: N: r) x! y& q! f: d
- [code]EDMA sample test application6 ?8 X. x% e; o: p, g
- /*
4 U( `7 H" W2 w8 k - * edma_test.c& n- A' B- R) e+ k* X
- * d# r; l$ ]7 f- _9 Q
- * brief EDMA3 Test Application' c1 Z! Q* v }. B- A$ }
- *" }/ v2 Y c6 L# B
- * This file contains EDMA3 Test code.; J3 q0 B: j4 K1 R& G
- *
+ G; d+ d% ^7 M# Z - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE i) d" s" e- T* S( `. j
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 q8 g; E: W# `2 E9 }, X4 A; c
- * TO CHANGE.
3 U/ r9 d$ S; m: L, S - * t# D6 Q% E5 S; W- X' h# d! g3 p
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
: s$ p5 [9 T/ i - *" `+ M- N, R6 v9 r/ g
- * This program is free software; you can redistribute it and/or
% ^( v; U9 ?7 z/ ^ - * modify it under the terms of the GNU General Public License as3 \. c3 k4 w( E V; M
- * published by the Free Software Foundation version 2.
' L+ j! k4 K, k - *% A: d2 u: o/ [+ E
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 i3 I2 r% }1 H) C- n3 q4 B6 r' A
- * kind, whether express or implied; without even the implied warranty3 h! N m/ z+ t& h: z, {# k+ j
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! c; D8 I9 C" t - * GNU General Public License for more details.
, ^( `% S) e, m- I7 j! O7 H - */, a9 q; W4 W( u& U; _* K6 O
- S! P H; }( q/ q" _' w7 P1 K- #include <linux/module.h>
1 t1 e: G; W- V+ ` - #include <linux/init.h>, w6 d" F$ v. h, l- `3 [
- #include <linux/errno.h>( o5 ^' z5 I+ B# s( r' B
- #include <linux/types.h>
7 T1 L* ~4 g( d6 e* ^$ C - #include <linux/interrupt.h>5 H1 |% c1 [5 q) a! f8 p1 b, {
- #include <asm/io.h>3 a# }0 c0 v0 v
- #include <linux/moduleparam.h>
# n8 y# i2 P4 a8 t9 e - #include <linux/sysctl.h>2 F9 a! S x# v) B5 O
- #include <linux/mm.h>- S+ |; m, X: |, B
- #include <linux/dma-mapping.h>8 R9 V; U7 ?. q& v% B3 E7 }" r
- 8 E. ?/ r# y1 Q: @( T
- #include <mach/memory.h>
/ V" }: {' ^0 O/ R - #include <mach/hardware.h>
: p! B, V1 J8 G* p9 g - #include <mach/irqs.h>
4 z8 Z5 a3 q! B o - #include <asm/hardware/edma.h>
* I0 ]* p2 U6 x - 5 s* Q. [& e) S6 U6 ?* E
- #undef EDMA3_DEBUG
$ F0 U, P% r! t0 l$ t5 z - /*#define EDMA3_DEBUG*/
/ g" M; T; ~& A$ a+ f# A2 } - - H* R0 _( ?7 j/ d g1 H0 Z+ W
- #ifdef EDMA3_DEBUG
/ x; d$ c' J* }7 u5 b$ a" w - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
" m9 h f0 j$ U: x" U$ i) b; L. r - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 N2 F( Z z0 z4 H# w9 g
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" P b5 T, d' ?% s: @% R
- #else+ [$ v3 o$ \2 C j. [
- #define DMA_PRINTK( x... )
" S; H6 P4 d) c: v! |8 W - #define DMA_FN_IN
& k# @0 H% |/ c4 j1 M6 _! J* t3 G - #define DMA_FN_OUT0 W8 y* e" ~! C% C$ ?+ [+ s! y
- #endif% X) _, U& \& _$ y/ J9 ^
- N/ u$ u- w" f2 r' J0 @
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
8 y- M) L4 s; j* `; w - #define STATIC_SHIFT 35 d- s+ S3 O, r% p2 G1 A
- #define TCINTEN_SHIFT 201 x' ^ A$ J3 M0 R5 Q3 c0 v
- #define ITCINTEN_SHIFT 21
6 j* ~2 E$ h1 X v' q - #define TCCHEN_SHIFT 22; S1 Q6 G9 @1 T7 C
- #define ITCCHEN_SHIFT 23
7 S/ o# y2 [2 u7 P* | - 5 u4 w+ ]# V/ z. d$ f
- static volatile int irqraised1 = 0;( F& G1 _6 c( B& O) z7 |' |
- static volatile int irqraised2 = 0;
3 Y7 X1 M& p1 W% B- M - 8 j/ K5 ?6 d+ [8 C1 y" z
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" u$ ?, Q. k S, c4 M3 B: ^
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; g- S3 |, H0 j/ I5 z - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( I; L3 X$ W* _4 N( K" l - - b! H1 S' \ Y7 J
- dma_addr_t dmaphyssrc1 = 0;
( p N1 K0 R$ ]" \/ K3 p( F - dma_addr_t dmaphyssrc2 = 0;
5 F/ E+ f; a" Y& M0 v - dma_addr_t dmaphysdest1 = 0; J4 x4 I% r2 F; s+ u% v
- dma_addr_t dmaphysdest2 = 0;
q; E: e5 X- h
, C9 S. \- {0 {4 ~) @- char *dmabufsrc1 = NULL;! r5 v, F4 t& K* G
- char *dmabufsrc2 = NULL;
! t) r( o4 f* m7 H6 @ - char *dmabufdest1 = NULL;
) u* `5 `$ |5 w5 Z: T* E2 Z - char *dmabufdest2 = NULL;1 X I6 {3 ^1 _4 _0 h
0 K* q. A5 H3 a% {7 _( u+ ?. r( p8 ~- static int acnt = 512;
: ^" J: C: G F! G3 d" z* I - static int bcnt = 8;
: u# t$ E( S6 { - static int ccnt = 8;1 [9 E5 Q- X, G/ [, w9 b4 H* z9 M
1 c+ u7 u- H. c: |- module_param(acnt, int, S_IRUGO);
9 M9 f- P# t/ e. \3 h o - module_param(bcnt, int, S_IRUGO);
+ `; M# O4 |6 t1 B, G% v! V" m% } - module_param(ccnt, int, S_IRUGO);
复制代码
& P8 \7 ^5 r. }. _
5 X% d8 H# X3 g3 f' l8 f: `0 T 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 X Q) k& u4 [% ^. D7 t
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 A, Y) ?1 N6 e. z4 Z( J4 l) [
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 q7 c6 E# z( u3 x, j* L! p0 i [" e1 M* x5 d
5 S6 a {' I' E; }
|
|