|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* N L0 _7 r. J. Q; {' j7 w- [code]EDMA sample test application
9 P; y4 f2 ^/ } - /*
$ e3 A* k0 ^+ m1 p0 B' R - * edma_test.c
+ u- z0 }# U! V. v1 W" [6 M - *
+ a- f8 J) Q4 M# x - * brief EDMA3 Test Application
5 H! N- T/ Q h" L1 L8 d8 d% l - *
( F+ W2 p/ M4 \/ n1 q' n0 H+ j - * This file contains EDMA3 Test code.
3 F9 K: _# V) p) M- r5 U3 N% D! ?5 Q - *+ K* n3 c$ a$ m2 ^. I1 A$ Z
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ a, S. `# \4 Z4 m
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
, o' j0 C0 D$ ~% U: E- T: i+ |0 @+ y - * TO CHANGE.) c6 D# H D4 N2 O2 H9 q/ T
- *
u& h+ Y+ M/ m% x; j' N* A - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ C# C0 P0 L" D- e3 ?3 e
- *! _% D& r* f% [' ] }2 q+ p7 [% P
- * This program is free software; you can redistribute it and/or
% y; u" J+ T3 w/ t - * modify it under the terms of the GNU General Public License as
8 c; F4 z& U4 R9 H- N; F. c - * published by the Free Software Foundation version 2.: d0 ?5 c1 R+ {; [( o
- *' H/ b% ]+ b4 z% Z) e% |
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
% C; c9 h5 a" J8 w6 Q9 u; J - * kind, whether express or implied; without even the implied warranty
3 k; t: `( v4 \/ F1 E - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1 o( @4 b0 @! I# k0 V, Y! T. |
- * GNU General Public License for more details.
6 q1 o+ a- [% z! C% g - */. u, a" |) U4 x1 h Y" G
/ I6 P2 ~$ z3 l2 r* w- c% l- #include <linux/module.h>8 ~+ ^" Z5 E2 P, ^0 ?
- #include <linux/init.h>
+ Z% U5 n* `+ D8 i( ^/ m - #include <linux/errno.h>
2 f" u" |8 K* c" y8 \8 n - #include <linux/types.h>
; G Y( [8 H) J/ ~6 m - #include <linux/interrupt.h>
# q2 u( w: _1 |! ^: E' z1 ` - #include <asm/io.h>
$ B7 e' _( Y+ ~; H - #include <linux/moduleparam.h>
% E* I/ u. R: ]* h$ o - #include <linux/sysctl.h>
/ J0 l9 i3 v' b: F8 e - #include <linux/mm.h>. }/ j. h0 [# {, x; Q
- #include <linux/dma-mapping.h>
6 |$ k" @- x' M4 F- X
9 v( K3 h. _0 q: a! Q- #include <mach/memory.h>" q) N p- _& Y$ J, m
- #include <mach/hardware.h>
! R0 A [6 ^/ ] - #include <mach/irqs.h>1 r7 c' ~8 `+ T3 ]
- #include <asm/hardware/edma.h>$ g4 [( L# Z7 X6 w* x! f) N% {
+ x3 c" h( _, y# a- @6 [- #undef EDMA3_DEBUG
- a' C% a5 D$ ]1 | - /*#define EDMA3_DEBUG*/
0 S: L/ x. R9 p( O5 |" s( n - 6 Y4 a2 Q; o! B- H( \5 n" P
- #ifdef EDMA3_DEBUG
: _) X* `5 E" K) r; @% z - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
, b. g4 [9 `, {& m- n- H3 x5 f - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
/ o* w: T' p( P8 e - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ P. X, K3 Z T: W* d+ a
- #else: h, u" s# D# S! q# U
- #define DMA_PRINTK( x... )# B3 @( H; h6 O1 J0 I/ E1 n
- #define DMA_FN_IN
, @: V3 d. L% }7 m - #define DMA_FN_OUT
+ \) T/ E' N0 ~9 \$ h5 } - #endif
2 A! ^9 W: i- Y" k - 2 C; }5 x1 _1 ^5 w
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)1 `6 T" @4 d9 Y- e
- #define STATIC_SHIFT 3
0 E4 l T- q! H1 X* G. ]9 Q; m - #define TCINTEN_SHIFT 20
5 c0 H8 K8 X+ S( t; Y - #define ITCINTEN_SHIFT 218 u1 C" s) a* S* N- E% L
- #define TCCHEN_SHIFT 22. v8 M- i0 `% r7 J4 K# N$ g; A: d
- #define ITCCHEN_SHIFT 23
/ q: O' t3 A d" b - # S" U. ^0 [2 Q, B3 K
- static volatile int irqraised1 = 0;: N2 w) Y- I, k
- static volatile int irqraised2 = 0;
& I1 c- D' J- E4 ~, e
# p( [) S; V+ q- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% h: {6 n3 J# E; t7 b8 @' s1 N
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- j% W) N9 e: B% Q+ W8 ]- v7 H) @2 X* f - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. v$ ^$ [5 t8 u+ ^
+ h' P3 P2 n4 A8 O- dma_addr_t dmaphyssrc1 = 0;
! i9 B' }& g. T" K4 i1 R - dma_addr_t dmaphyssrc2 = 0;, B7 d/ F {+ X4 b
- dma_addr_t dmaphysdest1 = 0;
7 N& ~' Y3 o1 f- Z+ ^ - dma_addr_t dmaphysdest2 = 0;
; I7 A+ e# d5 K" @) H9 k: z) k - ' T, C7 b6 m( l* C1 L4 ]1 x
- char *dmabufsrc1 = NULL;
8 F7 Y3 g' ^6 p8 ^+ W$ f: U2 ~ v( { - char *dmabufsrc2 = NULL;
4 q& F% h' {) [. K/ c$ @- c7 e) X0 C9 S - char *dmabufdest1 = NULL;+ N% r- J! z6 }5 d
- char *dmabufdest2 = NULL;' ^% n* i, x& Q1 E# _4 j$ ]
- ?5 n$ g' [' s% b* A+ I. ~4 \' Y
- static int acnt = 512;! a a& K- ~' m6 \ o
- static int bcnt = 8;
, \. }' S" E+ @6 \$ R' h - static int ccnt = 8;
1 b0 W/ `* f7 {& Z
9 m" w# B) ~5 p- D# |+ A L- module_param(acnt, int, S_IRUGO);* N' U6 ^ u G5 \. k/ V i
- module_param(bcnt, int, S_IRUGO);
: P: Y0 n2 b" ~# J+ n% ^ - module_param(ccnt, int, S_IRUGO);
复制代码
: Q, G0 ]: F9 |4 J' l) C% o9 {6 y
2 S! ^/ `. M/ S9 `2 W, d/ ?! K+ w 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( l% J6 Q' _; p6 v: Warm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 s3 U* C, q% k/ W9 N8 ^ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 \. k0 {5 H7 X" g" x; n! k, L+ M8 ^ n+ S1 a
# t# E g: a+ A3 m! ~/ W3 |" @4 G |
|