|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( z6 U$ M- \- ?6 P3 c* B+ w5 C
- [code]EDMA sample test application
& o4 y* y0 b9 p& ~/ ~# L; M/ f0 ? - /*' ]4 s5 z+ w5 ^4 L! U9 B
- * edma_test.c, k D$ `6 a5 a
- *
6 k$ ~7 |* ~0 B% H0 Y* X - * brief EDMA3 Test Application
% k" g( V. m, t3 i( m, ?& S: a6 I/ Z - *
" K: |/ ?, D) g - * This file contains EDMA3 Test code.' v3 I# |1 _4 d: f8 Z2 q' P& n
- *
- o6 ?& P* B* ~1 p) i$ V+ u6 \ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, j2 a/ a& c7 X& S
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& c# [) T* O$ y( e7 n) e& @
- * TO CHANGE.# y4 w% f/ j* i& G
- *
# @4 t" t; y4 t6 D5 Q: d - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" o& {6 D4 V1 d1 S% F+ t
- *4 u' E2 L, p2 Y. x
- * This program is free software; you can redistribute it and/or1 I7 _: k, H9 s
- * modify it under the terms of the GNU General Public License as9 j+ e, C$ C- `: y6 A2 u$ k+ @9 t/ P
- * published by the Free Software Foundation version 2.
; X+ m4 ~- P- Q- ?4 S# f/ D# K - *3 _- O, q, g/ P' c2 f
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any% _2 J) U8 R' c3 y
- * kind, whether express or implied; without even the implied warranty
" N. v0 T* j8 z" ~9 Z/ q+ ~& W- c) w - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the9 \6 b4 a3 J2 u! N; I
- * GNU General Public License for more details.
; R- \) ^. J# F4 d$ ], q7 U - */# {9 D$ h* D/ Q( g; c9 j4 [
- . m$ x" Q6 q2 ^8 M$ _+ H* V
- #include <linux/module.h>5 U9 ^5 j2 d6 E2 G! N0 q6 u# E( s9 }8 E% {
- #include <linux/init.h>
, K# ^9 C# T, f; Q - #include <linux/errno.h>
) [- I/ G/ Z" r( s) F; n - #include <linux/types.h>- [" Y! H8 Z- q0 Z
- #include <linux/interrupt.h>
( O& B2 X6 d$ t( }5 P - #include <asm/io.h>
6 u( n" o' |7 f; f) W - #include <linux/moduleparam.h>
7 S# v$ U: X- k; r5 ]& Y7 ^! { - #include <linux/sysctl.h>
0 R; u# E+ {! `( |9 C) _- D' ?& h* i - #include <linux/mm.h>
( k2 S6 B9 H1 `* T& Y4 ] - #include <linux/dma-mapping.h>
8 S S" H! c* a* \% e3 ~4 u& t - & ?3 C3 r/ }' I9 Y' t# ]4 x
- #include <mach/memory.h>
3 J* Z# T5 _2 C& V A/ O& l - #include <mach/hardware.h>
! ?# C' i6 m% {0 A - #include <mach/irqs.h>
% p1 `. C m; Z& G: r( g* t) A - #include <asm/hardware/edma.h>
2 Q" w7 j' y% x/ y) c* { - , d1 L7 j1 W; f# {+ y) V
- #undef EDMA3_DEBUG3 c; ?4 z8 Y6 q7 [7 T/ A. b
- /*#define EDMA3_DEBUG*/
y2 K- G1 c# y2 z - 1 h6 \: D, n, Z( ]( y5 X! B( ?+ D
- #ifdef EDMA3_DEBUG; X0 J9 Z$ ?/ G% m! H% R& A
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
5 y$ X8 \5 D: T# C7 O$ P* L3 e - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
$ h+ x( ^& r* ?5 W2 x - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 l6 F) i' ~+ i2 F6 `' [7 d
- #else
; M+ X+ P$ ]: l- s* {7 B4 Q; u5 G4 G3 U - #define DMA_PRINTK( x... )2 C6 J0 B) x- h* N: y7 o
- #define DMA_FN_IN9 k3 i2 S2 v% B: ?
- #define DMA_FN_OUT3 Q5 {4 @0 O' Q' i+ U
- #endif5 P2 l; V9 A2 R4 e, y' F
- + j7 I9 [6 q: {; y; Y
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)1 A5 R. G$ f( `1 A: j7 D
- #define STATIC_SHIFT 3- M/ P9 W2 W: E/ }1 q# o/ \
- #define TCINTEN_SHIFT 204 N5 @0 N/ i4 B
- #define ITCINTEN_SHIFT 21
, K E% t( `9 a. @+ \% _ - #define TCCHEN_SHIFT 22 B" q8 m9 J' O# z
- #define ITCCHEN_SHIFT 231 r) P9 x' R% { M! F
/ D2 n& U+ W, `. c- static volatile int irqraised1 = 0;1 E7 U5 o; j) d9 i5 o5 E
- static volatile int irqraised2 = 0;) I2 b/ x0 z' W8 G$ {9 N
- 8 c. D, \: [& @9 ^, k7 {
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 l; z( V1 D" r% ]) e; u - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 y, @9 [1 t+ j- S* ~7 f
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 Y$ u" D7 w- p/ V$ f - 9 s5 ?/ n1 q* |0 Y5 z" l0 A
- dma_addr_t dmaphyssrc1 = 0;
$ a: m$ l5 w2 N* P: l - dma_addr_t dmaphyssrc2 = 0;' \, Z2 K' C+ n
- dma_addr_t dmaphysdest1 = 0;
$ r$ U$ Y% k; Q- I, M - dma_addr_t dmaphysdest2 = 0;, b1 \3 {9 F* D* c
- 3 D) ^! y: m7 a4 ?1 e, V- ^ `
- char *dmabufsrc1 = NULL;/ m7 ^! m/ |! s& z3 \" H
- char *dmabufsrc2 = NULL;* P4 {3 V! l% T/ o+ C
- char *dmabufdest1 = NULL;. K) q" o: y+ L
- char *dmabufdest2 = NULL;/ T n* q/ ~( g+ R, G6 I) {
- " f! n0 E6 B, n* J- Q
- static int acnt = 512;
* |+ Y$ V2 n8 f4 C6 P9 b - static int bcnt = 8;) ^3 {6 ^. k% E; D
- static int ccnt = 8; m/ A; Y7 A! F8 h
- % ^2 y: W) }, y% y8 H( ?" F
- module_param(acnt, int, S_IRUGO);0 r6 X3 d+ x% s& M
- module_param(bcnt, int, S_IRUGO);
! X- t. V/ X9 I% W4 Z( m' T5 b - module_param(ccnt, int, S_IRUGO);
复制代码
0 f8 q2 V+ ^, k" a l
, z' P8 n$ t) _: D/ R' m 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. Z. Y8 D# a7 y& x: C; @: x, Harm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, ^, I0 V( K) G8 J+ T+ k0 e
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" ]- H/ e3 S' S j1 W: w3 H$ t5 l; N5 {1 R: J8 A
( ^5 |. l. X9 f' k
|
|