|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
e/ R# n% ?8 `. x4 _- [code]EDMA sample test application
9 O& ~: J4 v) v( F - /*1 L; N8 N9 x0 C
- * edma_test.c
. |; L% X# D$ Z4 p! a" v/ x - *6 w x7 }2 z! |) J3 g
- * brief EDMA3 Test Application6 F) v7 B! d2 E
- *
4 k8 M i& R/ S/ W' T - * This file contains EDMA3 Test code.
, D- e$ ?. @- \3 [+ X1 ] - *
, S V+ h0 A) L6 K. X# r - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 ^2 r! s( B8 Z
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 ~; Z1 J" |( V" u0 C6 B
- * TO CHANGE.
. x: |( h; j* X# E' C- R) l - *+ I* q" \" `$ Z l Y. w% Y
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
. {* x+ q/ d6 O( h$ J - *2 @$ q1 d7 R) N' S
- * This program is free software; you can redistribute it and/or
. c& c" G7 m3 _; m- R Z, B% [: O - * modify it under the terms of the GNU General Public License as# J8 q* M; u. b; |/ Q3 ~) {
- * published by the Free Software Foundation version 2.
% |) B, ?1 S* W I+ o - *# g4 F' m' p/ r7 G- ~
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any" ], P7 E) s) D" R/ j" c' A
- * kind, whether express or implied; without even the implied warranty
% a% [# S; }8 n% |% \. K- F. ? - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the4 t& n5 n3 u+ R5 Y9 r
- * GNU General Public License for more details.
/ `% X2 v% h! \$ Q' R) ?: g - */& `7 ?# Y6 j+ }" g, z$ G( m, O
- 2 t5 V9 A( K" c% C& v
- #include <linux/module.h>
8 Z' ^& ] t; T: E - #include <linux/init.h>
5 ? B# E5 t3 C- D" ?* U - #include <linux/errno.h>
& b+ l( C1 e! R8 | - #include <linux/types.h>
5 }$ D. D) ^0 k) v - #include <linux/interrupt.h>
2 H$ i4 I4 C3 h: `9 M' } - #include <asm/io.h>
; G3 i) e; D# g" g- [7 K& f! g4 ?8 e, K& s - #include <linux/moduleparam.h>! B7 q& F5 Q# O0 X7 T4 F; k
- #include <linux/sysctl.h>; ^2 c3 L! h) Z* p& E& P( q
- #include <linux/mm.h>4 ]5 J1 [9 P& K
- #include <linux/dma-mapping.h>
7 H4 k. l) L8 K* M+ e - / c1 ~ q; g! p7 Y
- #include <mach/memory.h>, h. y$ L5 f# O% _ x) G1 b: r' n
- #include <mach/hardware.h>0 J% ` z% q1 X) j Z
- #include <mach/irqs.h>4 ^" H0 @( l- T( R$ P$ @
- #include <asm/hardware/edma.h>% s% y6 T- b$ N9 j$ u- C
- . f1 `- T5 q( S8 ]0 g4 u0 Z
- #undef EDMA3_DEBUG
! x' V3 P }, `' f" Q - /*#define EDMA3_DEBUG*/2 H+ i! w* t9 J+ g [1 u
2 h+ Z$ b; N2 f" Q- #ifdef EDMA3_DEBUG
- e9 V1 S% [0 I1 x' V - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
! x3 T5 @3 x: {+ V' I( @ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
( U! D( p" e/ n8 F2 ~# k - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
0 T. P5 t: I9 @+ k - #else
7 Y2 ?% Y1 H9 ?! X - #define DMA_PRINTK( x... )
5 j# f8 i/ F: C/ Q6 ? - #define DMA_FN_IN) o+ N9 @ W" b; o# ~; E
- #define DMA_FN_OUT
0 b9 {; O; t8 l/ ] - #endif
7 g4 b+ a* T/ m+ X
% P; u& d& o4 K/ x- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
{7 h% a8 R8 o4 ?& h - #define STATIC_SHIFT 3' B. B0 O* D6 _# _9 k; e
- #define TCINTEN_SHIFT 20+ y) |, s$ C! C! r& g
- #define ITCINTEN_SHIFT 21% d( F# y( i0 `9 p y1 r% Q+ s: h
- #define TCCHEN_SHIFT 22# r0 g* O1 h0 d) j- \
- #define ITCCHEN_SHIFT 23
e; M# j0 s% S0 n
5 [) y, @1 H9 a6 B( G% K, n" J- static volatile int irqraised1 = 0;" K4 ?3 y6 g" ^( a0 e
- static volatile int irqraised2 = 0;% S6 n; r) D" z- M+ R( M9 G
- ! j+ P5 Y ^5 ]& W5 c( @
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& y( |" s( }* I& I; c. X4 E- x - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 V% _( @4 L0 `1 z
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 }- X" ?7 h& c) s! D0 u/ o& |% W
; J3 p. U2 d4 K' p; H- dma_addr_t dmaphyssrc1 = 0;' d' X$ r/ e, G. h' W! f$ q" m
- dma_addr_t dmaphyssrc2 = 0;! p2 V0 K: j0 E; S# |- o
- dma_addr_t dmaphysdest1 = 0;
$ d. B2 W6 S5 @) Z/ K8 J& [) e - dma_addr_t dmaphysdest2 = 0;
% b/ o1 D, O! S+ m$ R! z5 |* z - 7 v/ x- P3 {' A
- char *dmabufsrc1 = NULL;
8 C% q8 w6 A* g - char *dmabufsrc2 = NULL;5 U# M7 v+ }" w* M, K8 e
- char *dmabufdest1 = NULL;
7 B L2 `1 u, k4 t) _3 m1 a5 e) n - char *dmabufdest2 = NULL;
- \/ E; l4 k9 n' j" {# K& `1 h
5 R9 m1 V! i5 ]9 D! f& J5 `8 I- static int acnt = 512;
* f+ @, ?* U5 X: m8 m - static int bcnt = 8;
/ B: _$ }6 w" r8 T2 p' M- } - static int ccnt = 8; X; C0 ?, V, c' a- Q. D, X, b
- + x9 r6 I, M% h/ K) W" t0 ^
- module_param(acnt, int, S_IRUGO);8 w+ h. {; Z+ C9 l( ?1 f# I
- module_param(bcnt, int, S_IRUGO);7 h$ y+ N- `9 |. t9 k
- module_param(ccnt, int, S_IRUGO);
复制代码
6 c. Q, M+ Y* l( G7 J: {. h: J: B' @9 U& b! _
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% Y" @% R+ g9 K- z- f2 @0 m
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。 m# v0 O/ h r2 a5 y
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
g$ Q+ h; R. i; \6 m/ l* l5 k; }- |$ M5 ]( O: g; N% T
5 {& P9 z) j; [7 g5 X# A$ r; N
|
|