Trond Enger / d7a_1x

Fork of d7a_1x by WizziLab

Committer:
Jeej
Date:
Tue Aug 30 16:59:12 2016 +0000
Revision:
43:28202405094d
Child:
45:b85384e7d825
New version of the API.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Jeej 43:28202405094d 1 #ifndef _D7A_ALP_H_
Jeej 43:28202405094d 2 #define _D7A_ALP_H_
Jeej 43:28202405094d 3
Jeej 43:28202405094d 4
Jeej 43:28202405094d 5 #define ALP_CTRL_GROUP 0x80
Jeej 43:28202405094d 6 #define ALP_CTRL_RESP 0x40
Jeej 43:28202405094d 7 #define ALP_CTRL_OVERLOAD 0x80
Jeej 43:28202405094d 8 #define ALP_CTRL_INDIRECT 0x40
Jeej 43:28202405094d 9 #define ALP_CTRL_EOP 0x80
Jeej 43:28202405094d 10 #define ALP_CTRL_ERR 0x40
Jeej 43:28202405094d 11
Jeej 43:28202405094d 12
Jeej 43:28202405094d 13 typedef enum {
Jeej 43:28202405094d 14 // OPCODE | OPERAND
Jeej 43:28202405094d 15 ALP_OPCODE_NOP = 0, //| -
Jeej 43:28202405094d 16
Jeej 43:28202405094d 17 ALP_OPCODE_F_RD_DATA = 1, //| FDR
Jeej 43:28202405094d 18 ALP_OPCODE_F_RD_PROP = 2, //| FID
Jeej 43:28202405094d 19
Jeej 43:28202405094d 20 ALP_OPCODE_F_WR_DATA = 4, //| FD
Jeej 43:28202405094d 21 ALP_OPCODE_F_WR_FLUSH = 5, //| FD
Jeej 43:28202405094d 22 ALP_OPCODE_F_WR_PROP = 6, //| FD
Jeej 43:28202405094d 23
Jeej 43:28202405094d 24 ALP_OPCODE_QUERY = 8, //| Q
Jeej 43:28202405094d 25 ALP_OPCODE_QBREAK = 9, //| Q
Jeej 43:28202405094d 26 ALP_OPCODE_PERM_REQ = 10, //| P
Jeej 43:28202405094d 27
Jeej 43:28202405094d 28 ALP_OPCODE_CRC_CHECK = 11, //| Q
Jeej 43:28202405094d 29
Jeej 43:28202405094d 30 ALP_OPCODE_F_EXIST = 16, //| FID
Jeej 43:28202405094d 31 ALP_OPCODE_F_CREATE = 17, //| FD
Jeej 43:28202405094d 32 ALP_OPCODE_F_DELETE = 18, //| FID
Jeej 43:28202405094d 33 ALP_OPCODE_F_RESTORE = 19, //| FID
Jeej 43:28202405094d 34 ALP_OPCODE_F_FLUSH = 20, //| FID
Jeej 43:28202405094d 35 ALP_OPCODE_F_OPEN = 21, //| FID
Jeej 43:28202405094d 36 ALP_OPCODE_F_CLOSE = 22, //| FID
Jeej 43:28202405094d 37 ALP_OPCODE_F_COPY = 23, //| 2xFID
Jeej 43:28202405094d 38 ALP_OPCODE_F_EXECUTE = 31, //| FID
Jeej 43:28202405094d 39
Jeej 43:28202405094d 40 ALP_OPCODE_RSP_F_DATA = 32, //| FD
Jeej 43:28202405094d 41 ALP_OPCODE_RSP_F_PROP = 33, //| FH
Jeej 43:28202405094d 42 ALP_OPCODE_RSP_STATUS = 34, //| S
Jeej 43:28202405094d 43 ALP_OPCODE_RSP_ISTATUS = ALP_OPCODE_RSP_STATUS + (1 << 6), //| SI
Jeej 43:28202405094d 44 ALP_OPCODE_RSP_TAG = 35, //| PID
Jeej 43:28202405094d 45 ALP_OPCODE_RSP_EOPTAG = ALP_OPCODE_RSP_TAG + (2 << 6), //| PID
Jeej 43:28202405094d 46 ALP_OPCODE_RSP_ERRTAG = ALP_OPCODE_RSP_TAG + (1 << 6), //| PID
Jeej 43:28202405094d 47
Jeej 43:28202405094d 48 ALP_OPCODE_CHUNK = 48, //| -
Jeej 43:28202405094d 49 ALP_OPCODE_LOGIC = 49, //| -
Jeej 43:28202405094d 50 ALP_OPCODE_FORWARD = 50, //| I
Jeej 43:28202405094d 51 ALP_OPCODE_IFORWARD = 51, //| IFID
Jeej 43:28202405094d 52 ALP_OPCODE_TAG = 52, //| PID
Jeej 43:28202405094d 53
Jeej 43:28202405094d 54 ALP_OPCODE_EXT = 63, //| RFU
Jeej 43:28202405094d 55
Jeej 43:28202405094d 56 // Modifiers
Jeej 43:28202405094d 57 ALP_OPCODE_RESP = 0x40,
Jeej 43:28202405094d 58 ALP_OPCODE_GROUP = 0x80,
Jeej 43:28202405094d 59
Jeej 43:28202405094d 60 ALP_OPCODE_ERR = 0x40,
Jeej 43:28202405094d 61 ALP_OPCODE_EOP = 0x80,
Jeej 43:28202405094d 62
Jeej 43:28202405094d 63 ALP_OPCODE_INDIRECT = 0x40,
Jeej 43:28202405094d 64 ALP_OPCODE_OVERLOAD = 0x80,
Jeej 43:28202405094d 65
Jeej 43:28202405094d 66 } alp_opcodes_t;
Jeej 43:28202405094d 67
Jeej 43:28202405094d 68 // =======================================================================
Jeej 43:28202405094d 69 // d7a_id_t
Jeej 43:28202405094d 70 // -----------------------------------------------------------------------
Jeej 43:28202405094d 71 /// Identifier types enumerator
Jeej 43:28202405094d 72 // =======================================================================
Jeej 43:28202405094d 73 typedef enum
Jeej 43:28202405094d 74 {
Jeej 43:28202405094d 75 /// Void identifier (broadcast)
Jeej 43:28202405094d 76 /// with indication of number of reached devices
Jeej 43:28202405094d 77 D7A_ID_NBID = 0,
Jeej 43:28202405094d 78 /// Void identifier (broadcast)
Jeej 43:28202405094d 79 D7A_ID_NOID = 1,
Jeej 43:28202405094d 80 /// Unique Identifier
Jeej 43:28202405094d 81 D7A_ID_UID = 2,
Jeej 43:28202405094d 82 /// Virtual identifier
Jeej 43:28202405094d 83 D7A_ID_VID = 3,
Jeej 43:28202405094d 84
Jeej 43:28202405094d 85 } d7a_id_t;
Jeej 43:28202405094d 86
Jeej 43:28202405094d 87 void d7a_alp_open(void);
Jeej 43:28202405094d 88 void d7a_alp_new_pkt(d7a_com_rx_msg_t* pkt);
Jeej 43:28202405094d 89 d7a_com_rx_msg_t* d7a_alp_wait_pkt(uint32_t millisec = osWaitForever);
Jeej 43:28202405094d 90 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);
Jeej 43:28202405094d 91 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);
Jeej 43:28202405094d 92
Jeej 43:28202405094d 93 #endif // _D7A_ALP_H_