|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 t2 E$ _' z2 q/ \* E- [code]EDMA sample test application# S3 w* T4 {1 R6 |; K
- /*( | Y: r3 D5 n) ?; S
- * edma_test.c
# m7 ]4 W4 f7 f9 N- o - *. L5 U$ T6 }8 z
- * brief EDMA3 Test Application
5 u& ~# m5 V9 H1 s# Q; U7 s G - *- i9 [% z) j; S5 I
- * This file contains EDMA3 Test code.
+ i. Y1 h7 q1 h - *
8 A7 C5 r7 i. R% ^5 ~' a8 F - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ G Y1 T& a1 r7 q) O; u9 p! i
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
* ?6 ^' _/ _& U& ^/ b" ^ - * TO CHANGE.
4 ?6 W. C( F1 X* O9 |. Y - *
+ R' ~2 d( w' Q, }: g6 {0 G - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 R7 a0 w4 [, W; q6 G
- *
5 T& r/ M" v2 u/ A - * This program is free software; you can redistribute it and/or3 Z- z# f% }, p( e% |
- * modify it under the terms of the GNU General Public License as
8 j0 O, ~- A/ }# C6 n2 P - * published by the Free Software Foundation version 2.) |) c; L0 K2 X; E9 A3 Z- Y
- *
0 u3 H! `- z0 u4 `% b) ~6 h' ` - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
3 |% a( @- D; I8 x2 r - * kind, whether express or implied; without even the implied warranty
G2 K' D3 B+ ~) K: o4 [% P" w - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ A. f9 U E2 R2 O
- * GNU General Public License for more details.& `2 l$ C% h6 [+ m
- */# Q+ \& |: c. m8 P1 X6 m
, o& E$ h7 K W p% @: j7 y4 W- #include <linux/module.h>$ j& i6 ^- j. a9 Q0 o
- #include <linux/init.h># s$ n- ]3 q. |
- #include <linux/errno.h>. L% |* |( P5 v5 o# o0 o
- #include <linux/types.h>' s2 \0 i0 I( ^, |+ H
- #include <linux/interrupt.h>: X8 u) v& K( F, ^7 N( o
- #include <asm/io.h>
& M2 [; g! A: I - #include <linux/moduleparam.h>6 z6 J0 W( W+ L# f# o1 t! O: R% M
- #include <linux/sysctl.h>9 ]! R& U7 @3 }5 F% R: u
- #include <linux/mm.h>0 p* _: @& S5 i, `5 ~! Z
- #include <linux/dma-mapping.h>
; ?1 M2 B6 m5 V - ! u8 y) ~+ T7 s
- #include <mach/memory.h>9 d* L `, S' U E i
- #include <mach/hardware.h>0 ~$ t) J( P) H* F
- #include <mach/irqs.h>9 T3 g0 S+ c# K; f- T4 ?; [1 b+ Z# S
- #include <asm/hardware/edma.h>* |& ~( c5 ?4 ` Q3 U
- , v7 N4 o# |2 ?2 V0 W
- #undef EDMA3_DEBUG
/ O" K! a) }- i% x - /*#define EDMA3_DEBUG*/
3 h/ H2 I% [& X8 } j$ h - - v! k0 [9 T5 j7 m% K9 i1 |/ n3 q
- #ifdef EDMA3_DEBUG
" W4 c/ @ ^: I - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
6 G" K6 | t0 d, W2 t, L - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
: s( `" V# V: I4 m - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
' ?2 S7 w' o' ]$ g! B - #else8 M g5 Y7 ]0 A3 d
- #define DMA_PRINTK( x... )
& x/ b0 b( y5 \) `* r - #define DMA_FN_IN8 o% L3 Q+ F* q4 C: {' d; G+ j
- #define DMA_FN_OUT
& F7 T/ o0 B" W/ z- c/ F; b% s - #endif
; u! b" B" ]/ b) `% } - ! C& c# i5 r6 y& e* K
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)" W: Q$ K. _0 x. d
- #define STATIC_SHIFT 3
8 \' P, x, T+ M5 f3 M$ }7 K - #define TCINTEN_SHIFT 204 {$ _; r K$ y; I
- #define ITCINTEN_SHIFT 21 p- x( Q- S& j& V
- #define TCCHEN_SHIFT 22
3 Z s6 G2 g" J0 I. H - #define ITCCHEN_SHIFT 23
, }/ Y8 f! k% |3 `/ q. v$ Z
; D6 L6 @2 Y; a- static volatile int irqraised1 = 0;
$ H1 u8 g& }! p# U1 U' u0 E: O- @$ d6 C - static volatile int irqraised2 = 0;
( f8 P1 I! ^8 ~, W - + P- P0 h3 ^% R+ h
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) j, I9 p; ]4 u2 D- D - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ {+ @& N0 A$ Z4 C
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ n7 B- D, P3 M - 7 b! h. t4 l) A9 c
- dma_addr_t dmaphyssrc1 = 0;5 W$ P9 m" @$ s/ J/ G" ^- Z ?
- dma_addr_t dmaphyssrc2 = 0;
* y" }- O' g# X1 h2 N0 I$ U9 }+ }: N - dma_addr_t dmaphysdest1 = 0;
2 i% U4 x$ r" N) ^4 Y- J7 @3 e - dma_addr_t dmaphysdest2 = 0;
3 C( V! H! {4 x I% @ h - \+ ^. A- T1 z0 m
- char *dmabufsrc1 = NULL;
c2 W7 l2 j4 `' R w) W) X - char *dmabufsrc2 = NULL;
- l: b3 ^% B1 [, @7 ~* \ - char *dmabufdest1 = NULL;
( F! m3 F6 V& o" o - char *dmabufdest2 = NULL;8 f+ ~+ H, {2 N3 ?5 l3 @$ e( B& Y4 N
$ {9 z& o2 L- V) u$ s, A- static int acnt = 512;! ^+ C8 S# Q4 r/ f9 Z
- static int bcnt = 8;
: x; K! h+ v" \1 R - static int ccnt = 8;
p3 |/ t! q3 e - 7 F+ w8 E$ _2 e
- module_param(acnt, int, S_IRUGO);
8 _) P' u# j6 N Y x1 L - module_param(bcnt, int, S_IRUGO);
# \0 n# _# u( s0 n - module_param(ccnt, int, S_IRUGO);
复制代码
! ?5 F w7 ~ [. X4 G1 k5 D4 T& ~ O+ D
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% J: [, ^9 z2 marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, K; u* j$ ?4 { 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 g7 ~) N7 @5 h A
1 M6 T9 P% B; e0 c# e# ?+ S. j
; ^3 V4 O Z4 [8 T) O% [
|
|