Use singly linked list to store profile commands.
This commit is contained in:
		@@ -22,6 +22,7 @@
 | 
			
		||||
#define __CONFIG_PARSER_TEMP_PROFILE_PARSER_H__
 | 
			
		||||
 | 
			
		||||
#include <stdint.h>
 | 
			
		||||
#include <linklist-lib/singly-linked-list.h>
 | 
			
		||||
 | 
			
		||||
enum pl_command_type {
 | 
			
		||||
	PL_PID_CONF = 0,
 | 
			
		||||
@@ -49,9 +50,33 @@ struct pl_command {
 | 
			
		||||
	float params[PROFILE_LANG_MAX_NUM_ARGS];
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Parse a temperature profile from file and generate the command list
 | 
			
		||||
 *
 | 
			
		||||
 * Commands are parsed into the list given by \p command_list. If \p max_len is reached,
 | 
			
		||||
 * the function returns with @ref PL_RET_LIST_FULL
 | 
			
		||||
 *
 | 
			
		||||
 * In any case, the command list not cleared afterwards. The user has to clear the command list manually
 | 
			
		||||
 * using @ref temp_profile_free_command_list.
 | 
			
		||||
 *
 | 
			
		||||
 * @param filename File to parse
 | 
			
		||||
 * @param[in, out] command_list Command list to output @ref pl_command elements in.
 | 
			
		||||
 * @param max_len maximum number of commands.
 | 
			
		||||
 * @param cmds_parsed Number of parsed commands
 | 
			
		||||
 * @return
 | 
			
		||||
 */
 | 
			
		||||
enum pl_ret_val temp_profile_parse_from_file(const char *filename,
 | 
			
		||||
					     struct pl_command *cmd_list,
 | 
			
		||||
					     uint32_t cmd_list_length,
 | 
			
		||||
					     SlList **command_list,
 | 
			
		||||
					     uint32_t max_len,
 | 
			
		||||
					     uint32_t *cmds_parsed);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Fully free a comamnd list including hte sotred command structures.
 | 
			
		||||
 *
 | 
			
		||||
 * \p list's destination is set to NULL to indicate the empty list.
 | 
			
		||||
 *
 | 
			
		||||
 * @param[in, out] list Pointer to list.
 | 
			
		||||
 */
 | 
			
		||||
void temp_profile_free_command_list(SlList **list);
 | 
			
		||||
 | 
			
		||||
#endif /* __CONFIG_PARSER_TEMP_PROFILE_PARSER_H__ */
 | 
			
		||||
 
 | 
			
		||||
@@ -24,7 +24,7 @@
 | 
			
		||||
#include <stdint.h>
 | 
			
		||||
#include <reflow-controller/config-parser/temp-profile-parser.h>
 | 
			
		||||
 | 
			
		||||
#define MAX_PROFILE_LENGTH 50
 | 
			
		||||
#define MAX_PROFILE_LENGTH 64
 | 
			
		||||
 | 
			
		||||
enum tpe_status {
 | 
			
		||||
	TPE_OFF,
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user