|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 o; N5 N; p B0 M. k- ^- [code]EDMA sample test application
1 @2 L8 E6 `6 j - /** X! e/ V ?! Y7 d3 [
- * edma_test.c
' ]/ j" X5 _/ y0 @. ]! N% W - *
2 S' S& B) C1 S. p - * brief EDMA3 Test Application3 G/ s3 ~/ C; H: `
- *; q0 _1 H8 A0 E: Q8 G' g1 c0 W
- * This file contains EDMA3 Test code.0 Y' M9 s/ J8 u+ V; g* c& N* `! P
- *
* r) L4 J2 s9 g+ H4 d( s - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
# f0 @7 ^, H4 p% M. O - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, A2 O! H0 I* T
- * TO CHANGE.3 }7 B4 i7 }$ ^* [1 _2 z% i8 o
- *) q2 t2 X5 |1 X) W
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
3 g' T+ P5 V; T3 {/ D/ i4 m - *
& N! H1 `( B3 F) f( j - * This program is free software; you can redistribute it and/or! x4 K C* ]9 z* F- a' U
- * modify it under the terms of the GNU General Public License as$ V x8 C4 v& c1 ~! V0 W- }
- * published by the Free Software Foundation version 2.
6 ?' v; l' ]% a - *
5 _2 J# O$ k( f - * This program is distributed "as is" WITHOUT ANY WARRANTY of any. s e; B! y! s: t) j8 R/ S7 [ h
- * kind, whether express or implied; without even the implied warranty+ q3 V7 {9 l$ Z2 d5 t; ^# f
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% _* U% W' n+ P1 N, D( t8 D - * GNU General Public License for more details.8 Y; ]5 {) z/ X4 {0 k/ r) @+ ]8 {! d
- */
; m1 f! b D* B3 H/ j
8 ?3 N! _8 L4 ~2 ?2 q Y# @% `' C- #include <linux/module.h>
1 U. v# e1 N8 u# I4 P* J$ R - #include <linux/init.h>! [7 W/ }. p/ o+ }& d7 e
- #include <linux/errno.h>1 |/ y9 s1 e( C" n9 M ]$ g
- #include <linux/types.h>) ?+ N+ i7 a2 |& b. k+ b
- #include <linux/interrupt.h>
$ l. n' Y2 n6 P8 R; C, k; W - #include <asm/io.h>
: w( _, L* P: ~: z' J0 F; n. p - #include <linux/moduleparam.h>
% N' C8 A" H9 u8 `) B - #include <linux/sysctl.h>' v: y' X/ P. [/ U' R
- #include <linux/mm.h>
) q$ C( z) a" q8 s Y. L9 U - #include <linux/dma-mapping.h>
- Z, h+ `, ]. V; e6 T+ d0 Y - 3 z; ~1 I/ S5 @! q& P; s% t2 f6 U' ~
- #include <mach/memory.h>
+ m" \2 i5 t* g& X' s2 ` - #include <mach/hardware.h>( K: T6 n5 }, B
- #include <mach/irqs.h>
& k! u( ^1 R/ ^ F* i T$ t# \. O0 ^! q# Y - #include <asm/hardware/edma.h>
' N( B' L2 g- v, k - & S- D7 ~6 r/ b: @2 ?
- #undef EDMA3_DEBUG! D1 F% {- v, a( s ^- \
- /*#define EDMA3_DEBUG*/: |* P9 \, \, t4 q) e3 n
- ) |4 G" W- X: r) @
- #ifdef EDMA3_DEBUG
+ I) L7 o$ S: m3 a3 S7 t - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 I/ q# Z8 {& Q
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
3 X5 V, c9 v( l4 N/ q - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
% J9 f9 x5 E( q- g# |) J - #else
! k7 p% l; n0 x% B, l - #define DMA_PRINTK( x... )- D% l4 q2 ^! I7 i; F
- #define DMA_FN_IN3 K6 a& X4 o2 c! P, c
- #define DMA_FN_OUT
6 A( h" V1 U; X( \& Z2 z2 R% O - #endif
$ a5 q" {; a0 R+ o! S! Z - : p( b1 t, _6 `9 r" [+ z3 W3 w
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)2 [1 o* d1 ]8 x G
- #define STATIC_SHIFT 3
- D# K6 {5 l8 o- g/ ?( ^ - #define TCINTEN_SHIFT 20
: X+ j* g& C2 ?) X/ | - #define ITCINTEN_SHIFT 21
3 P* w3 @& t' @! V( ~ - #define TCCHEN_SHIFT 226 w9 _: ^, ^0 Z- H [# h
- #define ITCCHEN_SHIFT 23 m O A5 e* [
) Z+ M$ `- q2 R: V! Z2 r- static volatile int irqraised1 = 0;
7 r+ R$ L" ~9 K8 i8 `) ` - static volatile int irqraised2 = 0;8 l$ \# G7 N' G' t. R
7 D2 n' q+ g* D1 J" m1 l0 W1 r- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 B9 @' w B+ {$ j! a: j
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 g6 e8 q9 x* x2 A2 c
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ i ~ R6 ?" R* k/ F0 l; P. s J' u
% |$ n9 q9 Y* A4 Z! U" D z- dma_addr_t dmaphyssrc1 = 0;" U. q, P5 Q' {0 v7 v) @( k' h
- dma_addr_t dmaphyssrc2 = 0;
/ x \! Z9 W2 e( D5 k - dma_addr_t dmaphysdest1 = 0;( c. ?% y! U+ w% N
- dma_addr_t dmaphysdest2 = 0;
* g9 Q$ H% b. a
) H! E E+ B0 ]" b8 x9 ?1 F) N: s0 l- char *dmabufsrc1 = NULL;
# Q" ~4 G0 `% L4 i7 f: Z8 J, s# `6 [ - char *dmabufsrc2 = NULL;' v0 o; W1 V7 v% R9 Z4 ?3 {
- char *dmabufdest1 = NULL;( }4 l1 Q7 F0 O; V8 q
- char *dmabufdest2 = NULL;4 P, V& I- s7 c# y
' \) y0 A% N5 S6 o7 e- static int acnt = 512;
! M- U2 D1 O3 b" Y: I - static int bcnt = 8;5 ]* y& l6 v" {. L( b
- static int ccnt = 8;
3 }$ G& t) o6 i! v" { - ; i) D S. x( h/ J9 A
- module_param(acnt, int, S_IRUGO);
" K; D( y( D* y/ P. h - module_param(bcnt, int, S_IRUGO);
) W N! [8 n _3 i& h+ _ - module_param(ccnt, int, S_IRUGO);
复制代码 7 q7 D0 j# O2 E/ n, b; ~2 C
: b3 k$ Z) E9 \, U- p
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ S2 v& E! m: y* ^9 |
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ p2 L2 k4 U2 D9 F
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 O9 n' w! X) ]) ~3 b
1 X G4 A! G% l' y% Z* z: A$ ~. n5 Y5 P& P) ]& B8 P+ d
|
|