|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, q: r1 S$ m ~* @- [code]EDMA sample test application0 q E( o& l8 D% L
- /*8 O' d8 f# g7 Y+ K4 R' s
- * edma_test.c
6 _4 g6 Z& [( n ^" N - *3 K, _9 y& _7 u9 K; D
- * brief EDMA3 Test Application9 K4 x5 f3 ?" s; Q
- *
4 h) v! R8 O2 F+ x G - * This file contains EDMA3 Test code.
4 s3 b" K$ b9 i, H - *
* a2 _# G; Y, K - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) }' d/ G8 ^7 d6 l& w) f; G, r
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( Y6 Z4 u9 a2 R% l8 A3 Q% W
- * TO CHANGE.$ F9 c& z" [: {2 ?8 W) i& `4 U
- *) `- x! s3 f$ e0 d$ l+ C! [
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
( S, ~+ R# v% T0 D2 A, U& g ]2 c$ ^, R5 y - *% A7 e! P; V& p/ _- u3 g: G6 P; r
- * This program is free software; you can redistribute it and/or
7 Z# v' _& Q/ s4 k, ~ - * modify it under the terms of the GNU General Public License as
. Y5 v, a4 p6 N, N- B" h# W" { - * published by the Free Software Foundation version 2.
* \- x/ h" ~) {/ h - *
, X9 ?. A* k* S6 Z- ^4 S6 y) e - * This program is distributed "as is" WITHOUT ANY WARRANTY of any" }# d4 z2 |. i! G
- * kind, whether express or implied; without even the implied warranty9 [4 B5 [& k+ k, W
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
" w# [: a% j/ g% B, U - * GNU General Public License for more details.8 {$ T* i8 k) m4 \$ c# T( h5 J1 U
- */) P0 P: V0 P- z5 Z
- ; ]$ a9 w) P' n6 z5 [" W0 V
- #include <linux/module.h>" {2 |; W- B0 ^/ _" Y# Y* [
- #include <linux/init.h>. T: p) {* D/ |3 w- ]
- #include <linux/errno.h>
0 [- j# k, P- F( X& K: n9 M - #include <linux/types.h>) x+ P# s8 F% z3 B! z0 G: @5 i. j
- #include <linux/interrupt.h>1 A( H, d7 f) A2 ~: G
- #include <asm/io.h>( B" x1 N: e& Y1 S3 a, m8 D4 |
- #include <linux/moduleparam.h>8 I1 F9 p1 n7 Y1 K; E
- #include <linux/sysctl.h>5 `* `- ?- Q, f# O$ _5 f$ [
- #include <linux/mm.h>
" Y+ K$ ~3 G4 r+ t1 e* [ - #include <linux/dma-mapping.h>1 I2 `9 W S2 s$ s- e. h3 U
9 }4 B4 `* W8 _ I/ D5 T0 I& `- #include <mach/memory.h>
0 g" C# S' [) g, f- o - #include <mach/hardware.h>) i0 b8 t$ q& P0 p
- #include <mach/irqs.h>
3 h, l8 r: p$ l# N4 ]5 ] - #include <asm/hardware/edma.h>5 N& O( a5 V3 K$ P
- ) n, V, `7 P3 L, d( S
- #undef EDMA3_DEBUG
/ K% R4 o# Q, i* ~ - /*#define EDMA3_DEBUG*/
* N9 k! r, t( C
$ ]" W+ d* H5 R- #ifdef EDMA3_DEBUG# ?; P: R; `& \( q, b6 H$ b
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! D# m5 a# |, k
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
, y+ B, i& E y - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
- ]. h! `2 F# G! f - #else
% F& L2 c$ u& ]+ d/ d0 J% R - #define DMA_PRINTK( x... )
' {* m: m& @! J - #define DMA_FN_IN f+ M3 R5 N& Q# Z0 |3 [ H" z( s6 c, y
- #define DMA_FN_OUT
. t; W( [& }3 U, F4 ` - #endif1 g: P _# \ x4 A7 T
- , U$ k8 u0 G1 K" N/ ]
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
: q' L3 \% M1 d# c) f3 a - #define STATIC_SHIFT 3
7 D; P* g/ z$ `7 _# ?) w, n - #define TCINTEN_SHIFT 20
5 P4 D$ c* d" O: L$ D. X7 i* x t - #define ITCINTEN_SHIFT 21
: B) G% M, @( ^2 z - #define TCCHEN_SHIFT 22
f7 @" j5 w0 c - #define ITCCHEN_SHIFT 236 G. N9 a# J B8 n
]: W8 |' U$ F# i- static volatile int irqraised1 = 0;
5 _3 d9 [& O' {0 ] - static volatile int irqraised2 = 0;" ~/ x# [# b/ |+ |9 P
- ) Q- ?$ t- X( J; X8 T% O
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 C6 D5 ]5 C# d' g# }1 R4 B
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, P1 u ? e$ B( d! I) d! \ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 V3 r3 ^- ], }: ]' r4 t
1 S+ v# }" t3 \1 k9 H- dma_addr_t dmaphyssrc1 = 0;# D. P& F8 m# T& M7 @( i
- dma_addr_t dmaphyssrc2 = 0;
- n# P2 ~+ V( I) E d - dma_addr_t dmaphysdest1 = 0;9 p. q# Q- T1 l! B/ i
- dma_addr_t dmaphysdest2 = 0;1 n% n) e. o+ b; R1 v
% T# m7 z8 I4 t+ U. j z0 {- char *dmabufsrc1 = NULL;# |# V' b! f& Q0 u2 J& F
- char *dmabufsrc2 = NULL;
) f+ e* }) j, X4 ?9 p5 J! w( {1 g - char *dmabufdest1 = NULL;
7 n) V0 ]1 b) [' n - char *dmabufdest2 = NULL;
4 I7 R3 E! \& L* K% J7 n, N) Y( ]9 T
$ n1 s* s! A7 w% p* ^- static int acnt = 512;( X1 q3 E" t8 a. y
- static int bcnt = 8;
( W- d2 G1 { f9 v W - static int ccnt = 8;
* E7 D& c) n, G# d
0 n. b# T4 @- ?% Z k ~- module_param(acnt, int, S_IRUGO);
% f( S* I' W2 ^4 D, {, S6 w5 G - module_param(bcnt, int, S_IRUGO);
( g5 v" Z0 Q8 ]3 Q/ J$ t2 K( Z# Q - module_param(ccnt, int, S_IRUGO);
复制代码 * N, H5 W, H5 Z u
8 w; G5 m+ }( k4 S+ q0 O
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) Q' S9 h( U! w, B9 {4 |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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 `/ q% g9 p% y+ d3 S# s0 x& b- } 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( n8 z# f* R% H N& h) L* @! v* }( \$ ]1 L8 j
7 A- d+ U: D5 i( t |
|