1 /*---------------------------------------------------------------------------*
2 Project: TwlSDK - MB - include
3 File: mb.h
4
5 Copyright 2007-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-10-17#$
14 $Rev: 8984 $
15 $Author: yosizaki $
16 *---------------------------------------------------------------------------*/
17
18 #ifndef NITRO_MB_MB_H_
19 #define NITRO_MB_MB_H_
20
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
24
25 #include <nitro/types.h>
26 #include <nitro/misc.h>
27 #include <nitro/fs/file.h>
28 #include <nitro/wm.h>
29
30
31 /* ---------------------------------------------------------------------
32
33 Constants
34
35 ---------------------------------------------------------------------*/
36
37 #define MB_MAX_CHILD WM_NUM_MAX_CHILD
38
39 /* Number of characters in file name */
40 #define MB_FILENAME_SIZE_MAX (10)
41
42 /* Maximum number of files in parent device */
43 #define MB_MAX_FILE (16)
44
45 /* Size of multiboot working memory */
46 #define MB_SYSTEM_BUF_SIZE (0xC000)
47
48 /* Possible size setting range for parent communication */
49 #define MB_COMM_PARENT_SEND_MIN 256
50 #define MB_COMM_PARENT_SEND_MAX 510
51
52 #define MB_COMM_PARENT_RECV_MIN 8
53 #define MB_COMM_PARENT_RECV_MAX 16
54
55 /* Minimum buffer size required for MB_ReadSegment() */
56 #define MB_SEGMENT_BUFFER_MIN 0x10000
57
58 /* MB API result type */
59 #define MB_SUCCESS MB_ERRCODE_SUCCESS // Backwards compatibility
60
61 /* Definition value that specifies that the TGID value for MB_Init() should be automatically set */
62 #define MB_TGID_AUTO 0x10000
63
64 /*
65 * Parent device game information for multibooting
66 */
67
68 #define MB_ICON_COLOR_NUM 16 // Number of icon colors
69 #define MB_ICON_PALETTE_SIZE (MB_ICON_COLOR_NUM * 2) // Icon data size (16-bit color x number of colors)
70 #define MB_ICON_DATA_SIZE 512 // Icon data size (32x32 dots, 16 colors)
71 #define MB_GAME_NAME_LENGTH 48 // Game name length (2-byte units) Note: Specify to fit within the number of characters noted on the left *and* within a width of 185 dots.
72 #define MB_GAME_INTRO_LENGTH 96 // Game description length (2-byte units) Note: Specify to fit within the number of characters noted on the left *and* within a width of 199 dots times 2.
73 #define MB_USER_NAME_LENGTH 10 // User name length (2-byte units)
74 #define MB_MEMBER_MAX_NUM 15 // Maximum number of communicating members
75 #define MB_FILE_NO_MAX_NUM 64 // When MbGameInfo.fileNo is carried on the beacon it becomes 6-bit. Therefore the maximum number is 64.
76 #define MB_GAME_INFO_RECV_LIST_NUM 16 // Number of lists that receive game information on the child side.
77
78 /* Boot type */
79 #define MB_TYPE_ILLEGAL 0 /* Illegal status */
80 #define MB_TYPE_NORMAL 1 /* Boot from ROM */
81 #define MB_TYPE_MULTIBOOT 2 /* Multiboot child device */
82
83 #define MB_BSSDESC_SIZE (sizeof(MBParentBssDesc))
84 #define MB_DOWNLOAD_PARAMETER_SIZE HW_DOWNLOAD_PARAMETER_SIZE
85
86 /* Parent download status */
87 typedef enum
88 {
89 MB_COMM_PSTATE_NONE,
90 MB_COMM_PSTATE_INIT_COMPLETE,
91 MB_COMM_PSTATE_CONNECTED,
92 MB_COMM_PSTATE_DISCONNECTED,
93 MB_COMM_PSTATE_KICKED,
94 MB_COMM_PSTATE_REQ_ACCEPTED,
95 MB_COMM_PSTATE_SEND_PROCEED,
96 MB_COMM_PSTATE_SEND_COMPLETE,
97 MB_COMM_PSTATE_BOOT_REQUEST,
98 MB_COMM_PSTATE_BOOT_STARTABLE,
99 MB_COMM_PSTATE_REQUESTED,
100 MB_COMM_PSTATE_MEMBER_FULL,
101 MB_COMM_PSTATE_END,
102 MB_COMM_PSTATE_ERROR,
103 MB_COMM_PSTATE_WAIT_TO_SEND,
104
105 /* Internally used enumerated values.
106 Will not transition to these value's states. */
107 MB_COMM_PSTATE_WM_EVENT = 0x80000000
108 }
109 MBCommPState;
110
111
112 /* Responses to connection request from child */
113 typedef enum
114 {
115 MB_COMM_RESPONSE_REQUEST_KICK, /* Reject child's entry request. */
116 MB_COMM_RESPONSE_REQUEST_ACCEPT, /* Accept child's entry request. */
117 MB_COMM_RESPONSE_REQUEST_DOWNLOAD, /* Notify child of commencement of download. */
118 MB_COMM_RESPONSE_REQUEST_BOOT /* Notify child of commencement of boot. */
119 }
120 MBCommResponseRequestType;
121
122
123 /* Parent event notification callback type */
124 typedef void (*MBCommPStateCallback) (u16 child_aid, u32 status, void *arg);
125
126
127 typedef struct
128 {
129 u16 errcode;
130 }
131 MBErrorStatus;
132
133 typedef enum
134 {
135 /* Value that indicates success */
136 MB_ERRCODE_SUCCESS = 0,
137
138 MB_ERRCODE_INVALID_PARAM, /* Argument error */
139 MB_ERRCODE_INVALID_STATE, /* Inconsistent call state conditions */
140
141 /* The following errors are only for children. */
142 MB_ERRCODE_INVALID_DLFILEINFO, /* Invalid download information */
143 MB_ERRCODE_INVALID_BLOCK_NO, /* Received block number is invalid */
144 MB_ERRCODE_INVALID_BLOCK_NUM, /* Number of blocks in received file is invalid */
145 MB_ERRCODE_INVALID_FILE, /* Received block from file that was not requested */
146 MB_ERRCODE_INVALID_RECV_ADDR, /* Receive address is invalid */
147
148 /* The following errors are caused by WM errors. */
149 MB_ERRCODE_WM_FAILURE, /* Error in WM callback */
150
151 /** The following are for when it is not possible to continue communications. (Must re-initialize WM) **/
152 MB_ERRCODE_FATAL,
153
154 MB_ERRCODE_MAX
155 }
156 MBErrCode;
157
158 /* ---------------------------------------------------------------------
159
160 Structures
161
162 ---------------------------------------------------------------------*/
163
164 /*
165 * Structure with registration data for multiboot games
166 */
167 typedef struct
168 {
169 /* Program binary's file path */
170 const char *romFilePathp;
171 /* Pointer to game name string */
172 u16 *gameNamep;
173 /* Pointer to game content description string */
174 u16 *gameIntroductionp;
175 /* Icon character data file path */
176 const char *iconCharPathp;
177 /* Icon palette data file path */
178 const char *iconPalettePathp;
179 /* Game group ID */
180 u32 ggid;
181 /* Max number of players */
182 u8 maxPlayerNum;
183 u8 pad[3];
184 /* User definition extended parameters (32 bytes) */
185 u8 userParam[MB_DOWNLOAD_PARAMETER_SIZE];
186 }
187 MBGameRegistry;
188
189
190 /*
191 * Icon data structure
192 * An icon uses a 16-color palette and is 32x32 pixels.
193 */
194 typedef struct
195 {
196 /* Palette data (32 bytes) */
197 u16 palette[MB_ICON_COLOR_NUM];
198 u16 data[MB_ICON_DATA_SIZE / 2];
199 /* Character data (512 bytes) */
200 }
201 MBIconInfo; /* 544 bytes */
202
203
204 /*
205 * User information structure
206 */
207 typedef struct
208 {
209 /* Favorite color data (color set number) */
210 u8 favoriteColor:4;
211 /* Player number (Parent = #0, Children = #1-#15) */
212 u8 playerNo:4;
213 /* Nickname Length */
214 u8 nameLength;
215 /* Nickname */
216 u16 name[MB_USER_NAME_LENGTH];
217 }
218 MBUserInfo; /* 22 bytes */
219
220
221 /*
222 * Multiboot parent device information
223 * (excluding gameInfo[128] from WMbssDesc)
224 */
225 typedef struct
226 {
227 u16 length; // 2
228 u16 rssi; // 4
229 u16 bssid[3]; // 10
230 u16 ssidLength; // 12
231 u8 ssid[32]; // 44
232 u16 capaInfo; // 46
233 struct
234 {
235 u16 basic; // 48
236 u16 support; // 50
237 }
238 rateSet;
239 u16 beaconPeriod; // 52
240 u16 dtimPeriod; // 54
241 u16 channel; // 56
242 u16 cfpPeriod; // 58
243 u16 cfpMaxDuration; // 60
244 }
245 MBParentBssDesc;
246
247
248 /* Structure that holds parent information for a multiboot child */
249 typedef struct
250 {
251 u16 boot_type;
252 MBParentBssDesc parent_bss_desc;
253 }
254 MBParam;
255
256
257 /* Data type received when entry request comes from child */
258 typedef struct
259 {
260 u32 ggid; // 4 bytes
261 MBUserInfo userinfo; // 22 bytes
262 u16 version; // 2 bytes
263 u8 fileid; // 1 byte
264 u8 pad[3]; // Total: 29 bytes
265 }
266 MBCommRequestData;
267
268
269 /* ---------------------------------------------------------------------
270
271 Multiboot library (MB) API - For parent device
272
273 ---------------------------------------------------------------------*/
274
275 /*---------------------------------------------------------------------------*
276 Name: MB_Init
277
278 Description: Initialize MB library
279
280 Arguments: work: Pointer to memory that is allocated for managing internal MB status.
281 This size must be at least MB_SYSTEM_BUF_SIZE bytes or larger.
282 In the case of dynamic allocation, it is also possible to acquire the size with the MB_GetParentSystemBufSize function.
283
284
285 The allocated memory is used internally until the MB_End is called.
286
287
288 user: - Pointer to the structure that holds user data.
289 Content pointed to by this pointer can only be referenced from inside the MB_Init function.
290
291
292 ggid: - Specifies a GGID.
293
294 tgid: - Value of TGID (Use a value generated by a decision method that follows WM guidelines)
295
296 When MB_TGID_AUTO is specified, an appropriate value is automatically set internally.
297
298
299 dma: - DMA channel that is allocated for managing internal MB processes.
300 This DMA channel is used internally until the MB_End is called.
301
302
303 Returns: Returns MB_SUCCESS if the initialization completes successfully.
304 *---------------------------------------------------------------------------*/
305
306 int MB_Init(void *work, const MBUserInfo *user, u32 ggid, u32 tgid, u32 dma);
307
308
309 /*---------------------------------------------------------------------------*
310 Name: MB_GetParentSystemBufSize
311
312 Description: Acquires the size of the work memory used by MB.
313
314 Arguments: None.
315
316 Returns: The size of the work memory used by MB.
317 *---------------------------------------------------------------------------*/
318 int MB_GetParentSystemBufSize(void);
319
320
321 /*---------------------------------------------------------------------------*
322 Name: MB_SetParentCommSize
323
324 Description: Sets the size of the parent's communication data that is used for MB communication.
325 Use this between the time MB_Init is started and the time MB_StartParent is called.
326 Buffer size cannot be changed after communications begins.
327
328 Arguments: sendSize: The size of send data that is sent from parent device to each child device.
329
330 Returns: If changing the size of the send/receive data succeeds, returns TRUE; otherwise returns FALSE.
331
332 *---------------------------------------------------------------------------*/
333
334 BOOL MB_SetParentCommSize(u16 sendSize);
335
336 /*---------------------------------------------------------------------------*
337 Name: MB_SetParentCommParam
338
339 Description: Sets the size of the parent's communication data that is used for MB communication, and the maximum number of children that can connect.
340 Use this between the time MB_Init is started and the time MB_StartParent is called.
341 Buffer size cannot be changed after communications begins.
342
343 Arguments: sendSize: The size of send data that is sent from parent device to each child device.
344 maxChildren: Maximum number of connected children
345
346 Returns: If changing the size of the send/receive data succeeds, returns TRUE; otherwise returns FALSE.
347
348 *---------------------------------------------------------------------------*/
349
350 BOOL MB_SetParentCommParam(u16 sendSize, u16 maxChildren);
351
352 /*---------------------------------------------------------------------------*
353 Name: MB_GetTgid
354
355 Description: Acquires the TGID used in WM as regards the MB library.
356
357 Arguments: None.
358
359 Returns: Returns the TGID used in WM.
360 *---------------------------------------------------------------------------*/
361
362 u16 MB_GetTgid(void);
363
364
365 /*---------------------------------------------------------------------------*
366 Name: MB_End
367
368 Description: Shuts down the MB library.
369
370 Arguments: None.
371
372 Returns: None.
373 *---------------------------------------------------------------------------*/
374
375 void MB_End(void);
376
377
378 /*---------------------------------------------------------------------------*
379 Name: MB_EndToIdle
380
381 Description: Shuts down the MB library.
382 However the WM library will be kept in an idle state.
383
384 Arguments: None.
385
386 Returns: None.
387 *---------------------------------------------------------------------------*/
388
389 void MB_EndToIdle(void);
390
391 /*---------------------------------------------------------------------------*
392 Name: MB_DisconnectChild
393
394 Description: Disconnects a child.
395
396 Arguments: aid: aid of the child to disconnect.
397
398 Returns: Returns MB_SUCCESS if start succeeds.
399 *---------------------------------------------------------------------------*/
400
401 void MB_DisconnectChild(u16 aid);
402
403
404 /*---------------------------------------------------------------------------*
405 Name: MB_StartParent
406
407 Description: Parent parameter setting & start
408
409 Arguments: channel: Channel used for communicating as a parent
410
411 Returns: Returns MB_SUCCESS if start succeeds.
412 *---------------------------------------------------------------------------*/
413
414 int MB_StartParent(int channel);
415
416
417 /*---------------------------------------------------------------------------*
418 Name: MB_StartParentFromIdle
419
420 Description: Parent parameter setting & start.
421 However, the WM library must be in an idle state.
422
423 Arguments: channel: Channel used for communicating as a parent
424
425 Returns: Returns MB_SUCCESS if start succeeds.
426 *---------------------------------------------------------------------------*/
427
428 int MB_StartParentFromIdle(int channel);
429
430 /*---------------------------------------------------------------------------*
431 Name: MB_CommGetChildrenNumber
432
433 Description: Acquires the total number of children that are currently entered.
434
435 Arguments: None.
436
437 Returns: Returns the total number of children that the parent currently recognizes.
438 *---------------------------------------------------------------------------*/
439
440 u8 MB_CommGetChildrenNumber(void);
441
442
443 /*---------------------------------------------------------------------------*
444 Name: MB_CommGetChildUser
445
446 Description: Acquires information belonging to a child that has a specified aid.
447
448 Arguments: child_aid: aid that specifies the child for which status is being acquired
449
450 Returns: Returns MB_SUCCESS if start succeeds.
451 *---------------------------------------------------------------------------*/
452
453 const MBUserInfo *MB_CommGetChildUser(u16 child_aid);
454
455
456 /*---------------------------------------------------------------------------*
457 Name: MB_CommGetParentState
458
459 Description: Acquires the state of a parent with respect to a child that has a specified aid.
460
461 Arguments: child_aid: aid that specifies the child for which status is being acquired
462
463 Returns: Returns one of the states indicated by MBCommPState.
464 *---------------------------------------------------------------------------*/
465
466 int MB_CommGetParentState(u16 child);
467
468
469 /*---------------------------------------------------------------------------*
470 Name: MB_CommSetParentStateCallback
471
472 Description: Sets the parent state notification callback.
473
474 Arguments: callback: Pointer to the callback function that notifies of the parent's state
475
476 Returns: None.
477 *---------------------------------------------------------------------------*/
478
479 void MB_CommSetParentStateCallback(MBCommPStateCallback callback);
480
481
482 /*---------------------------------------------------------------------------*
483 Name: MB_GetSegmentLength
484
485 Description: Gets the length of the segment buffer that is required for the specified binary file.
486
487 Arguments: file: FSFile structure that points to a binary file
488
489 Returns: Returns a positive value if it can properly get size. Otherwise returns 0.
490 *---------------------------------------------------------------------------*/
491
492 u32 MB_GetSegmentLength(FSFile *file);
493
494
495 /*---------------------------------------------------------------------------*
496 Name: MB_ReadSegment
497
498 Description: Reads the required segment data from the specified binary file.
499
500 Arguments: file: FSFile structure that points to a binary file
501 buf: Buffer for reading segment data
502 len: Size of buf
503
504 Returns: Returns TRUE if it properly reads segment data. Otherwise returns FALSE.
505 *---------------------------------------------------------------------------*/
506
507 BOOL MB_ReadSegment(FSFile *file, void *buf, u32 len);
508
509
510 /*---------------------------------------------------------------------------*
511 Name: MB_RegisterFile
512
513 Description: Registers the specified file in the download list.
514
515 Arguments: game_reg: Pointer to the MBGameRegistry structure where information of the program to be registered is stored.
516
517 buf: - Pointer to the memory that holds extracted segment information
518 This segment information is obtained with the MB_ReadSegment function.
519
520 Returns: Returns TRUE if the file was registered properly and FALSE otherwise.
521
522 *---------------------------------------------------------------------------*/
523
524 BOOL MB_RegisterFile(const MBGameRegistry *game_reg, const void *buf);
525
526
527 /*---------------------------------------------------------------------------*
528 Name: MB_UnregisterFile
529
530 Description: Deletes the specified file from the download list.
531
532 Arguments: game_reg: Pointer to the MBGameRegistry structure where information of the program to be registered is stored.
533
534
535 Returns: Returns TRUE if the file was deleted properly and FALSE otherwise.
536
537 *---------------------------------------------------------------------------*/
538
539 void *MB_UnregisterFile(const MBGameRegistry *game_reg);
540
541
542 /*---------------------------------------------------------------------------*
543 Name: MB_CommResponseRequest
544
545 Description: Specifies a response to a connect request from a child.
546
547 Arguments: child_aid: aid that specifies the child to send a response to
548 ack: - Specifies the acknowledgement response result to a child.
549 Enumerated value for the MBCommResponseRequestType type.
550
551 Returns: Returns TRUE if the specified child is waiting for a connect response, and if the specified response type is appropriate; otherwise returns FALSE.
552
553
554 *---------------------------------------------------------------------------*/
555
556 BOOL MB_CommResponseRequest(u16 child_aid, MBCommResponseRequestType ack);
557
558
559 /*---------------------------------------------------------------------------*
560 Name: MB_CommStartSending
561
562 Description: Begins sending a boot image to a child that has a specified aid (and that has been entered).
563
564 Arguments: child_aid: aid that specifies the child to begin sending a boot image to
565
566 Returns: Returns TRUE if the specified child has been entered and FALSE otherwise.
567
568 *---------------------------------------------------------------------------*/
569
MB_CommStartSending(u16 child_aid)570 static inline BOOL MB_CommStartSending(u16 child_aid)
571 {
572 return MB_CommResponseRequest(child_aid, MB_COMM_RESPONSE_REQUEST_DOWNLOAD);
573 }
574
575
576 /*---------------------------------------------------------------------------*
577 Name: MB_CommStartSendingAll
578
579 Description: Begins sending a boot image to the children that have entered.
580
581 Arguments: None.
582
583 Returns: Returns TRUE if there is a child that has performed entry and FALSE otherwise.
584
585 *---------------------------------------------------------------------------*/
586
MB_CommStartSendingAll(void)587 static inline BOOL MB_CommStartSendingAll(void)
588 {
589 u8 child, num;
590
591 for (num = 0, child = 1; child <= WM_NUM_MAX_CHILD; child++)
592 {
593 if (TRUE == MB_CommStartSending(child))
594 {
595 num++;
596 }
597 }
598
599 if (num == 0)
600 return FALSE;
601
602 return TRUE;
603 }
604
605
606 /*---------------------------------------------------------------------------*
607 Name: MB_CommIsBootable
608
609 Description: Determines whether a boot is possible.
610
611 Arguments: child_aid: AID of target child
612
613 Returns: yes - TRUE no - FALSE
614 *---------------------------------------------------------------------------*/
615
616 BOOL MB_CommIsBootable(u16 child_aid);
617
618
619 /*---------------------------------------------------------------------------*
620 Name: MB_CommBootRequest
621
622 Description: Sends a boot request to a specified child that has completed download.
623
624 Arguments: child_aid: AID of target child
625
626 Returns: success - TRUE failed - FALSE
627 *---------------------------------------------------------------------------*/
628
MB_CommBootRequest(u16 child_aid)629 static inline BOOL MB_CommBootRequest(u16 child_aid)
630 {
631 return MB_CommResponseRequest(child_aid, MB_COMM_RESPONSE_REQUEST_BOOT);
632 }
633
634
635 /*---------------------------------------------------------------------------*
636 Name: MB_CommBootRequestAll
637
638 Description: Sends a boot request to children that have completed download.
639
640 Arguments: None.
641
642 Returns: success - TRUE failed - FALSE
643 *---------------------------------------------------------------------------*/
644
MB_CommBootRequestAll(void)645 static inline BOOL MB_CommBootRequestAll(void)
646 {
647 u8 child, num;
648
649 for (num = 0, child = 1; child <= WM_NUM_MAX_CHILD; child++)
650 {
651 if (TRUE == MB_CommBootRequest(child))
652 {
653 num++;
654 }
655 }
656
657 if (num == 0)
658 return FALSE;
659
660 return TRUE;
661 }
662
663
664 /*---------------------------------------------------------------------------*
665 Name: MB_GetGameEntryBitmap
666
667 Description: Obtains the bitmap of AIDs that have been entered for the GameRegistry being distributed.
668
669
670 Arguments: game_req: - Pointer to the target GameRegistry
671
672 Returns: Bitmap of AIDs entered in the specified GameRegistry
673 (Parent AID: 0, Child AID: 1-15)
674 If a game is not in distribution, the return value is 0.
675 (If a game is being distributed, parent AID:0 is always included in the entry members.�j
676
677 *---------------------------------------------------------------------------*/
678
679 u16 MB_GetGameEntryBitmap(const MBGameRegistry *game_reg);
680
681
682 /* ---------------------------------------------------------------------
683
684 Multiboot library (MB) API - For booted child
685
686 ---------------------------------------------------------------------*/
687
688 /*---------------------------------------------------------------------------*
689 Name: MB_GetMultiBootParam
690
691 Description: Acquires a pointer to the location where parent information for a multiboot child is maintained.
692
693 Arguments: None.
694
695 Returns: None.
696 *---------------------------------------------------------------------------*/
697
MB_GetMultiBootParam(void)698 static inline const MBParam *MB_GetMultiBootParam(void)
699 {
700 return (const MBParam *)HW_WM_BOOT_BUF;
701 }
702
703
704 /*---------------------------------------------------------------------------*
705 Name: MB_IsMultiBootChild
706
707 Description: Determines whether a device is a multiboot child.
708 If TRUE, MB_GetMultiBootParentBssDesc() is valid.
709
710 Arguments: None.
711
712 Returns: TRUE if a multiboot child.
713 *---------------------------------------------------------------------------*/
714
MB_IsMultiBootChild(void)715 static inline BOOL MB_IsMultiBootChild(void)
716 {
717 return MB_GetMultiBootParam()->boot_type == MB_TYPE_MULTIBOOT;
718 }
719
720
721 /*---------------------------------------------------------------------------*
722 Name: MB_GetMultiBootParentBssDesc
723
724 Description: If a multiboot child, returns a pointer to parent information.
725
726 Arguments: None.
727
728 Returns: Returns a valid pointer if the device is a multiboot child. Otherwise returns NULL.
729 *---------------------------------------------------------------------------*/
730
MB_GetMultiBootParentBssDesc(void)731 static inline const MBParentBssDesc *MB_GetMultiBootParentBssDesc(void)
732 {
733 return MB_IsMultiBootChild()? &MB_GetMultiBootParam()->parent_bss_desc : NULL;
734 }
735
736 /*---------------------------------------------------------------------------*
737 Name: MB_GetMultiBootDownloadParameter
738
739 Description: If a multiboot child, the user-defined extended parameter specified at download is returned.
740
741
742 Arguments: None.
743
744 Returns: Returns a valid pointer if the device is a multiboot child. Otherwise returns NULL.
745 *---------------------------------------------------------------------------*/
746
MB_GetMultiBootDownloadParameter(void)747 static inline const u8 *MB_GetMultiBootDownloadParameter(void)
748 {
749 return MB_IsMultiBootChild()? (const u8 *)HW_DOWNLOAD_PARAMETER : NULL;
750 }
751
752 /*---------------------------------------------------------------------------*
753 Name: MB_ReadMultiBootParentBssDesc
754
755 Description: Based on information inherited from the multiboot parent, sets information in the WMBssDesc structure that is used in the WM_StartConnect function.
756
757
758
759 Arguments: p_desc: pointer to destination WMBssDesc
760 (must be aligned 32-bytes)
761 parent_max_size: max packet length of parent in MP-protocol.
762 (must be equal to parent's WMParentParam!)
763 child_max_size: max packet length of child in MP-protocol.
764 (must be equal to parent's WMParentParam!)
765 ks_flag: if using key-sharing mode, TRUE.
766 (must be equal to parent's WMParentParam!)
767 cs_flag: if using continuous mode, TRUE.
768 (must be equal to parent's WMParentParam!)
769
770 Returns: None.
771 *---------------------------------------------------------------------------*/
772 void MB_ReadMultiBootParentBssDesc(WMBssDesc *p_desc,
773 u16 parent_max_size, u16 child_max_size, BOOL ks_flag,
774 BOOL cs_flag);
775
776 /*---------------------------------------------------------------------------*
777 Name: MB_SetLifeTime
778
779 Description: Explicitly specifies the lifetime of MB wireless operation.
780 Default value: ( 0xFFFF, 40, 0xFFFF, 40 ).
781
782 Arguments: tableNumber: CAM table number that sets the lifetime.
783 camLifeTime: Lifetime of CAM table
784 frameLifeTime: Lifetime in frame units
785 mpLifeTime: MP communication lifetime
786
787 Returns: None.
788 *---------------------------------------------------------------------------*/
789 void MB_SetLifeTime(u16 tableNumber, u16 camLifeTime, u16 frameLifeTime, u16 mpLifeTime);
790
791 /*---------------------------------------------------------------------------*
792 Name: MB_SetPowerSaveMode
793
794 Description: Configures power-save mode.
795 Power-save mode is enabled by default.
796 This function is an option for stable operation during situations where power consumption is not a concern. This option should not be used by typical game applications unless they are being operated in an environment in which connection to power is guaranteed.
797
798
799
800
801 Arguments: enable: To enable, TRUE; to disable, FALSE.
802
803 Returns: None.
804 *---------------------------------------------------------------------------*/
805 void MB_SetPowerSaveMode(BOOL enable);
806
807 /*---------------------------------------------------------------------------*/
808 /* Internal Functions */
809
810 /*---------------------------------------------------------------------------*
811 Name: MBi_AdjustSegmentMapForCloneboot
812
813 Description: Adjusts placement of the .parent section for clone booting.
814 This originally had a fixed placement at ARM9.static[00005000-00007000], but this is not necessarily true anymore because extended TWL-SDK features cause the size of crt0.o to be increased.
815
816
817 It is therefore not possible for hybrid applications to clone boot at this point in time. Nevertheless, this is tentatively possible (without any guarantees) if you continue to call this function manually and change the arguments to emuchild.exe.
818
819
820
821 Arguments: None.
822
823 Returns: None.
824 *---------------------------------------------------------------------------*/
825 void MBi_AdjustSegmentMapForCloneboot();
826
827
828 /*****************************************************************************/
829 /* Obsolete Interfaces */
830
831 #define MB_StartParentEx(channel) SDK_ERR("MB_StartParentEx() is discontinued. please use MB_StartParentFromIdle()\n")
832 #define MB_EndEx() SDK_ERR("MB_EndEx() is discontinued. please use MB_EndToIdle()\n")
833
834
835
836 #ifdef __cplusplus
837 } /* extern "C" */
838 #endif
839
840
841 #endif // NITRO_MB_MB_H_
842