10 #include "../sf/service.h"
11 #include "../services/mii.h"
27 NfpState_NonInitialized = 0,
28 NfpState_Initialized = 1,
32 NfcState_NonInitialized = 0,
33 NfcState_Initialized = 1,
37 NfpDeviceState_Initialized = 0,
38 NfpDeviceState_SearchingForTag = 1,
39 NfpDeviceState_TagFound = 2,
40 NfpDeviceState_TagRemoved = 3,
41 NfpDeviceState_TagMounted = 4,
42 NfpDeviceState_Unavailable = 5,
43 NfpDeviceState_Finalized = 6,
47 NfcDeviceState_Initialized = 0,
48 NfcDeviceState_SearchingForTag = 1,
49 NfcDeviceState_TagFound = 2,
50 NfcDeviceState_TagRemoved = 3,
51 NfcDeviceState_TagMounted = 4,
52 NfcDeviceState_Unavailable = 5,
53 NfcDeviceState_Finalized = 6,
57 NfpApplicationAreaVersion_3DS = 0,
58 NfpApplicationAreaVersion_WiiU = 1,
59 NfpApplicationAreaVersion_3DSv2 = 2,
60 NfpApplicationAreaVersion_Switch = 3,
61 NfpApplicationAreaVersion_NotSet = 0xFF,
62 } NfpApplicationAreaVersion;
65 NfpDeviceType_Amiibo = 0,
69 NfpMountTarget_Rom = 1,
70 NfpMountTarget_Ram = 2,
71 NfpMountTarget_All = 3,
79 NfcProtocol_All = 0xFFFFFFFF,
91 NfcTagType_All = 0xFFFFFFFF,
95 NfcMifareCommand_Read = 0x30,
96 NfcMifareCommand_AuthA = 0x60,
97 NfcMifareCommand_AuthB = 0x61,
98 NfcMifareCommand_Write = 0xA0,
99 NfcMifareCommand_Transfer = 0xB0,
100 NfcMifareCommand_Decrement = 0xC0,
101 NfcMifareCommand_Increment = 0xC1,
102 NfcMifareCommand_Store = 0xC2,
129 u32 application_area_size;
140 u16 first_write_year;
141 u8 first_write_month;
143 char amiibo_name[(10*4)+1];
149 u8 mii_store_data[0x44];
150 u16 first_write_year;
151 u8 first_write_month;
153 char amiibo_name[(10*4)+1];
160 u32 application_area_id;
161 u16 crc_change_counter;
164 u8 application_area_version;
178 u16 application_write_counter;
180 u32 application_area_size;
184 u16 first_write_year;
185 u8 first_write_month;
190 u32 register_info_crc;
195 u16 settings_crc_counter;
201 u8 application_area[0xD8];
280 Result nfpMount(
const NfcDeviceHandle *handle, NfpDeviceType device_type, NfpMountTarget mount_target);
350 Result nfpGetState(NfpState *out);
361 Result nfcMfGetState(NfcState *out);
Result nfcGetNpadId(const NfcDeviceHandle *handle, u32 *out)
Only available with [4.0.0+].
Result nfpBreakTag(const NfcDeviceHandle *handle, u32 break_type)
Only available with NfpServiceType_Debug.
Result nfpSetRegisterInfoPrivate(const NfcDeviceHandle *handle, const NfpRegisterInfoPrivate *register_info_private)
Not available with NfpServiceType_User.
Result nfcAttachActivateEvent(const NfcDeviceHandle *handle, Event *out_event)
Returned event will have autoclear off.
Service * nfcMfGetServiceSession_Interface(void)
Gets the Service object for the interface from nfc:mf:u.
Service * nfpGetServiceSession(void)
Gets the Service object for the actual nfp:* service session.
Result nfpAttachActivateEvent(const NfcDeviceHandle *handle, Event *out_event)
Returned event will have autoclear off.
NfcServiceType
NfcServiceType.
Definition: nfc.h:21
@ NfcServiceType_System
Initializes nfc:sys.
Definition: nfc.h:23
@ NfcServiceType_User
Initializes nfc:user.
Definition: nfc.h:22
Result nfpWriteBackupData(const NfcDeviceHandle *handle, const void *buf, size_t buf_size)
Only available with NfpServiceType_Debug.
void nfcExit(void)
Exit nfc:*.
Result nfcAttachAvailabilityChangeEvent(Event *out_event)
Returned event will have autoclear on.
Result nfcMfAttachActivateEvent(const NfcDeviceHandle *handle, Event *out_event)
Returned event will have autoclear off.
Result nfcInitialize(NfcServiceType service_type)
Initialize nfc:*.
Result nfcWriteMifare(const NfcDeviceHandle *handle, const NfcMifareWriteBlockParameter *write_block_parameter, s32 count)
Only available with [4.0.0+].
Result nfpInitialize(NfpServiceType service_type)
Initialize nfp:*.
Result nfpRecreateApplicationArea(const NfcDeviceHandle *handle, u32 app_id, const void *buf, size_t buf_size)
Not available with NfpServiceType_System.
Result nfpSetApplicationArea(const NfcDeviceHandle *handle, const void *buf, size_t buf_size)
Not available with NfpServiceType_System.
Result nfpGetApplicationAreaSize(const NfcDeviceHandle *handle, u32 *out_app_area_size)
Not available with NfpServiceType_System.
Result nfpAttachDeactivateEvent(const NfcDeviceHandle *handle, Event *out_event)
Returned event will have autoclear off.
Result nfpReadBackupData(const NfcDeviceHandle *handle, void *out_buf, size_t buf_size, u32 *out_size)
Only available with NfpServiceType_Debug.
NfcProtocol
Definition: nfc.h:74
@ NfcProtocol_TypeA
ISO14443A.
Definition: nfc.h:76
@ NfcProtocol_TypeB
ISO14443B.
Definition: nfc.h:77
@ NfcProtocol_TypeF
Sony FeliCa.
Definition: nfc.h:78
Service * nfpGetServiceSession_Interface(void)
Gets the Service object for the interface from nfp:*.
Result nfcStartDetection(const NfcDeviceHandle *handle, NfcProtocol protocol)
Only available with [4.0.0+].
Result nfcMfAttachAvailabilityChangeEvent(Event *out_event)
Returned event will have autoclear on.
Result nfpWriteNtf(const NfcDeviceHandle *handle, u32 write_type, const void *buf, size_t buf_size)
Only available with NfpServiceType_Debug.
Result nfpAttachAvailabilityChangeEvent(Event *out_event)
Returned event will have autoclear on.
Result nfcGetState(NfcState *out)
Only available with [4.0.0+].
Result nfcGetTagInfo(const NfcDeviceHandle *handle, NfcTagInfo *out)
Only available with [4.0.0+].
Service * nfcGetServiceSession(void)
Gets the Service object for the actual nfc:* service session.
void nfcMfExit(void)
Exit nfc:mf:u.
Result nfpGetRegisterInfoPrivate(const NfcDeviceHandle *handle, NfpRegisterInfoPrivate *out)
Not available with NfpServiceType_User.
Result nfcAttachDeactivateEvent(const NfcDeviceHandle *handle, Event *out_event)
Returned event will have autoclear off.
Result nfpFlushDebug(const NfcDeviceHandle *handle)
Only available with NfpServiceType_Debug.
Result nfpGetAdminInfo(const NfcDeviceHandle *handle, NfpAdminInfo *out)
Not available with NfpServiceType_User.
Service * nfcMfGetServiceSession(void)
Gets the Service object for the actual nfc:mf:u service session.
Result nfcStopDetection(const NfcDeviceHandle *handle)
Only available with [4.0.0+].
Result nfcListDevices(s32 *total_out, NfcDeviceHandle *out, s32 count)
Only available with [4.0.0+].
NfcTagType
Definition: nfc.h:82
@ NfcTagType_Type4B
ISO14443B RW/RO. DESFire.
Definition: nfc.h:88
@ NfcTagType_Type4A
ISO14443A RW/RO. DESFire.
Definition: nfc.h:87
@ NfcTagType_Mifare
Mifare clasic. Skylanders.
Definition: nfc.h:90
@ NfcTagType_Type3
ISO14443A RW/RO. Sony FeliCa.
Definition: nfc.h:86
@ NfcTagType_Type2
ISO14443A RW. Ultralight, NTAGX, ST25TN.
Definition: nfc.h:85
@ NfcTagType_Type1
ISO14443A RW. Topaz.
Definition: nfc.h:84
@ NfcTagType_Type5
ISO15693 RW/RO. SLI, SLIX, ST25TV.
Definition: nfc.h:89
Result nfcReleasePassThroughSession(const NfcDeviceHandle *handle)
Only available with [4.0.0+].
Result nfcMfInitialize()
Initialize nfc:mf:u.
Result nfpOpenApplicationArea(const NfcDeviceHandle *handle, u32 app_id)
Not available with NfpServiceType_System.
Result nfpGetApplicationArea(const NfcDeviceHandle *handle, void *buf, size_t buf_size, u32 *out_size)
Not available with NfpServiceType_System.
NfpServiceType
NfpServiceType.
Definition: nfc.h:14
@ NfpServiceType_User
Initializes nfp:user.
Definition: nfc.h:15
@ NfpServiceType_System
Initializes nfp:sys.
Definition: nfc.h:17
@ NfpServiceType_Debug
Initializes nfp:dbg.
Definition: nfc.h:16
Result nfcMfAttachDeactivateEvent(const NfcDeviceHandle *handle, Event *out_event)
Returned event will have autoclear off.
Result nfcReadMifare(const NfcDeviceHandle *handle, NfcMifareReadBlockData *out_block_data, const NfcMifareReadBlockParameter *read_block_parameter, s32 count)
Only available with [4.0.0+].
Result nfcSendCommandByPassThrough(const NfcDeviceHandle *handle, u64 timeout, const void *cmd_buf, size_t cmd_buf_size, void *reply_buf, size_t reply_buf_size, u64 *out_size)
Only available with [4.0.0+].
Result nfpDeleteApplicationArea(const NfcDeviceHandle *handle)
Not available with NfpServiceType_User.
Result nfcKeepPassThroughSession(const NfcDeviceHandle *handle)
Only available with [4.0.0+].
Result nfpCreateApplicationArea(const NfcDeviceHandle *handle, u32 app_id, const void *buf, size_t buf_size)
Not available with NfpServiceType_System.
void nfpExit(void)
Exit nfp:*.
Result nfpFormat(const NfcDeviceHandle *handle)
Not available with NfpServiceType_User.
Service * nfcGetServiceSession_Interface(void)
Gets the Service object for the interface from nfc:*.
Result nfpDeleteRegisterInfo(const NfcDeviceHandle *handle)
Not available with NfpServiceType_User.
Result nfpExistsApplicationArea(const NfcDeviceHandle *handle, bool *out)
Not available with NfpServiceType_User.
Result nfcGetDeviceState(const NfcDeviceHandle *handle, NfcDeviceState *out)
Only available with [4.0.0+].
Result nfcIsNfcEnabled(bool *out)
This uses nfc:*.
Result nfpSetAll(const NfcDeviceHandle *handle, const NfpData *nfp_data)
Only available with NfpServiceType_Debug.
Result nfpGetAll(const NfcDeviceHandle *handle, NfpData *out)
Only available with NfpServiceType_Debug.
Kernel-mode event structure.
Definition: event.h:13
Nfc/Nfp DeviceHandle.
Definition: nfc.h:237
u8 unknown
Usually 1.
Definition: nfc.h:206
u8 unknown1
Normally zero.
Definition: nfc.h:189
u8 application_id_byte
(Original Program ID >> 0x24) & 0xF byte (Program ID has this byte swapped with console type)
Definition: nfc.h:199
u8 settings_flag
bit4 = amiibo was initialized in console settings, bit5 = has application area
Definition: nfc.h:188
Service object structure.
Definition: service.h:14
#define BIT(n)
Creates a bitmask from a bit number.
Definition: types.h:54
uint64_t u64
64-bit unsigned integer.
Definition: types.h:22
uint8_t u8
8-bit unsigned integer.
Definition: types.h:19
#define NX_PACKED
Packs a struct so that it won't include padding bytes.
Definition: types.h:63
uint16_t u16
16-bit unsigned integer.
Definition: types.h:20
u32 Result
Function error code result type.
Definition: types.h:44
int32_t s32
32-bit signed integer.
Definition: types.h:27
uint32_t u32
32-bit unsigned integer.
Definition: types.h:21