canboot: Introduce a new canboot.h header file

Move canboot specific definitions in board/misc.h to new canboot.h
header file.  This makes it a little easier to identify differences
between canboot code and low-level upstream klipper code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2022-12-15 14:45:15 -05:00 committed by Eric Callahan
parent 6a233ff4f5
commit d30ad28f03
13 changed files with 30 additions and 16 deletions

View File

@ -10,8 +10,8 @@
#include "board/gpio.h" // gpio_in_setup
#include "board/misc.h" // set_bootup_code
#include "bootentry.h" // bootentry_check
#include "canboot.h" // udelay
#include "ctr.h" // DECL_CTR
#include "sched.h" // udelay
// Generated by buildcommands.py
DECL_CTR("DECL_BUTTON " __stringify(CONFIG_BUTTON_PIN));

19
src/canboot.h Normal file
View File

@ -0,0 +1,19 @@
#ifndef __CANBOOT_H
#define __CANBOOT_H
#include <stdint.h> // uint32_t
#define CANBOOT_SIGNATURE 0x21746f6f426e6143 // CanBoot!
#define REQUEST_CANBOOT 0x5984E3FA6CA1589B
#define REQUEST_START_APP 0x7b06ec45a9a8243d
uint64_t get_bootup_code(void);
void set_bootup_code(uint64_t code);
void application_read_flash(uint32_t address, uint32_t *dest);
int application_check_valid(void);
void application_jump(void);
void udelay(uint32_t usecs);
void timer_setup(void);
#endif // canboot.h

View File

@ -9,6 +9,8 @@
#include "board/armcm_reset.h" // try_request_canboot
#include "board/flash.h" // flash_write_block
#include "board/io.h" // readb
#include "board/misc.h" // timer_read_time
#include "canboot.h" // timer_setup
#include "deployer.h" // deployer_is_active
#include "sched.h" // sched_check_periodic

View File

@ -9,6 +9,7 @@
#include "board/flash.h" // flash_write_block
#include "board/misc.h" // application_jump
#include "byteorder.h" // cpu_to_le32
#include "canboot.h" // application_jump
#include "command.h" // command_respond_ack
#include "flashcmd.h" // flashcmd_is_in_transfer
#include "sched.h" // DECL_TASK

View File

@ -9,7 +9,7 @@
#include "autoconf.h" // CONFIG_MCU
#include "board/internal.h" // SysTick
#include "board/irq.h" // irq_disable
#include "board/misc.h" // get_bootup_code
#include "canboot.h" // get_bootup_code
#include "command.h" // DECL_CONSTANT_STR
// Export MCU type

View File

@ -9,6 +9,7 @@
#include "board/internal.h" // NVIC_SystemReset
#include "board/irq.h" // irq_disable
#include "board/misc.h" // try_request_canboot
#include "canboot.h" // REQUEST_CANBOOT
void
try_request_canboot(void)

View File

@ -9,7 +9,7 @@
#include "board/internal.h" // SysTick
#include "board/irq.h" // irq_disable
#include "board/misc.h" // timer_from_us
#include "canboot.h" // timer_setup
// Return the number of clock ticks for a given number of microseconds
uint32_t

View File

@ -8,18 +8,6 @@ struct command_encoder;
void console_sendf(const struct command_encoder *ce, va_list args);
void *console_receive_buffer(void);
#define CANBOOT_SIGNATURE 0x21746f6f426e6143 // CanBoot!
#define REQUEST_CANBOOT 0x5984E3FA6CA1589B
#define REQUEST_START_APP 0x7b06ec45a9a8243d
uint64_t get_bootup_code(void);
void set_bootup_code(uint64_t code);
void application_read_flash(uint32_t address, uint32_t *dest);
int application_check_valid(void);
void application_jump(void);
void timer_setup(void);
uint32_t timer_from_us(uint32_t us);
uint8_t timer_is_before(uint32_t time1, uint32_t time2);
uint32_t timer_read_time(void);

View File

@ -10,6 +10,7 @@
#include "board/internal.h" // SysTick
#include "board/irq.h" // irq_disable
#include "board/misc.h" // get_bootup_code
#include "canboot.h" // get_bootup_code
#include "command.h" // DECL_CONSTANT_STR
// Export MCU type

View File

@ -8,6 +8,7 @@
#include "board/armcm_boot.h" // armcm_enable_irq
#include "board/irq.h" // irq_disable
#include "board/misc.h" // timer_read_time
#include "canboot.h" // timer_setup
#include "hardware/structs/resets.h" // RESETS_RESET_UART0_BITS
#include "hardware/structs/timer.h" // RESETS_RESET_UART0_BITS
#include "internal.h" // enable_pclock

View File

@ -7,6 +7,7 @@
#include "board/io.h" // readb
#include "board/misc.h" // jump_to_application
#include "bootentry.h" // bootentry_check
#include "canboot.h" // timer_setup
#include "deployer.h" // deployer_is_active
#include "sched.h" // sched_check_periodic

View File

@ -17,7 +17,6 @@ struct task_wake {
};
// sched.c
void udelay(uint32_t usecs);
void sched_wake_tasks(void);
void sched_wake_task(struct task_wake *w);
uint8_t sched_check_wake(struct task_wake *w);

View File

@ -9,6 +9,7 @@
#include "board/io.h" // readl
#include "board/irq.h" // irq_disable
#include "board/misc.h" // timer_read_time
#include "canboot.h" // timer_setup
/****************************************************************