|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # W: `- {3 E- s6 ~7 n1 E, ~5 J
- [code]EDMA sample test application
, G" G O& C0 B- O3 a/ @+ G - /*
( ?, _/ r, Z% { - * edma_test.c
5 o% W' R7 |5 z- K3 D; } - *
8 p5 d4 H! W4 a7 B - * brief EDMA3 Test Application7 J4 G- G+ Y+ V+ e+ D
- ** L5 p% Z) f: H% T/ D1 G9 l. \$ l- F# S
- * This file contains EDMA3 Test code.) K# b h0 I& m2 X
- *
3 g# u; q& Z2 b0 A1 w. U2 s# G - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& O) W0 ^. ~5 _% {
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
2 b' Q8 a+ \ I - * TO CHANGE.& U' J; R5 G2 I; l c3 p4 [5 C+ K( x
- *7 b- S! C! Y2 _( J: D/ \
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
5 \8 E+ R ]) A6 x - *
7 s: ^9 x$ L) @) L; n. T - * This program is free software; you can redistribute it and/or
7 `% o7 J5 L; O8 G - * modify it under the terms of the GNU General Public License as
3 E; D: K8 o. A; j9 T3 [ - * published by the Free Software Foundation version 2./ z/ X' F4 D I/ n( ]+ g0 {; ~
- *- G T- p4 V1 B+ E2 H6 d
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
8 E3 h/ N2 g$ S' S2 j8 X - * kind, whether express or implied; without even the implied warranty
1 e& X, h7 ~+ C - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the9 @; x$ ^' G* g% @
- * GNU General Public License for more details.5 H! q- Z- x# O! \
- */" L$ o, Q( R! V/ g. R, h0 C
- " { v, V& B0 L/ |
- #include <linux/module.h>; f/ _$ R7 A M. f
- #include <linux/init.h>
- U' g' r/ j: r7 G0 ` - #include <linux/errno.h>
: L% O6 U& v. T2 J - #include <linux/types.h>
( l. j/ v0 _" R8 n9 | - #include <linux/interrupt.h>
+ x6 t. F* W; B. p2 j9 C - #include <asm/io.h>
6 q ~6 B F* [! E7 ]+ G6 r - #include <linux/moduleparam.h>& l. K9 m' j( v+ Z* U5 D
- #include <linux/sysctl.h>
, b* ~# M# o4 d* t2 A - #include <linux/mm.h>, [4 {3 C# j! r; Y( d N) K
- #include <linux/dma-mapping.h># l$ @4 h& f5 S* t, q" n9 g
6 b [& G$ }* x5 g, ]* y2 |( c! u- #include <mach/memory.h>
! x3 R" F6 N& S" j, c, G+ u9 Z$ S - #include <mach/hardware.h>3 F4 A) F, i' T7 J% s, q
- #include <mach/irqs.h>
7 q9 \% b3 c# B0 i" B' N. S - #include <asm/hardware/edma.h>
# N. g* |# O7 j; `, C
& }! y' v: f7 @& Y- #undef EDMA3_DEBUG
( l# b5 J* r7 {! N& w - /*#define EDMA3_DEBUG*/ V( l( L" C: |! [
- 2 T" g6 t* V' S/ H5 d9 L) L* ]
- #ifdef EDMA3_DEBUG4 A! S% r* I; t" V! L8 U
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( X- a5 t. N7 J: r! ^+ [* o5 d
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
/ k$ H) v! [9 x7 ] - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
. s( i# [7 L- Z; C( |- C - #else" n0 V- }& `: U$ `& A! R0 d
- #define DMA_PRINTK( x... )
6 j% E. z2 v' s# M: r7 y - #define DMA_FN_IN" h" I) { R5 s* X! ]1 I
- #define DMA_FN_OUT$ |# Z0 ?3 o3 C; W5 J
- #endif
' c S% ^6 ~! G8 G( ^3 [. x- R - 5 Z2 `0 |2 B% P3 s$ A4 ]+ N) z
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
* r1 `. T( n- U2 Y7 |6 J - #define STATIC_SHIFT 3% F" O0 T& n: @# x
- #define TCINTEN_SHIFT 20
* u, G% x/ s6 H0 _% o4 z/ {% I - #define ITCINTEN_SHIFT 21* q* ^; V t$ c/ M. E/ d
- #define TCCHEN_SHIFT 22' D9 P8 X0 G' i1 ]* |
- #define ITCCHEN_SHIFT 23* n( R$ s$ t( B$ [
- # z# A v- K6 F7 ~6 D7 H3 A$ Q5 Z
- static volatile int irqraised1 = 0;
' X3 z8 Z& r) _ ` - static volatile int irqraised2 = 0;3 z& U1 {6 R5 M1 C2 E! W+ t
- 8 V" L e2 M7 v3 C1 \
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! F) T/ {+ s; c0 Y1 x4 ] - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! o. ~& J* ]6 u6 V( ]
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# R( g4 y+ C' ]( ^7 e
2 g6 b' ~- a* S6 `* O1 M) y( ? q- dma_addr_t dmaphyssrc1 = 0;7 q: ^6 x& |" l8 }7 ]2 `' f
- dma_addr_t dmaphyssrc2 = 0;
# ] C$ Z# T1 d3 K( | - dma_addr_t dmaphysdest1 = 0;
+ C$ o4 g/ ], a" c2 P! \. _$ c - dma_addr_t dmaphysdest2 = 0;
. z* R, G3 N1 b3 a4 P+ n+ O' Q' M - 8 Q; |* U1 B* Y% v! A# D- k
- char *dmabufsrc1 = NULL;
7 _: C6 \" ]3 T: I, x; p - char *dmabufsrc2 = NULL;* R# R/ e8 i" F: ^+ i. [' h, ?
- char *dmabufdest1 = NULL;; q7 {; J: G; ?- `- U: ~# ^
- char *dmabufdest2 = NULL;
# ]" F; m( V' }( ?1 n - 6 l5 a% S9 M4 x' w! v' s8 r
- static int acnt = 512;8 l6 e7 d% ~4 p
- static int bcnt = 8;& c7 z1 V+ [ L! D
- static int ccnt = 8;
7 m8 v# s+ e, j( ? - 9 Y/ R% Q, F" f) n
- module_param(acnt, int, S_IRUGO);
2 \7 T n, h- B5 c/ ?' q; x - module_param(bcnt, int, S_IRUGO);
7 A" F3 \' a8 Z1 ^3 l) x# S - module_param(ccnt, int, S_IRUGO);
复制代码
5 i: ~8 S# v' W7 f& b
" W$ G3 t- D- V9 f, f7 Y! c! E0 y3 s 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 K- l1 }( A2 a/ O; [
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% C6 I& o& X, G" L) \ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 N! R1 p W/ z' z2 U3 H
2 m6 n6 d& T& u
" t5 G3 A6 W3 f$ i! c' { |
|