bootloader/uart_commands.h

46 lines
1019 B
C
Raw Normal View History

2022-05-19 08:57:38 -04:00
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
#include "uart.h"
#include "iap.h"
#include "crc.h"
2022-05-22 13:52:44 -04:00
#define DELIMIERS ","
2022-05-28 17:09:33 -04:00
#define LPC1769_FLASH_SIZE 0x80000
2022-05-24 09:17:23 -04:00
#define APP_OFFSET 0x4000
2022-05-28 17:09:33 -04:00
#define MAX_PROG_SIZE (LPC1769_FLASH_SIZE - APP_OFFSET)
2022-05-19 08:57:38 -04:00
typedef struct cmd {
char** argv; // a first command splitted as arguments in the argv style
int argc; // number of arguments in the first command
} cmd_t;
2022-05-24 08:53:35 -04:00
2022-05-19 08:57:38 -04:00
void uart_commands_getid(error_code* status);
void uart_commands_getserial(error_code* status);
2022-05-24 06:48:02 -04:00
crc_t uart_commands_prog(error_code* status, int size);
2022-05-19 08:57:38 -04:00
2022-05-19 15:37:51 -04:00
error_code uart_commands_data(error_code* status, int size, crc_t* checksum_global, crc_t checksum_loc, int offset);
error_code uart_commands_check(crc_t crc_received, crc_t crc_calculated);
2022-05-19 08:57:38 -04:00
int uart_parse_command(char *user_input, cmd_t *cmd);
2022-05-24 06:48:02 -04:00
void uart_send_ok();
void uart_send_err();
2022-05-30 11:50:19 -04:00
void uart_send_cmd_illeg();
2022-05-24 09:17:23 -04:00
2022-05-24 10:52:09 -04:00
void digit_to_str(char* str, uint32_t number, int base);
2022-05-24 08:53:35 -04:00
2022-05-19 08:57:38 -04:00
uint32_t uart_string_to_int(const char* str);