|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
K1 u, K9 I/ B6 U+ A3 ?) o- m5 ^- [code]EDMA sample test application
3 k9 ]* i2 [) B# B& M' g - /*
; ?+ U' ^4 b* Q' ` - * edma_test.c
- s, M5 c6 b) Q% }* e) F T - *
) x$ g! u) J' c9 P7 |7 n - * brief EDMA3 Test Application
/ r2 S. v" R5 _; a. R+ p! V - *
7 r) `3 [; n4 e6 l/ g) @2 N - * This file contains EDMA3 Test code.0 p' A n/ C' e0 G4 \
- *
- g1 r$ S3 I& a" t* t2 B( u - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
* `5 L* u7 D: ^ v0 ?- m - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
$ B8 ^" P$ ^# \% | - * TO CHANGE.
, Z4 ^9 s( ~. X' g1 w - *
# \$ I* O2 }2 ]5 O - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- ]3 a3 ~( D' ~9 r/ A% u
- *) y i6 z6 v9 x+ h
- * This program is free software; you can redistribute it and/or
, e; d* R. l7 p2 P3 `8 g+ T3 E/ e @ - * modify it under the terms of the GNU General Public License as
/ t9 J) z% l* r - * published by the Free Software Foundation version 2.
' m0 s; u3 w! l- _ - *
( a1 } }7 E& n6 E - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
6 u0 O4 N5 a) v( J - * kind, whether express or implied; without even the implied warranty
/ c; f- E' n. L5 _9 F - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
& s$ h6 q) T% L) C8 ]* [ - * GNU General Public License for more details.4 F" v) C7 C) m& U& e1 \: S
- */
4 f( ]' q# ^5 b) t1 D5 `
' P& s. `& k# T- #include <linux/module.h>& {2 R9 ~: o, w6 ]/ q* A6 l
- #include <linux/init.h>& ~& I) B* R- L
- #include <linux/errno.h>- t# a" K" V* c1 R! t6 Y) [$ R+ }
- #include <linux/types.h>
+ K. m% D, \) W# M' u/ \& H4 \ - #include <linux/interrupt.h>
" |. w# |0 B2 T - #include <asm/io.h>
) |, f* s7 E* f* V" o) j4 b - #include <linux/moduleparam.h>
1 B& q. T5 X' Q2 V8 {9 } - #include <linux/sysctl.h>
/ U" |, V! ]* h1 L8 Z - #include <linux/mm.h>
w$ s: {, O! P- V' S3 l - #include <linux/dma-mapping.h>% D4 R, }1 F# I; K: ]/ F" c C
- 8 L; h# d6 w: w `
- #include <mach/memory.h>
& _! j* u! @2 G5 g0 {. o - #include <mach/hardware.h>
: t W- z: @/ I1 u4 T5 o9 X - #include <mach/irqs.h>
( z4 Q% z$ e K1 y7 k/ p4 X - #include <asm/hardware/edma.h>
% k( E& Q7 z5 g
2 v& K5 H2 G9 R5 M- P- #undef EDMA3_DEBUG: V2 ?. A+ K' s! R3 a, M( l
- /*#define EDMA3_DEBUG*/
1 H) {& T( ^6 V0 T x% ^: g - 4 Z# C- Z3 u v5 g
- #ifdef EDMA3_DEBUG
& M: Q7 i1 k' f5 r ? - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 o B7 k2 R1 o' ^; L! u# X
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); J# `9 d- {2 M3 b+ [
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
( n# ]+ E/ \9 J9 `: h - #else
% h, _6 _, M: }% H - #define DMA_PRINTK( x... )! z" f N( S, Z
- #define DMA_FN_IN* C( C+ n5 }; s5 r5 ?2 c6 O& _: ]( u9 T) [' |
- #define DMA_FN_OUT7 _$ A$ C& N+ k, M2 {
- #endif
% s( s8 u7 R9 |. {1 n; |& I - ! }) n* X: t! _1 V* Z
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
. j0 e% y8 d% R6 G" t2 ?/ ? - #define STATIC_SHIFT 3% ~9 F; j, Q; E8 u. t3 O
- #define TCINTEN_SHIFT 202 `; [+ X7 v; H# n" S
- #define ITCINTEN_SHIFT 21! z( V, H, ?8 n8 r* @. ?+ Q
- #define TCCHEN_SHIFT 22
6 q/ Z3 F5 u' s - #define ITCCHEN_SHIFT 23
( P1 M- x z4 u7 H% L5 p' w2 S, C
! U4 u y- O! [% v2 x0 ~2 m- static volatile int irqraised1 = 0;
; |+ p/ _6 \5 I! u) E3 { r - static volatile int irqraised2 = 0;
0 t# G$ N7 B2 r' q. w; q) r
( n1 r6 w# \7 ]4 [# l- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 t' F7 S2 b3 l - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# H+ _0 s7 R& M
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 t2 i5 Z) G4 f I# W+ D - 9 {+ m8 J# F' k% b( a. r
- dma_addr_t dmaphyssrc1 = 0;
7 }" B( |! L! s - dma_addr_t dmaphyssrc2 = 0;
) i) [4 J& c. N, L0 G - dma_addr_t dmaphysdest1 = 0;! W& C) C) x) T7 D( K
- dma_addr_t dmaphysdest2 = 0;" E; O/ V; D' r- ]- ]# m* ^
8 K, G- m, A$ e) h5 F6 K- char *dmabufsrc1 = NULL;
& h/ E* m8 E( t& C, i0 | - char *dmabufsrc2 = NULL;# i$ }; G ~5 P7 @" l
- char *dmabufdest1 = NULL;% T2 }; a+ s8 m
- char *dmabufdest2 = NULL;
+ r! T. D+ u+ h: _# G c& i3 g - # F, \5 v7 |3 K8 S" G
- static int acnt = 512;
% d2 P0 F3 b6 X) x - static int bcnt = 8;8 j4 K+ `5 V! |+ }2 p
- static int ccnt = 8;
" j( M. ^; B# q P5 r1 H6 a
" Q. J" v, q6 `6 {- _$ K6 K' x R- module_param(acnt, int, S_IRUGO);
2 H0 v! z. y3 l# {3 H6 g c( h' { - module_param(bcnt, int, S_IRUGO);
+ R; N+ J* k8 Y7 ~3 a6 }0 y - module_param(ccnt, int, S_IRUGO);
复制代码
2 J; S2 ?9 a& V% j- Q6 X- }9 C
" P9 X% m* Z% |2 d% d& G- ^* p5 U 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! }4 u) D4 H3 tarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
^8 `7 l L6 @% `6 z8 m& | 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" `3 C& N# o/ A1 E# M2 c
5 U2 \/ `" c" v2 y, m9 R
2 q" e, Q1 D) ^: D8 e) ` r |
|