|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! a" m% a/ d3 }( B2 E1 N! ~: {
- [code]EDMA sample test application/ Y0 \! z+ q) Z# T: E: q# ] T
- /*5 g* ~2 y8 _, J: P- f9 j+ |
- * edma_test.c {7 w3 R) A0 I; R
- *
6 ^. x) J: C' T. A: E - * brief EDMA3 Test Application- q, t+ {! k/ S6 v0 e; r t& ^) h
- *
. _( d }5 \2 a) a) r+ ` - * This file contains EDMA3 Test code.2 |8 _9 O# \. m& o
- *
2 ^, N9 h+ e/ e* |5 r - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
9 K7 k* f5 \. P4 y - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
4 H' u4 N* B9 M% U; D5 ]$ M - * TO CHANGE.
* [0 E' y: S$ h8 O* ] G! ~ - *& M: X# D' k, g2 d1 j
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. P& D* w- ]0 Q' \) F4 a
- *2 T! W1 X; S4 a
- * This program is free software; you can redistribute it and/or3 I7 B- ]" s( _ c" I. d, Q
- * modify it under the terms of the GNU General Public License as5 F' F: `: g* }5 f/ E3 P
- * published by the Free Software Foundation version 2.
* `+ x e r: \) Z+ T/ k8 e/ D8 T - *
# I; d' C! Y4 ^4 |% q - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
1 \- r1 p, Y- H- t' T {5 I - * kind, whether express or implied; without even the implied warranty
1 N% z( |* I m1 E0 ~ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1 L3 O% s1 q! j7 f+ {$ b( [ - * GNU General Public License for more details.
' r0 C" K# s ^7 r% T% W" n" s - */8 y K" r/ J% C9 J3 L% o
2 z) z5 T, `9 ]/ A- #include <linux/module.h>9 a2 s5 e9 O8 E) T
- #include <linux/init.h>
) W( F& u$ ?# { W( V! B - #include <linux/errno.h>
, u* T3 i% e$ F* `2 D7 T - #include <linux/types.h>
$ @5 m) s7 ]8 j* G7 O; A - #include <linux/interrupt.h>
. N: i5 |0 B/ E' g; A2 L( } - #include <asm/io.h>
6 Z, r ?7 o8 C! z% _/ U7 ^ - #include <linux/moduleparam.h>
9 h* R4 ^( H: R/ _ - #include <linux/sysctl.h>/ d& ?# v7 u0 y4 G# d* K" p
- #include <linux/mm.h>
u) A& E6 e0 w9 Y- S5 v - #include <linux/dma-mapping.h>) b' @/ F4 h! y5 [9 P7 ~! y! p
' Z, g& \7 X# K' @$ w c- #include <mach/memory.h>
2 v% G, `' j, ~6 Z, P: W - #include <mach/hardware.h>3 r9 S( T$ h- P- z' _/ C, U8 V
- #include <mach/irqs.h>
- D- C: l5 |6 s - #include <asm/hardware/edma.h>
, U* n/ P! \7 Y( G+ \
E% U- i R8 }8 T( U6 s/ H- #undef EDMA3_DEBUG& \& b. t2 L) H- a* l
- /*#define EDMA3_DEBUG*/
% D* ?7 O2 G- \. B. e/ g - " W! L f( B, r0 ]. r6 u% L
- #ifdef EDMA3_DEBUG# ^( r1 k& V3 D7 P5 V6 J
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
9 X* @3 ^% C; O$ x, A - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
7 @2 E1 U" Z/ T; D - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
1 M8 d4 c& T0 P0 S: q - #else
/ t; L; F$ v" D A! w5 E - #define DMA_PRINTK( x... )
( L3 _; X0 p: e1 }; J - #define DMA_FN_IN& e+ p( z2 F+ D- [# \9 i( |
- #define DMA_FN_OUT
1 L! D8 @. T2 X. }& f - #endif: u w# w2 D( ^; t' e8 a. r/ x+ F
- ) \( v4 Z) M0 T+ F1 q7 ~) H; P3 U
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)/ g* U$ P' Q9 `, Z0 m* E
- #define STATIC_SHIFT 35 O5 k; f5 N, Z: V( `
- #define TCINTEN_SHIFT 206 w3 j+ d1 X, t$ Z+ U
- #define ITCINTEN_SHIFT 21
/ F3 |% p) `. p' e, y8 ? - #define TCCHEN_SHIFT 22
& B: R, [8 y0 ^ - #define ITCCHEN_SHIFT 23& U7 t1 u1 V: E z7 V9 r
- / Q0 j' ]) P0 Q" J+ N
- static volatile int irqraised1 = 0;$ X2 J- L, P+ F1 P
- static volatile int irqraised2 = 0;
! q0 C3 t" e0 ]! K
, h; A& L! _. b5 H8 M- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. x! o% \, G- r. l" y. X, Z
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 h8 E+ M" h( f* L, J3 x - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 q' j- x: j- C, _2 u
; [* k6 X9 Z# l- dma_addr_t dmaphyssrc1 = 0;& [9 f k; |+ |1 e3 S
- dma_addr_t dmaphyssrc2 = 0;: D4 ?' Y1 F, n# n! q% k
- dma_addr_t dmaphysdest1 = 0;
( \: N" h+ V3 w' g8 u5 U - dma_addr_t dmaphysdest2 = 0;1 r3 t% `& R6 S1 ?6 \4 B
% w4 c( T- B: C$ P0 {- char *dmabufsrc1 = NULL;
, }; Y# a& }. C7 O6 Z* ?' f - char *dmabufsrc2 = NULL;9 x" \( u: v% e; U7 y% l; n
- char *dmabufdest1 = NULL;' P8 f/ O& T4 k5 Y% ~4 X6 |. Y- s
- char *dmabufdest2 = NULL;
3 o2 G* Y" @5 Q2 C' R; a - ( l, K( R6 [8 V% |0 Y$ v2 B1 X
- static int acnt = 512;) v' o2 u% Y# e* V8 c3 c$ N2 Q
- static int bcnt = 8;( d6 H0 M5 r7 X; Y9 `1 a$ \& A
- static int ccnt = 8;1 Q# ^' w; g" F
- 2 z: _8 b4 a8 F% H
- module_param(acnt, int, S_IRUGO);8 ^1 P# X0 J, ?0 n- g; g, ~+ S
- module_param(bcnt, int, S_IRUGO);
2 n0 }! D3 R. _ - module_param(ccnt, int, S_IRUGO);
复制代码
/ M2 y- P" u3 ?6 F3 j6 F) |# n' L( U
5 \7 U. e% H# {7 x 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! _8 E- w) ~ l6 R7 S/ farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! m7 ~5 }, D1 K 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 X) D( U! x/ q) C, Q' k1 m Q
( p/ {$ C5 R: t6 p) S
6 [0 c4 F2 P4 M9 S% ` |
|