|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( k6 o( n* R( f9 E) W- [code]EDMA sample test application; O# ?/ w& k1 @% H3 X' T
- /*
# a' |, z; a3 W8 q - * edma_test.c2 a" k6 j2 X- t- e
- *
+ k$ N) J( ]+ K( _( ^; c( r1 n - * brief EDMA3 Test Application
' v) Z, _$ a7 r* {$ v0 E, I - *: F: T: B# T1 M9 t. W4 s: J8 p/ z
- * This file contains EDMA3 Test code.
1 k6 N, R8 q2 m' S, I1 c - *. _; \. [1 Y1 [7 p2 H
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
, h! v5 B, t4 }/ M* y - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
9 s* ~+ |( Z6 N) q - * TO CHANGE.
2 K p3 e5 R6 I4 ]% R4 Y - *7 |1 P% t' S) ?. u) V' C
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' Y6 ^3 c/ ?5 d2 L8 T
- *
+ o/ {" R0 J6 H( A; w - * This program is free software; you can redistribute it and/or/ Z! V3 W- g* q) |4 Y
- * modify it under the terms of the GNU General Public License as" ^6 O) q4 W& j) Z0 z. D
- * published by the Free Software Foundation version 2.( c/ T: O. v- k `
- *7 {3 V6 o; C# X! W
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any- C- N" |/ J1 r& ?; f# z
- * kind, whether express or implied; without even the implied warranty f" y- e* E& I4 p# L
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4 G, ]/ F8 v/ H# c; o0 _, p - * GNU General Public License for more details.
! i+ C/ F3 E0 \) q - */# E* k7 z, b+ P5 N, h
M9 N: ^0 ]9 V' {7 k& t- #include <linux/module.h>
! y; e/ ~& ?9 f& X7 l - #include <linux/init.h>) E' H$ v' W" R/ ~6 F: b
- #include <linux/errno.h>
9 S" e/ Z' ~% H T, x6 E' P$ ? - #include <linux/types.h>$ M; K8 ]# r6 m6 u& I7 v
- #include <linux/interrupt.h>9 V0 n7 A0 `1 l4 l2 E
- #include <asm/io.h>
( X' v, L R7 h2 ? W8 M - #include <linux/moduleparam.h>) P$ e( C4 i7 {6 f& |3 U
- #include <linux/sysctl.h>
! \7 f+ F# U* H7 h# B* A - #include <linux/mm.h>. m, ?$ R, R% I+ [8 ?1 T) T9 E
- #include <linux/dma-mapping.h>
1 @" R- a# H! Y0 _! L - ) U: \( {) u/ ]3 m
- #include <mach/memory.h>
" I$ V6 f# S3 Y- ] - #include <mach/hardware.h>; m1 }; d+ F! L
- #include <mach/irqs.h>
0 R& J9 N& g& Q) H# C# C - #include <asm/hardware/edma.h>! k& C' c" k" ~ H V- L+ _; W
- 3 n- o5 ?, S3 I. V/ ^' w
- #undef EDMA3_DEBUG R' F. `2 F# Y
- /*#define EDMA3_DEBUG*/
1 f7 T# h$ E2 V8 A1 m( l
% D' T2 O. I: P s- #ifdef EDMA3_DEBUG6 X6 @% ?1 Z+ @3 h
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
7 i) l; K3 M2 X2 T - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
4 n! [ g/ Y/ q/ l! e+ E - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
) W8 d; L0 j# H5 P: ~* [ - #else* k9 G, J1 Q# y( F4 i
- #define DMA_PRINTK( x... )
# _: R! S" e F/ W2 n - #define DMA_FN_IN
# B3 M$ D1 O4 T0 W) m6 f* Z: x. c - #define DMA_FN_OUT
4 o R% p% `3 Y& H4 S- | - #endif
: ^5 G- {- |. W& |+ l
2 `( Q$ g, r- p# w% O- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
/ ]% p+ [6 @+ m# o4 P4 g - #define STATIC_SHIFT 3
|4 S* p5 j% n - #define TCINTEN_SHIFT 20
9 Z: ^# \& k! R- J9 f - #define ITCINTEN_SHIFT 216 u6 t, X { n8 l0 X: a, G
- #define TCCHEN_SHIFT 22$ j" ]4 q! @, d4 U; c
- #define ITCCHEN_SHIFT 23, M/ o2 [ V# [0 N) E; l5 {
: A! p) f- `, J4 u1 H6 w% M2 d% d- static volatile int irqraised1 = 0;. S' p* K3 H' U l6 n
- static volatile int irqraised2 = 0;$ r& {$ { s- ~, O6 z. G
- O+ W- g6 l' k/ K5 U1 |
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- G$ N" k: U- J' o7 b1 ~- Z( B
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ x" m$ R3 a. c+ m
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' a# P. g+ Z% `4 k9 g+ u5 w
9 N' r$ w5 h- Y1 G7 G; l9 D- dma_addr_t dmaphyssrc1 = 0;3 z p$ T5 c; X" s
- dma_addr_t dmaphyssrc2 = 0;
; m1 Y8 k3 n L6 ] - dma_addr_t dmaphysdest1 = 0;
) L0 k0 P- g9 M. l# c5 _ - dma_addr_t dmaphysdest2 = 0;% [3 x. g" ?" U8 B6 ~- q
3 M* \4 a, f' A2 c! m- char *dmabufsrc1 = NULL;! a4 L+ D, z5 Z
- char *dmabufsrc2 = NULL;
5 I; C$ N3 l+ l - char *dmabufdest1 = NULL;
8 e- c- m9 W; W5 X4 p0 R - char *dmabufdest2 = NULL;
+ i* D8 x0 U2 _! w0 o9 t+ M3 C! Y - " O; d* T" Y7 |% b% y! i8 b
- static int acnt = 512;( ~! y) Y2 w3 }4 d- A
- static int bcnt = 8;
0 I. V( z4 L- l; P6 H - static int ccnt = 8;8 w* n$ D) t6 a9 E0 L! @
- ! t# b* S8 m9 P$ S& Q
- module_param(acnt, int, S_IRUGO);
( S- c4 w6 |& \ - module_param(bcnt, int, S_IRUGO);2 \6 z- Q3 H2 W* j( |
- module_param(ccnt, int, S_IRUGO);
复制代码 / R# j% M/ D+ {- _/ _3 q: U
9 x' c' \+ U" ^( w
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ F1 ]# r6 S* t! y, Y- @
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 L+ g( f; w v6 |. q( k/ W( ]
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- d5 {. z5 l* q- w4 {
6 Z- H5 \: p$ Q8 U' T$ w# ]3 a( J
/ L7 j9 d: P+ ^5 c9 X( x( [
|
|