|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* T7 l4 b* c9 H0 K3 V- [code]EDMA sample test application
; X9 [; u T i: ] - /*% _8 |2 U" \; I- H4 D
- * edma_test.c$ a: Z8 d' \1 Y
- *
x. p' W2 @$ E7 C - * brief EDMA3 Test Application# ~7 b9 j1 P; Y+ O" n
- *
$ J3 l. g# H/ t. j - * This file contains EDMA3 Test code.7 ~! x' k6 R; w T1 v% D8 I: v
- *
) y3 x# Z8 o! f- B: u+ Q; Z - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
; z' {# s/ H: V6 N+ }* W. B. I' M - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! e [9 g. Y7 n) [. r8 D& j/ I0 ]
- * TO CHANGE.
7 h; I: I' } h, C& w; X - *
( e' J, J. t( o% T% i - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; q9 c) @3 U* }4 b* s/ A
- *
. v6 ^0 p. [0 \& z8 U - * This program is free software; you can redistribute it and/or
: _2 c/ Q5 {- F+ J; f7 [ - * modify it under the terms of the GNU General Public License as
" E3 j$ B+ I, m, N. f, A# I6 m - * published by the Free Software Foundation version 2.
! ^9 }% R% F( P - *
m1 V D9 r3 ~ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any" n5 U) n& d; v7 K5 b5 x& {
- * kind, whether express or implied; without even the implied warranty! |9 |9 x& F9 H3 @3 | D( h
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
$ l" E6 ]8 `, k/ L5 F B+ u - * GNU General Public License for more details.
! h3 k# }' G2 t, [ - */0 [" ?' V/ |# W
- ' o% [, l8 n7 K+ `1 n; H
- #include <linux/module.h>
! l0 g1 q% x$ C8 _ - #include <linux/init.h>
6 ?+ H" t4 d& ^. c0 K- Z - #include <linux/errno.h>- ~2 ]9 _. R5 o( S: ?% X
- #include <linux/types.h>' P2 U) t: o. M9 l
- #include <linux/interrupt.h>8 s+ w, \- D4 m; z* ^
- #include <asm/io.h>/ ?9 `( `& v- Q/ l
- #include <linux/moduleparam.h>* q4 Z# p# p4 @3 @) F
- #include <linux/sysctl.h>" o: W6 d# t P& {- \
- #include <linux/mm.h>
5 h$ P# |: H/ e - #include <linux/dma-mapping.h>3 d c* g1 H% O) M8 y- X4 r
- # P+ s! \( u4 }$ K6 [5 _# x
- #include <mach/memory.h>
2 E+ O0 }/ }5 q- t( B: \ - #include <mach/hardware.h>
+ |) ]- V3 m4 O! a" Q - #include <mach/irqs.h>
& P5 ?8 q c) J9 Z - #include <asm/hardware/edma.h>% i& \ L5 `$ |& c2 ?/ _
- 4 x# X+ Y. E/ H d0 |7 {2 E8 V
- #undef EDMA3_DEBUG3 h! }) _2 G7 B: F/ k* p
- /*#define EDMA3_DEBUG*// c# \3 b1 Y% W7 z1 G4 E5 D' w( {( \
( I+ ~9 G% e! E D, M- #ifdef EDMA3_DEBUG! }- V1 H0 f* b" R8 G, C
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' F/ U+ c* F" `) X
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 e+ Q3 S/ A n E
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
+ x6 b2 G' l) Y { - #else5 l9 \' n) t) w/ m6 ^1 x: Y
- #define DMA_PRINTK( x... )* h+ n- e& ^9 \, a; k
- #define DMA_FN_IN" d8 c; h/ @8 {; T8 z. L
- #define DMA_FN_OUT$ t5 [ |5 {; D
- #endif) J$ S7 Z/ X" F" z$ M
- 1 m% @$ _7 ]( m
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
0 D4 P* a2 x0 J j2 D/ g - #define STATIC_SHIFT 3
+ W: U( T5 B! ?1 `( W9 ] - #define TCINTEN_SHIFT 20
' d, j4 n/ f) w" I - #define ITCINTEN_SHIFT 21) e) G" l _) r& O
- #define TCCHEN_SHIFT 22: ?4 P& J6 I: l" N. d
- #define ITCCHEN_SHIFT 23
0 d5 K1 |0 }- }+ ]/ S - 0 A$ c- G* j+ F! R" {. p7 q+ y
- static volatile int irqraised1 = 0;
' A# v# R0 m5 C+ ?, ? - static volatile int irqraised2 = 0;, e2 c9 X& E" U! M! N- a. D
) K2 Q2 l, ?9 w/ m- E5 U- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, N7 |. M# I8 e
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- s, R y8 d l9 T( N/ s% P3 z - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 i8 w, l0 R- d9 k7 G% k - 4 E3 J2 M3 P2 {# d; ?7 @
- dma_addr_t dmaphyssrc1 = 0;: B$ E- @. L- P) c1 y' k3 Q! E8 T& S
- dma_addr_t dmaphyssrc2 = 0;
0 o+ S' f# Z9 W4 o: f0 \% p - dma_addr_t dmaphysdest1 = 0;" [6 E8 C! l8 V, R" c. M
- dma_addr_t dmaphysdest2 = 0;& w: o1 l1 m; j" O! v6 a2 w
- ' A* }: e, X" D1 @7 D, l2 S) i
- char *dmabufsrc1 = NULL;
' R9 H* @9 L5 R7 j4 u3 k7 A - char *dmabufsrc2 = NULL;
1 P& @' m/ E# N1 R/ i5 W$ K0 p - char *dmabufdest1 = NULL;
# Y0 y# r6 ]% O - char *dmabufdest2 = NULL;8 c: h- t4 q3 e b; y% S0 B
- f0 g# t6 G5 B8 G- static int acnt = 512;
$ x! e; v6 P$ ~% y/ @/ S - static int bcnt = 8;/ K/ [4 C' _3 U8 u
- static int ccnt = 8;% y+ D- A1 ^6 B4 P3 m7 H9 `
- . W+ o7 F1 n- V: I5 \5 ~
- module_param(acnt, int, S_IRUGO); E% P, c* v0 T7 L z/ P6 }
- module_param(bcnt, int, S_IRUGO);4 F( H1 n* X* v7 Z/ s! H. b
- module_param(ccnt, int, S_IRUGO);
复制代码 8 o; E7 N+ L, v. q' ]# Z7 e7 u
) x: Y& { h# p E) B/ r) l 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ C' l; |6 p4 J( Yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 K/ W4 Q- c& F6 N9 D
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 \3 k2 r# j, R/ n/ s# p- @. ?9 |8 D# v' u: k* X
" g2 A3 D& Q* d m |
|