|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ h5 S3 x9 a g6 y+ a/ ?- [code]EDMA sample test application
/ N% j: g! h3 F, ^( w - /*
: Y: E6 h1 C* L7 l4 _0 v& z - * edma_test.c
C" @( O" w+ D" H1 ~' R+ Y - *
: j# S/ E8 _2 Z3 m6 |6 s - * brief EDMA3 Test Application
& s y" S- F" Y* \ - *
; ]1 v. N1 [( T7 ^4 K+ } - * This file contains EDMA3 Test code.* H3 _; e- g' K D9 |. G# ?
- *, ~1 C% T' V5 {' P: d- C
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ d1 Q5 U3 V" D( {4 H
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! s- G/ R& ^& w7 g/ @0 G3 V
- * TO CHANGE.* h( ?3 ^3 C/ U+ e
- *1 [0 x& n0 s+ P8 y. @4 L6 R
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 U3 O9 H5 M, r1 l8 s8 c: i
- * Y6 z5 o! G! b4 d8 @) ]* s0 I- l Z1 u
- * This program is free software; you can redistribute it and/or
' @* Q8 k) [ b2 r) ]2 v/ [( X3 T - * modify it under the terms of the GNU General Public License as
( {6 W( E5 J4 f9 [( L - * published by the Free Software Foundation version 2.* a$ p/ c% `& }
- *2 D0 b9 }7 B' u7 W3 L& Y5 e
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
( w/ c7 ?- Q) h' T* f- Z, C9 N - * kind, whether express or implied; without even the implied warranty1 P: I. J- t; p. G" s0 Y
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/ V- z- a% X5 y7 n4 g5 W - * GNU General Public License for more details.' e5 R3 |& R/ H6 R
- */
1 I% A/ d6 O+ q
% _3 F0 j* T$ w" b- e0 U- #include <linux/module.h>
. t: l" Y' [8 C2 x/ k4 i - #include <linux/init.h>
+ G7 A/ A1 B' Z3 R/ x( Y6 { - #include <linux/errno.h>
4 d& H$ x- |* m+ k. B - #include <linux/types.h>5 K, w4 e9 q; m5 G- c
- #include <linux/interrupt.h>
7 G( w% E( S: O0 k& z - #include <asm/io.h>
6 a% [' L+ t7 o% w* O, B' G - #include <linux/moduleparam.h>/ a) l6 f7 c: f. C* |% v
- #include <linux/sysctl.h>
* D$ Y1 t$ i7 `, a) q - #include <linux/mm.h>3 l+ p1 X2 H* R5 `2 v, p
- #include <linux/dma-mapping.h>' f/ k O! `9 z. Q# b% i$ z5 y
# }. h7 D$ h% q5 `: `, t4 u+ H0 p- #include <mach/memory.h>
3 {- S$ Q _' _) C( l( j - #include <mach/hardware.h>
* S1 }7 F) o% @7 S) G9 X6 D) \ - #include <mach/irqs.h>5 s9 W& Z% F, s: F2 b" o k3 P
- #include <asm/hardware/edma.h>' Z* j! V1 ^0 }- ~0 T
- ; t+ e8 K3 c8 M0 u8 h, m
- #undef EDMA3_DEBUG
' e* U- G" B, Z& W, | - /*#define EDMA3_DEBUG*/
. C; h' z1 l1 S# |/ q - 2 z( @: V% c% }+ X
- #ifdef EDMA3_DEBUG
" F/ Q) K; y7 [ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 w$ P% a5 |' Y' m6 W
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): @0 r5 R" A! J0 u" m: h7 ~9 C; ?3 e* k" t) x
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): q( d9 A. g1 I+ k4 O1 k
- #else# @6 D m4 P7 y! l) P
- #define DMA_PRINTK( x... )) \ l Q/ ^9 w; | \. Q* }: x w
- #define DMA_FN_IN
5 t7 L# f/ P8 l4 d& b5 h# R - #define DMA_FN_OUT
; M$ T0 c- T7 y, i( h" g - #endif
( k6 J8 y5 u) O& D2 c# g
H, _3 w# l6 J+ c( N0 r7 C- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
3 [+ L4 S3 @' V- P9 d - #define STATIC_SHIFT 3
8 |8 c2 F( A1 x - #define TCINTEN_SHIFT 20
7 \( p% c1 ]) u+ ` - #define ITCINTEN_SHIFT 214 \) x9 A# V# f
- #define TCCHEN_SHIFT 22" Y# t" Y2 c A& y1 s
- #define ITCCHEN_SHIFT 23% k+ D) {* Z, S% h
- " @6 i K9 i: m) T4 U' Q, c
- static volatile int irqraised1 = 0;
- ^' f! _* H5 Q; p$ `- E9 W B0 w - static volatile int irqraised2 = 0;7 t8 H' @0 B4 f9 n+ i
$ s: M8 ]+ _# Z- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! k1 [& _* C& K( y/ \, D - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; C6 d2 I4 M* k' C% |2 P D& ^ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 ?0 U- M: g& T9 F+ P' { - 6 V# ^, M B, {; U: F4 ]
- dma_addr_t dmaphyssrc1 = 0;
; \+ V: ?4 P& w6 k/ w& } - dma_addr_t dmaphyssrc2 = 0;& U* F4 a! ]( K* p; o/ @# f/ {
- dma_addr_t dmaphysdest1 = 0;. U! {% O1 M+ f Q( u$ ^7 ]
- dma_addr_t dmaphysdest2 = 0;
1 h- H- |8 R. ?8 {9 S4 T% ]: t - / `; ?" j. [8 O* b- E0 k
- char *dmabufsrc1 = NULL;/ L" f2 ]$ o* g! g; N* n0 p& r
- char *dmabufsrc2 = NULL;
3 B6 v* T3 {: ]2 Z) e' \: S; r - char *dmabufdest1 = NULL;7 ?4 i+ o1 V& P; O4 z* H
- char *dmabufdest2 = NULL;- n7 V U* Z5 K9 g
- 5 @. }; D$ V7 p( @4 w3 k' `* F
- static int acnt = 512;
% X% w' z9 Z! D. |( p% M- k$ a - static int bcnt = 8;
- T8 I! i2 f& F; ` - static int ccnt = 8;
. c9 Q& s2 v* s& j# L
2 T" T2 J. ^/ M) g5 t- module_param(acnt, int, S_IRUGO);
! J& P3 H; Z/ p2 E: B% G, o9 e - module_param(bcnt, int, S_IRUGO);
/ z4 H' T- `0 F8 b7 E4 L - module_param(ccnt, int, S_IRUGO);
复制代码 " `2 a9 F' \1 M; P
; W2 i' T4 U. K/ d
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 f* v7 [5 d( P. |: F
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. g7 Y! k7 Y1 ] a( h+ I. |
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" H0 U- `( f: }3 P
" S1 O9 h+ u. h" i' L; w$ i B/ Q: N2 t
|
|