|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ m- J: ]3 U8 C- [code]EDMA sample test application
% N) |/ {: b, T% f0 p9 b - /*
! `- I3 `/ H T% Z - * edma_test.c
; p, o& l) N. M+ a3 K - *
7 v( J& r4 M! T2 \6 r9 `6 M - * brief EDMA3 Test Application8 E9 r. ~6 Q5 X2 }& S! ^/ A' @
- *' r& N8 u+ w* K0 G6 L
- * This file contains EDMA3 Test code.7 \; S+ h8 _+ z. V8 c
- *9 ~; Q% E" |4 x. i. L
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
' l, z5 l% [1 b - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
+ W+ [: z: K, V4 n - * TO CHANGE.
* C. g: @* X, Z- l - *9 j4 g: {( I7 z$ ^. D& b2 `1 I
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* s0 t! ?" K5 O' p9 {
- *
9 o2 q$ U s4 @! g3 n ]5 `# C - * This program is free software; you can redistribute it and/or5 D R! a5 S4 R3 b
- * modify it under the terms of the GNU General Public License as
( U/ N$ L7 j, ?, s - * published by the Free Software Foundation version 2.4 E j5 `0 u% i8 w5 j
- *
a: x" ^4 ] O5 @9 v& ?) i - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
7 I& u; F& T3 W# j - * kind, whether express or implied; without even the implied warranty
7 j0 s0 ~1 ^3 a7 j2 `8 }" Q - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ u7 s& k! W. G5 h - * GNU General Public License for more details.
* B+ X* T r! s- v8 E9 P6 x - */9 q) s$ G C% j) }
- ; ~- m7 ?; {7 G7 X+ m
- #include <linux/module.h>0 r0 c$ G1 v0 a. a3 S
- #include <linux/init.h>* }* ~5 i. u( g7 ? J6 w
- #include <linux/errno.h>
/ P: \6 R5 l& [ - #include <linux/types.h>
; K- S7 J3 M4 D0 J- P: g. \ - #include <linux/interrupt.h>
0 I* K' s# a9 k0 ^( Z6 @2 H: a - #include <asm/io.h>
% @6 |6 _ m7 R0 a; I* P - #include <linux/moduleparam.h>
3 g; e. d, D) d - #include <linux/sysctl.h>
5 M9 g2 [5 s F! b - #include <linux/mm.h>, S' Y! Y1 Y2 j0 I% x1 M$ P T$ O
- #include <linux/dma-mapping.h>
, O- f g1 y( n
( Y5 p/ l& ~* {4 B/ _- #include <mach/memory.h>
5 x/ L, V5 k, \ - #include <mach/hardware.h>; B, C Z9 j- E; c2 E# o+ A
- #include <mach/irqs.h>
) B, n' R2 |0 ]+ [0 \% _. O2 X - #include <asm/hardware/edma.h>% i( B/ @$ J- F* |2 H' {/ Z+ h! B
' ]: u& ?/ k5 x7 k3 N0 k- #undef EDMA3_DEBUG
1 l% P# o, ~8 C% a+ | - /*#define EDMA3_DEBUG*/2 b1 ?% i. X. a/ |0 R
+ X! a- L; Y. v& ~- #ifdef EDMA3_DEBUG
4 Y7 }& }* s' G1 t, g6 X& | - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
/ Z5 r4 u5 Y7 F9 H( U* Y - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
0 o* r: ^0 Q- `1 Q# s$ W - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 Q4 d: n- r" K$ y d4 M
- #else4 v6 [! v" q: `; s# ]
- #define DMA_PRINTK( x... ): l7 Z$ g) e& U$ x
- #define DMA_FN_IN2 O. i c1 v! u/ N$ E
- #define DMA_FN_OUT
( O* v- w, ]0 ?7 `3 H3 c# }6 X - #endif, f% x$ I% s: l2 S
- / R8 h2 _+ N: ^( q
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)' `9 K! T; `: n" L) z$ _
- #define STATIC_SHIFT 30 X) A/ ^) P9 k4 r+ M2 `, B
- #define TCINTEN_SHIFT 20/ p9 p$ X7 G! i: b
- #define ITCINTEN_SHIFT 21
* a! l. L, ^4 I, x - #define TCCHEN_SHIFT 22
7 w2 Z& u5 U0 j! j) G - #define ITCCHEN_SHIFT 23' |: y; C3 |4 k- |% Y2 \1 a
- + Q: N8 ?5 u- Z, N& q
- static volatile int irqraised1 = 0;
U2 u. y) B. v F5 G+ v - static volatile int irqraised2 = 0;
; S8 C! O$ H1 r* r8 o c
; ^! D8 r0 X' E; G+ c: H, o- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 P8 ?( k. R5 n
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 f5 s0 n* j' S) G6 M - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 m# z/ X' x% h* ?
/ C" S+ |9 i# `2 g* R ^- dma_addr_t dmaphyssrc1 = 0;1 \0 Q! f' q2 [+ D1 x: M
- dma_addr_t dmaphyssrc2 = 0;
& K+ Y$ X* ]) J( @4 u0 [ - dma_addr_t dmaphysdest1 = 0;
: T/ s7 r. }8 T1 |- u) B - dma_addr_t dmaphysdest2 = 0;/ Q0 N% W- \' k+ y- g. F/ v$ i# T0 }
- : t$ Y& @( f. n: L/ v8 z
- char *dmabufsrc1 = NULL;
" V" K4 e4 |+ A" H9 H" w6 {/ K - char *dmabufsrc2 = NULL;
5 I8 X- z+ f$ s: v/ }% u/ w2 d! [ - char *dmabufdest1 = NULL;
: {$ M& L1 i0 p Q9 F$ j9 A5 O - char *dmabufdest2 = NULL;
5 U* a6 B5 I- B; [! G7 g6 ]
" Y! a% M# Y- o1 q1 G# T" B" m+ A- static int acnt = 512;" J2 n$ F' s, k) L
- static int bcnt = 8;& v* _! a0 ~2 V- [( _ z
- static int ccnt = 8;$ a' p; v. ?3 J, ~+ {5 b8 o
- 6 a$ a$ \. S+ P: {+ c+ r
- module_param(acnt, int, S_IRUGO);: ~1 {. b. A3 z2 I$ a$ b
- module_param(bcnt, int, S_IRUGO);- S4 X) c$ M2 I9 m4 U
- module_param(ccnt, int, S_IRUGO);
复制代码
+ v3 P2 j# w0 }0 ?! p# o6 j ?; b" v6 Y3 C+ @. C( f" P {
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' }7 H3 p% X$ l5 D3 f1 F: C/ X. narm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% W, x: x7 F0 r, I* K 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' J9 G% M7 u9 `, x( ?# ^
9 c9 P4 ]& H3 Z+ r" w, a, ?. U- Q2 A5 Y$ Z% ]
|
|