1.4.3 PRIME API

This protocol consists of the serialization of the PRIME API primitives. The Microchip PRIME Stack can provide the Application Programming Interface (PRIME API) through a serial interface as an independent protocol of USI. It is available only when the user application contains the modem example.
Figure 1-7. PRIME API USI Frame Format
The following three fields are available within the general MESSAGE DATA field:
  • LENGTH Extended (1 bit): As the information contained in the message data can exceed the size reserved for MSG length (10 bits), a bit has been added to increase the message length size. In this field the most significant bit of the message length is codified.
  • PRIME API COMMAND (7 bits): This field refers to the primitive included in the message, using the same primitives described in the PRIME API interface description. The values for those primitives are defined in enumerator prime_api_cmd_t in the modem.h file.
  • Primitive function parameters: The serialization of each primitive directly concatenates the different parameters included in the primitive function, with the most significant byte of a variable always on the left. The only exception is that the length of buffers is always placed before the buffer itself so that the data can be inserted and extracted easily. This is applicable to all primitives in the PRIME API.
    • Figure 1-8 shows how a serialized primitive looks. It is based on the MAC_ESTABLISH.request, which is mapped into the following type:
      typedef void (*mac_establish_request_t)(uint8_t *puc_eui48, uint8_t uc_type, uint8_t *puc_data, uint16_t us_data_len, uint8_t uc_arq, uint8_t uc_cfbytes);
    Figure 1-8. Message Data for MAC_ESTABLISH.request Primitive
    Important: The Base Management primitives already include the PRIME API command as the first function parameter, therefore exceptionally sending it twice is not required.