|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: q! K) K' f. g9 x& [ Q8 ]% N- [code]EDMA sample test application( ]& o6 g* F- C m- D
- /*' o7 ~8 Y% q% G7 O, m
- * edma_test.c2 G+ E4 z8 o- ^1 a2 q9 U
- *$ |4 u0 `/ O0 y, T, g( g; C$ p& i
- * brief EDMA3 Test Application3 _$ ]8 Y* n9 K [
- *
2 x' E8 W, e/ R* M) s! D$ p. n - * This file contains EDMA3 Test code., w. Y& R a8 ^0 v+ n H% q
- *
1 ?2 v* h, C& A$ s2 ~/ R. G. | - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 H' ?0 _$ J+ o \# }0 M. \: _
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 b$ Q% R8 N+ S0 Z$ Y8 O" C, L
- * TO CHANGE.% [5 [9 M+ y, ~% I- I' V
- *
+ K6 e+ I0 i( u - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
1 ^0 N% B4 C, i5 i - *5 n1 S/ T& [! ]( Y: [. L
- * This program is free software; you can redistribute it and/or( P+ c3 }( b$ G7 S) B/ V( h
- * modify it under the terms of the GNU General Public License as* s/ U% Y2 v0 K" b* @+ z( l! B/ ?* g6 K
- * published by the Free Software Foundation version 2.
3 S* `+ X7 |* K* L x3 u - *" l+ l# o8 m4 k
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
$ ~. l* U c) E% I/ Q9 ~, p; _- h8 J - * kind, whether express or implied; without even the implied warranty8 j# y5 D( F9 G0 j# l7 A ]* j6 d
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
& V% _- O9 }" @% j$ N - * GNU General Public License for more details.
/ w) V7 _. y% I* q% {! \0 K( y \ - */
, ]! |2 y" O( i# a9 _8 E' {# P
6 a! ^# z" [2 H3 o% d' p- #include <linux/module.h>" A! S" _- T& h3 E8 j0 |+ e
- #include <linux/init.h>
; s0 }1 r/ d. {' O - #include <linux/errno.h>
5 G& P' z8 S+ ?8 n; A. Z I - #include <linux/types.h>& D# v0 m- \4 ~3 D) n6 i
- #include <linux/interrupt.h>- G0 f+ O( A7 o7 q q7 e% u
- #include <asm/io.h>
" \0 G7 M: `# K( F; q$ [* ^, K - #include <linux/moduleparam.h>
; H7 o( ?8 h/ O - #include <linux/sysctl.h>' p/ O, n$ t3 D N; b1 y
- #include <linux/mm.h>
. B/ V6 A: v" q) n( c - #include <linux/dma-mapping.h>7 _6 \ L1 Y2 Q G- q
- ( \% y' z$ I) h e6 I; J
- #include <mach/memory.h>; D& a, Y( [1 a w) Q X
- #include <mach/hardware.h>
; t% L. S, r; }! v7 R% k) o/ L - #include <mach/irqs.h>- B) l! K- v8 v3 R
- #include <asm/hardware/edma.h>; Z! M2 P' F4 ^6 U( l( g/ Z
) I% Y6 J! \/ U( K) z- #undef EDMA3_DEBUG! K4 z7 o2 X) e0 s
- /*#define EDMA3_DEBUG*/
* L/ G+ p, n6 |: P7 b - 5 K9 _, {2 }6 D6 @/ [6 F
- #ifdef EDMA3_DEBUG! Q: d2 g2 c1 q# ~$ l5 P
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
% ]& {; u& K0 g3 T4 ^& q3 X* g. x - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 q" Z, \; i) a( {3 J
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
5 F: D1 H- F9 R6 J+ y9 L9 g! f% k - #else7 u' x0 l4 \ W4 M
- #define DMA_PRINTK( x... )0 K* o' g/ u" b' _) l6 f
- #define DMA_FN_IN8 x" P& e5 t1 P8 `5 e" |
- #define DMA_FN_OUT
$ _! u/ h; w0 ? - #endif6 h$ d' e# B9 r# _: w7 [
* J8 m# i3 S% h1 x& [- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
& R; K" ^" Y6 [, S6 U - #define STATIC_SHIFT 3
2 l X h% a( p. M; |4 p% O* H - #define TCINTEN_SHIFT 20
. @, H3 w* E& J, f- f( B. Y- a. ~" _ - #define ITCINTEN_SHIFT 213 d2 q; N: O& l* o7 h, u
- #define TCCHEN_SHIFT 22) Y$ S+ M0 }, e" S: D3 M$ W
- #define ITCCHEN_SHIFT 23$ i8 B& [/ ]% J1 x: I9 b
/ i6 C! b9 F. o# R1 @8 v- static volatile int irqraised1 = 0;
. D% s/ ]; }; S6 o8 c - static volatile int irqraised2 = 0;
% Q- L1 j6 U6 z! m- w0 v. N- w
" n1 M( ]2 w! S& t% l6 ^, r0 z- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); L1 Y5 a3 i# A. p: _, \ k
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* {. S, K& s$ e# ^0 H - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" L8 _% E' D9 E5 g! H4 T8 h
% G- P$ a0 e$ M! c- f1 {( d- u- dma_addr_t dmaphyssrc1 = 0;
* Q) y. n$ K- ~ - dma_addr_t dmaphyssrc2 = 0;% o# V/ B. W! i; C# i' n
- dma_addr_t dmaphysdest1 = 0;
3 G+ P$ b8 Z, t% n# E - dma_addr_t dmaphysdest2 = 0;
0 n0 ?0 ?! n% p' b4 P: S1 ^ - + H: N( J8 Z( y6 L% _
- char *dmabufsrc1 = NULL;. E) {# |' {1 Q# o! @0 n8 \) a
- char *dmabufsrc2 = NULL;9 j. Z! ~; Y- \( F3 o7 P0 o# G" e
- char *dmabufdest1 = NULL;
7 O+ F( ?' x+ M9 v - char *dmabufdest2 = NULL;
! w2 `0 U, d' G7 a! d9 g - + |0 d. `- K5 B N6 l6 l- S# [
- static int acnt = 512;, R# O5 j- n, I6 `5 {+ x
- static int bcnt = 8;0 J$ |7 z7 _# c! t+ e
- static int ccnt = 8;
, a4 K" J- w R0 I% Y - 0 l% d4 x5 G* P
- module_param(acnt, int, S_IRUGO);
4 E1 e% {! G9 s7 f - module_param(bcnt, int, S_IRUGO);4 ~' a. W6 A" i `8 m
- module_param(ccnt, int, S_IRUGO);
复制代码
& S7 [9 G; t% u, ]: b# b2 p0 U! r4 E6 \* @, J) \4 W
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 @; j- x1 `- [/ D; e; v: T% aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。% ~1 H5 v) G4 Z6 _ I8 y/ U
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 L* U$ q" E; S0 U) g1 q1 T- E
/ O% f( W% b1 |1 @4 c+ w7 b: L3 k
4 B- [1 m& X5 Y. @ |
|