|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - m2 G/ _" F2 C7 _0 y) {) i
- [code]EDMA sample test application
! N7 h$ T0 n) y' i' x; D - /*6 j; I8 A( Q4 Y( z
- * edma_test.c
2 g; G1 k7 n+ o v - *
" S% @; q* b- s) B4 L- C9 | - * brief EDMA3 Test Application: w- L& ~7 q: X( u
- *% g7 Q6 s o' \; S r- S8 f
- * This file contains EDMA3 Test code.+ ^6 x# S0 m# N5 p/ Y; {7 R3 g! \
- *
- p [. y) c8 v( f - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# E, `% ^2 s% U9 F6 Q2 ^& W: X% G
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* E0 _; T+ I3 M8 b
- * TO CHANGE.) M4 F2 c. { ~1 O. @8 L+ L
- *9 U( y1 A+ ^$ S* h, T
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
: N/ m0 Z4 a: b8 v: W& w4 F3 { - *
0 q4 Z" P) F2 N% P* f! [3 Z - * This program is free software; you can redistribute it and/or
$ J, m8 W G& [0 Z# n+ K8 M g - * modify it under the terms of the GNU General Public License as. Z4 n0 m, k- Y8 ^& O
- * published by the Free Software Foundation version 2.+ t y# O9 Q2 S+ b- |
- *
% T% k7 ]) l7 R/ W- V0 G* ?% C1 E - * This program is distributed "as is" WITHOUT ANY WARRANTY of any& o% f% S5 Y* b5 q& L
- * kind, whether express or implied; without even the implied warranty
, y" j) R) N" ]# ] - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the* o9 A8 m$ H& a# I
- * GNU General Public License for more details.
* ]$ q9 O& b% |, {, L" o - */
* A9 [& |! C* p, d5 i; r8 A - 8 ^. ^: n! m: ?8 x
- #include <linux/module.h>
8 b) ~2 {3 `5 y1 d) A1 d' ?3 R - #include <linux/init.h>3 V" M2 O, N' ]! l; A
- #include <linux/errno.h>3 u+ K- X1 e ^% M9 Y0 G5 V, }$ T
- #include <linux/types.h>
( C5 L6 `6 \) R: {- n& \ - #include <linux/interrupt.h>3 c$ t9 F/ {' \
- #include <asm/io.h>
; P3 K1 G* H T+ g7 w/ v, p - #include <linux/moduleparam.h>
7 } T4 r+ d2 T6 R1 \& z - #include <linux/sysctl.h>/ ^( {1 I* w/ w4 X3 z! G
- #include <linux/mm.h>
4 L& o; ~$ y/ M/ Q" X - #include <linux/dma-mapping.h> o9 V, n" n4 L
2 F/ S7 A! a' e4 I. {- #include <mach/memory.h>
- p& q3 O5 k( G - #include <mach/hardware.h>
1 @2 y$ Q) c. o) S- ?8 I - #include <mach/irqs.h>
$ H- E1 Q, }8 T# c - #include <asm/hardware/edma.h>
- u H) M+ ?% k; q ? - ! r7 G; N$ N/ @2 J
- #undef EDMA3_DEBUG: T8 E# a! j: O. h' P' V/ y
- /*#define EDMA3_DEBUG*/- b0 L6 j+ ?/ G& r5 a
+ V( c, o9 Q6 v+ l4 b, d2 l) \/ m- #ifdef EDMA3_DEBUG/ Q$ e! X; m$ d6 {% X/ x" n& @" |
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); P+ Z; g8 u m7 ?! C$ p
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 m: W3 G" b( F0 E* i# u" F; R
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
# e# B$ c" Y7 } t4 s' M - #else
# J, I8 M1 h! d% J2 u2 Z - #define DMA_PRINTK( x... )
) G3 X1 M& n% i* r" Z- r7 g - #define DMA_FN_IN3 K2 c V4 a* C6 n& E5 J2 {" k
- #define DMA_FN_OUT
/ k# j6 v+ ]/ X7 p0 ?0 n - #endif0 M6 W( [- V" \( \! s
9 k4 Z3 G4 P! y9 @ h/ S4 n- #define MAX_DMA_TRANSFER_IN_BYTES (32768) H* u4 P2 K ?% {0 N
- #define STATIC_SHIFT 3
; P1 I5 r! ]# V# {5 M - #define TCINTEN_SHIFT 20
* S4 o( K2 H6 o7 }4 I8 m+ _ - #define ITCINTEN_SHIFT 21% J* h" b" r0 c
- #define TCCHEN_SHIFT 22
6 y: Z. I% O0 i9 ?( F8 m3 w - #define ITCCHEN_SHIFT 23* c+ O1 I, C2 E, k
8 Y6 S, g8 E, S; M; a4 ?- static volatile int irqraised1 = 0;$ E* n: p7 y! q/ i# g
- static volatile int irqraised2 = 0;" O2 Z1 m2 [& _7 c# q! C
' W1 G4 N' j L- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# b7 J) ]# O; w F! Q - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 \5 ~$ A( z& j$ ~" ?5 `2 ] - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* N6 H& P* i3 l
- + h$ w2 H8 S, G9 @/ H, M2 `
- dma_addr_t dmaphyssrc1 = 0;1 f" ], b/ n6 Z; Z$ p
- dma_addr_t dmaphyssrc2 = 0;9 m, ~( C: Q( c H* l* g: D
- dma_addr_t dmaphysdest1 = 0;: U e' u: G2 a. I4 k7 W' k' r
- dma_addr_t dmaphysdest2 = 0;: K. L$ l7 \2 J" B
- / H% F) P# z2 k! P
- char *dmabufsrc1 = NULL;
/ B. U& L# K1 I - char *dmabufsrc2 = NULL;
- X* H/ n9 q3 Y: J, y - char *dmabufdest1 = NULL;
; U0 p% E# k! r+ P8 ]6 L. \ - char *dmabufdest2 = NULL;7 a$ s8 I( B! v3 O, y
7 n" L0 V8 ]- J' E. P5 W- static int acnt = 512;; y6 _' h# l9 r6 t7 M. L
- static int bcnt = 8;
- z, [; [5 L1 R! R0 g! q - static int ccnt = 8;# D. j& O8 h) n9 ~
- 3 D0 E/ I! b. c* C3 M. m
- module_param(acnt, int, S_IRUGO);
6 x R* S9 t) l5 {: Q4 b8 a - module_param(bcnt, int, S_IRUGO);
3 N" p" U" m' [9 w3 h7 C, O8 e - module_param(ccnt, int, S_IRUGO);
复制代码 R: z" G7 o' F
0 d2 ` h' y! a9 u1 W2 N( l 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 r* r, h: |6 b
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 G8 t& z9 R3 }9 D7 v& Z/ y3 K0 I. N9 J 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" k. v4 a) z& o3 W; A8 ^
0 S- J- i4 U$ J0 @
& v, I2 X, X( z+ C2 V3 ^+ D, W |
|