|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, j2 L( o$ |0 C- [code]EDMA sample test application
6 J. ]' u9 O6 t: F8 ]. j) l - /*( K3 H, Q% i# P% N# w; h
- * edma_test.c
; u) o: O* q; c3 ^, H) n - *$ r. N( G4 t+ E( ?3 b2 L
- * brief EDMA3 Test Application7 ?/ _( L* r! K1 Q( h
- ** r; E6 l7 _! H* T1 x7 H% A
- * This file contains EDMA3 Test code.4 w% U; k5 x" Z' {6 X9 o! f
- *4 m1 ?: g% e2 e
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ i0 w. u; S3 S% w1 p+ o( x) C
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
1 c2 a% @. l0 q: x - * TO CHANGE.+ y4 @! b( i# B- Z7 @
- *
% ^, i( V1 M0 M0 G - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
' K9 P3 N! a3 {9 c: r$ a - *
1 b9 q, B2 X( M/ V - * This program is free software; you can redistribute it and/or
0 U& N; \3 b' Q0 n& Z% Y1 `& E - * modify it under the terms of the GNU General Public License as
. o& |% m/ ^$ K4 K! T4 u - * published by the Free Software Foundation version 2.
/ N# T; e; X$ @4 d# `- U7 M - *$ m' I/ L1 S5 h1 p
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ A4 l5 M( H' W- o6 u4 t( F# c
- * kind, whether express or implied; without even the implied warranty7 y o# S* W8 R g" {1 c3 Z
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the5 v* |2 ^& p+ k7 G
- * GNU General Public License for more details.
. c0 w+ e% `$ D2 A9 E$ ? - */
( q# m7 O" ~, R4 L5 m) A; F
: k5 i- @' i4 z5 \- x5 s5 L- #include <linux/module.h>7 I. W0 H9 r% H3 ]. V6 K0 G
- #include <linux/init.h>
+ Q) S! t4 m8 e$ r8 i/ L - #include <linux/errno.h>4 K! \, z7 {! n, C
- #include <linux/types.h>
; r {0 n+ L: A. O - #include <linux/interrupt.h>
' y% c, `& r0 q9 B8 x - #include <asm/io.h>
6 n! w3 R3 F5 H$ o# O& d/ K* p9 q8 ^ - #include <linux/moduleparam.h>
9 E% t' A. ]; l0 P+ Z4 v - #include <linux/sysctl.h>
& x5 `& I( K( D- q* d - #include <linux/mm.h>
2 e7 n0 N3 {5 X* @2 C, i0 X1 s; S+ a - #include <linux/dma-mapping.h>
" a2 M5 d- I( n7 k: @0 u" t5 c2 O' Q - " \# ]9 m1 Z. L8 W, o
- #include <mach/memory.h>. a! ^% [- k1 }4 G+ V
- #include <mach/hardware.h>
: M* J3 r8 _! }+ g7 y/ ] - #include <mach/irqs.h>! {! w- s+ o% V; f8 ^. h
- #include <asm/hardware/edma.h>2 ]$ ?0 t- l! m- D9 o# y3 w8 D6 b
- + Q0 o' R Q3 s% v' f
- #undef EDMA3_DEBUG
% B, ]- y" L" V - /*#define EDMA3_DEBUG*/
9 y/ c8 g& V) @8 g7 M2 Z9 H - , O! Z# F" u. Q
- #ifdef EDMA3_DEBUG" ~0 |% e9 b7 h2 w K! P4 d$ \
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
+ q& G) c8 s: c) O - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ i: E+ K: i0 u- |
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
: V1 u: d0 n6 L' F - #else
4 r' L1 i7 G1 H% L& g+ e' o$ _ - #define DMA_PRINTK( x... )3 [) t; F1 a& z6 j# [; b$ v
- #define DMA_FN_IN
6 g! A+ T3 I. z% F' y7 w" v - #define DMA_FN_OUT# Q7 N$ R# S! u7 @8 d& n
- #endif. S K. _$ }8 P$ ]+ _+ F* t) a
- & p l' L0 O; f
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
1 A' _9 [% k! Y - #define STATIC_SHIFT 3
5 i z, L4 C* e2 U5 A; {7 c5 ^ - #define TCINTEN_SHIFT 201 i9 r% c. `; T0 }) p6 |
- #define ITCINTEN_SHIFT 21
2 `# J# K+ y: H; W8 g - #define TCCHEN_SHIFT 22
. c& x$ y4 D! s8 A. D A - #define ITCCHEN_SHIFT 23' w; H$ H4 |# t
- 7 I) }' z- O! Z& D
- static volatile int irqraised1 = 0;4 a6 G- ^- K1 f/ L+ U/ k
- static volatile int irqraised2 = 0;
3 D* m/ c: i9 r9 A9 X - - A4 A7 U2 e+ L2 z' g/ B& J6 V5 F( ~
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
L) Q& ^# _& U, u" j8 D5 S P - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' M# }- H( G7 ?7 x1 U. ? - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! D; L" }/ ]7 L/ V }: V& @0 I/ r
- ( P8 d Z% I* N9 {% v- ^1 _) z& f
- dma_addr_t dmaphyssrc1 = 0;
$ c* A' _0 Z- }, Q2 Q2 K2 Z; h - dma_addr_t dmaphyssrc2 = 0;
" F( V; ^" N3 s1 e9 S; D - dma_addr_t dmaphysdest1 = 0;, B" M3 s% f3 E4 V- t& x
- dma_addr_t dmaphysdest2 = 0;- k5 `9 x; q; M D- t& M. u
- / F& }6 v! L/ m6 b/ L& @
- char *dmabufsrc1 = NULL;* }5 n. t9 J- E; R0 E, X( Y
- char *dmabufsrc2 = NULL;+ V1 ?% W/ [) i
- char *dmabufdest1 = NULL;
' ~& Y# t( Q( ~6 s9 a' _& k - char *dmabufdest2 = NULL;
) E2 Q' S' g6 t, E
& H6 J( ?5 w- O: n- static int acnt = 512;5 {- N+ c7 S/ p
- static int bcnt = 8;
# S8 Y" N a/ u9 l - static int ccnt = 8;
1 r w/ F1 y5 g% e+ z$ @/ |+ x - / c3 r7 Z/ r' d: T5 _" e( Z+ j" Z/ {
- module_param(acnt, int, S_IRUGO);
9 ~! z# \5 h3 z/ _3 Z - module_param(bcnt, int, S_IRUGO);6 }3 B2 j1 S, \# s: l6 P/ v/ |
- module_param(ccnt, int, S_IRUGO);
复制代码 " v% B. n. K7 Z- {6 m
5 m \+ `9 r0 j 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 I$ R3 ^6 v/ P0 s" 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# x/ f7 Y9 T) I: X( e* F+ M 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 A7 q# q8 A; v3 B7 }3 ~; T/ c5 }3 ]- e* A4 _. F3 `; h
7 a: U$ q/ e8 \, a5 x! s
|
|