|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 W# z) k6 j" P& P# b1 ?
- [code]EDMA sample test application
3 a' V) x( P8 _ - /*5 u4 |4 ^1 c# u8 Q- z; h: D
- * edma_test.c
) \) I# W8 J0 E6 e$ t - *$ R2 W/ H& ` F p3 z* T0 q* `1 g8 O
- * brief EDMA3 Test Application! k3 I1 a8 Y. z5 c) c& R. H
- *
; t3 n0 m0 o7 p% Y - * This file contains EDMA3 Test code.
7 s4 u. E. k3 F' @ - *
) I0 [& ^6 _( j, v; r# {$ R- L' Q - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
" Q* ?# m2 z# [' X+ Z* Q - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
9 S: ?' @' r) ? - * TO CHANGE.; Q& v: t2 w% X7 G* }7 ~
- *
) s [- K, L* q$ \7 \ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
! P4 c* u) F5 b5 w - *. `% I& ~0 \0 b8 i
- * This program is free software; you can redistribute it and/or, `8 K4 b; r1 U( P6 x0 t
- * modify it under the terms of the GNU General Public License as
& [2 R2 e1 Y$ d2 r4 ? - * published by the Free Software Foundation version 2.7 \3 P! @( T$ ]1 h# ^4 j0 [* g9 w
- *" _+ l6 W* H& T6 I3 ^. n$ J: p4 ?" [ p
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 _" \, r) V/ V# H
- * kind, whether express or implied; without even the implied warranty$ V4 {, Z7 k# M6 S4 g6 ?3 m
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ R+ O+ B) }* s+ ~2 S& ] L# ~
- * GNU General Public License for more details.. K1 U5 c4 {; x* k
- */4 \0 b$ |* D v. n0 l, o+ A9 C" v
- g3 N7 d: _; p2 z" E0 d* P
- #include <linux/module.h>7 o* `( P2 N% B# F9 x* B6 f
- #include <linux/init.h>
# t; g! x: K( r; _ - #include <linux/errno.h>
; ~# R8 b" \( q0 p; W; ~ - #include <linux/types.h>4 h5 q3 Y% F* v
- #include <linux/interrupt.h>! I/ v0 l* C6 h# }3 t" b
- #include <asm/io.h>7 e! G. x8 g9 l. K, f* F
- #include <linux/moduleparam.h>
! X" p* X9 S( S) ? - #include <linux/sysctl.h>+ j0 j1 j) @3 v% j
- #include <linux/mm.h>
. C/ w" `& H# N( B, W - #include <linux/dma-mapping.h>( J& } C. g4 _' @$ m3 j8 M
% V" A6 A5 k0 S- #include <mach/memory.h>9 b2 D7 }$ ` Y y
- #include <mach/hardware.h># d; n! Z" h0 y- y* e) G4 ^
- #include <mach/irqs.h>
/ o2 `6 K$ {: P! q - #include <asm/hardware/edma.h>
, Q" o0 T" B/ J( r+ m5 V- \5 I6 V$ V) c
4 [: I" x, P+ h- #undef EDMA3_DEBUG; l5 H& t# R# `0 L6 r6 G
- /*#define EDMA3_DEBUG*/
/ f4 b9 p0 W3 Y! K - ' m$ A! q: `+ o, X" j& z1 V
- #ifdef EDMA3_DEBUG) {: n1 Q# p5 g& z$ o
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
8 [7 B4 g( p$ d* G# y$ A - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
9 D8 J$ |3 z& l& F - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
& W- e7 _ l: A3 r- l6 ^ - #else
% G4 h9 S( {5 y+ Q - #define DMA_PRINTK( x... ); S- i. b. y. g \. J+ t
- #define DMA_FN_IN. n) ?! \2 `3 m3 E2 T
- #define DMA_FN_OUT
9 X U3 v1 D r. |9 y - #endif
: y: d7 l( e4 p# P0 [* a1 W$ j
' D4 M$ V* G$ G) M- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
( `* R- W* q; t N! W5 f - #define STATIC_SHIFT 3
. s$ w1 h6 C% d. G" v - #define TCINTEN_SHIFT 20
( {0 L0 ^1 U [: t$ ~4 C8 s - #define ITCINTEN_SHIFT 21" L/ w9 O- x# R. [
- #define TCCHEN_SHIFT 22
4 p) x$ d: k: m3 W2 M - #define ITCCHEN_SHIFT 23
, S& F! N* w. p9 | - , u( N, M. t+ A- E2 T$ {
- static volatile int irqraised1 = 0;
& D8 W4 G9 h) m. q; ?, B) f& e - static volatile int irqraised2 = 0;
8 _, P t4 }4 P9 {$ S# l - J- a% M. w! Y8 y4 }2 w. k3 @4 h
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( v* W1 s$ w, |* n& f
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, x' U% Z, d/ V$ y" D6 ~; r
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 R$ M9 v! p/ `' b( e* | - : Z. e( n2 a" t' w& o/ O
- dma_addr_t dmaphyssrc1 = 0;
- k5 `, e$ K8 s# R- m5 Z - dma_addr_t dmaphyssrc2 = 0;
) _) u v) h9 n+ B4 a( M - dma_addr_t dmaphysdest1 = 0;
' T& s% ]& n, ^$ y# r - dma_addr_t dmaphysdest2 = 0;
1 l' f1 g' Z7 i4 K% r8 Z& i9 P - # u7 E' e* f0 p% Z- C/ D
- char *dmabufsrc1 = NULL;8 e. \" n# w! t3 W, S" L, P
- char *dmabufsrc2 = NULL;( w4 B# I0 q( V9 R1 C6 w! u8 h `
- char *dmabufdest1 = NULL;2 `0 C* h. y" M: M/ {; m9 v% U$ W
- char *dmabufdest2 = NULL;
" i& G. i7 q$ m8 F0 X# D - % w N5 g1 s- Y8 m7 f y
- static int acnt = 512;0 z4 i% W; X; I; F# O5 Y/ K
- static int bcnt = 8;5 K! Z9 @8 ^+ s) e( M% r5 u/ l
- static int ccnt = 8;# t/ I! j# E9 V4 l+ a1 f
- , r" {" F. X I6 {# [5 l
- module_param(acnt, int, S_IRUGO);+ k: ^1 L! U) h; i5 l
- module_param(bcnt, int, S_IRUGO);
9 g) W1 t% O1 R8 P. a( h& a - module_param(ccnt, int, S_IRUGO);
复制代码
7 g/ Y! w& w3 l: B2 A ]0 \/ L3 p9 S' X# f3 H, H4 I. c
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, R: h! `- k1 i: `+ o A2 k8 K
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 S" b* X; Y; H) `& S
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ R" t \; R2 O b: P* x4 j! y) d+ }
! l" o8 \, q3 {* }) G' n0 U
9 V2 P2 q$ _; a9 ^1 z* ?" D
|
|