|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . j" W' J! {# o6 K" \6 [: S* n u
- [code]EDMA sample test application
8 j( y! {+ U4 O& f. ~ - /*
: H- J H3 q( D1 e( i - * edma_test.c
; Y6 ^5 r: @4 G: A, |: D; [ - *5 X: l8 y1 @5 m) b) _2 a
- * brief EDMA3 Test Application
7 o# E0 I5 B% f, s% ? - *
, X, J' t1 V2 C+ f, E - * This file contains EDMA3 Test code.
/ X" m% D" L/ S2 u3 X* H0 U) x" ~ - *
6 A' T5 e5 r, g. _ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% @! l9 } L, [# v# |" ?" |
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' p% h7 O( [; j( m
- * TO CHANGE.
4 ]% C- G0 ~6 o - *2 w& ]% i2 m: g
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 i% E5 [% I# j8 ]6 U* R: I; X+ k
- *
: u6 s2 k# a4 V5 ~4 P O3 s - * This program is free software; you can redistribute it and/or( F6 E& r! m7 W% k1 \6 t2 {* p
- * modify it under the terms of the GNU General Public License as
6 ~$ r; ~! B: Z9 Q8 ^ - * published by the Free Software Foundation version 2.3 n8 W' E+ w5 L2 C$ J; \ N% H
- *5 Y6 E F% v5 P( N: C7 H* N
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
4 ~' B$ u- F1 T& x - * kind, whether express or implied; without even the implied warranty `7 a. m, S: r9 u. o. s% K# B
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the: O" F, C+ q P$ x/ i/ |6 i
- * GNU General Public License for more details.8 [" x* z4 i% `' T( j2 C- I
- */% h4 _1 a& O( ~5 A, H
- V. J$ s3 e5 o5 j$ Y- #include <linux/module.h>9 o, q1 U3 l+ W9 E4 U' ]: P8 y3 T
- #include <linux/init.h>% B' L% B3 u5 \5 V2 C' D
- #include <linux/errno.h> ^+ E. \1 ~7 ~2 J& l
- #include <linux/types.h>
7 a3 h2 V! Q/ S0 g4 |3 E: H - #include <linux/interrupt.h>
6 ^( J9 J* P3 n - #include <asm/io.h>
" x. C8 n5 x- N( n - #include <linux/moduleparam.h>* G+ J/ o' o5 }' T
- #include <linux/sysctl.h>
]" A+ X& Z% l* b4 n+ G - #include <linux/mm.h>
" y$ L& m$ c$ d5 \; a8 b - #include <linux/dma-mapping.h>
Y0 S7 @, Z+ c+ h; G B/ F$ C: _ - " R& U# G. U; t' ]# j$ n
- #include <mach/memory.h>
( @1 d* ^) M" L; z& h; n8 O - #include <mach/hardware.h>
( B! b6 Z# E4 u - #include <mach/irqs.h>
% k$ O! T" @2 G0 X& Z - #include <asm/hardware/edma.h>! ~ J( z k* f, L$ f, w q
7 e2 `! C1 E/ o. v- #undef EDMA3_DEBUG
, G6 K" l- g2 P2 n2 L$ v; ] - /*#define EDMA3_DEBUG*/- }: z1 N: ^$ v
# V( a9 i9 L& W- #ifdef EDMA3_DEBUG
$ l) b0 e4 ]4 [ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
2 e( y9 R9 s0 {! K7 A4 r4 e - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
; ?4 |$ S3 d( F9 m - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 b# P6 W4 C. i" _
- #else
3 Z- z. T9 T' W( t1 G# D4 l - #define DMA_PRINTK( x... )
# m5 T, M0 k3 M$ L7 Y: Y - #define DMA_FN_IN1 g: E9 s( w" N; |( R5 n" ]. W
- #define DMA_FN_OUT& T+ H* }2 p- {. a9 [1 l0 \. D. v
- #endif
! y% Q# s. V! u; u5 \4 b
* S7 D v4 r& Q! Y- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
" w s0 `0 Q, r( J* [: T& _# n- ~ - #define STATIC_SHIFT 30 J. H0 k6 X. x T$ U0 C
- #define TCINTEN_SHIFT 204 H) V3 P' N7 P
- #define ITCINTEN_SHIFT 21
0 l- y" N: y) G: N* K/ O' ] - #define TCCHEN_SHIFT 22
! ~/ w! G% l' L& `7 q - #define ITCCHEN_SHIFT 23$ R% N/ g- y$ E
; H5 _- ?3 I8 @6 `( O- static volatile int irqraised1 = 0;
* ?; B. M* W5 v - static volatile int irqraised2 = 0;6 a+ d- O( a! O2 A& R' r
- 7 _6 T G5 K8 r
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' R- ?" l: \9 y5 [; o4 K& _ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ n7 [9 ?" ]" S: O# g0 ]" k - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ Y9 ~. U* {- ]' ]' O
9 d! k' Y& t' M8 l' B- dma_addr_t dmaphyssrc1 = 0;1 q1 M/ O, D, |
- dma_addr_t dmaphyssrc2 = 0;6 V- n) D* M+ r; N1 t5 k5 @
- dma_addr_t dmaphysdest1 = 0;
8 b0 a7 ^7 f+ _2 u5 l0 H Q$ S( p5 E - dma_addr_t dmaphysdest2 = 0;$ d- A' t) C0 W6 a; b
' `2 p# Q6 t8 e' D# J9 @- char *dmabufsrc1 = NULL;% [, U7 B3 E* Y& F8 M% j
- char *dmabufsrc2 = NULL;
& Q M4 T, Q* k E' G) _; W+ j8 A - char *dmabufdest1 = NULL;! w! F. t. L2 P; r7 j9 a
- char *dmabufdest2 = NULL;
# ?9 h4 C$ q4 a
8 j, ` {2 Q3 l* ?$ w% i- static int acnt = 512;+ _4 _, y. D, Y( z- `* Z+ H+ |
- static int bcnt = 8;
! m1 ?) d3 K% v0 j. k+ B& r& o - static int ccnt = 8;
. Z( [7 ], M/ K2 | - : [* m$ x( k8 w5 [
- module_param(acnt, int, S_IRUGO);
3 ?% N$ x* a8 G7 u. p6 Z" |. Y - module_param(bcnt, int, S_IRUGO);
1 U S; p$ Y2 e7 k - module_param(ccnt, int, S_IRUGO);
复制代码 . u& Y/ S9 n, x! k( N) m" X
1 ^# }% z. U. } x 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, i. l' q& s; ^ R/ L$ d% s7 l1 V
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- S; U6 ^+ ~) |2 M8 i
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ Q Z1 `6 J' i v: e: w7 r6 H
& C5 ~, D' |/ |* i+ H3 Z
" x5 H/ ?+ i; V0 }) X |
|