|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# O6 Z3 g1 t E4 ~3 G- [code]EDMA sample test application
$ F: J: @3 @/ J# K - /*" J' X* S8 D* D# o, T
- * edma_test.c
8 k$ V5 H( I8 S - *& a& v/ ~) B: u3 E1 V# K% C
- * brief EDMA3 Test Application
! U; c; b. L( ]; B - ** w1 a M# C& Y
- * This file contains EDMA3 Test code.
# M f& u8 V' ^% n. U3 ?5 J - *
6 _+ j/ i( X, A; J A - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' q0 q" \; D! ?0 c* t6 ^2 ]
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
4 z5 |6 T: z) ~9 \, a- k) T1 | - * TO CHANGE.( d Y5 U! U" f0 c- Q. F
- *
9 f# z6 c: h" K5 e+ K. g7 n7 Z - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// w7 z& I. e- v
- *
4 B: @0 c4 ^5 H/ u$ S. X - * This program is free software; you can redistribute it and/or9 d2 O5 H, N- J7 Q
- * modify it under the terms of the GNU General Public License as: E9 f4 C7 \* a7 N
- * published by the Free Software Foundation version 2.6 e! q' O* q2 y3 V& E: Z! c, j
- *
/ f/ _; [% A/ b- S - * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 _1 X$ V& P K6 ?, P7 M9 o
- * kind, whether express or implied; without even the implied warranty
* q$ W% S8 ~* O: A - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the0 h" s- L# ]7 }: M
- * GNU General Public License for more details.3 F4 b, h4 H5 t9 i& s
- */
4 _+ I- y: E; V3 }, _
+ X" [/ k N3 K! ?8 c, l8 K- #include <linux/module.h>
) P: [; A* e) {5 i/ Q+ M - #include <linux/init.h>5 ?/ [' f+ H0 w! U' f) Y$ U
- #include <linux/errno.h>
, [% g: Z. T3 u! ]8 j4 s. J - #include <linux/types.h>
$ B4 y# V4 y5 O5 P- L - #include <linux/interrupt.h>& z' N: ^2 Z# K
- #include <asm/io.h># [# R! j* O: U
- #include <linux/moduleparam.h>
! J/ z% ]1 g+ p! M1 c, R# n, w - #include <linux/sysctl.h>
8 G1 F. ]) I6 C8 b( S5 |, I - #include <linux/mm.h>
: o9 a8 s+ R; b( ^: X - #include <linux/dma-mapping.h>
. t5 ]5 _ t# B+ S7 S - & s; v/ r. F4 Z6 P2 F7 d& a
- #include <mach/memory.h>: n$ ]9 ?1 v7 o5 d: a7 l/ J5 b
- #include <mach/hardware.h>
5 R! ?& W2 C* B9 I/ [. h - #include <mach/irqs.h>0 D' b; f3 u; H+ c; W9 t! p
- #include <asm/hardware/edma.h>
% l% n1 a3 p0 v) I! `7 W( Z3 e - ' A# ^8 o: l0 l7 P( V) Q# f4 K
- #undef EDMA3_DEBUG. H5 D) G$ `% u, K$ o5 r
- /*#define EDMA3_DEBUG*/! w/ }3 h& W9 J1 N" {- w
- 1 Y; E! m/ F& N8 F+ j5 d9 g
- #ifdef EDMA3_DEBUG, d; A8 C/ z) U5 @
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
1 q6 x2 n6 W% G9 B2 k+ ^. m) v - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 O. o1 E4 u- ?6 Z6 t; E
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
7 X/ \8 r) ]1 x0 K) g. X - #else, k: X t- F! B* q2 p4 c; h% v
- #define DMA_PRINTK( x... )
( j2 S# C/ A! V, t - #define DMA_FN_IN1 K# O+ \( p! j- L/ Q
- #define DMA_FN_OUT
2 N' q5 O: Z4 `( R - #endif% A8 R9 s5 d' ^4 ~2 V4 a
- ; O9 W- z( {/ ~+ h+ z$ z# i7 ]! h. d
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)# D2 ^$ L( }+ m" c
- #define STATIC_SHIFT 35 S7 [; w. B( s8 [- c, i" _
- #define TCINTEN_SHIFT 20
8 M4 J. x6 o1 B/ {" L* M$ o5 V - #define ITCINTEN_SHIFT 21* d% J% E; T/ n8 P. x
- #define TCCHEN_SHIFT 22% w8 b# L( O9 V4 _" u! q! {
- #define ITCCHEN_SHIFT 23
. k- J/ t2 X% ?: y- l
- G8 r7 j6 g' l$ m- static volatile int irqraised1 = 0; i* e4 j) i* T
- static volatile int irqraised2 = 0;
; Q0 p. }0 E! `
) @3 Q9 c2 V. _- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- Y' N( F9 P0 `: X - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 [% X |. v3 ~3 F6 z, [; h0 ] - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* z+ J5 X2 V$ ^ - 9 o1 @( A4 g5 E& g) ^
- dma_addr_t dmaphyssrc1 = 0;- z) a5 ~" S; P% k
- dma_addr_t dmaphyssrc2 = 0;
$ P9 \4 X6 |& n$ H) _1 ~ - dma_addr_t dmaphysdest1 = 0;7 c3 S, V1 [ r1 X
- dma_addr_t dmaphysdest2 = 0;
7 Y1 V- p' ^8 @! {4 T |
$ j {% z: n# p0 S- Y" o- char *dmabufsrc1 = NULL;8 v4 K: X+ w4 A1 l$ Y: {
- char *dmabufsrc2 = NULL;! p% s( Q* _. ^$ L" [
- char *dmabufdest1 = NULL;
5 R8 o4 U' {, c - char *dmabufdest2 = NULL;
/ ]% m4 w& D1 q9 `8 F0 [) y( F. ~0 { - 6 L2 r. v2 S/ G
- static int acnt = 512;$ ?6 _7 @1 ?% g( U8 ^
- static int bcnt = 8;
w( t5 {+ F6 b t - static int ccnt = 8;
b0 U: ^2 A9 S - 9 J; l; D2 u; f9 N
- module_param(acnt, int, S_IRUGO);4 L8 }& ^% H9 A* E2 W( c% m
- module_param(bcnt, int, S_IRUGO);
) ]; c; q. H# w" I% j' @0 C - module_param(ccnt, int, S_IRUGO);
复制代码
) i2 ]0 _7 H# v2 {$ ]) U
4 {8 T7 p& n' b/ M 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# s2 G8 B/ H* A- i% x. |
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* \. B& ^7 q2 ~) ?# b' p& a
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 j" U& i3 L% H' }# ?( o+ Z( t- m# o/ J$ f8 P( I2 x8 l' O
( x: j9 W4 b( v6 `; a& Z
|
|