Skip to content
Snippets Groups Projects
Commit f9349322 authored by Dominik Loidolt's avatar Dominik Loidolt
Browse files

Unification of buffer names between RDCU and ICU compression

Fix some typos
Use default values if .rdcu_pkt_mode_cfg file is not available
parent 59ee1a0c
No related branches found
No related tags found
1 merge request!11decompression/compression for non-imagette data
...@@ -569,7 +569,7 @@ static int guess_cmp_pars(struct cmp_cfg *cfg, const char *guess_cmp_mode, ...@@ -569,7 +569,7 @@ static int guess_cmp_pars(struct cmp_cfg *cfg, const char *guess_cmp_mode,
} }
/* generate packets to setup a RDCU compression */ /* generate packets to setup an RDCU compression */
static int gen_rdcu_write_pkts(struct cmp_cfg *cfg) static int gen_rdcu_write_pkts(struct cmp_cfg *cfg)
{ {
int error; int error;
......
...@@ -54,3 +54,6 @@ void print_cfg(const struct cmp_cfg *cfg, int rdcu_cfg); ...@@ -54,3 +54,6 @@ void print_cfg(const struct cmp_cfg *cfg, int rdcu_cfg);
int atoui32(const char *dep_str, const char *val_str, uint32_t *red_val); int atoui32(const char *dep_str, const char *val_str, uint32_t *red_val);
int cmp_mode_parse(const char *cmp_mode_str, uint32_t *cmp_mode); int cmp_mode_parse(const char *cmp_mode_str, uint32_t *cmp_mode);
enum cmp_data_type string2data_type(const char *data_type_str);
const char *data_type2string(enum cmp_data_type data_type);
...@@ -55,9 +55,9 @@ int rdcu_read_cmp_status(struct cmp_status *status); ...@@ -55,9 +55,9 @@ int rdcu_read_cmp_status(struct cmp_status *status);
int rdcu_read_cmp_info(struct cmp_info *info); int rdcu_read_cmp_info(struct cmp_info *info);
int rdcu_read_cmp_bitstream(const struct cmp_info *info, void *output_buf); int rdcu_read_cmp_bitstream(const struct cmp_info *info, void *compressed_data);
int rdcu_read_model(const struct cmp_info *info, void *model_buf); int rdcu_read_model(const struct cmp_info *info, void *updated_model);
int rdcu_interrupt_compression(void); int rdcu_interrupt_compression(void);
......
...@@ -27,6 +27,11 @@ ...@@ -27,6 +27,11 @@
#define MAX_TC_FOLDER_DIR_LEN 256 #define MAX_TC_FOLDER_DIR_LEN 256
/* default values when no .rdcu_pkt_mode_cfg file is available */
#define DEF_ICU_ADDR 0xA7
#define DEF_RDCU_ADDR 0xFE
#define DEF_MTU 4224
int init_rmap_pkt_to_file(void); int init_rmap_pkt_to_file(void);
void set_tc_folder_dir(const char *dir_name); void set_tc_folder_dir(const char *dir_name);
......
...@@ -82,13 +82,13 @@ static void sync(void) ...@@ -82,13 +82,13 @@ static void sync(void)
/** /**
* @brief check if the compression data product type, compression mode, model * @brief check if the compression data product type, compression mode, model
* value and the lossy rounding parameters are valid for a RDCU compression * value and the lossy rounding parameters are valid for an RDCU compression
* *
* @param cfg pointer to a compression configuration containing the compression * @param cfg pointer to a compression configuration containing the compression
* data product type, compression mode, model value and the rounding parameters * data product type, compression mode, model value and the rounding parameters
* *
* @returns 0 if the compression data type, compression mode, model value and * @returns 0 if the compression data type, compression mode, model value and
* the lossy rounding parameters are valid for a RDCU compression, non-zero * the lossy rounding parameters are valid for an RDCU compression, non-zero
* if parameters are invalid * if parameters are invalid
*/ */
...@@ -131,7 +131,7 @@ static int rdcu_cfg_gen_par_is_invalid(const struct cmp_cfg *cfg) ...@@ -131,7 +131,7 @@ static int rdcu_cfg_gen_par_is_invalid(const struct cmp_cfg *cfg)
/** /**
* @brief create a RDCU compression configuration * @brief create an RDCU compression configuration
* *
* @param data_type compression data product types * @param data_type compression data product types
* @param cmp_mode compression mode * @param cmp_mode compression mode
...@@ -401,7 +401,7 @@ int rdcu_cfg_buffers(struct cmp_cfg *cfg, uint16_t *data_to_compress, ...@@ -401,7 +401,7 @@ int rdcu_cfg_buffers(struct cmp_cfg *cfg, uint16_t *data_to_compress,
/** /**
* @brief check if the Golomb and spillover threshold parameter combination is * @brief check if the Golomb and spillover threshold parameter combination is
* invalid for a RDCU compression * invalid for an RDCU compression
* @note also checked the adaptive Golomb and spillover threshold parameter combinations * @note also checked the adaptive Golomb and spillover threshold parameter combinations
* *
* @param cfg a pointer to a compression configuration * @param cfg a pointer to a compression configuration
...@@ -519,7 +519,7 @@ int rdcu_cfg_imagette(struct cmp_cfg *cfg, ...@@ -519,7 +519,7 @@ int rdcu_cfg_imagette(struct cmp_cfg *cfg,
/** /**
* @brief check if the compressor configuration is invalid for a RDCU compression, * @brief check if the compressor configuration is invalid for an RDCU compression,
* see the user manual for more information (PLATO-UVIE-PL-UM-0001). * see the user manual for more information (PLATO-UVIE-PL-UM-0001).
* *
* @param cfg pointer to a compression configuration contains all parameters * @param cfg pointer to a compression configuration contains all parameters
...@@ -677,10 +677,13 @@ int rdcu_start_compression(void) ...@@ -677,10 +677,13 @@ int rdcu_start_compression(void)
* *
* @param cfg configuration contains all parameters required for compression * @param cfg configuration contains all parameters required for compression
* *
* @note when using the 1d-differencing mode or the raw mode (cmp_mode = 0,2,4), * @note Before the rdcu_compress function can be used, an initialization of
* the model parameters (model_value, model_buf, rdcu_model_adr) are ignored * the RMAP library is required. This is achieved with the functions
* @note the validity of the cfg structure is checked before the compression is * rdcu_ctrl_init() and rdcu_rmap_init().
* started * @note When using the 1d-differencing mode or the raw mode (cmp_mode = 0,2,4),
* the model parameters (model_value, model_of_data, rdcu_model_adr) are ignored.
* @note The validity of the cfg structure is checked before the compression is
* started.
* *
* @returns 0 on success, error otherwise * @returns 0 on success, error otherwise
*/ */
...@@ -761,7 +764,7 @@ int rdcu_read_cmp_status(struct cmp_status *status) ...@@ -761,7 +764,7 @@ int rdcu_read_cmp_status(struct cmp_status *status)
/** /**
* @brief read out the metadata of a RDCU compression * @brief read out the metadata of an RDCU compression
* *
* @param info compression information contains the metadata of a compression * @param info compression information contains the metadata of a compression
* *
...@@ -818,14 +821,13 @@ int rdcu_read_cmp_info(struct cmp_info *info) ...@@ -818,14 +821,13 @@ int rdcu_read_cmp_info(struct cmp_info *info)
* @brief read the compressed bitstream from the RDCU SRAM * @brief read the compressed bitstream from the RDCU SRAM
* *
* @param info compression information contains the metadata of a compression * @param info compression information contains the metadata of a compression
* * @param compressed_data the buffer to store the bitstream (if NULL, the
* @param output_buf the buffer to store the bitstream (if NULL, the required * required size is returned)
* size is returned)
* *
* @returns the number of bytes read, < 0 on error * @returns the number of bytes read, < 0 on error
*/ */
int rdcu_read_cmp_bitstream(const struct cmp_info *info, void *output_buf) int rdcu_read_cmp_bitstream(const struct cmp_info *info, void *compressed_data)
{ {
uint32_t s; uint32_t s;
...@@ -835,7 +837,7 @@ int rdcu_read_cmp_bitstream(const struct cmp_info *info, void *output_buf) ...@@ -835,7 +837,7 @@ int rdcu_read_cmp_bitstream(const struct cmp_info *info, void *output_buf)
/* calculate the need bytes for the bitstream */ /* calculate the need bytes for the bitstream */
s = cmp_bit_to_4byte(info->cmp_size); s = cmp_bit_to_4byte(info->cmp_size);
if (output_buf == NULL) if (compressed_data == NULL)
return (int)s; return (int)s;
if (rdcu_sync_sram_to_mirror(info->rdcu_cmp_adr_used, s, if (rdcu_sync_sram_to_mirror(info->rdcu_cmp_adr_used, s,
...@@ -845,22 +847,22 @@ int rdcu_read_cmp_bitstream(const struct cmp_info *info, void *output_buf) ...@@ -845,22 +847,22 @@ int rdcu_read_cmp_bitstream(const struct cmp_info *info, void *output_buf)
/* wait for it */ /* wait for it */
sync(); sync();
return rdcu_read_sram(output_buf, info->rdcu_cmp_adr_used, s); return rdcu_read_sram(compressed_data, info->rdcu_cmp_adr_used, s);
} }
/** /**
* @brief read the model from the RDCU SRAM * @brief read the updated model from the RDCU SRAM
* *
* @param info compression information contains the metadata of a compression * @param info compression information contains the metadata of a compression
* *
* @param model_buf the buffer to store the model (if NULL, the required size * @param updated_model the buffer to store the updated model (if NULL, the required size
* is returned) * is returned)
* *
* @returns the number of bytes read, < 0 on error * @returns the number of bytes read, < 0 on error
*/ */
int rdcu_read_model(const struct cmp_info *info, void *model_buf) int rdcu_read_model(const struct cmp_info *info, void *updated_model)
{ {
uint32_t s; uint32_t s;
...@@ -870,7 +872,7 @@ int rdcu_read_model(const struct cmp_info *info, void *model_buf) ...@@ -870,7 +872,7 @@ int rdcu_read_model(const struct cmp_info *info, void *model_buf)
/* calculate the need bytes for the model */ /* calculate the need bytes for the model */
s = info->samples_used * IMA_SAM2BYT; s = info->samples_used * IMA_SAM2BYT;
if (model_buf == NULL) if (updated_model == NULL)
return (int)s; return (int)s;
if (rdcu_sync_sram_to_mirror(info->rdcu_new_model_adr_used, (s+3) & ~3U, if (rdcu_sync_sram_to_mirror(info->rdcu_new_model_adr_used, (s+3) & ~3U,
...@@ -880,7 +882,7 @@ int rdcu_read_model(const struct cmp_info *info, void *model_buf) ...@@ -880,7 +882,7 @@ int rdcu_read_model(const struct cmp_info *info, void *model_buf)
/* wait for it */ /* wait for it */
sync(); sync();
return rdcu_read_sram(model_buf, info->rdcu_new_model_adr_used, s); return rdcu_read_sram(updated_model, info->rdcu_new_model_adr_used, s);
} }
......
...@@ -311,8 +311,11 @@ int init_rmap_pkt_to_file(void) ...@@ -311,8 +311,11 @@ int init_rmap_pkt_to_file(void)
uint8_t icu_addr, rdcu_addr; uint8_t icu_addr, rdcu_addr;
int mtu; int mtu;
if (read_rdcu_pkt_mode_cfg(&icu_addr, &rdcu_addr, &mtu)) if (read_rdcu_pkt_mode_cfg(&icu_addr, &rdcu_addr, &mtu)) {
return -1; icu_addr = DEF_ICU_ADDR;
rdcu_addr = DEF_RDCU_ADDR;
mtu = DEF_MTU;
}
rdcu_ctrl_init(); rdcu_ctrl_init();
rdcu_set_source_logical_address(icu_addr); rdcu_set_source_logical_address(icu_addr);
rdcu_set_destination_logical_address(rdcu_addr); rdcu_set_destination_logical_address(rdcu_addr);
...@@ -323,7 +326,7 @@ int init_rmap_pkt_to_file(void) ...@@ -323,7 +326,7 @@ int init_rmap_pkt_to_file(void)
/** /**
* @brief generate the rmap packets to set up a RDCU compression * @brief generate the rmap packets to set up an RDCU compression
* @note note that the initialization function init_rmap_pkt_to_file() must be * @note note that the initialization function init_rmap_pkt_to_file() must be
* executed before * executed before
* @note the configuration of the ICU_ADDR, RDCU_ADDR, MTU settings are in the * @note the configuration of the ICU_ADDR, RDCU_ADDR, MTU settings are in the
...@@ -363,7 +366,7 @@ int gen_write_rdcu_pkts(const struct cmp_cfg *cfg) ...@@ -363,7 +366,7 @@ int gen_write_rdcu_pkts(const struct cmp_cfg *cfg)
/** /**
* @brief generate the rmap packets to read the result of a RDCU compression * @brief generate the rmap packets to read the result of an RDCU compression
* @note note that the initialization function init_rmap_pkt_to_file() must be * @note note that the initialization function init_rmap_pkt_to_file() must be
* executed before * executed before
* @note the configuration of the ICU_ADDR, RDCU_ADDR, MTU settings are in the * @note the configuration of the ICU_ADDR, RDCU_ADDR, MTU settings are in the
...@@ -434,7 +437,7 @@ int gen_read_rdcu_pkts(const struct cmp_info *info) ...@@ -434,7 +437,7 @@ int gen_read_rdcu_pkts(const struct cmp_info *info)
/** /**
* @brief generate the rmap packets to set up a RDCU compression, read the * @brief generate the rmap packets to set up an RDCU compression, read the
* bitstream and the updated model in parallel to write the data to compressed * bitstream and the updated model in parallel to write the data to compressed
* and the model and start the compression * and the model and start the compression
* @note the compressed data are read from cfg->rdcu_buffer_adr with the length * @note the compressed data are read from cfg->rdcu_buffer_adr with the length
......
...@@ -490,7 +490,7 @@ int rdcu_sync(int (*fn)(uint16_t trans_id, uint8_t *cmd), ...@@ -490,7 +490,7 @@ int rdcu_sync(int (*fn)(uint16_t trans_id, uint8_t *cmd),
/** /**
* @brief submit a data sync command * @brief submit a data sync command
* *
* @param fn a RDCU data transfer generation function * @param fn an RDCU data transfer generation function
* @param addr the remote address * @param addr the remote address
* @param data the local data address * @param data the local data address
* @param data_len the length of the data payload * @param data_len the length of the data payload
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment