|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : r, u5 H4 E5 R' Q( R- D
- [code]EDMA sample test application3 x4 a, G7 h* K y
- /*
- y7 O" e2 h) ?- `* a - * edma_test.c
1 u2 }. \5 N' K& }7 G5 A - *2 |. t$ L$ y0 x; G" n; n" K
- * brief EDMA3 Test Application
3 z8 M# m; P2 E+ ?& U( J% |% ?; _5 t/ Q - *
3 f0 w8 n j7 v7 z# f! X- n+ | - * This file contains EDMA3 Test code.! F4 R5 ?0 u3 ~6 z
- *" L$ A* X. x$ N4 z7 {
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
! K7 b( r( { P8 t& Q$ Z - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
4 e5 t l2 b! J8 M( |" L' V& ^ - * TO CHANGE.* N2 k# @9 M Z
- *. K6 Q( |, c% \
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
' Z0 g* j A7 f - *& t9 }+ G8 Q* }+ U" A- r. r
- * This program is free software; you can redistribute it and/or" g3 F" _' {- I3 m5 q: b
- * modify it under the terms of the GNU General Public License as- i7 A ^' ` v6 L: o
- * published by the Free Software Foundation version 2.
: U9 X. F/ _# x# O+ N; y8 k U - *$ H9 `* x# E( d; U5 q6 `( F
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
. H6 b) Y( I! m; G" b0 j$ [9 { - * kind, whether express or implied; without even the implied warranty
+ }- t6 s: b- K - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the: ^' o5 p0 M, U3 _5 L
- * GNU General Public License for more details.
* _8 H/ Z v, Q$ N7 ], H- ^3 s - */$ j) ]- {- Y3 ?
$ Y# c$ N( v/ @( r, Y- #include <linux/module.h>7 L# u0 x/ Z0 z: G1 b) w6 P& O
- #include <linux/init.h>
* w. A; q! ^0 ? - #include <linux/errno.h>
$ n/ v% _ h& i; X' Z - #include <linux/types.h>& z$ f- y8 c- h' s5 n1 P l+ M1 i
- #include <linux/interrupt.h>
8 M+ J6 G0 @8 c* u! i; c# n - #include <asm/io.h>
4 \3 |0 B# K. _# b - #include <linux/moduleparam.h>
- H& g0 L% I2 B* b- q - #include <linux/sysctl.h>
1 f+ i3 G4 `6 c7 W) ]7 N& X2 C - #include <linux/mm.h>
- R4 X- ~0 O" Z" p - #include <linux/dma-mapping.h>
. n4 q; `3 x" C3 B
4 a* x. b! [2 _* o- #include <mach/memory.h>
0 F3 q& o, k- g; R% _ - #include <mach/hardware.h>+ `3 J8 U7 Y; a
- #include <mach/irqs.h>
8 B. W6 G% q/ v: P) X! L7 C' @$ [ - #include <asm/hardware/edma.h>" _; [" H0 ~* L! C u+ H6 ^
- - O% P& g5 L p$ _. P1 u
- #undef EDMA3_DEBUG" c% w: ^- M% S! `# L Y( h
- /*#define EDMA3_DEBUG*/6 D) ^3 A' V. u* t
- $ U5 K" u w1 o8 f1 [6 e3 U( X
- #ifdef EDMA3_DEBUG* ~/ @; R3 [! S5 j8 r
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) V( _ E- c4 c, ]5 t- o
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 b; R D. p6 d; W
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
/ C- F* `) w+ Z5 J( G - #else# Y0 v. [2 Y1 @5 ~
- #define DMA_PRINTK( x... )
# P1 ?2 ?* u" I3 E6 `4 q - #define DMA_FN_IN5 I i9 x. I2 s# G
- #define DMA_FN_OUT* ]0 `# c1 X5 j8 o
- #endif
( C2 z- J2 v$ p- ~: v* u/ d
J7 O# `5 k& h" t- #define MAX_DMA_TRANSFER_IN_BYTES (32768). H1 ]2 ?7 J$ v% Q% L
- #define STATIC_SHIFT 3: n1 k" j/ J0 S* a* E% `
- #define TCINTEN_SHIFT 202 z. M( x( T* }* f
- #define ITCINTEN_SHIFT 21
c4 j) T- U: {0 e3 j# t" @4 n* U! ^* N) ` - #define TCCHEN_SHIFT 222 t9 L- S4 R8 ?9 ?1 o1 D
- #define ITCCHEN_SHIFT 23
6 {, W& f5 y! K1 K# d- p
! ^6 p5 c' [7 o1 n. |- static volatile int irqraised1 = 0;% P0 Q9 b0 M8 ^/ f; _0 O$ Q! t; b
- static volatile int irqraised2 = 0;
1 `+ l2 r+ j; |8 c* s* ?8 i9 g - 0 C1 M' W7 z; c
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, q( c. l, Z1 X# T - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" H! \# X2 [+ }5 W1 M7 l6 f$ O& d - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. h+ k& a& O0 O4 q( w - * W3 j, g5 @( z7 N" n9 p
- dma_addr_t dmaphyssrc1 = 0;
: Q1 A8 O; L8 k/ ^- Q - dma_addr_t dmaphyssrc2 = 0;
0 d- W9 |6 |* h: a) F( b - dma_addr_t dmaphysdest1 = 0;3 I; k* B; B# B
- dma_addr_t dmaphysdest2 = 0; o( {6 u$ z' [- v2 j4 e" N( u
: i! q! I2 E% \# Y- char *dmabufsrc1 = NULL;, D3 a% _9 T" S. O! C8 S! ]% ?5 {
- char *dmabufsrc2 = NULL;' h1 w% G* B7 H1 I a8 L9 M
- char *dmabufdest1 = NULL;- f E: k4 M- }; ~! a
- char *dmabufdest2 = NULL;3 x, n6 S7 O9 |
- 1 z' o2 d+ n+ g- F* @1 K
- static int acnt = 512;
0 c! D( p3 a$ c6 N; p - static int bcnt = 8;
1 x3 N& u* h6 R( E; m w - static int ccnt = 8;
' i& H7 |. ~# }: l, O
; t. @2 J, o2 @- module_param(acnt, int, S_IRUGO);
' c4 }5 d4 M m - module_param(bcnt, int, S_IRUGO); C% `. d, T6 D7 R$ q
- module_param(ccnt, int, S_IRUGO);
复制代码
' [% O1 Q0 Z- L/ z0 @2 D5 Y) O; T; |6 ]# v1 s; X7 H
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: P/ a/ S% ?+ U% w% _% p1 J
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- x- g' X; M8 S7 j 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 S& Y0 A+ q' J" ~; S9 ~2 Q2 \3 c* u' i; S
; q8 V4 k5 ~. J' o7 E0 } |
|