|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & e( T ]7 u; B9 |3 \( v3 v
- [code]EDMA sample test application
/ v" x3 m( n a* @8 G* P* x B - /*9 {6 ~1 c0 r; O
- * edma_test.c
" X: h8 g+ ^5 p- S5 V& J/ \ - *
5 V2 L$ g+ {& o6 q - * brief EDMA3 Test Application
9 J3 Z! A/ i# ?& ~$ a9 l1 ?; | - *8 }( {) @6 l7 c3 ]$ @5 z
- * This file contains EDMA3 Test code.3 P( T2 K% M7 v4 ?
- *
: Y3 n* ~7 y, E& L - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 i; U/ o. z6 |! N' p* U
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
8 S2 L' g4 S5 f4 K - * TO CHANGE.' B' e; _4 N3 ?7 G' J H
- *$ i6 e# D* f" j. R
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ L1 d7 K% y @: M' [. K
- *- A. Z$ H& @9 e; F$ w5 S* D: i
- * This program is free software; you can redistribute it and/or
4 I; ^# z; X3 L$ Y# {) ~% j3 Z& @ - * modify it under the terms of the GNU General Public License as; B, [" l& P; e3 ]" P1 d8 s& P! h
- * published by the Free Software Foundation version 2.
" X7 Z2 q k/ |! |- U! i- a - *
8 m4 s0 z3 a$ g1 {; B( S - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
0 _6 }% e' Y8 L1 T4 D& z - * kind, whether express or implied; without even the implied warranty
0 x8 l `/ |( q4 p, z - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the) ~" \7 d; o% |7 `* r4 J% D8 n, W
- * GNU General Public License for more details.
1 h; c/ ?: L3 M4 r - */
6 s5 `- h7 G7 s/ x3 d9 d - 4 G9 g2 c1 R. ^! }5 O$ B
- #include <linux/module.h>
$ W# g5 ?2 X6 |; T6 W; F - #include <linux/init.h>
, ^( x: O7 |& {) T - #include <linux/errno.h>* C% P* ~% \0 L8 O4 V
- #include <linux/types.h>
) E3 g+ ^8 o$ ~: T' ^; n3 b* F - #include <linux/interrupt.h>
, {7 C2 M- S" ? - #include <asm/io.h>
9 y& i& \) ]% N5 O8 ?7 Y - #include <linux/moduleparam.h>
* A5 W5 q/ g; M/ m0 o - #include <linux/sysctl.h>" x; l" s# [; l! X# d
- #include <linux/mm.h>% s) C; Z ]! N1 I! H
- #include <linux/dma-mapping.h>5 T2 C! }& C7 h3 y8 e" a
# H( ]0 o0 U" M0 {- #include <mach/memory.h>. i7 u$ ^1 `" F1 ?9 ~$ }
- #include <mach/hardware.h>" W" L" y V' G1 ]
- #include <mach/irqs.h>; a+ @, U: U9 M
- #include <asm/hardware/edma.h>
' L0 Z* _% |3 A - 2 n$ j7 N8 G0 U# m) L
- #undef EDMA3_DEBUG
/ K& X7 i7 X7 N& i - /*#define EDMA3_DEBUG*/2 ~' U/ o0 Y& t/ U; I
- ; ~9 m: E; H) I3 W; z5 g% k
- #ifdef EDMA3_DEBUG
( b* ~" }( W7 i0 O. ?, \8 L: s - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). M+ S) p1 ~9 }8 [
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
8 X+ A; Q" L5 w - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
9 j Z. O; D0 w: r- Q - #else: S2 H, D+ w. x% w9 U- v
- #define DMA_PRINTK( x... )8 q/ m/ y$ {0 W k. N
- #define DMA_FN_IN8 X* F3 j/ x) z. }& A% k6 j
- #define DMA_FN_OUT
1 F! @' v4 w. Q5 i! K7 y - #endif4 e% I5 h/ b3 b. ?3 d6 Q
- 7 a" J) ~0 L, B7 K2 p$ o8 @
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
0 H% |& q1 k# ]6 Q - #define STATIC_SHIFT 3
. F3 k d) ]3 z# R5 z9 }6 i' Q - #define TCINTEN_SHIFT 20
/ G, l) b* y& \* }# C0 T - #define ITCINTEN_SHIFT 212 P! R' `: @7 v- o7 v
- #define TCCHEN_SHIFT 22$ Q7 ?6 D0 w3 S; K
- #define ITCCHEN_SHIFT 237 V/ \/ \7 T$ V8 w6 L7 k
4 F7 i/ O. Z1 i" e5 f( g- static volatile int irqraised1 = 0;& f" Z/ j' L* D9 L0 G$ |8 F
- static volatile int irqraised2 = 0;
0 s4 D3 L f) }$ x2 U - g$ r* h( i; d6 ~2 p5 n' {
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 q. F$ {( B; `$ c" x - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' u4 P4 f/ k. o
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ ?: O9 S2 w+ P
- + W9 B+ r0 b8 y5 {' ~! k; j
- dma_addr_t dmaphyssrc1 = 0;: S9 B2 r, F* u. v
- dma_addr_t dmaphyssrc2 = 0;6 B; W! M3 B6 G+ F/ b" _
- dma_addr_t dmaphysdest1 = 0;
5 q4 u7 E L, j: ]& O - dma_addr_t dmaphysdest2 = 0;( e* p+ q1 v5 y( B/ o& \
- 7 N$ J( w. C( a( o
- char *dmabufsrc1 = NULL;
+ U' c4 V3 r7 B( P' V5 v0 e - char *dmabufsrc2 = NULL;
4 z7 ~, z( M k* v5 X - char *dmabufdest1 = NULL;0 }5 A6 e9 G) {0 z0 Q% K7 e
- char *dmabufdest2 = NULL;6 x- [+ L+ `/ D" D! x# J m8 F
% ]: ^0 L* \. {( |* Z2 b# m- static int acnt = 512;9 A( d; S" W- c( Z. i8 `
- static int bcnt = 8;
( [ R: t6 y1 J# b+ K( c - static int ccnt = 8;
) }0 z: B5 v8 U, c& k - 8 v# c y, ~2 _# D. ]7 T
- module_param(acnt, int, S_IRUGO);
3 X0 R- T/ A# R% M4 v - module_param(bcnt, int, S_IRUGO);
+ \9 e- y: S, S8 F( E! Y - module_param(ccnt, int, S_IRUGO);
复制代码
& z5 d# E1 r2 s3 b9 i4 `
/ ^4 W$ i3 j+ J8 \1 I: G. G2 ]4 V2 t 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 H0 b+ x) m# s
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 ]. L+ }! R7 g/ k, ` 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& c1 l# j v1 {5 Q7 A
/ C3 m$ p+ c, I \8 f9 E: p. B" @5 J+ P
|
|