|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, T& e2 x" V: [- [code]EDMA sample test application q& Y2 G# D! m1 `
- /*
6 O: E# H2 ^- g6 X - * edma_test.c: i+ z. i; n+ o3 I; @: C9 _* r! \
- *
1 P5 w) m4 Q4 H( S: }8 e+ d - * brief EDMA3 Test Application. L2 k! ~& v, Q" |! Q4 W
- ** |3 {9 T; N+ c/ @6 _& @
- * This file contains EDMA3 Test code.1 j" I- j, ^0 n" v, @& f7 U
- *& T- f R- ^, Q1 E+ ^4 p" T+ f
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
/ P8 u1 a6 Z6 W6 M7 T" X; U - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 s( H* D+ \7 V$ |1 ]' P
- * TO CHANGE.( }! m1 k2 t/ Z7 s# |/ A( i
- *
/ t( k1 b+ d7 U( w' M% U: X - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
9 H, |+ q! f1 O% Q- {0 ]7 r4 C - *
- _. b7 H: k$ r Z) Z - * This program is free software; you can redistribute it and/or8 l+ D" Y" D6 y1 `! K1 @2 q
- * modify it under the terms of the GNU General Public License as. J1 b: ]# r: ]) \3 k# s( T
- * published by the Free Software Foundation version 2.
. Y: N- \% x: Q5 V. I3 ~2 V% S6 o - *
' k) W, t) N$ E, V1 s% q - * This program is distributed "as is" WITHOUT ANY WARRANTY of any# U9 N! S- P+ i2 S3 E: D
- * kind, whether express or implied; without even the implied warranty4 z# _1 X. V' Z* Z' j. j B
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the" p- U& {# o4 D2 a
- * GNU General Public License for more details.
" L% }) L b) r - */
/ L$ q1 l! o. T3 G% [, ` - 7 }) W. r/ a( Z( D4 y
- #include <linux/module.h>2 x0 Z8 h9 q4 y: z \0 L; t/ T
- #include <linux/init.h>1 l& V p- G% K0 h" Z) m
- #include <linux/errno.h>
3 s; {/ o/ I7 a) E7 q: W - #include <linux/types.h>% n. ?: B/ b1 S$ _' `
- #include <linux/interrupt.h>9 z8 C b& b l6 T T- b
- #include <asm/io.h>
) n- Z( j E5 e1 J" P6 n7 q9 ? - #include <linux/moduleparam.h>
* J/ B# t0 p8 Y3 w: G - #include <linux/sysctl.h>
/ v0 `1 w, E5 L+ P& O2 F4 C1 g - #include <linux/mm.h>7 n% f8 C6 G# m! A2 n3 D
- #include <linux/dma-mapping.h>5 R! ^: r, K7 ~/ T/ o+ s
. }8 C6 x, C0 j- #include <mach/memory.h>$ R: m( K5 |1 t! c% u4 q+ \
- #include <mach/hardware.h>
- o/ G9 O9 Y7 W# f - #include <mach/irqs.h>" f( r' R" e1 b6 g7 F% R7 Q3 b
- #include <asm/hardware/edma.h>' Z0 ]/ ]. k: G/ }
- " K, K1 L6 Q$ s. |( v
- #undef EDMA3_DEBUG1 w) Q8 L% M6 @* q4 p, i6 f
- /*#define EDMA3_DEBUG*/0 F* K, k& `, U& k: m
- ; Z2 K2 W) J! r1 ]. q; J( s0 K
- #ifdef EDMA3_DEBUG# B: ]* M5 E: U( X J& c+ o. ]% U
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
" T- k9 @5 L6 X0 i! P6 @0 N) R* Z - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 e n r2 ^$ g
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 |8 S4 s$ N2 q; |8 Y& ~
- #else3 `, O: A2 K: @' ?# Q$ v, y
- #define DMA_PRINTK( x... )
# e3 g. H. y0 q8 j) G) Z$ }+ F - #define DMA_FN_IN: @6 L" [- f" r, @+ E5 b
- #define DMA_FN_OUT% x ^3 n; M" ~5 q. z
- #endif
5 G; a% y9 Q( z) Y4 k6 `( @# L
- R) u2 A; }8 g" Z- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
7 t; W& m* s$ ?' {) C/ o- H3 H [ - #define STATIC_SHIFT 3
3 B) Y; \; Z) A% ]0 T( Z6 a - #define TCINTEN_SHIFT 20, O7 {; k# H& r- k/ Q' I
- #define ITCINTEN_SHIFT 21* u6 y$ A; ^6 J! W% N( g
- #define TCCHEN_SHIFT 228 B) j6 [/ H7 `' L
- #define ITCCHEN_SHIFT 231 c, B, ^6 u* A/ m& O6 P7 w! Q
; @; Y3 d3 P( i- static volatile int irqraised1 = 0;& X1 u& D& r, i# T( j2 M
- static volatile int irqraised2 = 0;: H+ I I5 _* a
- 8 _' z) J; ]; {0 Y4 i
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 ~4 j- ?1 ~5 ?! z
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. o! y9 q. V0 Z! { - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" N" m5 r' P9 n1 A2 b U
8 X+ s$ d O* X( `3 c! Y* {9 g- dma_addr_t dmaphyssrc1 = 0;% C3 a! q5 `, |+ T4 V7 J
- dma_addr_t dmaphyssrc2 = 0;
m1 q) S% F$ t" d5 b* b - dma_addr_t dmaphysdest1 = 0;
# u% }4 n8 m6 I3 V' ^ - dma_addr_t dmaphysdest2 = 0;( K* \9 W5 H3 B2 \% O* F: ^4 A
4 K* I! [: K" u) w4 d+ l- char *dmabufsrc1 = NULL;
# F8 F: J- `. B5 n1 l - char *dmabufsrc2 = NULL;
% a* q2 ~# H: C ^$ S8 q - char *dmabufdest1 = NULL;9 _- F) K7 {" [0 S: L+ e
- char *dmabufdest2 = NULL;
6 y4 \: v# n7 i( C% `. d' {
2 X+ e) K. i/ I- static int acnt = 512;
7 x# M( Y1 g8 m; ?0 j* S* ?2 c - static int bcnt = 8;+ M3 \% F$ e1 K0 U4 E/ T2 z
- static int ccnt = 8;- E0 Y9 ^$ S- F C+ H$ W- Y
- # V+ q3 ]- h z& ~% r
- module_param(acnt, int, S_IRUGO);
0 E" ` u+ M" w" G! D1 D - module_param(bcnt, int, S_IRUGO);4 ?; i8 e0 F7 ^" d5 E
- module_param(ccnt, int, S_IRUGO);
复制代码 : j% C5 W9 Y& q/ V$ ?# s V
% M& q9 K' y* S
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ E l* G7 q9 n" B# P
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 O# U1 Y! ~& E7 L
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' L+ j' {) q% T8 ~/ o) Q z, H5 `' |% H& u
: d( `% s+ i% C% L: t8 k9 N% |- I( r
|
|