diff --git a/include/rdcu_cmd.h b/include/rdcu_cmd.h index a490c3136daaa0027c95ef5789355e2d172fe360..ec4a73a34a0eac23bc3655362af9d4e00f9316c1 100644 --- a/include/rdcu_cmd.h +++ b/include/rdcu_cmd.h @@ -58,7 +58,7 @@ #define DATA_START_ADDR 0x11000010UL #define MODEL_START_ADDR 0x11000014UL #define NUM_SAMPLES 0x11000018UL -/* spare: 0x1100001CUL */ +#define NEW_MODEL_START_ADDR 0x1100001CUL #define COMPR_DATA_BUF_START_ADDR 0x11000020UL #define COMPR_DATA_BUF_LEN 0x11000024UL /* spare: 0x11000028UL */ @@ -136,6 +136,8 @@ int rdcu_write_cmd_adaptive_param2(uint16_t trans_id, uint8_t *cmd); int rdcu_write_cmd_data_start_addr(uint16_t trans_id, uint8_t *cmd); int rdcu_write_cmd_model_start_addr(uint16_t trans_id, uint8_t *cmd); int rdcu_write_cmd_num_samples(uint16_t trans_id, uint8_t *cmd); +int rdcu_write_cmd_new_model_start_addr(uint16_t trans_id, uint8_t *cmd); + int rdcu_write_cmd_compr_data_buf_start_addr(uint16_t trans_id, uint8_t *cmd); int rdcu_write_cmd_compr_data_buf_len(uint16_t trans_id, uint8_t *cmd); diff --git a/include/rdcu_ctrl.h b/include/rdcu_ctrl.h index 218b80affd6b3b3863abb721b14c60ef49e05ed0..a008943bdf48c14a97111002f51d6c6f9f1c55d6 100644 --- a/include/rdcu_ctrl.h +++ b/include/rdcu_ctrl.h @@ -52,6 +52,8 @@ struct rdcu_mirror { uint32_t data_start_addr; /* RDCU-FRS-FN-0812 */ uint32_t model_start_addr; /* RDCU-FRS-FN-0822 */ uint32_t num_samples; /* RDCU-FRS-FN-0832 */ + uint32_t new_model_start_addr; /* RDCU-FRS-FN-0842 */ + uint32_t compr_data_buf_start_addr; /* RDCU-FRS-FN-0852 */ uint32_t compr_data_buf_len; /* RDCU-FRS-FN-0862 */ uint32_t used_param1; /* RDCU-FRS-FN-0892 */ @@ -101,6 +103,8 @@ int rdcu_sync_adaptive_param2(void); int rdcu_sync_data_start_addr(void); int rdcu_sync_model_start_addr(void); int rdcu_sync_num_samples(void); +int rdcu_sync_new_model_start_addr(void); + int rdcu_sync_compr_data_buf_start_addr(void); int rdcu_sync_compr_data_buf_len(void); int rdcu_sync_used_param1(void); @@ -224,6 +228,8 @@ int rdcu_set_model_start_addr(uint32_t addr); int rdcu_set_num_samples(uint32_t samples); +int rdcu_set_new_model_start_addr(uint32_t addr); + int rdcu_set_compr_data_buf_start_addr(uint32_t addr); int rdcu_set_compr_data_buf_len(uint32_t samples); diff --git a/lib/rdcu_cmd.c b/lib/rdcu_cmd.c index 888f97700cbc7866b28dc7ac0960b2e48d45a1b9..0e75cc70d798b9cec337504bbd3382630dbf1f0d 100644 --- a/lib/rdcu_cmd.c +++ b/lib/rdcu_cmd.c @@ -647,6 +647,22 @@ int rdcu_write_cmd_num_samples(uint16_t trans_id, uint8_t *cmd) } +/** + * @brief create a command to write the RDCU updated/new model start address register + * + * @param trans_id a transaction identifier + * + * @param cmd the command buffer; if NULL, the function returns the needed size + * + * @returns the size of the command data buffer or 0 on error + */ + +int rdcu_write_cmd_new_model_start_addr(uint16_t trans_id, uint8_t *cmd) +{ + return rdcu_write_cmd_register_internal(trans_id, cmd, NEW_MODEL_START_ADDR); +} + + /** * @brief create a command to write the RDCU compressed data buffer start * address register diff --git a/lib/rdcu_ctrl.c b/lib/rdcu_ctrl.c index d2d5b6a5c57ca9cdf15bdfe359bbe4ade29f8f7f..60e5e1c76f8d4b9072d8b70095832fe549dbc450 100644 --- a/lib/rdcu_ctrl.c +++ b/lib/rdcu_ctrl.c @@ -1126,6 +1126,26 @@ int rdcu_set_num_samples(uint32_t samples) } +/** + * @brief set updated_model/new model start address + * @see RDCU-FRS-FN-0842 + * + * @returns 0 on success, otherwise error + */ + +int rdcu_set_new_model_start_addr(uint32_t addr) +{ + if (addr > 0x00FFFFFFUL) + return -1; + + /* clear and set */ + rdcu->new_model_start_addr &= ~0x00FFFFFFUL; + rdcu->new_model_start_addr |= addr; + + return 0; +} + + /** * @brief set compressed data buffer start address * @see RDCU-FRS-FN-0850