Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of d7a_1x by
Diff: include/d7a_alp.h
- Revision:
- 45:b85384e7d825
- Parent:
- 43:28202405094d
- Child:
- 46:665391110051
--- a/include/d7a_alp.h Tue Aug 30 17:15:31 2016 +0000 +++ b/include/d7a_alp.h Thu Sep 01 09:35:27 2016 +0000 @@ -84,10 +84,81 @@ } d7a_id_t; +typedef enum { + ALP_RESP_TYPE_UNKNOWN = 0, + ALP_RESP_TYPE_F_DATA = ALP_OPCODE_RSP_F_DATA, + ALP_RESP_TYPE_F_PROP = ALP_OPCODE_RSP_F_PROP, + ALP_RESP_TYPE_ISTATUS = ALP_OPCODE_RSP_ISTATUS, + ALP_RESP_TYPE_STATUS = ALP_OPCODE_RSP_STATUS, + ALP_RESP_TYPE_TAG = ALP_OPCODE_RSP_TAG, +} alp_resp_type_t; + +typedef struct { + uint8_t type; + uint8_t* data; // data + union + { + struct { + uint32_t length; + uint32_t offset; + uint8_t fid; + } f_data; + struct { + uint32_t length; + uint32_t offset; + uint8_t fid; + } f_prop; + struct { + uint8_t code; + uint8_t id; // Action ID + } status; + struct { + uint32_t length; + uint8_t type; + } itf; + struct { + uint8_t id; + uint8_t eop; + uint8_t err; + } tag; + } meta; +} alp_uns_resp_parsed_t; + +TYPEDEF_STRUCT_PACKED +{ + uint8_t aid; + int8_t status; +} d7a_alp_rsp_status_t; + +TYPEDEF_STRUCT_PACKED +{ + uint8_t ctrl; + uint8_t fid; + uint32_t offset; + uint32_t length; + uint8_t data[1]; +} d7a_alp_rsp_f_data_t; + +TYPEDEF_STRUCT_PACKED +{ + uint8_t tag; +} d7a_alp_rsp_tag_t; + + +TYPEDEF_STRUCT_PACKED +{ + uint8_t tag; + uint8_t tag_status; + uint8_t nb_status; + d7a_alp_rsp_status_t status[5]; + uint32_t length; + uint8_t* data; +} d7a_alp_rsp_t; + void d7a_alp_open(void); void d7a_alp_new_pkt(d7a_com_rx_msg_t* pkt); d7a_com_rx_msg_t* d7a_alp_wait_pkt(uint32_t millisec = osWaitForever); -bool d7a_alp_write_file(const uint8_t file_id, const uint32_t offset, const uint32_t size, const uint8_t* const buf, d7a_addressee_t* addressee = NULL, uint8_t retry = 0, bool resp = true); -bool d7a_alp_read_file(const uint8_t file_id, const uint32_t offset, const uint32_t size, const uint8_t* const buf, d7a_addressee_t* addressee = NULL, uint8_t retry = 0); +int8_t d7a_alp_write_file(const uint8_t file_id, const uint32_t offset, const uint32_t size, const uint8_t* const buf, d7a_addressee_t* addressee = NULL, uint8_t retry = 0, bool resp = true); +int8_t d7a_alp_read_file(const uint8_t file_id, const uint32_t offset, const uint32_t size, const uint8_t* const buf, d7a_addressee_t* addressee = NULL, uint8_t retry = 0); #endif // _D7A_ALP_H_