|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' Y& f" J) v/ C; @7 O+ i' D- [code]EDMA sample test application
/ I+ m- v# z. Y/ Q - /** M9 S" {5 E: P4 \# h
- * edma_test.c0 K$ E, q+ m6 P4 G, y3 @0 u
- *
: C3 c6 Y+ j3 M - * brief EDMA3 Test Application
" |1 H' n: U1 a0 S5 s q0 H - *
# l' J# E- F7 s, l+ k6 `/ h! h# P - * This file contains EDMA3 Test code.0 g7 m& Y" w& Y6 S; `1 I5 P
- *. o2 N: f; o' C
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
& T" u/ n6 L! k - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 @1 H% K5 {$ |" E0 w+ z& @
- * TO CHANGE." ]9 r1 [$ z7 P9 z; T5 w8 s
- *1 O, ^; ]% c; m4 |; ]/ F1 r
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
, H- o9 Z; A: R - *
5 E0 T( x- i0 t) g2 G( f - * This program is free software; you can redistribute it and/or
9 W7 n3 K7 | {$ i6 L - * modify it under the terms of the GNU General Public License as) A' l, O6 y# _/ a8 \; V
- * published by the Free Software Foundation version 2.. C1 h5 Y8 j% L+ c5 {, p
- *
5 U; h7 g$ [- u; Y0 o7 ]; e# Y. v - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
5 ] Z+ {- |! C3 g ^- J5 ? - * kind, whether express or implied; without even the implied warranty& |4 `* \7 v) s T8 c
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the' {) r) ?- [/ Q3 H1 C. O# W
- * GNU General Public License for more details.0 S2 [* `9 |4 V
- */: a# @; g# V+ ^- G1 n& _1 i
5 O/ s! F) k& ~ K, u' Q5 b! {* X- #include <linux/module.h>. z. R, j& F5 C7 }
- #include <linux/init.h>
6 C) U2 ~, V; [/ |0 u7 C - #include <linux/errno.h>
0 ^* \, B- W3 S a" f- v - #include <linux/types.h>& ?+ x) p' x6 V4 s, {+ z: K
- #include <linux/interrupt.h>
' O! x$ u7 I3 N; B4 C - #include <asm/io.h>" Q! j* ?0 R$ j C0 Y" A
- #include <linux/moduleparam.h>8 Q! [: u0 O6 J% `% b( y( k
- #include <linux/sysctl.h>6 m) }- |* o P1 d* R7 N- H$ s( J$ r
- #include <linux/mm.h>% r$ Z+ a: l) \6 N1 T. n
- #include <linux/dma-mapping.h>
7 G% V1 H; t; y$ f - 0 v1 ^4 i' Y: |9 r3 I6 ^; p
- #include <mach/memory.h>
0 g* p! W/ I' y& C* _ - #include <mach/hardware.h>1 i8 H& _- ~+ R0 K: X
- #include <mach/irqs.h>
6 j9 R2 w$ J: K/ R1 V7 M5 } - #include <asm/hardware/edma.h>
# a& z$ O5 y% Z$ ^4 E9 N - . D# U/ l- b6 R* ~, P1 P
- #undef EDMA3_DEBUG+ O6 b1 ?# u: [4 E
- /*#define EDMA3_DEBUG*/$ _7 _9 v/ M9 m
- / |1 }! {8 l( n2 H% `; H
- #ifdef EDMA3_DEBUG1 h8 X" H& {8 ]% T. v9 p9 {! u
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS) R @1 M1 y+ d; _8 R
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); {& E: E" v d1 \8 f/ G' S3 g% A
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
o* f- n/ @" {# L( E - #else
n5 m6 I% W* p; L+ ?4 I. h g - #define DMA_PRINTK( x... )/ w: }% ~5 m+ ^* B; L4 j$ q
- #define DMA_FN_IN
# u' m- o/ |- }/ E+ S5 n - #define DMA_FN_OUT
! w1 L( V0 H6 h8 a/ u2 S8 q - #endif
1 {& G" _- r: `, \* ]7 N
! q+ y o: }# C- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
1 n" n: L* r F B: t/ t/ Z2 x - #define STATIC_SHIFT 3* s+ K& Q, U4 f4 b* ~. v
- #define TCINTEN_SHIFT 20
- h: ?& t& G, `) M - #define ITCINTEN_SHIFT 218 r! Y! @, c4 Y( g- y9 K' z
- #define TCCHEN_SHIFT 22
: ~+ i* @4 W" T# r - #define ITCCHEN_SHIFT 23" I! G% c, S& u
- # p# _/ f& v. g z: r0 o5 r
- static volatile int irqraised1 = 0;6 o; K/ `, ~0 @$ {) y8 L
- static volatile int irqraised2 = 0;- [6 J0 x" f/ m1 {" |
- 0 e; \1 q; j( i, l' F
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. x4 D! n+ q8 M- G( x - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& B3 k8 m2 Q9 c' t8 a6 A$ @* E - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# f+ Z# _5 ^. Q7 A
% F/ q9 }3 D3 I. O% x- dma_addr_t dmaphyssrc1 = 0;
7 I' H* Z) j4 y2 l# o6 H - dma_addr_t dmaphyssrc2 = 0;
0 k9 @: N/ z: M+ [4 h; ] - dma_addr_t dmaphysdest1 = 0;
. u: H; B( r& L3 n - dma_addr_t dmaphysdest2 = 0;* p+ f6 g. }# g' `# k8 q4 B# m
1 P5 d1 \3 S0 c- char *dmabufsrc1 = NULL;% L; l! }* J* |4 l/ X! `
- char *dmabufsrc2 = NULL;
. A* L6 a7 X* w9 r. P - char *dmabufdest1 = NULL;# K( k( U6 x9 ?2 A: P( l
- char *dmabufdest2 = NULL;$ m- e5 r4 m2 M% C' d! f/ q
6 z! ^- Y" ]' T4 }; k% `' M, T- static int acnt = 512;
1 y! v9 k& e2 N6 J - static int bcnt = 8;
2 | s7 c2 }# N% c" y5 k$ x - static int ccnt = 8;' A2 h4 f" |/ U8 E" \* F( `
- " q0 U, k! L5 H5 X3 o
- module_param(acnt, int, S_IRUGO);
: P9 G; @- ` k' A: t - module_param(bcnt, int, S_IRUGO);
; @" Z! L# m9 Z3 @ - module_param(ccnt, int, S_IRUGO);
复制代码
4 ~. y9 S" n( a6 m* J( R, K6 |: b0 E0 I" A( Q+ o
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* c: J" M; C( Q3 @$ m- rarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# c) |4 d2 u$ o/ h; {
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: B+ {7 ]! K" J( j/ C c: D# R6 U, w" }* h8 n
; W* U! ^& A0 \ |
|