|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! C% s$ R! O/ f2 Y
- [code]EDMA sample test application- N b# {5 m/ h1 w+ f6 I
- /*
! l; ?+ L: e" Z5 V5 n - * edma_test.c2 w5 [. y3 D: j1 V
- *- c C1 f" Z' F& S1 t
- * brief EDMA3 Test Application
5 `& G5 ^5 ]( O6 t' O# O - *4 d1 x. a5 W8 `- X$ I
- * This file contains EDMA3 Test code.; r* ?9 B. `! M! t3 U; G
- *% z8 r8 L; A9 |5 ] l$ D
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
# c) b& \) Q1 q - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
5 h/ ]- U" g9 ~% a) Z. o6 s - * TO CHANGE.
4 J1 Q$ W3 E0 X, g% K: K - *0 H: N7 m2 S4 M: k$ p, z% T( F
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; m3 t; i- {3 `, ]" Q' G6 M: H
- *' H9 H! c5 L1 ~, d$ K5 U- C6 u- [* A
- * This program is free software; you can redistribute it and/or6 G+ C. |6 ~. d$ `) W. {% B2 B
- * modify it under the terms of the GNU General Public License as' x0 q# {% b0 }" V8 T, y$ ~
- * published by the Free Software Foundation version 2., K' g' a: N% b( ~
- *
$ [# T) b; e' C8 T, n3 G - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
. ]; k3 |! Y" Z- W5 S8 F8 T - * kind, whether express or implied; without even the implied warranty
3 u Q' u- {7 b" [) I" g% s4 Y - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
" m V, B( C2 V. x' A - * GNU General Public License for more details.
/ p1 g; @% ~+ E5 Z! m& H9 n - */6 t7 b! m6 T4 K' c
- 9 e: ~% e0 ]$ R' ~5 d2 L; F" w
- #include <linux/module.h>
( j# G5 O% @4 f2 y0 v$ I% I - #include <linux/init.h>
. S* Y x0 v; |8 T( j# O: i1 e - #include <linux/errno.h>! E: d+ p2 _- m$ o7 H9 a
- #include <linux/types.h>1 o/ H+ ^4 l( U; x
- #include <linux/interrupt.h>' `0 `! @1 h: K. V5 _1 u3 p5 K5 c* F
- #include <asm/io.h>0 e" {* _, [6 U5 r
- #include <linux/moduleparam.h>8 V" e) }: R' _) ^5 R& f1 j$ @
- #include <linux/sysctl.h>1 E: V9 X7 i( O+ @4 o
- #include <linux/mm.h>
) s2 {. P9 I p& A$ F' q) E - #include <linux/dma-mapping.h>3 O; y: Z- Y6 g
- + H* D2 M* j! D% C. R
- #include <mach/memory.h>
! ?' n8 d/ h7 I3 S8 ~. o - #include <mach/hardware.h>
% v- Q. J' ?, L, [* Q3 z - #include <mach/irqs.h>; P8 x) u2 N2 ^5 b
- #include <asm/hardware/edma.h>6 e: M7 o+ W6 P3 Z# o
8 ~6 K5 \) J$ b1 R8 q( F8 ]' q7 e& H" ?- #undef EDMA3_DEBUG
, Z j$ C4 G& d& p* Y' O+ N; R- j- l - /*#define EDMA3_DEBUG*/+ o- U p$ j/ v2 y7 `/ {$ P2 x
, y/ @2 P. l# H8 y8 s- #ifdef EDMA3_DEBUG
$ A9 E' F) m# R: s9 @ x* X6 E: S G - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
* m9 m- C7 F6 w0 `8 g1 \& {" S b - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% B! N5 [! W! w0 \3 w
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
, e0 s o' j& Z( c( l - #else
) Y2 W* U7 ^+ k8 r. E2 V - #define DMA_PRINTK( x... )
, K' s, C9 x7 f8 m, O" ]7 B) p - #define DMA_FN_IN
# y3 X+ V. u+ B - #define DMA_FN_OUT
; B" _: |' q2 a$ p9 Y - #endif) @( B% R& w# ~
) \' }# k$ A. d# v! w1 B- G& b- #define MAX_DMA_TRANSFER_IN_BYTES (32768)% R( B! G3 x0 h+ M
- #define STATIC_SHIFT 3% f- e: P( H2 @0 b% ^3 h
- #define TCINTEN_SHIFT 20
! Z( _# G1 n# {+ h" V5 v - #define ITCINTEN_SHIFT 21
4 _( S9 i' R4 B+ q! s - #define TCCHEN_SHIFT 22
: a3 U% C% N' k. \ p - #define ITCCHEN_SHIFT 238 y6 n* H1 D/ p* J" f; o, x
, `7 M5 {1 p# t- Q9 e- static volatile int irqraised1 = 0;' L8 k# `% [. x8 J' E c
- static volatile int irqraised2 = 0;4 _9 E: n# [; \
) Z2 d# G# @) i' d0 ?. }. x+ C- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& K8 Z1 i$ M- Z6 E. \1 m - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 L5 l: Q. |6 ~8 U7 F8 d+ r8 F
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 \) m, n H, }4 d7 u
7 @4 K6 @9 x$ {% E& A4 A3 S! P/ s, z7 {- dma_addr_t dmaphyssrc1 = 0;1 c Y3 n7 A- W: n
- dma_addr_t dmaphyssrc2 = 0;8 i9 x! ]* f, v5 J* |
- dma_addr_t dmaphysdest1 = 0;
8 E# G, b9 Z5 J, `+ S; |+ | - dma_addr_t dmaphysdest2 = 0;
9 s4 }- k9 r: z1 v5 T W8 N3 w3 ~
% |1 k& x1 k& @6 @- char *dmabufsrc1 = NULL;$ F) k( d4 H0 z5 I( f# _; O4 `
- char *dmabufsrc2 = NULL;. D+ W- S% |: v2 F' a! b
- char *dmabufdest1 = NULL;! X- L2 R# H/ S; T m& n& N
- char *dmabufdest2 = NULL;
+ I7 }. Y9 ?" ]( K2 U* c - 8 ]' X2 h$ g" W4 `' T
- static int acnt = 512;9 A# x5 e6 W: `0 e2 |" n) V
- static int bcnt = 8;
9 E& h' c8 a8 @9 W$ N6 o" v - static int ccnt = 8;
/ {0 N3 p- e2 J# g& ~5 ] - , {7 V2 x5 N. f0 E2 Q
- module_param(acnt, int, S_IRUGO);
" p8 V# y9 Z' P. j' F7 u" o - module_param(bcnt, int, S_IRUGO);3 q8 X- M' c$ @4 H# F' J
- module_param(ccnt, int, S_IRUGO);
复制代码 1 m v* r. b' o% n. _$ k2 |5 ~" E
# i' I; W& `9 ] v
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 c' O; x! u# `1 G/ parm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& \/ L' \* J# N$ `5 S+ c/ d% {
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& B) `* Z! c5 h) C6 x4 M2 R7 c
6 {* N+ g, z) H m9 \+ b' L# D' x1 N" r% z# W2 H) X
|
|