1 /*---------------------------------------------------------------------------*
2   Project:  TwlSDK - SPI - demos
3   File:     monkey.h
4 
5   Copyright 2003-2008 Nintendo. All rights reserved.
6 
7   These coded instructions, statements, and computer programs contain
8   proprietary information of Nintendo of America Inc. and/or Nintendo
9   Company Ltd., and are protected by Federal copyright law. They may
10   not be disclosed to third parties or copied or duplicated in any form,
11   in whole or in part, without the prior written consent of Nintendo.
12 
13   $Date:: 2008-09-18#$
14   $Rev: 8573 $
15   $Author: okubata_ryoma $
16  *---------------------------------------------------------------------------*/
17 
18 #ifndef	MONKEY_H_
19 #define	MONKEY_H_
20 
21 #ifdef	__cplusplus
22 extern "C" {
23 #endif
24 
25 /*===========================================================================*/
26 
27 #include	<nitro/os.h>
28 #include	<nitro/spi.h>
29 
30 /*---------------------------------------------------------------------------*
31 	Constant Definitions
32  *---------------------------------------------------------------------------*/
33 #define		MONKEY_MESSAGE_ARRAY_MAX	8
34 #define		MONKEY_STACK_SIZE			1024
35 #define		MONKEY_THREAD_PRIORITY		15
36 #define		MONKEY_MIC_SPAN_TICK		( HW_SYSTEM_CLOCK / 64 / 60 / 263 )     //Approximately 1 line
37 #define		MONKEY_MIC_ARRAY_MAX		256
38 #define		MONKEY_TP_ARRAY_MAX			8
39 #define		MONKEY_SAMPLING_SPAN_LINE	4       // Line period of periodic timer
40 
41 #define		MONKEY_MESSAGE_TYPE_MIC		1
42 #define		MONKEY_MESSAGE_TYPE_TP		2
43 
44 
45 /*---------------------------------------------------------------------------*
46 	Structure Definitions
47  *---------------------------------------------------------------------------*/
48 typedef struct MonkeyWork
49 {
50     OSMessageQueue msg_q;
51     OSMessage msg_buf[MONKEY_MESSAGE_ARRAY_MAX];
52     OSThread thread;
53     u32     stack[MONKEY_STACK_SIZE / sizeof(u32)];
54     OSAlarm alarm;
55     u16     micBuf[MONKEY_MIC_ARRAY_MAX];
56     u16     micIndex;
57     TPData  tpBuf[MONKEY_TP_ARRAY_MAX];
58     u16     tpIndex;
59     u32     timerCount;
60 
61 }
62 MonkeyWork;
63 
64 
65 /*---------------------------------------------------------------------------*
66 	Function definitions
67  *---------------------------------------------------------------------------*/
68 
69 // Initialize, start thread
70 void    MonkeyInit(void);
71 
72 // Get touch panel input value in array
73 void    MonkeyGetNewTpData(s32 num, TPData *array);
74 
75 // Get mike input value in array
76 void    MonkeyGetNewMicData(s32 num, u16 *array);
77 
78 
79 /*===========================================================================*/
80 
81 #ifdef	__cplusplus
82 }          /* extern "C" */
83 #endif
84 
85 #endif // MONKEY_H_
86 
87 /*---------------------------------------------------------------------------*
88   End of file
89  *---------------------------------------------------------------------------*/
90