BM program mode declarations.
Copyright (c) 2018 Microchip Technology Inc. and its subsidiaries.
#include "stdint.h"
#include "stdbool.h"
#include "stdlib.h"
#include "string.h"
Data Structures | |
struct | _bm_program_cmd |
struct | _bm_program_cmdpkt |
struct | _bm_program_event |
struct | PACKED |
Blue-tooth Low Energy address Type. More... | |
struct | PACKED |
Blue-tooth Low Energy address Type. More... | |
struct | PACKED |
Blue-tooth Low Energy address Type. More... | |
struct | PACKED |
Blue-tooth Low Energy address Type. More... | |
struct | PACKED |
Blue-tooth Low Energy address Type. More... | |
struct | PACKED |
Blue-tooth Low Energy address Type. More... | |
struct | PACKED |
Blue-tooth Low Energy address Type. More... | |
struct | PACKED |
Blue-tooth Low Energy address Type. More... | |
struct | PACKED |
Blue-tooth Low Energy address Type. More... | |
struct | PACKED |
Blue-tooth Low Energy address Type. More... | |
struct | PACKED |
Blue-tooth Low Energy address Type. More... | |
struct | PACKED |
Blue-tooth Low Energy address Type. More... | |
struct | PACKED |
Blue-tooth Low Energy address Type. More... | |
struct | PACKED |
Blue-tooth Low Energy address Type. More... | |
Macros | |
#define | BM_PGM_HCI_ACL_VAL 0x02 |
#define | BM_PGM_HCI_EVENT_VAL 0x04 |
#define | BM_PGM_PKT_LEN_MAX 320 |
Enumerations | |
enum | _bm_pgm_hci_acl_index { BM_PGM_HCI_ACL_HANDLEL_INDEX = 0x01, BM_PGM_HCI_ACL_HANDLEH_INDEX, BM_PGM_HCI_ACL_LENL_INDEX, BM_PGM_HCI_ACL_LENH_INDEX, BM_PGM_HCI_ACL_DATA_INDEX } |
enum | _bm_pgm_hci_index { BM_PGM_HCI_EVENT_INDEX = 0x00, BM_PGM_HCI_EVENT_TYPE_INDEX, BM_PGM_HCI_EVENT_LEN_INDEX, BM_PGM_HCI_EVENT_DATA_INDEX } |
enum | _bm_program_cmd_state { BM_PGM_HCI_EVENT = 0x00, BM_PGM_HCI_EVENT_TYPE, BM_PGM_HCI_EVENT_LEN, BM_PGM_HCI_EVENT_DATA, BM_PGM_HCI_ACL_HANDLEH, BM_PGM_HCI_ACL_HANDLEL, BM_PGM_HCI_ACL_LENH, BM_PGM_HCI_ACL_LENL, BM_PGM_HCI_ACL_DATA } |
enum | _bm_program_hci_event_id { BM_PROGRAM_HCI_CONN = 0x03, BM_PROGRAM_HCI_DISCONN = 0x05, BM_PROGRAM_HCI_COMPLETE = 0x0E, BM_PROGRAM_HCI_STATUS = 0x0F, BM_PROGRAM_HCI_NOCP = 0x13, BM_PROGRAM_HCI_ERROR = 0xFF } |
enum | _bm_program_hci_event_status { BM_PROGRAM_HCI_SUCCESS = 0x00, BM_PROGRAM_HCI_HANDLE = 0x01, BM_PROGRAM_HCI_FAIL } |
enum | HCI_PKT_TYPE { COMMAND_PKT_TYPE = 0x01, DATA_ACL_PKT_TYPE = 0x02, EVENT_PKT_TYPE = 0x04 } |
Functions | |
void | BM_PROGRAM_Connect (BM_PROGRAM_CMDPKT *programCmdPkt) |
Connect command to connect to BM70 in PROGRAM mode. More... | |
void | BM_PROGRAM_CRC_Get (BM_PROGRAM_CMDPKT *programCmdPkt, BM_PROGRAM_CMD *pgm_cmd) |
Builds a program mode command packet to get CRC of the program memory. More... | |
void | BM_PROGRAM_DeInit (BM_PROGRAM_CMDPKT *programCmdPkt) |
De-initializes PROGRAM mode configuration library. More... | |
void | BM_PROGRAM_Disconnect (BM_PROGRAM_CMDPKT *programCmdPkt) |
Disconnect command to disconnect from BM70 in PROGRAM mode. More... | |
void | BM_PROGRAM_Erase (BM_PROGRAM_CMDPKT *programCmdPkt, BM_PROGRAM_CMD *pgm_cmd) |
Builds a program mode command packet to erase the program memory. More... | |
BM_PROGRAM_CMDPKT * | BM_PROGRAM_Init (void) |
Initializes program mode. More... | |
void | BM_PROGRAM_Read (BM_PROGRAM_CMDPKT *programCmdPkt, BM_PROGRAM_CMD *pgm_cmd) |
Builds a program mode command packet to read the program memory. More... | |
bool | BM_PROGRAM_ResponseCheck (uint8_t *data, uint8_t len) |
Parses the event packet and provides the handle to the event. More... | |
void | BM_PROGRAM_Write (BM_PROGRAM_CMDPKT *programCmdPkt, BM_PROGRAM_CMD *pgm_cmd) |
Builds a program mode command packet to write the program memory. More... | |
void | BM_PROGRAM_Write_Continue (BM_PROGRAM_CMDPKT *programCmdPkt, BM_PROGRAM_CMD *pgm_cmd) |
Builds a program mode command packet to continue writing the program memory. More... | |
#define BM_PGM_HCI_ACL_VAL 0x02 |
Referenced by BM_PROGRAM_ResponseCheck(), dfu_response_read_parser(), and dfu_response_report_parser().
#define BM_PGM_HCI_EVENT_VAL 0x04 |
Referenced by BM_PROGRAM_ResponseCheck(), and dfu_response_report_parser().
#define BM_PGM_PKT_LEN_MAX 320 |
typedef enum _bm_pgm_hci_acl_index BM_PGM_HCI_ACL_INDEX |
typedef enum _bm_pgm_hci_index BM_PGM_HCI_INDEX |
typedef struct _bm_program_cmd BM_PROGRAM_CMD |
typedef enum _bm_program_cmd_state BM_PROGRAM_CMD_STATE |
typedef struct _bm_program_cmdpkt BM_PROGRAM_CMDPKT |
typedef struct PACKED BM_PROGRAM_CONNECT_PKT |
typedef struct PACKED BM_PROGRAM_CRC_PKT |
typedef struct PACKED BM_PROGRAM_DATA_ALT_PKT |
typedef struct PACKED BM_PROGRAM_DATA_PKT |
typedef struct PACKED BM_PROGRAM_DISCONNECT_PKT |
typedef struct _bm_program_event BM_PROGRAM_EVENT |
typedef struct PACKED BM_PROGRAM_EVENT_COMPLETE_PKT |
typedef struct PACKED BM_PROGRAM_EVENT_CONN_PKT |
typedef struct PACKED BM_PROGRAM_EVENT_DATA_PKT |
typedef struct PACKED BM_PROGRAM_EVENT_DISCONN_PKT |
typedef struct PACKED BM_PROGRAM_EVENT_NOCP_PKT |
typedef struct PACKED BM_PROGRAM_EVENT_STATUS_PKT |
typedef enum _bm_program_hci_event_id BM_PROGRAM_HCI_EVENT_ID |
typedef enum _bm_program_hci_event_status BM_PROGRAM_HCI_EVENT_STATUS |
typedef struct PACKED HCI_COMMAND_PKT |
typedef struct PACKED HCI_DATA_PKT |
typedef struct PACKED HCI_EVENT_PKT |
enum _bm_pgm_hci_index |
enum HCI_PKT_TYPE |
void BM_PROGRAM_Connect | ( | BM_PROGRAM_CMDPKT * | programCmdPkt | ) |
Connect command to connect to BM70 in PROGRAM mode.
Builds a program mode command packet t0 connect to program memory to start the program mode.
programCmdPkt | Handle to the PROGRAM mode command packet created by connect function. |
programCmdPkt | Handle to the program mode command packet. |
References PACKED::addr, COMMAND_PKT_TYPE, PACKED::hci_command_pkt, PACKED::length, PACKED::mode, PACKED::offset, PACKED::opcode, PACKED::role, and PACKED::type.
Referenced by dfu_init().
void BM_PROGRAM_CRC_Get | ( | BM_PROGRAM_CMDPKT * | programCmdPkt, |
BM_PROGRAM_CMD * | pgm_cmd | ||
) |
Builds a program mode command packet to get CRC of the program memory.
programCmdPkt | Handle to the program mode command packet. |
pgm_cmd | Handle to the program mode data packet. |
References PACKED::acl_data_pkt, PACKED::address, PACKED::conn_handle, PACKED::crc_algo, DATA_ACL_PKT_TYPE, PACKED::length, PACKED::pgm_cmd_id, PACKED::pgm_data_len, PACKED::pgm_mem_subtype, PACKED::pgm_mem_type, PACKED::size, and PACKED::type.
void BM_PROGRAM_DeInit | ( | BM_PROGRAM_CMDPKT * | programCmdPkt | ) |
De-initializes PROGRAM mode configuration library.
De-initializes program mode.
programCmdPkt | Handle to the PROGRAM mode command packet created by init function. |
programCmdPkt | Handle to the program mode command packet. |
void BM_PROGRAM_Disconnect | ( | BM_PROGRAM_CMDPKT * | programCmdPkt | ) |
Disconnect command to disconnect from BM70 in PROGRAM mode.
Builds a program mode command packet to disconnect from program memory to stop the program mode.
programCmdPkt | Handle to the PROGRAM mode command packet created by connect function. |
programCmdPkt | Handle to the program mode command packet. |
References COMMAND_PKT_TYPE, PACKED::conn_handle, PACKED::hci_command_pkt, PACKED::length, PACKED::opcode, PACKED::reason, and PACKED::type.
Referenced by dfu_deinit().
void BM_PROGRAM_Erase | ( | BM_PROGRAM_CMDPKT * | programCmdPkt, |
BM_PROGRAM_CMD * | pgm_cmd | ||
) |
Builds a program mode command packet to erase the program memory.
programCmdPkt | Handle to the program mode command packet. |
pgm_cmd | Handle to the program mode data packet. |
References PACKED::acl_data_pkt, PACKED::address, PACKED::conn_handle, DATA_ACL_PKT_TYPE, PACKED::length, PACKED::pgm_cmd_id, PACKED::pgm_data_len, PACKED::pgm_mem_subtype, PACKED::pgm_mem_type, PACKED::size, and PACKED::type.
Referenced by dfu_program_memory_erase().
BM_PROGRAM_CMDPKT * BM_PROGRAM_Init | ( | void | ) |
Initializes program mode.
None. |
References BM_PROGRAM_HCI_ERROR, event_msg_t::data, event_msg_t::data_len, event_t::event_id, event_t::event_msg, NULL, pgmCmdPkt, and pgmDataCmdPkt.
Referenced by dfu_init().
void BM_PROGRAM_Read | ( | BM_PROGRAM_CMDPKT * | programCmdPkt, |
BM_PROGRAM_CMD * | pgm_cmd | ||
) |
Builds a program mode command packet to read the program memory.
programCmdPkt | Handle to the program mode command packet. |
pgm_cmd | Handle to the program mode data packet. |
References PACKED::acl_data_pkt, PACKED::address, PACKED::conn_handle, DATA_ACL_PKT_TYPE, PACKED::length, PACKED::pgm_cmd_id, PACKED::pgm_data_len, PACKED::pgm_mem_subtype, PACKED::pgm_mem_type, PACKED::size, and PACKED::type.
Referenced by dfu_program_memory_read().
bool BM_PROGRAM_ResponseCheck | ( | uint8_t * | data, |
uint8_t | len | ||
) |
Parses the event packet and provides the handle to the event.
data | Handle to the data containing the response. |
len | Length of the data containing the response. |
References BM_PGM_HCI_ACL_DATA, BM_PGM_HCI_ACL_DATA_INDEX, BM_PGM_HCI_ACL_HANDLEH, BM_PGM_HCI_ACL_HANDLEH_INDEX, BM_PGM_HCI_ACL_HANDLEL, BM_PGM_HCI_ACL_HANDLEL_INDEX, BM_PGM_HCI_ACL_LENH, BM_PGM_HCI_ACL_LENH_INDEX, BM_PGM_HCI_ACL_LENL, BM_PGM_HCI_ACL_LENL_INDEX, BM_PGM_HCI_ACL_VAL, BM_PGM_HCI_EVENT, BM_PGM_HCI_EVENT_DATA, BM_PGM_HCI_EVENT_DATA_INDEX, BM_PGM_HCI_EVENT_INDEX, BM_PGM_HCI_EVENT_LEN, BM_PGM_HCI_EVENT_LEN_INDEX, BM_PGM_HCI_EVENT_TYPE, BM_PGM_HCI_EVENT_TYPE_INDEX, BM_PGM_HCI_EVENT_VAL, BM_PROGRAM_HCI_ERROR, event_msg_t::data, data, event_msg_t::data_len, event_t::event_id, event_t::event_msg, NULL, pgmCmdState, pgmDataIndex, and pgmRspData.
Referenced by dfu_response_check().
void BM_PROGRAM_Write | ( | BM_PROGRAM_CMDPKT * | programCmdPkt, |
BM_PROGRAM_CMD * | pgm_cmd | ||
) |
Builds a program mode command packet to write the program memory.
programCmdPkt | Handle to the program mode command packet. |
pgm_cmd | Handle to the program mode data packet. |
References PACKED::acl_data_pkt, PACKED::address, PACKED::conn_handle, DATA_ACL_PKT_TYPE, PACKED::length, PACKED::pgm_cmd_id, PACKED::pgm_data_len, PACKED::pgm_mem_subtype, PACKED::pgm_mem_type, PACKED::size, and PACKED::type.
Referenced by dfu_program_memory_write(), and dfu_program_memory_write_continue().
void BM_PROGRAM_Write_Continue | ( | BM_PROGRAM_CMDPKT * | programCmdPkt, |
BM_PROGRAM_CMD * | pgm_cmd | ||
) |
Builds a program mode command packet to continue writing the program memory.
programCmdPkt | Handle to the program mode command packet. |
pgm_cmd | Handle to the program mode data packet. |
References PACKED::acl_data_pkt, PACKED::conn_handle, DATA_ACL_PKT_TYPE, PACKED::length, PACKED::pgm_cmd_id, PACKED::pgm_data_len, and PACKED::type.
Referenced by dfu_program_memory_write_continue().