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:
- 43:28202405094d
- Child:
- 45:b85384e7d825
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/include/d7a_alp.h Tue Aug 30 16:59:12 2016 +0000 @@ -0,0 +1,93 @@ +#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; + +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); + +#endif // _D7A_ALP_H_