|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( s: B1 }) Y/ }. D& K! P Y6 ]2 ]/ g- [code]EDMA sample test application
2 Q3 i$ o# U5 c! z1 V - /*
/ O3 x$ X- @5 h3 o A - * edma_test.c
5 T' l5 d+ j/ t0 ^ - *2 Y5 b! z- X# v- t& Y. I% A
- * brief EDMA3 Test Application4 w# I; L7 X- k2 i9 ~# n
- *7 c2 e. B: |4 a) }. ]
- * This file contains EDMA3 Test code.
+ e" s5 q8 C+ s. ?3 a9 M- M" @ - *
% d" Y: V) w$ U: Q3 S - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
1 O3 d* p+ u" @2 W! c9 n. U9 I - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 o( B0 t' d7 h2 L) x7 E+ H" @+ R
- * TO CHANGE.
; C7 n3 `1 }) I+ h L" B - *% F7 ?$ H% ~$ v8 @& ] W8 I9 p
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( h& I! [; T" t. H# S6 f+ ]
- *& [) u6 v( i1 h1 Q* c
- * This program is free software; you can redistribute it and/or7 ?6 \0 J/ r! A7 G6 i7 b
- * modify it under the terms of the GNU General Public License as
! b8 o$ o- }+ b. O0 o1 q& k* f" e - * published by the Free Software Foundation version 2.+ h4 j2 j8 N! E0 ~$ g' P+ v1 |
- *
2 G0 c0 y3 d2 A+ ?5 a6 B# N - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
" x, ]" O# E7 o% e1 A+ i* U - * kind, whether express or implied; without even the implied warranty) L9 a4 v+ M0 V
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5 C6 Q( o1 s; @ - * GNU General Public License for more details.
* G# }( k: C) U% X9 L" ^ - */
0 ~, K; J; E/ j! I* c6 P9 ]
2 [& i. a0 K# t- #include <linux/module.h>
3 q/ a3 J* g8 u0 \: C0 M+ D - #include <linux/init.h>
% w6 M0 t! p Y& x$ m - #include <linux/errno.h>
# n% r% g. j. q7 O9 d - #include <linux/types.h>
T8 B1 p4 A, }( Z - #include <linux/interrupt.h>
7 G9 t, y, S3 d& H* }' J- O" f - #include <asm/io.h>
' I' l3 [4 L0 B5 X4 J( V - #include <linux/moduleparam.h>
2 p( ?% R+ w6 P1 l0 y. ^% ~2 | - #include <linux/sysctl.h>% R j% n( c9 a
- #include <linux/mm.h>
) I/ D1 O) j9 D7 T( J r. o - #include <linux/dma-mapping.h>
5 V& H$ p3 p" s( L - @9 [3 ^& F. ^
- #include <mach/memory.h>$ f4 I2 S% D8 ~$ f% n2 W
- #include <mach/hardware.h>
; }& j. R) T5 D: O) \: n; l - #include <mach/irqs.h>
6 B5 o/ @4 ^( p2 S2 f# U - #include <asm/hardware/edma.h>4 S8 r! n0 D$ ]
9 q& t: E% I3 ?7 O9 n: O* ]- #undef EDMA3_DEBUG7 Y9 l; Z6 \% q1 V; p4 D7 Q6 I
- /*#define EDMA3_DEBUG*/
" y! ^" Y& n; N/ _
" ]* T& m( t" V- #ifdef EDMA3_DEBUG
V/ t9 v% {' f ? f8 q7 N - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
, j# U3 _+ R$ M - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
4 b* Y% o# D& h7 O; L - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
& L/ Q0 t! r* `+ W5 U - #else2 |4 Z& @1 ^! v; |! K
- #define DMA_PRINTK( x... ); B( o/ d- i( a# K# ~
- #define DMA_FN_IN
6 I3 ?: |- i4 r& s& R% z( l - #define DMA_FN_OUT/ e- w0 F3 Z. Z
- #endif
4 R& }. N5 k/ H+ ?, \ - 7 e2 i" G0 C. a( H! N, H
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
9 m) r5 R. s0 T! E7 G2 q% S - #define STATIC_SHIFT 3
# P) j7 \6 u$ K: L- G- R s [' s" M - #define TCINTEN_SHIFT 20$ {3 f/ c. I* D, c
- #define ITCINTEN_SHIFT 21* {5 ~9 {6 V, i4 V" r8 m
- #define TCCHEN_SHIFT 22& ?; v1 {& z7 x3 K
- #define ITCCHEN_SHIFT 23) ?& V3 i1 E: o. `0 ^" X
- 5 _ I1 o0 q+ Z1 L( f
- static volatile int irqraised1 = 0;5 W v7 Y& S9 w1 X* r
- static volatile int irqraised2 = 0;
: r a& r1 H5 e - O( Q9 p$ ^% X! R
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: }% X5 W( T7 J- x
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; E t* x/ y7 W* P6 Z - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 ]! [* k' D# P ]4 R, h
# @' S+ T: Q5 J1 h1 q+ T* V" f- dma_addr_t dmaphyssrc1 = 0;
' U% R* T9 m1 o2 j' }4 Q- d - dma_addr_t dmaphyssrc2 = 0;; ~ o: r. m! s d
- dma_addr_t dmaphysdest1 = 0;- s& d3 w1 ~4 A/ q
- dma_addr_t dmaphysdest2 = 0;
# u& x( A, C" B( K5 V1 s' J: C - / z% ?4 R n! T! W3 G6 E
- char *dmabufsrc1 = NULL;% p5 o6 c# d% @+ L! l* x* F7 z1 H
- char *dmabufsrc2 = NULL;
6 \, {" y7 D" k2 Q; W7 T8 e - char *dmabufdest1 = NULL;$ Q1 Y& {; h7 U
- char *dmabufdest2 = NULL;/ z- E/ x6 \' ]3 R0 k! b4 }: N
- 8 [' d- R' ~# \$ v# A* o
- static int acnt = 512;
) q+ T; z3 M* z7 X - static int bcnt = 8;
9 J- D6 }, S# [/ E" s2 i& T% a - static int ccnt = 8;0 |+ {! x$ m1 `" N. i4 g0 z5 r- v
- ; s4 f( `8 f8 {: o( t
- module_param(acnt, int, S_IRUGO);
1 F% p& ^6 J1 t* v v% T& d$ S - module_param(bcnt, int, S_IRUGO);
5 Z# b" @" n* T - module_param(ccnt, int, S_IRUGO);
复制代码
4 J+ {5 L" E. X1 d3 m R
& S+ |- C: l$ O$ {- I f8 i 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) Q4 p/ o! E7 Z7 b' M+ Y& 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- x2 H6 \4 {0 G" m6 p 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 S7 ~; L1 _' G9 R9 h0 Z! _7 U3 U/ n9 ?! h3 U# n9 S
' A Y0 ^1 b) a' K% K& B |
|