|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. Z6 T4 d) D) E7 D( ]5 o- [code]EDMA sample test application8 v. w' H) j6 H" I; A6 F5 q8 F% h1 T7 W
- /*
, v: ^# F4 s# r; q, V - * edma_test.c& A- T+ b1 z! p3 e: ^
- *
/ l3 [& g" G; J; n; ] - * brief EDMA3 Test Application
& M1 x6 R/ d8 Y - * i6 h; E+ [, `7 s) @+ }* u7 n$ c( f
- * This file contains EDMA3 Test code.
' C/ A8 Y, s6 X# x; \& l - ** C+ f' W" ]- Q0 n8 L
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& y' Y$ U/ {7 q+ _3 Y0 d% [6 X
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
$ }2 j$ l( S2 |( @ - * TO CHANGE.
8 x+ k# g6 ]5 c+ y; t* t) { - *. m* `, b0 u! p p4 {' S. ?
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ X% |- e* j5 c1 c" j7 L
- *
# p* Z4 B$ k, R( t+ g. \# v - * This program is free software; you can redistribute it and/or" P; u3 \3 }( J5 k. H( f7 ^
- * modify it under the terms of the GNU General Public License as
* ^& G# k/ Q- S' c - * published by the Free Software Foundation version 2.' `0 P, g! L+ S, ?$ X
- *2 T7 x& X5 m$ ?3 `" N/ ]+ x
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 ]4 b, h, N/ G
- * kind, whether express or implied; without even the implied warranty+ C5 \% J w5 G, w# g# i8 C
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# A; l- w, f. o
- * GNU General Public License for more details.
1 ], C" c* ?' Y - */# C5 f5 @+ }' ~* y/ o0 u$ c
" w& R( W; I( W1 K9 C0 l2 j- #include <linux/module.h>
0 x) P& F1 J4 s) E - #include <linux/init.h>
; Z- u. c7 s1 l4 B+ Q - #include <linux/errno.h>0 N1 e: c0 j C+ z
- #include <linux/types.h>& [- M$ g0 ^( L3 | ?
- #include <linux/interrupt.h>
4 s0 |* _7 n f - #include <asm/io.h>8 H- S' _7 O* x. S* j
- #include <linux/moduleparam.h>
# @! W' v' d# j- v - #include <linux/sysctl.h>
# K6 t. @3 P1 Z$ n0 j& A - #include <linux/mm.h>
+ i3 w4 x% G, I$ S - #include <linux/dma-mapping.h>
0 I) N6 ?) O6 R - : l, V' L: E5 W1 V9 F# x z" N2 T
- #include <mach/memory.h># L9 x, Q9 b& ]" o6 y
- #include <mach/hardware.h>
$ W8 y1 x0 `& x& o - #include <mach/irqs.h>
, a: |4 Q* M/ [* C& R, J - #include <asm/hardware/edma.h>
" x7 e% Z% K1 v5 Z - 1 Z4 | W' r$ A, s. `
- #undef EDMA3_DEBUG
$ p( F( L2 \, k# I - /*#define EDMA3_DEBUG*/9 p0 [1 c) M# l$ f
/ f$ U* N% c& F$ _- #ifdef EDMA3_DEBUG
% O3 a# V1 i4 J( e3 E$ Y2 K- x - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
G' O! ^3 O5 V& K& l - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( b1 Y9 k6 _5 L- T
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
' g/ t2 a. c5 h5 ~ - #else, t$ h1 H) |; w, Y% d
- #define DMA_PRINTK( x... )
( x/ f/ q6 W& {. C$ ^) H - #define DMA_FN_IN
0 P* }; F+ L0 H# z. J - #define DMA_FN_OUT& I- N. u$ `) V% |3 ?
- #endif
. c* @# h2 U" `$ ^" `1 z
; S# D2 ^0 l* G- f! y! o- #define MAX_DMA_TRANSFER_IN_BYTES (32768)( j* a( }& h4 d$ o. C- d
- #define STATIC_SHIFT 3
! `! i! a- j; Z# ]+ c - #define TCINTEN_SHIFT 20
! j' P6 z, ~3 L# ?( M! h - #define ITCINTEN_SHIFT 21
: q- G! g* B! n2 b+ U+ E3 ~# H - #define TCCHEN_SHIFT 22; w* k5 k2 G5 e
- #define ITCCHEN_SHIFT 23* C* [( O5 d+ E3 r. C, Q% U0 x
- m0 {: w7 ^7 }0 i: C% R" m
- static volatile int irqraised1 = 0;
3 |$ f! K; O! O - static volatile int irqraised2 = 0;# |- G4 X% m2 i8 O7 @4 i9 \# P2 d
- ; s2 P0 R# [# ?( m7 T
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 P$ Z+ j) D9 G/ b( y1 w4 B" d6 c
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' `: ^$ ~; |% R& @ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); [$ c, c. K% S! @) u0 T3 h
1 l. }. q' S) X$ L) N1 _- dma_addr_t dmaphyssrc1 = 0;0 ~( ~) z7 ?# `2 \
- dma_addr_t dmaphyssrc2 = 0; ~2 V# ^- `5 W) s, s+ }
- dma_addr_t dmaphysdest1 = 0;/ T) _! G& u# @( |
- dma_addr_t dmaphysdest2 = 0;% n0 {) S8 J- c+ u% p X# e* D* J! y
9 F* p7 S, m9 r0 B5 N- char *dmabufsrc1 = NULL;
/ e; ?! v+ M. R* A - char *dmabufsrc2 = NULL;: r3 H7 T/ [' w3 {; M* c
- char *dmabufdest1 = NULL;
b. u! M" l& J- w - char *dmabufdest2 = NULL;
$ o3 O) U; l: w' a
3 ^1 `* I" M' ?4 G8 v7 U, N- static int acnt = 512;
: v/ b2 R1 o* @ - static int bcnt = 8;
( H* {* j# }% ^+ f5 v - static int ccnt = 8;
; ]4 ?/ {5 R5 A8 o" ~
8 E$ L, `/ d+ R4 {. }$ M) T' y- module_param(acnt, int, S_IRUGO);! f/ d) U3 ]+ K) K4 q* ~; a
- module_param(bcnt, int, S_IRUGO);
2 E4 |$ I$ ]) s, y3 }. [+ I* e, U - module_param(ccnt, int, S_IRUGO);
复制代码 : d1 t2 j6 `3 _* `1 c- ]$ |
& d' T; h2 e1 E$ W 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- J$ `; u5 Q- `* d$ T8 g/ c5 k
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* n% a) s! a) J4 f) |: u# y 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& i A+ ^8 Q( B& x7 a8 c
3 w N7 [; ~! m4 ^8 R0 W
/ ]/ L0 g [# L+ s
|
|