|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 X0 \$ `9 r0 O- [code]EDMA sample test application
" s) L% s& o4 D T+ h. b) ~6 Z' n+ ] - /*# h( J3 t; M1 Q# y$ x+ `
- * edma_test.c
0 M: W% ]9 |. s# q- f6 N2 v& l) t - *
+ u, y' i5 B$ b; f - * brief EDMA3 Test Application
5 R# D! H& ^3 } - *0 y6 s+ }: Y: L6 D' O ^% y% D
- * This file contains EDMA3 Test code.
4 n3 R2 Y3 u/ K# F) n - *. t9 C/ u3 f, ]) K' R
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
0 _/ ^# ]: l4 c6 h; X6 I9 _! R8 n! k - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
* B( g9 n, _+ X$ o - * TO CHANGE.
m0 X! D% n. i5 e - *5 V9 K {1 q% ^7 L; ~
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
+ ]( W$ p' c& \2 r: j - *
% h! q& C5 [4 \% L - * This program is free software; you can redistribute it and/or
% a) R" H# g5 {9 e) B* h! ]) } - * modify it under the terms of the GNU General Public License as
- }" V7 A7 e. N$ m: } - * published by the Free Software Foundation version 2.7 O/ C B8 {' P
- *$ g1 J ], z) J6 w
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 |- g& `* O! G' ^ \- B& K" Z
- * kind, whether express or implied; without even the implied warranty
7 H, P; k# [7 E# ` - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! y7 {: i7 ]! L5 M: w - * GNU General Public License for more details.! m: x3 V9 k+ S
- */* x* p! D! F. s4 J- U5 L7 m/ a; b+ j: ]
0 U# e$ n/ y7 Z4 F) x2 x) F- #include <linux/module.h>
( p* \; ?3 J5 \. F( P - #include <linux/init.h>3 D' T/ J: x! R4 Z c
- #include <linux/errno.h>9 c& s# M0 B6 f, f7 L8 c6 D* G
- #include <linux/types.h>
# j; z" @, o% o4 F! W - #include <linux/interrupt.h>( m, s- ^7 z0 i0 V' g+ g/ A- U
- #include <asm/io.h>
4 C& d1 \/ [9 r7 ? - #include <linux/moduleparam.h>
, C8 J/ a& I: l) Z - #include <linux/sysctl.h>
: d; B4 t* q: Q; d* ? - #include <linux/mm.h>: ~2 J" v! p" E( n' f# j2 r9 A7 ~
- #include <linux/dma-mapping.h>
! L' d8 V' o9 X: ]9 y - $ Y7 f; T6 `% L; _* c
- #include <mach/memory.h>
, `' w: u. c4 i" O S - #include <mach/hardware.h>
1 n1 o/ z( w/ _1 S6 g+ v1 t - #include <mach/irqs.h> H! O. [0 G7 X2 z8 \; i
- #include <asm/hardware/edma.h>
, W; f2 K8 l# } - 7 F# f q/ Y. M P$ N$ c
- #undef EDMA3_DEBUG& Y& Z; Y' k; f1 L, Z5 k1 W K
- /*#define EDMA3_DEBUG*/
/ V1 D! ]4 |# C: Q
% E# c L& e3 S- #ifdef EDMA3_DEBUG
! D5 H! M3 d. f" V, R' w - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
$ r: q# g' l6 Z/ `6 A' Y7 i - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 j8 v' i3 l& V2 o# w0 g4 R8 j+ i
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
* U' g. ~( l, x/ E! U' n - #else
+ F3 ~) b1 E6 I! v/ v$ g8 ^ - #define DMA_PRINTK( x... )( T# b& O$ L$ L0 o" H* i
- #define DMA_FN_IN
: C; P' t4 v5 T H$ ~2 _ - #define DMA_FN_OUT* n$ s5 w; P; g- L
- #endif9 q* ]6 |% s4 W0 I Z0 `
' Z' {" ]4 s3 \& N- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
) i0 r7 Q+ J8 d1 L1 Y - #define STATIC_SHIFT 3
3 ` U+ u, I0 h: f, j6 W5 q - #define TCINTEN_SHIFT 20, \. k+ q1 g2 ]2 N; B
- #define ITCINTEN_SHIFT 21
3 m g0 ]$ ` A6 M$ h$ S - #define TCCHEN_SHIFT 22
* Y g) A5 g+ r0 p8 l - #define ITCCHEN_SHIFT 23
( P! t/ J; [& \( U" B- Z" T
9 K6 ~7 S2 U8 M- static volatile int irqraised1 = 0;
# s$ _) P" F6 i+ m - static volatile int irqraised2 = 0;
6 x* b% g, |% s7 T - 7 ^$ u$ e: N! {* o
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 c( y" f9 V6 }) z2 z" `& v) n
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" m5 `+ l4 a, _" N. `6 j ?; X. b
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) }# \, |( v' f/ X9 Q
- % X% t6 V0 }$ r6 B" Y- H4 z
- dma_addr_t dmaphyssrc1 = 0;
5 r3 F. h) ]2 x7 z+ _ - dma_addr_t dmaphyssrc2 = 0;
; _2 a* I+ ]4 U! l7 b - dma_addr_t dmaphysdest1 = 0;! J8 M8 w5 s. x. F# e
- dma_addr_t dmaphysdest2 = 0;
' A! B* O) G! m' a8 U7 A8 d
" ^4 h0 [/ _( n- Q* @3 Z- char *dmabufsrc1 = NULL;
1 T; e* e8 e: M7 q6 { - char *dmabufsrc2 = NULL;8 L8 O. }0 R. u) ^4 o2 {
- char *dmabufdest1 = NULL;+ l: `& {& E( I! }$ I
- char *dmabufdest2 = NULL;/ P% `' U1 L% C, g7 p1 N9 h
' ?! b% s* M$ R3 t6 T6 k; Y- static int acnt = 512;: `, I H! g( w% \, S" Q2 o0 m
- static int bcnt = 8;
, w+ d# ^# J+ |/ _/ t# h - static int ccnt = 8;
9 F2 u$ m1 w v) G- Z4 p - 9 e; o7 y9 p/ }! r7 k
- module_param(acnt, int, S_IRUGO);8 ~! Z: F9 H, a' B
- module_param(bcnt, int, S_IRUGO);" I$ l1 Z. q N/ l! i9 b! z
- module_param(ccnt, int, S_IRUGO);
复制代码 1 z% W/ P) T* u0 A3 ^- O
3 h, y/ E6 M2 S4 V! Q6 X
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用 B9 t! y. l u
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* `, y" i* H& a! t( [ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! |1 S0 G, ^$ |, e) G# _& l
2 U+ N5 H X9 |) s% A
" A, N* ^( V1 t# k- C |
|