|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& ?1 A I1 F+ |+ A; S- [code]EDMA sample test application
, z3 d4 h, }, ]+ c* A - /*/ F$ e, ]6 j: V# A1 T
- * edma_test.c
) `8 e9 K( l* g. r' ?: s - *
, D8 E( T: t4 W- K( _' p - * brief EDMA3 Test Application
0 {0 U' W3 [7 m. A0 F5 x - *
6 {' ?+ `, V% d! Y4 h! n6 C - * This file contains EDMA3 Test code.% I4 ]2 h7 U' \& y) X8 H
- *
/ J4 Z- j4 j/ m - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
' Q$ Y( N4 j. k, A$ N9 V: d - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 ~2 |5 s- J3 f9 W& @0 ~9 b
- * TO CHANGE.3 L8 k3 q- w* F+ T+ Y
- *
. G; p8 }. ~5 A/ f8 @" l" S3 Z - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
0 h/ Z& v- B8 @1 E2 h2 t - *$ E5 }- v! l% e5 b
- * This program is free software; you can redistribute it and/or
( t6 G5 q% y9 u3 i - * modify it under the terms of the GNU General Public License as( A- D2 a9 e& \: H7 d' J& g
- * published by the Free Software Foundation version 2.
1 s. x% i# H6 o6 _ b9 g/ ` - ** y# E6 K) R# |
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
- c* H9 i. T- o* e - * kind, whether express or implied; without even the implied warranty9 M3 ^2 L4 k+ g$ G$ r6 n' `
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! Z2 J, x, s' Y1 D- ] - * GNU General Public License for more details.
, y8 s( \2 A% L( g2 M4 C. ~) }' j2 M - */& W* s; a/ I/ n& d2 g
- 4 F" H$ T$ s. z; Y u
- #include <linux/module.h>" K E( P/ K4 Z
- #include <linux/init.h>6 i1 D$ A% t# F5 I; F
- #include <linux/errno.h>
) @9 @% i% Y: A4 k8 q - #include <linux/types.h>$ {8 m) A" S, U# V+ _1 o, G- k
- #include <linux/interrupt.h>
6 h8 h$ O. @7 {5 b2 ]( Y" v - #include <asm/io.h>- v( _1 e. ~+ u6 S2 Y0 I- q$ X# ^2 s7 \! G
- #include <linux/moduleparam.h>9 i* A# U: z9 K6 \
- #include <linux/sysctl.h>
6 {4 B, W9 Z4 W/ c0 R* q; I u' T; T4 T - #include <linux/mm.h>
5 o/ f9 |5 Z5 O' c- ^9 Y - #include <linux/dma-mapping.h>& e: ~' ]8 Y; J6 f' Q% E5 T
- - v, N! ?" ], s$ p
- #include <mach/memory.h>
/ C5 O5 P/ w2 D0 p6 C8 ^( s - #include <mach/hardware.h>5 M& |; e% W; ]# I9 D- P" o
- #include <mach/irqs.h>
) Z# k) z6 F" x: n - #include <asm/hardware/edma.h>
0 p2 v) k5 l! `0 p5 [
1 l7 V. T+ n9 i _% T' P; i. E8 p9 B% Q {- #undef EDMA3_DEBUG/ _& l3 }4 F/ W0 s
- /*#define EDMA3_DEBUG*/
5 ~9 n/ C' E+ @+ ~' u
3 L" y# I1 ]' m$ h% w6 ~4 B" U- #ifdef EDMA3_DEBUG' Z- r3 w% @, Q& _! t3 V
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ Z0 t; g* W+ B+ P2 k4 ^/ y$ p
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" b8 ^4 `6 Y$ B5 Y! n& q1 x4 n& b( U
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
) Y# m T- R% Y5 q* y - #else' C) Y, o+ Z0 [, G. A+ }0 B
- #define DMA_PRINTK( x... )& x$ O3 R1 C. L, Q6 \, h7 V- S
- #define DMA_FN_IN5 f# a% _8 ?: i
- #define DMA_FN_OUT
* i7 y. V8 b& a - #endif
+ w& j2 J3 D7 ]# C- h8 Z4 m/ J - " d- v% w) r7 m7 ~& F# h0 U4 f
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
+ g, p4 }' X r- r& G - #define STATIC_SHIFT 36 }/ Y6 N8 k- t# o1 F& M
- #define TCINTEN_SHIFT 204 G& |, C; c! h8 {( C% H+ Q
- #define ITCINTEN_SHIFT 21
, r. X. {/ B: S8 o4 b# f, t) | - #define TCCHEN_SHIFT 22+ O8 N/ r- O$ N( M" A+ z
- #define ITCCHEN_SHIFT 23
6 `( a m( F! P7 g4 r8 G
: k) w4 u& R6 H% }) e+ A- static volatile int irqraised1 = 0;
4 E, A( `. v2 f9 q - static volatile int irqraised2 = 0;
" T. c, ^9 i _9 m' C* D. _* E( H2 q9 G - 8 _/ ]6 N2 ^ M3 n% N' U* k
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. c6 P+ E. L1 e: M/ | - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 D& ]6 y% `2 Z5 s - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 L' t5 v j/ V2 D( s: |0 f5 T
) F; S+ G( r+ I5 \3 s; Z6 K- dma_addr_t dmaphyssrc1 = 0;
9 Y7 e' b, g% v7 E, W - dma_addr_t dmaphyssrc2 = 0;
: m4 k/ j, m, ]; X8 [ - dma_addr_t dmaphysdest1 = 0;/ ?8 W" ]1 {: [' Q
- dma_addr_t dmaphysdest2 = 0;7 U- _6 M" V: O* i5 D$ k3 o# s
- & J# v; a* @& A' V+ {5 a% }
- char *dmabufsrc1 = NULL;, {" m! `1 j8 l8 ?! N
- char *dmabufsrc2 = NULL;
- w+ n. X" ^: u8 j - char *dmabufdest1 = NULL;
$ M5 K4 E- ]7 q7 X0 u% Z - char *dmabufdest2 = NULL;+ z( Q+ j, T1 M' P/ |; w
- ! N- r$ A R' e) y
- static int acnt = 512;0 W' T+ m. O! P j
- static int bcnt = 8;
( ?, Y; s- o, n3 I - static int ccnt = 8;
9 a4 D4 m& Y& ^. A( D6 ~, U0 ?' F
- t$ v& Z, Z$ p0 K$ d, w- module_param(acnt, int, S_IRUGO);
5 m+ t) w/ H3 ~4 V8 s - module_param(bcnt, int, S_IRUGO);% d+ S0 r( k5 l% r+ o+ v( U
- module_param(ccnt, int, S_IRUGO);
复制代码 0 Q c, p3 T% S+ ~ y! F
! F) M# I4 h4 g- @/ Q% a
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, `( {' O' p3 E; W& Darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: G" A$ q4 l. M; }( Q* q. j
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 f3 T x) G- d$ [) F' n3 B# k6 k5 P( G- m4 S$ F+ J
) l+ p" X' w3 d' }+ e- O
|
|