📄 iap.h
字号:
uint32 Dig : 1; uint32 res22: 5; /* 1st byte*/ uint32 Gen : 1; uint32 Mic : 1; uint32 Sim : 1; uint32 Dis : 1; uint32 Ext : 1; uint32 RFt : 1; uint32 res11: 1; uint32 res12: 1;} tIapGenDevLingoesSpoken;typedef struct{ /* 4th byte */ uint32 res4 : 8; /* 3rd byte */ uint32 res3 : 8; /* 2nd byte */ uint32 res2 : 8; /* 1st byte */ uint32 AuthCtrl : 2; uint32 PowerCtrl : 2; uint32 res1 : 4;} tIapGenOptions;typedef struct{ union { uint32 flags; tIapGenDevLingoesSpoken flag; } DevLingoesSpoken; union { uint32 flags; tIapGenOptions flag; } Options; uint32 DeviceID;} tIapGenCmd0x13Data;typedef struct{ teIapVersion VerNum; union { struct { uint8 AuthMajVer; uint8 AuthMinVer; } V1; struct { uint8 AuthMajVer; uint8 AuthMinVer; uint8 CurSectIndex; uint8 MaxSectIndex; uint8* pCertData; uint16 CertDataLen; } V2; } Version;} tIapGenCmd0x15Data;typedef struct{ teIapVersion VerNum :8; union { struct { uint8 Challenge[C_ACP_CHALLENGE_V1_LENGTH]; uint8 AuthRetryCount; } V1; struct { uint8 Challenge[C_ACP_CHALLENGE_V2_LENGTH]; uint8 AuthRetryCount; } V2; } Version;} tIapGenCmd0x17iData;typedef struct{ uint16 SignatureLen; uint8* pSignData;} tIapGenCmd0x18Data;typedef struct{ teIapVersion VerNum; union { struct { uint8 AuthMajorVerNum; uint8 AuthMinorVerNum; uint16 AuthIndexHi; uint16 AuthIndexLo; } V1; struct { uint8 AuthMajorVerNum; uint8 AuthMinorVerNum; uint8 CurSectIndex; uint8 MaxSectIndex; uint16 CertDataLen; uint8 CertData[C_IAP_MAX_CERTIFICATE_LENGTH]; } V2; } Version;} tIapGenCmd0x1BiData;typedef struct{ teIapVersion VerNum; union { struct { uint8 Challenge[C_ACP_CHALLENGE_V1_LENGTH]; uint16 AuthIndex; uint8 AuthRetryCount; } V1; struct { uint8 Challenge[C_ACP_CHALLENGE_V2_LENGTH]; uint8 AuthRetryCount; } V2; } Version;} tIapGenCmd0x1DData;typedef struct{ uint8 OptionBits63_56; uint8 OptionBits55_48; uint8 OptionBits47_40; uint8 OptionBits39_32; uint8 OptionBits31_24; uint8 OptionBits23_16; uint8 OptionBits15_8; uint8 OptionBits7_0;} tIapGenCmd0x25Data;//TBD - check big-endian!typedef __packed union{ uint32 flags; __packed struct { /* 4th byte*/ uint32 res4 :8; /* 3rd byte*/ uint32 res3 :8; /* 2nd byte*/ uint32 SerialNum :1; uint32 InMaxPloadSize :1; uint32 res2 :6; /* 1st byte*/ uint32 InfoCapab :1; uint32 Name :1; uint32 MinSupFWVer :1; uint32 MinSupLingoVer :1; uint32 FWVer :1; uint32 HWVer :1; uint32 Manufacturer :1; uint32 ModelNum :1; } flag;} tIapAccessoryInfoCap;typedef struct{ teIapInfoType InfoType :8; __packed union { __packed struct { uint32 iModelId; uint8 FWMajorVer; uint8 FWMinorVer; uint8 FWRevVer; } Type2; __packed struct { teIapLingoId LingoId; } Type3; } Params;} tIapGenCmd0x27iData;typedef struct{ teIapInfoType InfoType :8; __packed union { __packed struct { tIapAccessoryInfoCap Capab; } Type0; __packed struct { uint8* pString; uint16 StringLen; } Type1678; __packed struct { uint32 iModelId; uint8 MinSupFWMajorVer; uint8 MinSupFWMinorVer; uint8 MinSupFWRevVer; } Type2; __packed struct { teIapLingoId LingoId; uint8 MajorProtocolVer; uint8 MinorProtocolVer; } Type3; __packed struct { uint8 AccMajorVerNum; uint8 AccMinorVerNum; uint8 AccRevVerNum; } Type45; __packed struct { uint16 MaxPayloadSize; } Type9; } Params;} tIapGenCmd0x28Data;/*---------------------------------------------------------------------------*//*!\brief Extended Lingo command payloads; *//*---------------------------------------------------------------------------*/typedef struct{ teIapAck result :8; uint16 CmdAck;} tIapExtCmd0x01iData;typedef enum{ IAP_CNTRL_PLAY_PAUSE = 0x01, IAP_CNTRL_STOP, IAP_CNTRL_NEXT, IAP_CNTRL_PREV, IAP_CNTRL_FF, IAP_CNTRL_RW, IAP_CNTRL_END_FFRW, IAP_CNTRL_NEXT_CHAPTER, IAP_CNTRL_PREV_CHAPTER} teIapExt0x29Data;/***************** APPLICATION STRUCTURES & TYPES ****************/typedef union{ uint8 flags; struct { uint8 Timer :1; uint8 TxAck :1; uint8 Rx :1; uint8 RxAcp :1; uint8 Cmd :1; uint8 padding :3; } flag;} tuIapInEvent;typedef union{ uint8 flags; struct { uint8 RxAck :1; uint8 Tx :1; uint8 TxCP :1; uint8 padding :5; } flag;} tuIapOutEvent;typedef enum{ IAP_FSM_DONE = 0, IAP_FSM_INIT, /* 1 */ IAP_FSM_AUTH_REQ_CP_INFO, /* 2 */ IAP_FSM_AUTH_GET_CP_INFO, /* 3 */ IAP_FSM_AUTH_TX_13, /* 4 */ IAP_FSM_AUTH_RX_ACK13, /* 5 */ IAP_FSM_AUTH_RX_14, /* 6 */ IAP_FSM_AUTH_REQ_CP_PAGE, /* 7 */ IAP_FSM_AUTH_GET_CP_PAGE, /* 8 */ IAP_FSM_AUTH_TX_15, /* 9 */ IAP_FSM_AUTH_RX_16, /* 10 */ IAP_FSM_TX_F, /* 11 */ IAP_FSM_IDLE = 20, IAP_FSM_TX, /* 21 */ IAP_FSM_RX, /* 22 */ IAP_FSM_ACP,/* 23 */ IAP_FSM_CMD,/* 24 */ IAP_FSM_REFRESH_TX /* 25 */} teIapFsmState;typedef enum{ IAP_ARCHIVE_ITEM_FREE = 0x00, IAP_ARCHIVE_ITEM_START = 0x01, IAP_ARCHIVE_ITEM_END = 0x02, IAP_ARCHIVE_ITEM_COMPLETE = 0x03, IAP_ARCHIVE_ITEM_INCOMPLETE = 0x04,} teIapItemState;/* DO NOT CHANGE! */typedef struct{ tIapCmdCode Code; uint16 RemainLen; uint16 ChunkLen; teIapItemState CompleteState :32; uint8* pData; /* must be the last item and 4-aligned */} tIapItem;typedef struct{ tIapItem aIapArchiveItem[C_IAP_ARCHIVE_MAX_LEN]; uint8* pPosition; /* first empty position */ int8 Count; /* number of items in the archive */ uint8 bIncomplete; /* flag - last iAP isn't complete */ uint8 padding[2];} tIapArchive;typedef struct{ uint8* pData; /* ptr to Tx data package = gIapTxBuffer */ uint16 DataLength; /* bytes to send of the package */ uint8 bEndFlag; /* package (Fig.4-4; pp.53; R26) last chunk flag - self-contained data end */ uint8 bPending; /* Tx processing of the chunk */ tIapItem Item;} tIapTx;typedef struct{ uint8* pData; uint16 DataLength; uint8 bEndFlag;// uint8 bAck; uint8 bParsing; //vs. bDone ? tIapArchive IapArchive; uint16 ErrPacketCount; uint8 padding[2];} tIapRx;typedef struct{ uint8* pData; t_acp_cmd Cmd :8; t_acp_state Error :16; //size? TBD - be carefull tAcpInitInfo InitInfo; tAcpInfoStatusData Info; tAcpCertPageStatusData* pPage; tAcpSignatureStatusData* pSignature;} tIapAcp;typedef struct{ tIapItem Item; uint8 bSemifinished; /* partinioned iAP request/command */} tIapReq;typedef tIapItem tIapMsg;typedef struct{ uint8 ProtMajVer; uint8 ProtMinVer;} tIapProtocolInfo;typedef struct{ uint8 AuthMajVer; uint8 AuthMinVer; tIapGenDevLingoesSpoken FoundLingoSpoken; tIapProtocolInfo Gen; tIapProtocolInfo Ext; tIapProtocolInfo Aud;} tIapInfo;typedef struct{ tuIapInEvent InEvent; tuIapOutEvent OutEvent; teIapFsmState FsmState; uint8 padding; uint8 bAgain; /* do not exit FSM yet */ uint8 bAuth; /* 1 = authentication is pending */ uint8 bFree; /* 0 = FSM in forced mode; 1 = FSM in free mode */ uint8 bReady; /* 0 = user commands denied; 1 = user commands permitted */ tIapTx Tx; tIapRx Rx; tIapAcp Acp; //size? TBD tIapReq Req; //size? TBD tIapMsg Msg; //size? TBD tIapInfo Info; uint8 bIsExtMode; /* 1 = iap in extended mode = */} tIap;/* DO NOT CHANGE! - joint with tIapItem */typedef struct{ uint32 Code; uint16 RemainLen; uint16 ChunkLen; uint32 CompleteState;} t_iap_cmd;typedef t_iap_cmd t_iap_msg;/*---------------------------------------------------------------------------*//*!\brief Mode selection *//*---------------------------------------------------------------------------*/typedef enum{ IAP_MODE_STANDARD = 0, IAP_MODE_EXTENDED} t_iap_mode;typedef void* t_iap_handler;/*********************** FUNCTION PROTOTYPES **********************/extern tIap gIap; //TBD - will be removedt_iap_handler iap_open(void);void iap_close(t_iap_handler hIap);t_bool iap_is_transition_required(t_iap_handler hIap);t_player_state iap_pop_transition_required(t_iap_handler hIap);t_player_state iap_transition(t_iap_handler hIap);t_player_state iap_get_msg(t_iap_handler hIap, t_iap_msg* pMsg, uint8** ppMsgData);t_player_state iap_set_remote_cmd(t_iap_handler hIap, t_iap_cmd* pRemoteCmd, uint8* pRemoteCmdData);t_player_state iap_set_cmd(t_iap_handler hIap, t_iap_cmd* pCmd, uint8* pCmdData);t_player_state iap_set_cmd_reset_db_selection_hierarchy(t_iap_handler hIap);t_player_state iap_set_cmd_reset_db_selection(t_iap_handler hIap);t_player_state iap_set_cmd_get_current_playing_track_index(t_iap_handler hIap);t_player_state iap_set_cmd_get_num_playing_tracks(t_iap_handler hIap);t_player_state iap_set_cmd_play_pause(t_iap_handler hIap);t_player_state iap_set_cmd_stop(t_iap_handler hIap);t_player_state iap_set_cmd_next(t_iap_handler hIap);t_player_state iap_set_cmd_previous(t_iap_handler hIap);t_player_state iap_set_cmd_start_ff(t_iap_handler hIap);t_player_state iap_set_cmd_start_rw(t_iap_handler hIap);t_player_state iap_set_cmd_end_ffrw(t_iap_handler hIap);t_player_state iap_set_cmd_next_chapter(t_iap_handler hIap);t_player_state iap_set_cmd_previous_chapter(t_iap_handler hIap);//void iap_set_in_event(t_usb_state in_event);/* auxiliary functions for message checking */#if 0 //moved to ipodvirt.hint iap_is_new_msg(int messageId); void iap_copy_msg( uint32 *pmsg , uint32 nbytes );int iap_is_msg_ack(uint32 *pmsg, uint32 CMD_ID );int iap_ack_error(uint32 *pmsg);void iap_flush_msg(void);uint32 iap_get_msg_data(uint32 *pmsg , uint16 payloffs , uint16 nbytes );#endif#define iap_is_cmd(p,m) ( ((0xFFFF)&(*p)) == (0xFFFF & m) )//extern t_iap_msg IPod_Message;//extern t_iap_msg *pIPod_Message;//extern uint8* pIPodMessageData;#endif /*IPOD_AP*/#endif /*_IAP_H*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -