1 /*---------------------------------------------------------------------------* 2 Project: TwlSDK - WXC - include - 3 File: wxc_protocol_impl_wpb.h 4 5 Copyright 2005-2009 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 NITRO_WXC_PROTOCOL_IMPL_WPB_H_ 19 #define NITRO_WXC_PROTOCOL_IMPL_WPB_H_ 20 21 #include <nitro.h> 22 23 24 /*****************************************************************************/ 25 /* Constants */ 26 27 28 #ifdef __cplusplus 29 extern "C" { 30 #endif 31 32 33 /* Direct copy of wpb from here */ 34 35 // Work area 36 #define PASS_PACKET_SIZE 512 37 #define PASS_BUFFER_SIZE (PASS_PACKET_SIZE - 4) 38 #define WPBC_PARENT_DATA_SIZE_MAX PASS_PACKET_SIZE 39 #define WPBC_CHILD_DATA_SIZE_MAX PASS_PACKET_SIZE 40 41 /*---------------------------------------------------------------------------* 42 Constant Definitions 43 *---------------------------------------------------------------------------*/ 44 45 #define REQUEST_DONE 0xffff 46 #define REQUEST_NONE 0xfffe 47 #define REQUEST_BYE 0xfffd 48 49 #define HARDWARE_BUFFER_DUMMY_COUNT 3 50 51 #define MAX_PATTERN 4 52 #define MAX_SEQ 4 53 54 /*---------------------------------------------------------------------------* 55 Structure Definitions 56 *---------------------------------------------------------------------------*/ 57 typedef struct 58 { 59 int size; 60 int total_count; 61 const u8 *user_send_data; 62 } PassData; 63 64 typedef struct 65 { 66 u16 req_count; 67 u16 res_count; 68 u8 buf[PASS_BUFFER_SIZE]; 69 } PassBuffer; 70 71 typedef struct 72 { 73 u8 *user_recv_buffer; 74 BOOL reset_done; 75 BOOL send_done; 76 BOOL recv_done; 77 int hardware_buffer_count; 78 PassBuffer send_buf; 79 PassBuffer recv_buf; 80 int pre_send_count; 81 u32 recv_bitmap; /* Loop in mod32 */ 82 int recv_bitmap_index; 83 } PassCtrl; 84 85 86 /* To here */ 87 88 // ImplWork structure for wpb 89 typedef struct 90 { 91 // Same section as PassCtrl 92 /* u8 *user_recv_buffer; 93 BOOL reset_done; 94 BOOL send_done; 95 BOOL recv_done; 96 int hardware_buffer_count; 97 PassBuffer send_buf; 98 PassBuffer recv_buf; 99 int pre_send_count; 100 u32 recv_bitmap; /* loop in mod32 */ 101 // int recv_bitmap_index; 102 103 PassCtrl pass_ctrl; 104 105 // Maintain my_pass_data held by wpb globally. 106 PassData my_pass_data; 107 108 // Because some of the WXCProtocolContext members are separated by protocol, members likely to be used in wpb as well are brought here in addition to wxc. 109 // 110 /* Data receive management information */ 111 u32 recv_bitmap_buf[WXC_RECV_BITSET_SIZE]; 112 113 u16 send_unit; /* Unit size of send packet */ 114 u16 recv_unit; /* Unit size of receive packet */ 115 116 /* Data send management information */ 117 u16 recent_index[WXC_RECENT_SENT_LIST_MAX]; 118 119 BOOL executing; 120 } WXCImplWorkWpb; 121 122 123 // wpb protocol send/receive function array 124 extern WXCProtocolImpl wxc_protocol_impl_wpb; 125 126 127 #ifdef __cplusplus 128 } /* extern "C" */ 129 #endif 130 131 132 #endif /* NITRO_WXC_PROTOCOL_IMPL_WPB_H_ */ 133 134 /*---------------------------------------------------------------------------* 135 End of file 136 *---------------------------------------------------------------------------*/ 137