|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 q. u$ Y! x, @* k& s3 [* P- [code]EDMA sample test application4 j* I6 A; c9 e3 [: t" f2 c# ]
- /*7 J0 {, B8 q. A: ?0 F
- * edma_test.c- `5 Y9 I7 g# }6 ?
- *
' q0 f! n- m1 { u6 D" f, t - * brief EDMA3 Test Application) k' m6 k+ x) ^5 @) _
- *
& w; B9 R0 z+ B, X; Z - * This file contains EDMA3 Test code.' w" s. H, v( M( }' F* ^
- *
, N& |5 d# c5 \4 O) D7 ?+ Y1 X - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" T: d. ^# z! r1 J
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 k5 ^, t* G: J* z) E
- * TO CHANGE.
5 q6 U' ^4 x3 A% s5 N - *
' g& w2 C6 f6 U" k: }3 @) [. X - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
( I8 [; N9 ^0 R; U - *
2 w! r T. o* q6 S- S8 j) s - * This program is free software; you can redistribute it and/or* V1 w5 m4 \7 c0 R0 {! [, E' v
- * modify it under the terms of the GNU General Public License as
8 V& U1 U; r' \2 s" z) W; \ - * published by the Free Software Foundation version 2.
% f5 b' m1 ?: k S. j; c - *
. M' Y9 v" Y4 l3 h, S - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
! ~' b5 B J* c' w8 [4 V - * kind, whether express or implied; without even the implied warranty
! K& }2 h- S5 \6 q& l; ] - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the) |! Y+ f4 T, E" x; {
- * GNU General Public License for more details.
0 {& c4 b5 ?# J: R' |# u y6 ~ - */
2 T- ^2 U9 |1 @* t6 @; u6 N, G - - q2 |/ n) m$ ?' u# d' @; W
- #include <linux/module.h>7 @! m' l- J& C: }. L
- #include <linux/init.h>
) @# E( e+ Y' d - #include <linux/errno.h>
9 `- `& E' y7 R0 k, F' A - #include <linux/types.h>
- o# g5 k4 k- O# a2 | - #include <linux/interrupt.h>) s, t1 k+ p% A
- #include <asm/io.h>
+ s/ d4 N4 h( |; b7 n - #include <linux/moduleparam.h>
% D; N- E; p% k8 u! l - #include <linux/sysctl.h>3 G: @+ P f, s7 w) K# O
- #include <linux/mm.h>, k0 m+ k9 f- Q9 V) e& h& x' r J
- #include <linux/dma-mapping.h>* e% S6 M9 ^7 b8 Y4 z
- 4 W( E. G# s: w# A* `7 D" I
- #include <mach/memory.h>* D+ p( m' N* A3 t9 U* i& a* }0 o
- #include <mach/hardware.h>$ w* z2 d, m3 A0 b
- #include <mach/irqs.h>2 z: e6 {+ I& c+ U7 d l7 ` E
- #include <asm/hardware/edma.h>
7 T- s6 Y/ o) W, u - , w4 |' A! a5 |" ]9 @
- #undef EDMA3_DEBUG# w+ \8 e! t( G8 B; [
- /*#define EDMA3_DEBUG*/7 [# `5 o! \8 u) ^; b/ P
- 6 ]1 T n2 T( a% H
- #ifdef EDMA3_DEBUG+ p; s- v5 X" H, U) ~5 Q1 Y
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
* W6 W' |9 `* T8 M" S2 q - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ t/ I( j; l$ o2 f
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). W8 T. h+ `) k; n( W$ Q
- #else
' N: y! r3 P6 [+ K s2 e - #define DMA_PRINTK( x... )3 I/ D: V+ h- W& q
- #define DMA_FN_IN4 w+ J& v7 C0 R1 m7 J
- #define DMA_FN_OUT w" C0 {) O# t; v6 U
- #endif& q0 u* `! [) m# Q
0 J% z8 T- l/ n: f+ P- #define MAX_DMA_TRANSFER_IN_BYTES (32768)$ n* { L) r" J, {; Z/ |
- #define STATIC_SHIFT 3 A5 Q. L9 _2 }" Y# M, O* P4 }
- #define TCINTEN_SHIFT 20! b: W( q7 |' o) r( H! H
- #define ITCINTEN_SHIFT 21* O, J# x% E0 g! j0 G9 }
- #define TCCHEN_SHIFT 22- D( P' b8 U- Z4 |
- #define ITCCHEN_SHIFT 238 R3 j" O3 ?: A" c9 ]0 E
2 R+ x& C+ U, P8 _- static volatile int irqraised1 = 0;) T3 _9 S% J: n. |" z
- static volatile int irqraised2 = 0;) C& r9 b- p% [3 S* Q9 c0 Y
8 j$ b Y e/ M; K% D- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' v3 U B4 ]+ q
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ R* I6 e; y" m) m% q
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ k3 s; E1 j; Q: ~ - + u9 L3 G8 g o2 c) S
- dma_addr_t dmaphyssrc1 = 0;
* O2 a( s2 @& y0 u) B* ] - dma_addr_t dmaphyssrc2 = 0;
( q' p" C: |+ T1 m) U# N - dma_addr_t dmaphysdest1 = 0;
0 U, W G) n5 j - dma_addr_t dmaphysdest2 = 0;1 |9 N! J& g" v6 I9 d# p- w8 X
7 ~! l! K# w# |9 ^4 ]8 r- ~+ h- char *dmabufsrc1 = NULL;
9 _# P; j: A. d9 F" _& U$ k% n# J - char *dmabufsrc2 = NULL;
. e9 @* T% s" H* R - char *dmabufdest1 = NULL;# f+ \% b$ f# t4 \1 O+ g; S/ Q7 N
- char *dmabufdest2 = NULL;9 H- A' G3 }, e2 ?/ T
- * ^+ t0 B' I! N/ m# W# X
- static int acnt = 512;
" P$ J( n/ s% h- t - static int bcnt = 8;: H) X; g l% D
- static int ccnt = 8;
& z# R+ w# ?0 k/ a - 3 `, }! R: O' C: d4 ^( o; F
- module_param(acnt, int, S_IRUGO);# _& ~2 Y. e' _# P% @
- module_param(bcnt, int, S_IRUGO);
/ ]9 w$ _$ d/ t& s3 U$ x9 H1 @ - module_param(ccnt, int, S_IRUGO);
复制代码 2 e$ p2 _: }% m' M9 B
1 I2 e# O) S# x* g 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( X M* t0 a6 Y$ O0 u" iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 a4 U2 @" S# G7 s; y3 f- b
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- ~6 @+ F" q, H% D9 T! N3 Z! m
6 |. L1 T" Z) Z, M
+ F; ^- N* e# T$ T j3 } |
|