|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* [/ @7 b& y+ w% |- [code]EDMA sample test application
3 j- g$ t6 L8 t4 N& M5 @* e - /*: l8 l% v, I4 M% L* s0 M& M, K
- * edma_test.c
9 x* S* K* N) e z# K3 K) S - *1 C G3 Q# q, l
- * brief EDMA3 Test Application5 I) u; o2 `7 D$ J6 J& |# O
- *
, X/ s3 C, P9 Q2 T5 Z - * This file contains EDMA3 Test code.( B1 h* K8 \! p' O" t8 w7 R
- *
2 U( a" Q( E& m2 j1 R) ?6 q - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! w$ B! s2 y. ]9 v, s
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) F' `4 }2 b$ O; t: O3 Q
- * TO CHANGE.
) R& n1 N; S7 a& b5 e/ h" m& A# p) r - *2 k% r: |% D9 L% S, U: ]/ }* X
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- [! d, Z1 U, l& h; P8 f5 v2 L5 ^
- *
7 }5 y; }& ^0 ?# B" ? - * This program is free software; you can redistribute it and/or
1 G( l) `9 x1 f' n# x) I& i7 L - * modify it under the terms of the GNU General Public License as
' y t. f7 h0 A b) i& B - * published by the Free Software Foundation version 2.( S9 H! f% a' S/ K* f: e
- *
% X# h- A1 `9 w6 V - * This program is distributed "as is" WITHOUT ANY WARRANTY of any) g" q5 L o# D! o0 v: E+ D' d
- * kind, whether express or implied; without even the implied warranty e4 S( W5 P0 d* a
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ D2 q5 K& R3 R - * GNU General Public License for more details.
* b6 z: N+ j' B5 G- _ - */5 ?4 U' {" ~: E
- ( V" K1 _' `/ Y6 m
- #include <linux/module.h>
4 S' Q- j( J$ x- Y - #include <linux/init.h>/ b) ]; I+ s; T
- #include <linux/errno.h># [# a0 M% B( e/ v) H$ I8 c
- #include <linux/types.h>
/ D6 h+ X! W, s' d/ f; M. o, D - #include <linux/interrupt.h> L- b+ P( W- t8 a# |. H" T+ t
- #include <asm/io.h>; |9 G% }; @! {' v2 Z
- #include <linux/moduleparam.h>
~, c) Y; H, A* z. ^ - #include <linux/sysctl.h>' M6 | \0 `5 v
- #include <linux/mm.h>5 Z5 ^( B3 v+ h; l9 m4 h" |# G
- #include <linux/dma-mapping.h>
0 h9 @; H# Y5 C9 n0 D+ x, [: p - ! y) \$ F4 f5 E6 o
- #include <mach/memory.h>( t6 m( G0 w0 G1 g3 r0 P4 n* a7 U
- #include <mach/hardware.h>+ @3 e) N8 a/ \4 U
- #include <mach/irqs.h>
4 n$ u; \* S- U - #include <asm/hardware/edma.h>
& r9 q& z. \; a% {4 z - - P, V1 b) Z* {* O
- #undef EDMA3_DEBUG
2 T) }) S- F4 y3 c/ D2 K - /*#define EDMA3_DEBUG*/
9 c; t8 E# W9 d7 M/ R
- g# \8 l, D" ~- #ifdef EDMA3_DEBUG
% R g, W/ l% s3 i; T O6 w# {! [ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
s$ X4 ~0 {. l9 X - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 j- a5 D. |3 g6 j2 i6 p- U! ~
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
7 _5 o" B. ~3 C2 {, C9 S8 P2 X. R% x - #else
4 j4 ~6 `' E' z2 ~6 ^ - #define DMA_PRINTK( x... )1 ^5 P$ F# B9 y5 ]. t& I- d' W
- #define DMA_FN_IN
6 l2 q7 G. O; x+ [% W, a - #define DMA_FN_OUT+ \* r9 u- V1 M; u+ A
- #endif
) T; L* |: v! v2 ?7 [ - ' c' T+ e' N# s _7 X
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)9 d/ i! R, A, X T
- #define STATIC_SHIFT 3
& k( |% h+ |% W1 d6 p - #define TCINTEN_SHIFT 20
* l: F |: w2 r4 f* t" Y& j: t# f - #define ITCINTEN_SHIFT 219 D1 g0 T1 {7 D2 h6 h0 I. r9 Y
- #define TCCHEN_SHIFT 22: X4 c; R" [$ |8 k2 Q
- #define ITCCHEN_SHIFT 23
! i4 z# B/ i. @( V7 g8 ] - " m2 K( \- L% c+ |" l
- static volatile int irqraised1 = 0;$ I, F7 i0 Y/ [+ O* B' z8 W
- static volatile int irqraised2 = 0;1 @" L6 L/ U# n3 d% e
+ F0 T7 N, A/ b! G, p/ {8 {5 H% B: @) T- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, G0 E7 }$ F( [+ L
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 U8 a0 ^7 K; C3 r% \0 m8 ^ f. | - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 }, W3 n5 [& r5 _ - # W$ h# b, B. M" m" t% ~
- dma_addr_t dmaphyssrc1 = 0;% o; p v$ a" h- \9 [1 Y1 y
- dma_addr_t dmaphyssrc2 = 0;) F' n% x) z, C* Y% T3 i
- dma_addr_t dmaphysdest1 = 0;
2 ~4 u1 P0 Y# Y5 A$ q+ T - dma_addr_t dmaphysdest2 = 0;
# ?8 u* ?# g6 W- c3 h% J0 ]
- ?" S$ X# C% `( l- char *dmabufsrc1 = NULL;% J6 d6 q) Y# u8 s: `
- char *dmabufsrc2 = NULL;% h: M8 I: z; ~' m- S, S/ `
- char *dmabufdest1 = NULL;
" n& V# v) X' p. s, k - char *dmabufdest2 = NULL;
& W7 L3 W& k! Q( ` - ; `6 [, h; p' Q& M) r; g8 Y4 Q
- static int acnt = 512;4 B2 v: F E0 r( q, w8 A8 P
- static int bcnt = 8;
! N! C" H( P8 \7 I5 m" e; Z - static int ccnt = 8;
2 G6 s e6 |; h
8 q/ t- @* x) C* q- module_param(acnt, int, S_IRUGO);1 h" s! A3 q. x; `
- module_param(bcnt, int, S_IRUGO);
" P! G: L* f7 `* w. L( R5 p - module_param(ccnt, int, S_IRUGO);
复制代码 % z3 {' |" Z9 c( |. V
. K$ }' o) H/ u4 y1 ?
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 g# i) v: w9 ~0 harm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 Y2 g% \7 n8 f7 X$ ?, Q9 o
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* _) t, b7 U6 c) g2 o7 \* L Z- I& M
7 E# N% {3 v" z: h' S: J) [' Y$ u) A5 }1 A3 V* }- n1 w
|
|