|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 \5 F' }1 q, R* r- [code]EDMA sample test application: C4 x. Q. G' j1 ~; l; N' ^- E
- /*
9 E( H: K# {6 W - * edma_test.c, S# ?2 u/ c( v
- *+ @" j ~! A: n& p
- * brief EDMA3 Test Application
# z% O* J1 P. e' A - *8 X# v+ F: A& @, Q6 [! |
- * This file contains EDMA3 Test code.( H5 o, D6 L. h) E. R
- *
) h a9 \/ D, m; N - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
+ f7 b* E0 w) }7 T6 b7 q) {) B - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
; N6 `- L Y7 W) V - * TO CHANGE.1 I7 j; h- r' i! n0 }, z
- *
# f# s3 Z" M# u6 p1 N& W6 A - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
7 ~1 }: y9 e% m - *
" A; H2 |3 [, T! b% a - * This program is free software; you can redistribute it and/or
: [8 t9 P q& ?, C - * modify it under the terms of the GNU General Public License as, N2 }$ w4 J5 s8 O. `. K1 U8 ~
- * published by the Free Software Foundation version 2.
7 I; P! E r: t u- S - *
9 c4 J8 B3 k) I0 v" L - * This program is distributed "as is" WITHOUT ANY WARRANTY of any! n1 R$ ^5 M A$ m
- * kind, whether express or implied; without even the implied warranty
% j# W/ X' g0 a% t% @ X" p - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the/ c9 ], ~& ?. Z& M `1 R: E, V; j
- * GNU General Public License for more details.) d6 m. n9 |( s% N: G( _) }$ s4 x
- */9 e: U) ?' C/ `, N
) P1 n/ G+ l3 z6 f! o- #include <linux/module.h>
! A, T% }9 E0 }* P. `" u/ Y - #include <linux/init.h>
' o8 ~7 \2 P/ y( d. G& d5 H$ h - #include <linux/errno.h>( h2 \8 H3 B \3 i
- #include <linux/types.h># g8 `3 I/ S0 W# S. Z
- #include <linux/interrupt.h>2 L+ |" D# v) L& O; A
- #include <asm/io.h>1 e' `6 x! i+ ~- J! u" a
- #include <linux/moduleparam.h>: X4 J6 A0 T' J$ u# l o
- #include <linux/sysctl.h>5 E7 z; {. U3 g6 r
- #include <linux/mm.h>
; Y( _3 j4 ?& M% I - #include <linux/dma-mapping.h>4 L" O: t: q* ?/ |/ L
+ @1 }/ V4 x; H* \4 A- #include <mach/memory.h>
. `$ I& ?) d, ?5 V. r- X/ h# i - #include <mach/hardware.h>7 L4 Z4 s+ m7 P# {! z" g
- #include <mach/irqs.h>$ r: Y' G, d$ c
- #include <asm/hardware/edma.h>
0 {) @. Q/ p3 K
2 o7 m% i0 K: w, ^- #undef EDMA3_DEBUG! K p; u9 S& w0 O1 e& L1 ~0 t
- /*#define EDMA3_DEBUG*/
/ p5 h: b. U: ^3 r) K, l
% f6 ~% d8 n; Z4 X5 R4 t- #ifdef EDMA3_DEBUG$ _. K0 [% F# `1 C: R' o! ?7 R
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 f* d9 e- L4 E" M
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" W8 s) L6 B0 z; j% a$ B% {
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 ]% C8 {# z; y9 [- y4 C4 N
- #else
. W! ?1 b0 b' N* M# | - #define DMA_PRINTK( x... )
. _# x+ @0 l S1 H4 [# A - #define DMA_FN_IN
# {0 J9 v2 V( t7 _ - #define DMA_FN_OUT
: K1 E; z# S. K5 X - #endif
- w8 x: q: q3 Q+ q& {2 l( g2 J
% H9 K$ S/ F. t. n* A+ |- l4 {- #define MAX_DMA_TRANSFER_IN_BYTES (32768)% A: g% M2 @5 g4 K/ x6 B; Y
- #define STATIC_SHIFT 3 @1 z' ~1 o9 ^
- #define TCINTEN_SHIFT 20( E5 f* }0 A0 _) d! Z/ X y* E
- #define ITCINTEN_SHIFT 21% @/ X& @0 G" J
- #define TCCHEN_SHIFT 22 J( h2 u$ X; `* z8 Z7 b
- #define ITCCHEN_SHIFT 23( ]3 h! ]. h, B5 F: n' p) l1 ~
- 1 k5 g$ k& g" Z- e1 d; n
- static volatile int irqraised1 = 0;( R: g6 }" A% K
- static volatile int irqraised2 = 0;/ g3 S/ Z8 I1 v% p2 S- m) O
- $ R1 i7 A& ^% D7 _' {
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# a! h$ t& W9 b# j" ]; v8 ]/ z
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- w& b, y! L. ~8 ^7 c8 ^0 b2 L5 E - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 a7 ~; f; P5 D4 e
- 9 b/ o8 ?2 V, T
- dma_addr_t dmaphyssrc1 = 0;
& @+ J7 k0 }; h) Z+ _" J - dma_addr_t dmaphyssrc2 = 0;
0 H, e6 S* M" E1 m* U: g - dma_addr_t dmaphysdest1 = 0;
$ l' X: N3 P# E3 x - dma_addr_t dmaphysdest2 = 0;: G; `8 S8 Q: D) g: ^5 H2 M
- & m. L* h5 G: [) H
- char *dmabufsrc1 = NULL;4 j! i/ L) B# r! M8 s
- char *dmabufsrc2 = NULL;/ J; E! b' G7 P/ ]# T
- char *dmabufdest1 = NULL;. e0 Q- W. }! ~- c* l
- char *dmabufdest2 = NULL;9 B2 y) ^3 B. r/ C
" m% M. q4 j* ?/ F- static int acnt = 512;
$ k, f, z( i. N- N( @ - static int bcnt = 8;
4 E8 _9 j6 [6 W - static int ccnt = 8;
7 w- c( B- \; {+ F
+ k3 T* d ^7 S8 O- module_param(acnt, int, S_IRUGO);0 m0 G. `. }: w+ ?) v8 L4 o
- module_param(bcnt, int, S_IRUGO);& r- l# \# s( R- s7 Y6 D
- module_param(ccnt, int, S_IRUGO);
复制代码
m1 @. V5 z5 Z O, R' K3 [1 F
/ T/ z( `5 _( }% q) w+ s9 _- X- S 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) _/ J) C) H! |$ K
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 J; c. ~, r+ z7 f4 a% G3 ^5 ^ O. @& K 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- Y6 f1 U6 r" F2 G# ` A3 C2 ~
0 Y4 ~& \- g# x7 p* N( m1 Q: r/ U M0 W) j/ ^# J
|
|