|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, A# Q( d6 [, d: `9 G- [code]EDMA sample test application" q' ~( N$ {+ \. ^: m3 Y
- /*
% z7 U3 p0 e, _) |- o. s - * edma_test.c
. M& i" V( C' _' f - *; F- a4 h6 i% N. Z
- * brief EDMA3 Test Application
- T- U: P+ s- H) c, o! |4 w3 b& ^ - *
7 k h. Y" Z; L) S0 k% g* C X$ Q - * This file contains EDMA3 Test code.4 j. p E# m' X2 m- j0 @
- *
2 W5 u6 K: s& Z' M( O7 m3 a9 ~ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
0 L- e4 c' N! ~+ T0 j - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT S- R, a1 w+ V1 J* M7 O+ w
- * TO CHANGE.9 b1 o* g# `0 }) P" c% d# B+ D
- *
8 I+ D# A% s/ D) b* L( O2 u) H* [ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 @) @$ j. N V C/ G3 ^
- *
; M- _8 ~. y; p - * This program is free software; you can redistribute it and/or
. r, c# _, L+ l4 ~' n - * modify it under the terms of the GNU General Public License as1 q; V# f: c6 y7 k
- * published by the Free Software Foundation version 2.
1 ?- _1 b% G/ x" H - *$ Y# ~) V' s. y' j' v, F
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
8 e' @" W) w& D - * kind, whether express or implied; without even the implied warranty
" c7 a# J$ }5 b1 p" L# C - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the! b! n- M D1 Y S+ J
- * GNU General Public License for more details.
" H2 G8 t; J3 Y - */
) z8 e& `+ x$ g! x* d - 9 j! M X' E$ S
- #include <linux/module.h>
9 \) }; R/ \) d" t3 _' X$ @ - #include <linux/init.h>
& ]" V6 B; b, i0 W0 Y. n0 [1 _8 k - #include <linux/errno.h>
+ ~/ @2 R3 O/ i! I+ Y - #include <linux/types.h>6 f$ s* h8 E2 F/ E! [
- #include <linux/interrupt.h>5 n# h! T8 W& _! U
- #include <asm/io.h>' F7 l0 F+ K. [
- #include <linux/moduleparam.h>
; t- F7 U3 K# N4 c - #include <linux/sysctl.h>
. @7 Y" ?' X. B6 \3 L9 l - #include <linux/mm.h>* {& } o2 F4 m% X) H
- #include <linux/dma-mapping.h>
% C; H1 F& P0 M0 Q3 M% ] - 7 y, P" r4 g. u* v3 z3 p f
- #include <mach/memory.h>! K! M3 w% }2 r( ?, x' L, w
- #include <mach/hardware.h>
% H ^: I8 a" B+ O) w, Z( a - #include <mach/irqs.h>
; o2 k. V; n+ s1 A4 r8 m - #include <asm/hardware/edma.h>- T2 X0 W; _2 N' u
/ G0 V, i$ K. e, P! X, [# W- #undef EDMA3_DEBUG9 N( I' H. ?0 O* Q2 x- L/ P8 _5 o
- /*#define EDMA3_DEBUG*/
! ?' v7 h; S/ }* d% P1 e - 1 X& h6 r- h7 j/ Z( D* G) r# w3 s
- #ifdef EDMA3_DEBUG3 M3 { U: g+ D- {- @: i: U
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): r6 c+ e4 i, J$ i
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* }& I2 g/ y9 [& b0 D6 `1 `- [
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
- B% K4 ^$ Q# T O' v - #else
& }0 F: P% B/ P, ^/ [' }% \ - #define DMA_PRINTK( x... )+ F3 h% q9 P4 b6 v
- #define DMA_FN_IN0 d4 b; G m) _5 _% C& |$ B' a
- #define DMA_FN_OUT
4 h8 b- k7 p; {- }) W2 l - #endif
% O; k7 l# F( N8 M9 @
7 Z) P8 b# n+ G; d& e7 P( Z- #define MAX_DMA_TRANSFER_IN_BYTES (32768)& q3 h% O6 K$ }- k' y2 D ~
- #define STATIC_SHIFT 3
% y. @: K& }8 b( p - #define TCINTEN_SHIFT 20; _7 P) ?! a# B
- #define ITCINTEN_SHIFT 21! ^8 [7 D1 b) Z5 J! ~$ N' q
- #define TCCHEN_SHIFT 221 k m T9 r6 \1 F- g6 ~) E% A4 j
- #define ITCCHEN_SHIFT 23; o6 r7 m7 y# ]& @1 M% i2 `
- - U5 U( }# b7 c3 ]) |8 m9 @
- static volatile int irqraised1 = 0;: u# K3 R0 u( K1 j& ~% e
- static volatile int irqraised2 = 0;
5 D j) _7 V, }4 O - % v7 o8 v! G2 F0 S
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 y$ |/ k* V; z& D0 i. r! r
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 G; U; P3 w8 |
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 g; }) W( c! y: H' b& \+ `
' q' B2 j1 r7 v N/ V3 V/ x- dma_addr_t dmaphyssrc1 = 0;1 C# T/ r: s! w2 h' A! m: f1 N6 V* e
- dma_addr_t dmaphyssrc2 = 0;8 ~: E. \% c! d8 v2 M
- dma_addr_t dmaphysdest1 = 0;& C- @6 \& T% t* T2 U1 R
- dma_addr_t dmaphysdest2 = 0;
$ |0 M2 J- U& M8 Z - 2 s( H5 ]. C# K; {5 H
- char *dmabufsrc1 = NULL;! C: @! u- x U* d4 t( L( q
- char *dmabufsrc2 = NULL;
- T9 P; P1 T0 s5 p8 i0 O - char *dmabufdest1 = NULL;
: a; H9 S5 ?* { - char *dmabufdest2 = NULL;/ n3 r5 a, F' B9 R$ G
3 P& [0 B- _, V2 ?6 ?$ c* y- _( |- static int acnt = 512;
# M, h8 L+ P0 [/ u - static int bcnt = 8;3 N7 S# w- p' Q" U% D+ v; p) R
- static int ccnt = 8;, @" S% w! T& P% p/ ?& }4 p
- # [5 d* v. g% h, ~8 j- h' x/ q) ^
- module_param(acnt, int, S_IRUGO);+ q5 S- K' Z0 j8 j, A& A8 _
- module_param(bcnt, int, S_IRUGO);
3 i* C. `& e2 _; l& i6 ~ - module_param(ccnt, int, S_IRUGO);
复制代码
& N& E! P4 z! H, ~/ E2 g# [4 ^- L; \+ z
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
`( x3 p$ u: q5 varm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' s- {4 C; V& }2 t7 W( q' w7 j
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。 S# i! k, {/ J9 X; Z, B
- }$ ^( ^1 _' P0 I- p0 S9 j+ `
9 D6 ]( O& K& d, O$ w8 Q' ^/ t |
|