|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) f0 q' d8 L1 R& [# ^
- [code]EDMA sample test application, c9 B; M- y' q' M# D8 f
- /*5 B; P( I/ g9 G% z5 X/ _ @
- * edma_test.c
7 D/ o0 H- r4 a; w$ X0 c# e4 C5 x' X - *
# o1 ~3 Z- S t( O% X0 w - * brief EDMA3 Test Application
; h! n8 S* M' l/ j0 @6 Z - *
: M8 t4 G+ H5 Y4 ]- Y& X - * This file contains EDMA3 Test code.
, D0 x/ v" Z, t6 [ - *
; I. e2 A% z8 O9 H- I1 Z" ]0 r - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# P" m: R/ V3 Z! S0 T4 p4 p+ i
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
- X. r" H( o; p0 e - * TO CHANGE.6 b& j" |9 @ H8 S9 p( \
- *
1 d7 p8 i: S. c5 n - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
0 m. m$ e% T' _( M- [ _ - *4 l9 {& @: y9 ]; q7 e
- * This program is free software; you can redistribute it and/or
, e6 D" S9 g1 {' ~# |0 I/ \ - * modify it under the terms of the GNU General Public License as, x, f. X$ \- T6 e
- * published by the Free Software Foundation version 2. Y- G' T/ z) V# e2 {( L) b
- *
g$ e! P6 R. x8 y/ C - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
; P# R" |2 U7 l* e: U- v - * kind, whether express or implied; without even the implied warranty I* M) W* y+ e) m7 |* q* ^' p
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- r1 s0 |" n6 f" X" \0 `" F
- * GNU General Public License for more details.
& U% b' K2 X! k7 T& Q - */& `2 |; G$ f! i( [" c
5 u! o4 B) g/ U z% i" w: ^1 ~; t- #include <linux/module.h>
# ?: q, Q: s8 C* M! @" K - #include <linux/init.h>- G6 i& V& R: q
- #include <linux/errno.h>: r r* K s* f, i! R
- #include <linux/types.h>
C% n+ S; W! ~; {) L2 E- [ - #include <linux/interrupt.h>
% a2 }. O3 k, A! i8 k - #include <asm/io.h>
+ U: l9 O, k0 P9 Q8 e5 u3 ^ - #include <linux/moduleparam.h>+ }0 y' k: e6 r, t3 K) \; S
- #include <linux/sysctl.h>
1 I) Z: h# E- W8 J1 r! l - #include <linux/mm.h>, }$ {+ ~. t j
- #include <linux/dma-mapping.h>+ | N1 U8 L8 c' D
! ^8 _+ V! O$ Q" i3 ]! @6 g$ D9 y- #include <mach/memory.h>
$ ^, _% i) y- y- ?8 m; } - #include <mach/hardware.h>) ?+ z7 X5 v$ \1 f& N$ ]6 M# \, S
- #include <mach/irqs.h>, {7 B$ @* K$ p& Q! U6 x, A% s. v2 f
- #include <asm/hardware/edma.h>
) x+ J+ A' d8 \. ]! ?* Z# O
8 p7 _( v- O) d# n( ~) S6 @1 n& B- #undef EDMA3_DEBUG
. Y& A7 I4 _( b" C, |, q$ f8 H - /*#define EDMA3_DEBUG*/
" @. [, K8 t6 K+ V' Z0 W! r
5 j5 f: h, e% n6 r- #ifdef EDMA3_DEBUG
2 X* B- V& r* V, E5 ]/ j5 ~ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ a* v7 P/ G9 d: }% U
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
- J S+ d4 v9 u - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! ^3 F& r* z3 x9 d1 s' g
- #else
( S2 F) M% c) Z0 t, A - #define DMA_PRINTK( x... )
1 a$ `8 z9 _0 M9 f- w: e( S, ~ - #define DMA_FN_IN
$ {; q6 \( `2 [ - #define DMA_FN_OUT( [" a7 ]. G' L- q' p
- #endif' J' g4 F; ^: n$ n
- A+ I' \+ Z; T7 K
- #define MAX_DMA_TRANSFER_IN_BYTES (32768): Z" _2 w3 e' d" j; N# E) @% j
- #define STATIC_SHIFT 3
6 e% W2 l& ]) Z" q; s8 c - #define TCINTEN_SHIFT 205 b% G) G7 c) L, i; |. u9 Q% {) e2 E
- #define ITCINTEN_SHIFT 21; _$ ]% ~1 b3 I. S: R8 Y
- #define TCCHEN_SHIFT 22
' F k. n$ U1 a. N - #define ITCCHEN_SHIFT 23
$ e3 l, ^; V2 x1 i3 Q
- j2 d1 M/ }% v- static volatile int irqraised1 = 0;
6 Y' O. @9 i8 S - static volatile int irqraised2 = 0;6 Y& E' w! ?- F; T( v7 T# i
- & [6 k5 n+ ^1 S. ]% k+ {/ F* P) V
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% [8 M0 ]. d/ H6 z5 A
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ F3 ~; o8 c& F+ n# ^. o
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 F& `8 B3 j( w& g% a
- $ ]& l y# F" T& g. ?6 m
- dma_addr_t dmaphyssrc1 = 0;, T0 ]3 _$ o4 Q
- dma_addr_t dmaphyssrc2 = 0;8 _9 ]) l [. T: s/ f
- dma_addr_t dmaphysdest1 = 0;" }: s) r) p1 I0 U! G- }
- dma_addr_t dmaphysdest2 = 0;/ l4 `; J# q7 g `+ F
7 q9 J5 \9 x/ J7 b6 G, U- G- char *dmabufsrc1 = NULL;$ @: w" P# H! }" |
- char *dmabufsrc2 = NULL;
9 F K% N2 r. T( V - char *dmabufdest1 = NULL;
* \( }4 |+ k, \ - char *dmabufdest2 = NULL;# A' c1 N6 m6 Q$ ^+ E; A
- , y$ u' x4 D' K0 `4 d/ ~
- static int acnt = 512;
1 u2 _" X) {& Z5 [% [5 Z - static int bcnt = 8;
- v9 G: f% d, ]/ x q- u. h - static int ccnt = 8;
' r6 l9 B# Q4 t$ Q9 @0 W( i; V4 z
- g* y; g9 ?, o/ w# n7 Y4 O- module_param(acnt, int, S_IRUGO);) w3 i: z. L$ L" K. `( H! {
- module_param(bcnt, int, S_IRUGO);4 W3 u3 I; P* C6 T n/ t, Y p
- module_param(ccnt, int, S_IRUGO);
复制代码 ' M r \" z' a! b# w* A/ i
7 b7 h) f5 v: Y& F5 M7 c! x1 S 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; d% M1 c3 F0 i: J; |2 s( C
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) _) e- s/ b! t 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 ?& w5 l" L: S( \9 F: D( _4 ?" F: H- C5 W0 j8 X4 j5 [
2 g) i& D+ \ g1 j: Y, l1 P2 K% m |
|