2019-04-20 21:04:46 -07:00
|
|
|
/*
|
|
|
|
* @file chconf_common.h
|
|
|
|
*
|
|
|
|
* @date Apr 20, 2019
|
2020-01-07 21:02:40 -08:00
|
|
|
* @author Andrey Belomutskiy, (c) 2012-2020
|
2019-04-20 21:04:46 -07:00
|
|
|
*/
|
|
|
|
|
2023-07-06 10:46:50 -07:00
|
|
|
/*
|
|
|
|
* __process_stack_size__ and __process_stack_size__ defaults are each hard-coded as 0x400 in ChibiOS rules.mk files
|
|
|
|
* rusEFI does not override these defaults.
|
|
|
|
*
|
|
|
|
* http://www.chibios.com/forum/viewtopic.php?t=309
|
|
|
|
* "__main_stack_size__ is the size of INTERRUPTS stack"
|
|
|
|
* "__process_stack_size__ is the stack of the C-runtime, in ChibiOS the "main" thread uses the C-runtime stack."
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2019-04-20 21:04:46 -07:00
|
|
|
#ifndef CONFIG_CHCONF_COMMON_H_
|
|
|
|
#define CONFIG_CHCONF_COMMON_H_
|
|
|
|
|
2023-07-06 10:46:50 -07:00
|
|
|
#define _CHIBIOS_RT_CONF_
|
|
|
|
#define _CHIBIOS_RT_CONF_VER_6_1_
|
|
|
|
|
2021-02-05 19:19:24 -08:00
|
|
|
#define PORT_IDLE_THREAD_STACK_SIZE 32
|
|
|
|
|
|
|
|
// See global_shared.h notes about stack requirements
|
|
|
|
// see also http://www.chibios.org/dokuwiki/doku.php?id=chibios:kb:stacks
|
|
|
|
#define PORT_INT_REQUIRED_STACK 128
|
|
|
|
|
|
|
|
#define CHPRINTF_USE_FLOAT TRUE
|
|
|
|
|
2019-04-20 21:04:46 -07:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C"
|
|
|
|
{
|
|
|
|
#endif /* __cplusplus */
|
|
|
|
#ifndef __ASSEMBLER__
|
2020-04-27 13:07:05 -07:00
|
|
|
void irqEnterHook(void);
|
|
|
|
void irqExitHook(void);
|
|
|
|
void contextSwitchHook(void);
|
2020-04-29 07:53:35 -07:00
|
|
|
void threadInitHook(void* tp);
|
2020-07-10 20:27:27 -07:00
|
|
|
void onLockHook(void);
|
|
|
|
void onUnlockHook(void);
|
2019-04-20 21:04:46 -07:00
|
|
|
#endif /* __ASSEMBLER__ */
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif /* __cplusplus */
|
|
|
|
|
2020-07-10 20:27:27 -07:00
|
|
|
#define ON_LOCK_HOOK onLockHook()
|
|
|
|
#define ON_UNLOCK_HOOK onUnlockHook()
|
2019-04-20 21:04:46 -07:00
|
|
|
|
2019-06-12 11:55:26 -07:00
|
|
|
#if !defined(_FROM_ASM_)
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
void boardInit(void);
|
|
|
|
void setPinConfigurationOverrides(void);
|
|
|
|
void setAdcChannelOverrides(void);
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif /* _FROM_ASM_ */
|
|
|
|
|
2021-01-19 12:20:35 -08:00
|
|
|
/*===========================================================================*/
|
|
|
|
/**
|
|
|
|
* @name Kernel hooks
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
/*===========================================================================*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Threads descriptor structure extension.
|
|
|
|
* @details User fields added to the end of the @p thread_t structure.
|
|
|
|
*/
|
|
|
|
#define CH_CFG_THREAD_EXTRA_FIELDS \
|
|
|
|
void *activeStack; \
|
|
|
|
int remainingStack; \
|
|
|
|
unsigned char threadId; \
|
|
|
|
/* Add threads custom fields here.*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Threads initialization hook.
|
|
|
|
* @details User initialization code added to the @p chThdInit() API.
|
|
|
|
*
|
|
|
|
* @note It is invoked from within @p chThdInit() and implicitly from all
|
|
|
|
* the threads creation APIs.
|
|
|
|
*/
|
|
|
|
#define CH_CFG_THREAD_INIT_HOOK(tp) { \
|
|
|
|
threadInitHook(tp); \
|
|
|
|
}
|
2019-04-20 21:04:46 -07:00
|
|
|
|
2020-04-27 13:07:05 -07:00
|
|
|
/**
|
|
|
|
* @brief Context switch hook.
|
|
|
|
* @details This hook is invoked just before switching between threads.
|
|
|
|
*/
|
|
|
|
#define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) { \
|
2021-01-19 12:20:35 -08:00
|
|
|
contextSwitchHook(); \
|
2020-04-27 13:07:05 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief ISR enter hook.
|
|
|
|
*/
|
|
|
|
#define CH_CFG_IRQ_PROLOGUE_HOOK() { \
|
|
|
|
/* IRQ prologue code here.*/ \
|
|
|
|
irqEnterHook(); \
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief ISR exit hook.
|
|
|
|
*/
|
|
|
|
#define CH_CFG_IRQ_EPILOGUE_HOOK() { \
|
|
|
|
/* IRQ epilogue code here.*/ \
|
|
|
|
irqExitHook(); \
|
|
|
|
}
|
|
|
|
|
2021-02-05 20:41:26 -08:00
|
|
|
/**
|
|
|
|
* declared as a macro so that this code does not use stack
|
|
|
|
* so that it would not crash the error handler in case of stack issues
|
|
|
|
*/
|
|
|
|
#if CH_DBG_SYSTEM_STATE_CHECK
|
|
|
|
#define hasOsPanicError() (ch.dbg.panic_msg != NULL)
|
|
|
|
#else
|
|
|
|
#define hasOsPanicError() (FALSE)
|
|
|
|
#endif
|
|
|
|
|
2021-02-05 20:56:22 -08:00
|
|
|
#ifndef __ASSEMBLER__
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C"
|
|
|
|
#endif // __cplusplus
|
|
|
|
void chDbgPanic3(const char *msg, const char * file, int line);
|
|
|
|
#endif // __ASSEMBLER__
|
|
|
|
|
2019-04-20 21:04:46 -07:00
|
|
|
#endif /* CONFIG_CHCONF_COMMON_H_ */
|