|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 ~ x& r3 ^1 K5 R. I8 d' g) T
- [code]EDMA sample test application
2 u/ c7 g% N( `2 k4 c3 i8 O( b' P - /*
2 U) p1 j- S& u) z% H - * edma_test.c
+ |+ J- [$ i8 J9 o2 o - *, Q) Y1 b* o, ]* g( l# T9 E5 N
- * brief EDMA3 Test Application
: D+ q; B$ ~% D2 X - *# Q% q9 s% X' G
- * This file contains EDMA3 Test code. i" }+ U5 [1 y- k7 ]& \# ~5 o
- *
, I+ ]8 n* @$ g( F4 E. N - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
+ N2 p/ x( E l8 N$ f F, T - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
) V* p3 _6 t" [# y# z - * TO CHANGE.
/ d. b) q+ r( d/ o+ M0 K2 n - *, R/ V, ~6 A, e% s+ x/ K, o
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
3 {% N* D/ Y4 y0 {8 C9 @( Y/ t8 X - *3 v( ^) l: m6 G/ |* ^
- * This program is free software; you can redistribute it and/or
# x( J7 v5 s W/ \" \- W7 ^7 k - * modify it under the terms of the GNU General Public License as3 m6 j' m$ v1 [8 T
- * published by the Free Software Foundation version 2.
! s4 U# y* m# D1 i6 U- H$ Q - *
/ ]$ Q1 U& w3 J, l - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
5 t" t$ h/ r3 O4 V& R - * kind, whether express or implied; without even the implied warranty0 V8 I1 D. ~# G: {0 D, N( S5 ~5 @
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# S% O% p) O4 [- t- C$ o - * GNU General Public License for more details.
' C3 D' L, ^4 V7 x - */
8 y5 t! H- d7 p6 q0 R/ K - 1 F# o; Z4 R6 e( y4 X
- #include <linux/module.h>
) `, [" M( i5 z$ P6 \ - #include <linux/init.h>: F6 u7 `; [( R: u( P3 }0 e, {
- #include <linux/errno.h>
/ b& f9 C+ e3 s1 u, ]- ~ - #include <linux/types.h>6 f6 _7 Y! c' u/ ?1 {
- #include <linux/interrupt.h>2 m( K/ K) |' _
- #include <asm/io.h>
+ e- _- y9 }! E4 p - #include <linux/moduleparam.h>
5 O& t8 P% h; m- R H - #include <linux/sysctl.h>
3 Z5 M5 c: C+ D+ C3 r' d# Y% R. ^ - #include <linux/mm.h>
* x/ E# l. S& r% J6 ^9 i% H, L8 { - #include <linux/dma-mapping.h>
! u& X h5 i7 l! ` - : v; | O# O* _; m
- #include <mach/memory.h>
8 g# D. n, w5 l7 [: \; a* \ - #include <mach/hardware.h>( G1 {- A \# Z9 ?
- #include <mach/irqs.h> T5 E% G: {% ^; }8 ?% @
- #include <asm/hardware/edma.h>+ q8 C( L$ c8 x7 m
- ' B/ d& R" J6 W
- #undef EDMA3_DEBUG
& z, _( w' c- `1 c+ k - /*#define EDMA3_DEBUG*/& I4 j% I4 K8 \$ X0 u* W q; M
% K. I7 D3 A; b- #ifdef EDMA3_DEBUG
! ?1 L7 i! S) _( g% K - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 U- n& C2 v' Y( a! n/ e* F. n: x
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__) o0 U7 V# G: p1 B& F# |% V
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
! ]3 B( g5 i$ J" R- D - #else3 B1 s2 i7 G+ W* N' [/ ~
- #define DMA_PRINTK( x... )
$ f5 |$ e3 Q/ Y2 K Q1 v5 Y% m - #define DMA_FN_IN1 |( m, F+ i2 L. u) p
- #define DMA_FN_OUT
: i; k& }% g# X" n) {$ ] - #endif e9 z. R& b" ^4 k# i
- ) e# X# l" D2 w: l7 `" c% L
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)8 }# ~! M( v5 N
- #define STATIC_SHIFT 3
& `9 Z, D4 l: v4 @0 o, \, T2 U3 Z - #define TCINTEN_SHIFT 201 D' x/ I2 [; q5 q
- #define ITCINTEN_SHIFT 216 w' f. `" p1 i) E$ H; X
- #define TCCHEN_SHIFT 22
% C: X- K y) [) k - #define ITCCHEN_SHIFT 23+ L0 U7 S& m3 D1 K1 X; H& _! e/ N7 B
- 4 x$ z: H( U$ {! H% G6 Q
- static volatile int irqraised1 = 0;0 [& p: `4 j" p; {1 G6 d' w. I
- static volatile int irqraised2 = 0;
* ?% l5 z7 Q6 S. i$ D" [3 b
0 \. J/ F( C+ h W- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& G6 W$ _4 O- x: i7 G
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ }- k3 `! G8 B0 U# S( c+ u0 a, u1 I - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# [) c$ X( `: Q& {% _
4 O+ _" q1 U" Y$ v6 [- dma_addr_t dmaphyssrc1 = 0;
4 t! b* o$ `: B- ~/ e - dma_addr_t dmaphyssrc2 = 0;
7 s d; j5 h3 D0 O' Q0 S - dma_addr_t dmaphysdest1 = 0;
1 W; F% `0 o' L' I; F - dma_addr_t dmaphysdest2 = 0;
+ d; |, a$ g1 H - & z( V( |+ S* z) H3 I5 _, s
- char *dmabufsrc1 = NULL;1 T1 x& B7 Y: Y# }9 X+ O- F
- char *dmabufsrc2 = NULL;. t1 y9 z+ `" Y! a
- char *dmabufdest1 = NULL;
2 w6 m( f4 C" [9 @; K |7 L' G1 i6 E - char *dmabufdest2 = NULL;' A( p, G6 s& v- P
7 d i; t4 B- T/ Z+ Z% g- static int acnt = 512;; K( [$ P/ k6 i# n q( z- N0 _1 K
- static int bcnt = 8;
3 [) d' J: E' X3 V - static int ccnt = 8;
5 l6 O* |# A2 F4 j' T* E% ~
5 p$ i' R0 H) P- l- c- module_param(acnt, int, S_IRUGO);- L, O/ x7 B _9 ^! N% e5 u
- module_param(bcnt, int, S_IRUGO);% @- \- [8 m% A; S/ x# I
- module_param(ccnt, int, S_IRUGO);
复制代码
4 o* r. B; o+ t: Z
0 Y& ^4 H- C+ e D- o1 C2 c- |% ^/ f. o 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* S: m. r2 n- R0 R
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 }" l, z1 u% H" j; {) ^ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) |0 x1 M0 V5 @& w& ~& G$ _5 r. B3 F
; i, V# r* C( H8 @. I5 s# ` |
|