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
include/d7a_alp.h
- Committer:
- Jeej
- Date:
- 2016-09-01
- Revision:
- 45:b85384e7d825
- Parent:
- 43:28202405094d
- Child:
- 46:665391110051
File content as of revision 45:b85384e7d825:
#ifndef _D7A_ALP_H_ #define _D7A_ALP_H_ #define ALP_CTRL_GROUP 0x80 #define ALP_CTRL_RESP 0x40 #define ALP_CTRL_OVERLOAD 0x80 #define ALP_CTRL_INDIRECT 0x40 #define ALP_CTRL_EOP 0x80 #define ALP_CTRL_ERR 0x40 typedef enum { // OPCODE | OPERAND ALP_OPCODE_NOP = 0, //| - ALP_OPCODE_F_RD_DATA = 1, //| FDR ALP_OPCODE_F_RD_PROP = 2, //| FID ALP_OPCODE_F_WR_DATA = 4, //| FD ALP_OPCODE_F_WR_FLUSH = 5, //| FD ALP_OPCODE_F_WR_PROP = 6, //| FD ALP_OPCODE_QUERY = 8, //| Q ALP_OPCODE_QBREAK = 9, //| Q ALP_OPCODE_PERM_REQ = 10, //| P ALP_OPCODE_CRC_CHECK = 11, //| Q ALP_OPCODE_F_EXIST = 16, //| FID ALP_OPCODE_F_CREATE = 17, //| FD ALP_OPCODE_F_DELETE = 18, //| FID ALP_OPCODE_F_RESTORE = 19, //| FID ALP_OPCODE_F_FLUSH = 20, //| FID ALP_OPCODE_F_OPEN = 21, //| FID ALP_OPCODE_F_CLOSE = 22, //| FID ALP_OPCODE_F_COPY = 23, //| 2xFID ALP_OPCODE_F_EXECUTE = 31, //| FID ALP_OPCODE_RSP_F_DATA = 32, //| FD ALP_OPCODE_RSP_F_PROP = 33, //| FH ALP_OPCODE_RSP_STATUS = 34, //| S ALP_OPCODE_RSP_ISTATUS = ALP_OPCODE_RSP_STATUS + (1 << 6), //| SI ALP_OPCODE_RSP_TAG = 35, //| PID ALP_OPCODE_RSP_EOPTAG = ALP_OPCODE_RSP_TAG + (2 << 6), //| PID ALP_OPCODE_RSP_ERRTAG = ALP_OPCODE_RSP_TAG + (1 << 6), //| PID ALP_OPCODE_CHUNK = 48, //| - ALP_OPCODE_LOGIC = 49, //| - ALP_OPCODE_FORWARD = 50, //| I ALP_OPCODE_IFORWARD = 51, //| IFID ALP_OPCODE_TAG = 52, //| PID ALP_OPCODE_EXT = 63, //| RFU // Modifiers ALP_OPCODE_RESP = 0x40, ALP_OPCODE_GROUP = 0x80, ALP_OPCODE_ERR = 0x40, ALP_OPCODE_EOP = 0x80, ALP_OPCODE_INDIRECT = 0x40, ALP_OPCODE_OVERLOAD = 0x80, } alp_opcodes_t; // ======================================================================= // d7a_id_t // ----------------------------------------------------------------------- /// Identifier types enumerator // ======================================================================= typedef enum { /// Void identifier (broadcast) /// with indication of number of reached devices D7A_ID_NBID = 0, /// Void identifier (broadcast) D7A_ID_NOID = 1, /// Unique Identifier D7A_ID_UID = 2, /// Virtual identifier D7A_ID_VID = 3, } 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); 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_