|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 Y) L6 n& e3 k3 i- [code]EDMA sample test application; x, y* J% l% [9 G' N. S% T6 r
- /*) {0 p# W6 O4 {. q! N0 M/ U2 J
- * edma_test.c1 b1 P0 q$ _0 D o) s& U7 ~7 @
- *" \& l4 Z7 u) \
- * brief EDMA3 Test Application
- H9 g. D7 E2 u5 w- Z1 K; ? O1 a - *$ R/ ?+ x! r$ ?1 x; q7 e
- * This file contains EDMA3 Test code.
* p, U8 D& d) ^* E6 L% G( @ - *
$ |" @4 o' }1 g7 O7 @ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
5 b6 D7 p& K J) \ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
7 T& |, n. W' R' u& J. x - * TO CHANGE.4 F' |2 [! Z# ?: K3 R& X
- *; z# h. c$ c0 [5 [8 y
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 `2 u. e/ i g& r
- *9 f6 }. O' T- M' l( W3 v5 ^% }* _
- * This program is free software; you can redistribute it and/or
: f6 ^6 o' d( q7 | k$ U! z* R5 k" L - * modify it under the terms of the GNU General Public License as! G9 ]# s$ X" n; _0 Z, N: {
- * published by the Free Software Foundation version 2.* J, p+ j! t% Z" S
- *& `1 P' x8 ^0 I p/ M t
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
8 L& M; p3 ~. A' F0 l - * kind, whether express or implied; without even the implied warranty/ Z8 A4 A/ @' N* {; G/ U' c9 j
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the H6 s/ t- L: x( w
- * GNU General Public License for more details.
^- i6 u7 z+ n5 N - */
% f, ?7 C( [( N* h3 g - 7 V% r5 y$ S1 \2 g$ S2 h
- #include <linux/module.h>6 f: r$ K. z/ r/ Z
- #include <linux/init.h>1 w: ^' [0 I2 I5 u7 `
- #include <linux/errno.h>" f/ x; p. k" C2 `7 R1 R+ D! x: @# q
- #include <linux/types.h>8 F7 _6 N' m+ k" N$ ~/ Y# X
- #include <linux/interrupt.h>2 p- m* U2 E+ G, a% [3 t0 `
- #include <asm/io.h>+ S7 ]" X1 l" F
- #include <linux/moduleparam.h>8 U; d& q4 t9 Z
- #include <linux/sysctl.h>
* O3 p4 q. |/ M9 V8 t8 P: D& u% W - #include <linux/mm.h>
2 f0 n8 [! r/ s. } - #include <linux/dma-mapping.h>
7 W7 D3 j H6 ~% S
, f6 l2 C9 }$ d* {, E- #include <mach/memory.h># x E/ X, y6 n; D2 d7 w: b: J
- #include <mach/hardware.h>% r! [, S6 J; z) z
- #include <mach/irqs.h>
; O; i+ j; m2 }( g - #include <asm/hardware/edma.h>
7 P1 @7 `4 {' }" @
# x4 j+ N. x/ C: `. N' c: i- #undef EDMA3_DEBUG
t7 n* w6 Z( U) y! g& e - /*#define EDMA3_DEBUG*/
2 R9 ^" P2 U& h9 f, {/ h9 O - 1 u* D9 w& d* X1 R7 p
- #ifdef EDMA3_DEBUG
( T( f4 e/ z! W0 j8 H - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ c( s+ p! r( q( z f
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
6 G% B+ r& B( Z) U - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), g ^9 U) r* S$ d
- #else
" z+ U$ T5 D% k8 ]' _* E - #define DMA_PRINTK( x... )8 f# S! ]4 f! g# Y; m& |
- #define DMA_FN_IN" ^4 y/ W- f2 c& ^5 W/ k9 i
- #define DMA_FN_OUT
) H- `* _) Q# p6 J3 w - #endif
5 t+ m0 i' |! B4 X6 R4 X8 q - & G* b# ^6 O/ T1 C0 v$ F) \
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
2 e8 g) B# z$ a+ d$ F, M - #define STATIC_SHIFT 3' q4 y" G& J$ d! n2 j
- #define TCINTEN_SHIFT 20+ K( {, q2 Y* \
- #define ITCINTEN_SHIFT 21
0 r9 R. b, \. S+ o- F# p8 J - #define TCCHEN_SHIFT 22% @) A( R6 N$ O5 z# Z2 r+ i0 `2 e
- #define ITCCHEN_SHIFT 23
/ }' w6 S* O- N! o
- B+ y" ]2 F8 y9 d5 y/ l2 C3 C- static volatile int irqraised1 = 0;
, i1 m5 R$ q5 C1 ~ - static volatile int irqraised2 = 0;
8 A6 j6 y8 L" Q( s( w9 c - 7 U0 r% q$ v5 K) @) `& a/ z
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- p8 {6 r0 f, W) j% A: X. p" [" w - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ B6 Y$ e! p; B3 G9 a3 ^3 h' R - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 N) {3 A! I) G - ! ~1 T& g0 b2 ^, V5 n) w
- dma_addr_t dmaphyssrc1 = 0;
! k3 R# |9 j- C) K. c4 S - dma_addr_t dmaphyssrc2 = 0;
- i; R3 H: p0 C- L - dma_addr_t dmaphysdest1 = 0;
8 c: }: R6 y4 F _' A0 W - dma_addr_t dmaphysdest2 = 0;
! \/ ?5 p6 c9 e1 A& F! O: Z9 i - & x$ K; b3 ~6 v/ t! }, ^; }( h
- char *dmabufsrc1 = NULL;
- E' f& V3 [) G$ j - char *dmabufsrc2 = NULL;
/ z# `! C2 F! @( n# L1 T - char *dmabufdest1 = NULL;$ U% w( B4 B0 @8 h
- char *dmabufdest2 = NULL;
4 X6 ^# A( F6 d) z$ @7 o# K
, Q# z9 c9 `$ r! u+ e+ n- static int acnt = 512;
1 A: R" @8 @) q/ a _+ s - static int bcnt = 8;. H2 A2 K2 q9 ^
- static int ccnt = 8;
6 E8 U7 t" t G2 F0 x
8 J k; _; I* l) S- module_param(acnt, int, S_IRUGO);( c. g+ _! r* ]
- module_param(bcnt, int, S_IRUGO);
4 J, {, L- C, m$ G& O3 G3 g) i0 y - module_param(ccnt, int, S_IRUGO);
复制代码
" Q9 S, R5 x4 s3 h/ m3 ?1 g4 A( T2 Z2 M4 d3 X, q" y
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 b7 O1 L( x4 d2 H$ ^! F# a9 I; i
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 b; @1 {6 j' m
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" ~0 \' p# r" |! ~+ N, _5 d; Y% R$ y+ u$ y" P
0 q( T% Z( T! `% D9 i5 I' t# n |
|