|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ w) C/ t( P, u1 {2 A% P: C5 ~
- [code]EDMA sample test application# R t, z6 z& F$ j, ?5 m
- /*
3 }5 W2 a% y$ J2 r+ e - * edma_test.c5 Z* T( h" {) J3 @7 T
- *
! [: z( t+ h0 a4 o9 }( [ - * brief EDMA3 Test Application4 Z s7 a; b9 H; f2 u) g: K
- *
. R4 ?8 H( p4 [1 F - * This file contains EDMA3 Test code.
) E9 _, a5 i0 r2 g - *7 d# p9 u+ M' {) Q0 e
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
; Q9 C* g# C# U, Q - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
, A2 O# F- v7 V2 w - * TO CHANGE.9 i0 e% z3 @+ \# k
- *
2 F4 g3 {3 M# V7 r, v% R% n% ^ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
+ U. M& G5 G) q n3 C1 H7 B - *7 E2 _& w3 J0 f% I4 b6 q
- * This program is free software; you can redistribute it and/or
- x( h) V# K* N ^$ d+ j. D - * modify it under the terms of the GNU General Public License as
$ {# [, i4 }% ?* x - * published by the Free Software Foundation version 2.
) e2 x6 ?1 i l5 r; B2 E - *
+ M8 P( H! ^' H! g7 w - * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 |$ \4 X- A; I% K ~
- * kind, whether express or implied; without even the implied warranty
* Q8 w; `% {) l - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/ n" _8 t8 R7 L0 m) |" g f, \. f" l - * GNU General Public License for more details.
* ?5 q# y( f3 B x2 H3 w- v% B" Z& F* a - */
* }: t3 j) ?& C& h3 ?$ V6 B - - X* K2 C0 k# l7 Q+ `# N
- #include <linux/module.h>
" }0 ~& O: x6 w) L; s( @ - #include <linux/init.h>
. W+ j6 h3 M6 p3 w9 | - #include <linux/errno.h>
9 ~) f* T# `6 P1 \ - #include <linux/types.h>
+ F$ F+ _$ t9 ~6 @7 p, n. {( ]5 N. U9 A - #include <linux/interrupt.h>
4 u; l }( M+ j, U - #include <asm/io.h>
7 B1 H/ r a2 W5 D - #include <linux/moduleparam.h>
: v) K% |& f9 y, Z - #include <linux/sysctl.h>
4 O) ~6 r6 N: i; ~6 r - #include <linux/mm.h>
6 \) G0 {2 y& _# w9 K - #include <linux/dma-mapping.h>( o9 |2 L7 L3 l1 e+ R2 A s' m
. N: ?# R5 H: ]' r0 \# P, ?' i- #include <mach/memory.h>
- @! k: S' c U* O# ?# c4 f - #include <mach/hardware.h>
9 I/ Z7 a' T6 l7 c" h% E3 D! f - #include <mach/irqs.h>4 a( @ W! @' u9 j2 u$ B
- #include <asm/hardware/edma.h># y% [1 C' F# q) S
$ {+ V! w6 Z5 c- #undef EDMA3_DEBUG% T7 H- Z# f! q% d' w- N
- /*#define EDMA3_DEBUG*/3 j; h5 N1 b( Y: P1 p# b
" ]0 F0 j* _, ^( L( N+ F9 e; W- #ifdef EDMA3_DEBUG3 X2 \, y: j$ O- t: A+ l! Q4 I
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% Q; T- c0 c/ ~) L6 ?; ~# j/ Y' T
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). D) n1 L2 o& E
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( f, E% F# A1 M P) J, M# U' O
- #else
0 @! K- B+ q1 x8 E2 O) e" M* f3 E - #define DMA_PRINTK( x... )
' g7 {; U& F. X - #define DMA_FN_IN
# K# t1 h/ p# J) F0 p' T - #define DMA_FN_OUT
0 O2 v# G0 ]; F: R( e q. J y - #endif* D$ q1 }. d9 @: q3 R
- 4 g4 Y3 v- y; y3 [- V5 i2 Z1 I
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
% K/ O. H) \( ^9 o H6 ~# U - #define STATIC_SHIFT 3
! J: D- D+ C& t, H" H - #define TCINTEN_SHIFT 20
: c7 E! P" T2 q* K8 G1 p - #define ITCINTEN_SHIFT 21
: C8 W9 x- S, ~4 \6 R9 r - #define TCCHEN_SHIFT 22
+ Q; ]/ a1 C. L) h0 D$ b - #define ITCCHEN_SHIFT 23
$ k- y) j- P7 y! }
3 p- i8 w1 H* g' {2 I- static volatile int irqraised1 = 0;
" O( P2 z* L5 o$ F4 n6 N - static volatile int irqraised2 = 0;
6 T% P) `& L* Q$ O( J - ( h5 A$ q Z/ ]. m! `$ `
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 A3 N+ A" h& C - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( m5 g7 o' T* T' u9 l - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, }! Z& j/ m" D+ T7 T1 V
/ a9 m- `. O1 @$ n8 [- dma_addr_t dmaphyssrc1 = 0;
1 K& ^0 n( B, G& d - dma_addr_t dmaphyssrc2 = 0;" m; B: s, q \: w4 ^
- dma_addr_t dmaphysdest1 = 0;
* ~! n' g% |% v2 h5 M - dma_addr_t dmaphysdest2 = 0;
! ^1 G" c* l: `( p% I/ b
" J- Y6 d' L0 e* F7 K4 S( [$ @7 k- char *dmabufsrc1 = NULL;1 C+ ^! S7 ~$ `0 Y( ?: |6 `% \
- char *dmabufsrc2 = NULL;5 P3 ~8 ?* P' |% m# w d* b' Q+ _
- char *dmabufdest1 = NULL;9 Z( I) j' ?$ s ~
- char *dmabufdest2 = NULL;
- t8 e" O0 m# e! K# @8 d) C- Y
/ f+ N- y* {2 h8 h! J F0 l K; L, v- static int acnt = 512;4 ~8 |6 n( [* F! [" U$ U( u+ f
- static int bcnt = 8;
5 G/ s: g9 R; v5 B& _ - static int ccnt = 8;
7 @+ k" M8 Y- G9 B - 4 e6 O! n6 u9 d7 E; K+ B
- module_param(acnt, int, S_IRUGO);. k4 B6 O+ K7 t% a
- module_param(bcnt, int, S_IRUGO);
4 f% }2 w+ q3 M; r; c: P. d - module_param(ccnt, int, S_IRUGO);
复制代码
+ b8 E- r/ e2 y; l6 V
) C( O$ {# Z! t 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 n7 @$ 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。% f: t6 _/ u1 B+ O
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& W6 J" o& f, W) n
8 F9 S; |+ Y- m5 R7 J$ @8 |' H8 G B, w0 w8 M4 N
|
|