Lines Matching refs:context

33 inline static void WFSi_NotifyEvent(WFSClientContext *context,  in WFSi_NotifyEvent()  argument
36 if (context->callback) in WFSi_NotifyEvent()
38 context->callback(context, event, argument); in WFSi_NotifyEvent()
53 static void WFSi_ReallocBitmap(WFSClientContext *context, int length) in WFSi_ReallocBitmap() argument
57 length = (int)context->max_file_size; in WFSi_ReallocBitmap()
58 context->max_file_size = 0; in WFSi_ReallocBitmap()
60 if (context->max_file_size < length) in WFSi_ReallocBitmap()
62 const int packet = WBT_GetParentPacketLength(context->wbt); in WFSi_ReallocBitmap()
64 context->max_file_size = (u32)length; in WFSi_ReallocBitmap()
65 MI_CallFree(context->allocator, context->recv_pkt_bmp_buf); in WFSi_ReallocBitmap()
66 context->recv_pkt_bmp_buf = (u32 *)MI_CallAlloc(context->allocator, in WFSi_ReallocBitmap()
68 if (context->recv_pkt_bmp_buf == NULL) in WFSi_ReallocBitmap()
72 context->recv_buf_packet_bmp_table.packet_bitmap[0] = context->recv_pkt_bmp_buf; in WFSi_ReallocBitmap()
74 SDK_ASSERT(context->recv_pkt_bmp_buf); in WFSi_ReallocBitmap()
91 WFSClientContext * const context = (WFSClientContext *)userdata; in WFSi_ReceiveTableSequence() local
92 WBTContext * const wbt = context->wbt; in WFSi_ReceiveTableSequence()
112 0, &context->block_info_table); in WFSi_ReceiveTableSequence()
117 const int length = context->block_info_table.block_info[0]->block_size; in WFSi_ReceiveTableSequence()
119 context->table->length = (u32)length; in WFSi_ReceiveTableSequence()
120 context->table->buffer = (u8 *)MI_CallAlloc(context->allocator, (u32)length, 1); in WFSi_ReceiveTableSequence()
121 if (context->table->buffer == NULL) in WFSi_ReceiveTableSequence()
125 WFSi_ReallocBitmap(context, length); in WFSi_ReceiveTableSequence()
126 context->recv_buf_table.recv_buf[0] = context->table->buffer; in WFSi_ReceiveTableSequence()
129 WFS_TABLE_BLOCK_INDEX, context->table->length, in WFSi_ReceiveTableSequence()
130 &context->recv_buf_table, in WFSi_ReceiveTableSequence()
131 &context->recv_buf_packet_bmp_table); in WFSi_ReceiveTableSequence()
137 WFS_ParseTable(context->table); in WFSi_ReceiveTableSequence()
138 context->fat_ready = TRUE; in WFSi_ReceiveTableSequence()
139 WFSi_NotifyEvent(context, WFS_EVENT_CLIENT_READY, NULL); in WFSi_ReceiveTableSequence()
180 WFSClientContext * const context = (WFSClientContext *)userdata; in WFSi_ReadRomSequence() local
181 WBTContext * const wbt = context->wbt; in WFSi_ReadRomSequence()
192 context->request_region.offset + context->table->origin, in WFSi_ReadRomSequence()
193 context->request_region.length); in WFSi_ReadRomSequence()
221 context->block_id = id; in WFSi_ReadRomSequence()
222 context->recv_buf_table.recv_buf[0] = context->request_buffer; in WFSi_ReadRomSequence()
225 context->block_id, context->request_region.length, in WFSi_ReadRomSequence()
226 &context->recv_buf_table, in WFSi_ReadRomSequence()
227 &context->recv_buf_packet_bmp_table); in WFSi_ReadRomSequence()
236 WFSi_ReallocBitmap(context, -1); in WFSi_ReadRomSequence()
237 WFSi_ReadRomSequence(context, NULL); in WFSi_ReadRomSequence()
243 u32 id = context->block_id; in WFSi_ReadRomSequence()
252 … WFS_DEBUG_OUTPUT(("WBT-MSG(UNLOCK,0x%08X):done [read-operation completed]", context->block_id)); in WFSi_ReadRomSequence()
253 context->request_buffer = NULL; in WFSi_ReadRomSequence()
255 WFSRequestClientReadDoneCallback callback = context->request_callback; in WFSi_ReadRomSequence()
256 void *argument = context->request_argument; in WFSi_ReadRomSequence()
257 context->request_callback = NULL; in WFSi_ReadRomSequence()
258 context->request_argument = NULL; in WFSi_ReadRomSequence()
261 (*callback)(context, TRUE, argument); in WFSi_ReadRomSequence()
303 WFSClientContext * const context = (WFSClientContext *)userdata; in WFSi_WBTSystemCallback() local
306 (context->request_buffer)) in WFSi_WBTSystemCallback()
308 WFSi_ReadRomSequence(context, callback); in WFSi_WBTSystemCallback()
322 void WFS_CallClientConnectHook(WFSClientContext *context, const WFSPeerInfo *peer) in WFS_CallClientConnectHook() argument
324 (void)context; in WFS_CallClientConnectHook()
338 void WFS_CallClientDisconnectHook(WFSClientContext *context, const WFSPeerInfo *peer) in WFS_CallClientDisconnectHook() argument
340 (void)context; in WFS_CallClientDisconnectHook()
354 void WFS_CallClientPacketSendHook(WFSClientContext *context, WFSPacketBuffer *packet) in WFS_CallClientPacketSendHook() argument
356 packet->length = WBT_CallPacketSendHook(context->wbt, packet->buffer, packet->length, FALSE); in WFS_CallClientPacketSendHook()
369 void WFS_CallClientPacketRecvHook(WFSClientContext *context, const WFSPacketBuffer *packet) in WFS_CallClientPacketRecvHook() argument
372 WBT_CallPacketRecvHook(context->wbt, aid, packet->buffer, packet->length); in WFS_CallClientPacketRecvHook()
388 void WFS_InitClient(WFSClientContext *context, in WFS_InitClient() argument
393 context->userdata = userdata; in WFS_InitClient()
394 context->callback = callback; in WFS_InitClient()
395 context->allocator = allocator; in WFS_InitClient()
396 context->fat_ready = FALSE; in WFS_InitClient()
400 context->block_info_table.block_info[i] = &context->block_info[i]; in WFS_InitClient()
401 context->recv_buf_table.recv_buf[i] = NULL; in WFS_InitClient()
402 context->recv_buf_packet_bmp_table.packet_bitmap[i] = NULL; in WFS_InitClient()
404 context->recv_pkt_bmp_buf = NULL; in WFS_InitClient()
405 context->max_file_size = 0; in WFS_InitClient()
406 context->block_id = 0; in WFS_InitClient()
407 context->request_buffer = NULL; in WFS_InitClient()
408 context->table->length = 0; in WFS_InitClient()
409 context->table->buffer = NULL; in WFS_InitClient()
410 context->unmount_callback = NULL; in WFS_InitClient()
412 WBT_InitContext(context->wbt, context, WFSi_WBTSystemCallback); in WFS_InitClient()
413 WBT_AddCommandPool(context->wbt, context->wbt_list, in WFS_InitClient()
414 sizeof(context->wbt_list) / sizeof(*context->wbt_list)); in WFS_InitClient()
426 void WFS_EndClient(WFSClientContext *context) in WFS_EndClient() argument
428 MI_CallFree(context->allocator, context->recv_pkt_bmp_buf); in WFS_EndClient()
429 WBT_ResetContext(context->wbt, NULL); in WFS_EndClient()
430 if (context->table->buffer) in WFS_EndClient()
432 MI_CallFree(context->allocator, context->table->buffer); in WFS_EndClient()
433 context->table->buffer = NULL; in WFS_EndClient()
435 if (context->request_callback) in WFS_EndClient()
437 (*context->request_callback)(context->request_argument, FALSE, context->request_argument); in WFS_EndClient()
439 if (context->unmount_callback) in WFS_EndClient()
441 (*context->unmount_callback)(context); in WFS_EndClient()
455 void WFS_StartClient(WFSClientContext *context, const WFSPeerInfo *peer) in WFS_StartClient() argument
457 WBT_StartChild(context->wbt, peer->aid); in WFS_StartClient()
458 WFSi_ReceiveTableSequence(context, NULL); in WFS_StartClient()
476 void WFS_RequestClientRead(WFSClientContext *context, void *buffer, u32 offset, in WFS_RequestClientRead() argument
480 if (context->fat_ready) in WFS_RequestClientRead()
482 context->request_buffer = buffer; in WFS_RequestClientRead()
483 context->request_region.offset = offset; in WFS_RequestClientRead()
484 context->request_region.length = length; in WFS_RequestClientRead()
485 context->request_callback = callback; in WFS_RequestClientRead()
486 context->request_argument = arg; in WFS_RequestClientRead()
487 WFSi_ReallocBitmap(context, (int)length); in WFS_RequestClientRead()
488 WFSi_ReadRomSequence(context, NULL); in WFS_RequestClientRead()
503 void WFS_GetClientReadProgress(WFSClientContext *context,int *current, int *total) in WFS_GetClientReadProgress() argument
505 WBT_GetDownloadProgress(context->wbt, context->block_id, 0, current, total); in WFS_GetClientReadProgress()