|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; P$ [* p8 |( u$ Y- [code]EDMA sample test application! M( D i+ n7 r4 R! Y* A
- /*3 a, K- @) Y( h. }" b
- * edma_test.c
! K. ^" V. H8 X% e - *6 G( |& b% a# x; q5 k
- * brief EDMA3 Test Application! {" D3 j3 D1 S. }4 S- n0 |: h
- *
/ g9 ]- P! b1 @: g6 |" D, ` - * This file contains EDMA3 Test code.4 H9 {1 g- c- x2 k4 ^
- * B" T# J6 e8 Z' B. A: m& g
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
) \, L2 a n# h9 \1 u - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT p7 q( a7 x! P# D# I6 r4 {2 n) ]5 a
- * TO CHANGE.
& j4 }# z" Y6 G8 i, A$ ?3 I5 k - *
# K! x+ ]8 S( j! J9 R1 n - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
3 U7 K5 v* m; h( z: ]; h- F - *; L: l& x! H& T# C$ {
- * This program is free software; you can redistribute it and/or2 G1 |* E, D1 T8 K5 A) J6 c8 X4 ~
- * modify it under the terms of the GNU General Public License as
# M* d/ H M+ J% n7 h - * published by the Free Software Foundation version 2.5 ], _+ f/ {/ v0 U- B# s0 h
- *9 x8 T% B1 a6 s" P; j* ~
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any% r+ L6 H3 X* J) \
- * kind, whether express or implied; without even the implied warranty3 \; V& r e# }! z( a5 p( T" q
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
" B! t2 h# [9 |; B3 a - * GNU General Public License for more details.9 W1 G/ a6 j, B; {2 g6 k" t9 v. V
- */
* h {0 z0 J% X4 z$ D5 B' Y/ W8 L! s - % r& [( n1 Y4 z* G! u7 z, e% A
- #include <linux/module.h>* D; {/ Z+ n+ V5 q5 Z
- #include <linux/init.h>
\) }8 T' A3 G' e - #include <linux/errno.h>
; Y+ g6 X& M y% S1 ]+ T4 j2 e5 C. Y - #include <linux/types.h>/ [0 @$ I5 J4 H" P. r( M0 k5 }; G
- #include <linux/interrupt.h>7 p" R- R- Y. s+ j9 C. v5 s! N
- #include <asm/io.h>
1 k! B( v$ Y- V# t& v: C6 w0 w - #include <linux/moduleparam.h>! J5 {5 w7 e# Z& Y
- #include <linux/sysctl.h>
( |! x" a5 {- E g+ M2 K& f - #include <linux/mm.h>
& R! Z4 o# t" g6 b, B2 u) J - #include <linux/dma-mapping.h>+ g. B7 |' U1 f$ ? o; q6 G0 D7 D1 j
, u, i# T4 u( _1 S5 \- #include <mach/memory.h>
# _+ ^& O+ a, @ - #include <mach/hardware.h>) A8 u( ^7 u$ _6 q/ ^% q- ?. ~
- #include <mach/irqs.h>( {1 u9 Y: t- D" k: o# v
- #include <asm/hardware/edma.h>
, c+ C/ k+ U1 K( L- Y, w; i+ y - % D8 o) W0 h; e+ [8 z. \
- #undef EDMA3_DEBUG! {" J: n9 a- D/ u
- /*#define EDMA3_DEBUG*/
" P3 |: ~# j) | - ! u# E2 Z5 C) R: Y' Q) H7 Q: \1 H
- #ifdef EDMA3_DEBUG+ I% p& h0 ^7 L
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 |. {; M# ]( D; R5 n
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 Z$ `& `7 G2 }( M) r
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
2 U+ O8 U- M4 _5 U( g - #else
4 z6 ^! A. J$ ~% G - #define DMA_PRINTK( x... )( A, v R$ p4 j' w% N1 Z4 ?( T; }( t
- #define DMA_FN_IN
; e$ W3 {& V: D - #define DMA_FN_OUT
& W& o- P7 c; b, \ - #endif
" q% [ K/ v2 ?) Q7 q3 d
8 H3 m2 F) U; H- #define MAX_DMA_TRANSFER_IN_BYTES (32768)7 T6 v* i3 t+ Y. X
- #define STATIC_SHIFT 31 r6 J5 v1 r/ V9 n6 T
- #define TCINTEN_SHIFT 20
) V# ~" h1 K: W: v+ J: R - #define ITCINTEN_SHIFT 21
4 ^" G8 i8 S2 } - #define TCCHEN_SHIFT 22, L& ~9 `( H8 \$ h% U9 x6 _& ?9 K
- #define ITCCHEN_SHIFT 23
. [0 h: B8 e6 H4 f" o# V - / G0 J" r/ N9 e) g5 [2 n
- static volatile int irqraised1 = 0;
; g8 v' @2 S1 p, w, z - static volatile int irqraised2 = 0;
- W, _! J4 w4 e; P# w. N' d* s2 |
7 v( J8 R7 f9 s% q$ }8 M- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" K" |; i {2 c* y+ X
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 v$ J3 M) Q$ L9 P
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" p$ o s2 f6 H
* g% e; ~2 \" [! j. i) X, Z- dma_addr_t dmaphyssrc1 = 0;( { {5 V( x6 F: n2 ?- m# L, |, a
- dma_addr_t dmaphyssrc2 = 0;
2 i( A& H& p" ^+ }0 ^/ } - dma_addr_t dmaphysdest1 = 0;
+ g m0 U) i4 B1 V7 {2 G9 [' |3 @ - dma_addr_t dmaphysdest2 = 0;
; u# A# Q2 w# s - ' I/ i0 ^6 q% z
- char *dmabufsrc1 = NULL;' a2 ]. S$ J7 Q
- char *dmabufsrc2 = NULL;
' t+ u/ [5 \, H* @ Y- j - char *dmabufdest1 = NULL;
( f. o7 E: F. Y5 L0 D9 B9 V - char *dmabufdest2 = NULL;
/ d" P+ O4 F* G - 0 Q( S5 }- g* H t- R' w L! X
- static int acnt = 512;
+ f+ r' ]7 o; U: a6 E - static int bcnt = 8;
" d; _1 W2 H9 W+ N - static int ccnt = 8;$ d8 |0 \0 N: i5 u% m
- 7 P) R: c5 X5 y. j; L' u
- module_param(acnt, int, S_IRUGO);
$ O, A3 S2 a4 J* i' i8 @ F - module_param(bcnt, int, S_IRUGO);
( F3 j% s; z" E W( V+ }; t - module_param(ccnt, int, S_IRUGO);
复制代码
1 W0 ~) Q( n ?7 t) A/ @; G0 H
6 f& ^% Z4 p' H8 o5 N 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 ?/ R" @# b1 Y4 S
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 ^# d( M7 z4 g% D 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
I: i. T4 w* V2 m$ C/ _4 f/ r- @ c+ N4 {, L R0 g
$ c/ d8 D; X5 G# k4 @- s; _$ ~% Y) \ |
|