diff options
Diffstat (limited to 'arm9/lib')
| -rw-r--r-- | arm9/lib/include/WM.h | 61 | ||||
| -rw-r--r-- | arm9/lib/include/WM_ks.h | 9 | ||||
| -rw-r--r-- | arm9/lib/src/WM_ks.c | 15 | 
3 files changed, 85 insertions, 0 deletions
| diff --git a/arm9/lib/include/WM.h b/arm9/lib/include/WM.h new file mode 100644 index 00000000..ad287292 --- /dev/null +++ b/arm9/lib/include/WM.h @@ -0,0 +1,61 @@ +#ifndef POKEDIAMOND_WM_H +#define POKEDIAMOND_WM_H + +#include "nitro/types.h" + +typedef struct WMDataSet +{ +    u16 aidBitmap; +    u16 receivedBitmap; +    u16 data[508 / sizeof(u16)]; +} WMDataSet; + +typedef struct WMDataSharingInfo +{ +    WMDataSet ds[4]; +    u16 seqNum[4]; +    u16 writeIndex; +    u16 sendIndex; +    u16 readIndex; +    u16 aidBitmap; +    u16 dataLength; +    u16 stationNumber; +    u16 dataSetLength; +    u16 port; +    u16 doubleMode; +    u16 currentSeqNum; +    u16 state; +    u16 reserved[1]; +} WMDataSharingInfo; + +typedef WMDataSharingInfo WMKeySetBuf; + +typedef enum WMErrCode +{ +    WM_ERRCODE_SUCCESS = 0, +    WM_ERRCODE_FAILED = 1, +    WM_ERRCODE_OPERATING = 2, +    WM_ERRCODE_ILLEGAL_STATE = 3, +    WM_ERRCODE_WM_DISABLE = 4, +    WM_ERRCODE_NO_KEYSET = 5, +    WM_ERRCODE_NO_DATASET = 5, +    WM_ERRCODE_INVALID_PARAM = 6, +    WM_ERRCODE_NO_CHILD = 7, +    WM_ERRCODE_FIFO_ERROR = 8, +    WM_ERRCODE_TIMEOUT = 9, +    WM_ERRCODE_SEND_QUEUE_FULL = 10, +    WM_ERRCODE_NO_ENTRY = 11, +    WM_ERRCODE_OVER_MAX_ENTRY = 12, +    WM_ERRCODE_INVALID_POLLBITMAP = 13, +    WM_ERRCODE_NO_DATA = 14, +    WM_ERRCODE_SEND_FAILED = 15, + +    WM_ERRCODE_DCF_TEST, +    WM_ERRCODE_WL_INVALID_PARAM, +    WM_ERRCODE_WL_LENGTH_ERR, + +    WM_ERRCODE_FLASH_ERROR, +    WM_ERRCODE_MAX +} WMErrCode; + +#endif //POKEDIAMOND_WM_H diff --git a/arm9/lib/include/WM_ks.h b/arm9/lib/include/WM_ks.h new file mode 100644 index 00000000..0eeb6b1b --- /dev/null +++ b/arm9/lib/include/WM_ks.h @@ -0,0 +1,9 @@ +#ifndef POKEDIAMOND_WM_KS_H +#define POKEDIAMOND_WM_KS_H + +#include "WM.h" + +WMErrCode WM_StartKeySharing(WMKeySetBuf *buf, u16 port); +WMErrCode WM_EndKeySharing(WMKeySetBuf *buf); + +#endif //POKEDIAMOND_WM_KS_H diff --git a/arm9/lib/src/WM_ks.c b/arm9/lib/src/WM_ks.c new file mode 100644 index 00000000..93e96f89 --- /dev/null +++ b/arm9/lib/src/WM_ks.c @@ -0,0 +1,15 @@ +#include "WM_ks.h" +#include "function_target.h" + +extern WMErrCode WM_StartDataSharing(WMKeySetBuf *buf, u16 port, u16 aidBitmap, u16 dataLength, BOOL doubleMode); +extern WMErrCode WM_EndDataSharing(WMKeySetBuf *buf); + +ARM_FUNC WMErrCode WM_StartKeySharing(WMKeySetBuf *buf, u16 port) +{ +    return WM_StartDataSharing(buf, port, 0xffff, 2, TRUE); +} + +ARM_FUNC WMErrCode WM_EndKeySharing(WMKeySetBuf *buf) +{ +    return WM_EndDataSharing(buf); +} | 
