8 #include PLATFORM_HEADER
29 GPIO_DBGCFG &= ~GPIO_EXTREGEN;
35 #ifndef DISABLE_WATCHDOG
52 OSC24M_CTRL = OSC24M_CTRL_RESET;
53 CPU_CLKSEL = CPU_CLKSEL_RESET;
55 SCS_AIRCR = (0x05FA0000 | SCS_AIRCR_SYSRESETREQ);
73 static uint16_t seed0 = 0xbeef;
74 static uint16_t seed1 = 0xface;
78 seed0 = (uint16_t) seed;
81 seed1 = (uint16_t) (seed >> 16);
86 static uint16_t shift(uint16_t *val, uint16_t taps)
88 uint16_t newVal = *val;
98 return (shift(&seed0, 0x0062)
99 ^ shift(&seed1, 0x100B));
102 void halCommonMemCopy(
void *dest,
const void *source, uint8_t bytes)
104 memcpy(dest, source, bytes);
107 int8_t halCommonMemCompare(
const void *source0,
const void *source1, uint8_t bytes)
109 return memcmp(source0, source1, bytes);
112 void halCommonMemSet(
void *dest, uint8_t val, uint16_t bytes)
114 memset(dest, val, bytes);
118 typedef struct appSwitchStruct {
126 } appSwitchStructType;
128 static appSwitchStructType *appSwitch = (appSwitchStructType *) RAM_BOTTOM;
133 uint8_t cut = *(
volatile uint8_t *) 0x08040798;
134 if (!( (halFixedAddressTable.baseTable.type == FIXED_ADDRESS_TABLE_TYPE) &&
135 ( ( (halFixedAddressTable.baseTable.version & FAT_MAJOR_VERSION_MASK)
137 (halFixedAddressTable.baseTable.version == 0x0003)
138 ) && (cut >= 2) && (cut <= 3)))
145 appSwitch->param.panID = panID;
151 appSwitch->mode = mode;
STM32W108 series memory map definitions used by the full hal.
StStatus halBootloaderStart(uint8_t mode, uint8_t channel, uint16_t panID)
Request the appplication to enter in bootloader mode.
void halInit(void)
Initializes microcontroller-specific peripherals.
void halInternalCalibrateFastRc(void)
Calibrates the internal FastRC to generate a 12Mhz clock.
void halInternalEnableWatchDog(void)
Enables the watchdog timer.
#define IAP_BOOTLOADER_MODE_OTA
IAP bootloader OTA mode.
#define ST_BAD_ARGUMENT(x02)
An invalid value was passed as an argument to a function.
#define IAP_BOOTLOADER_DEFAULT_CHANNEL
Radio default channel for OTA bootloader.
Utility and convenience functions for STM32W108 microcontroller, common to both the full and minimal ...
void halBoardPowerDown(void)
Perform board specific action to power down the system, usually before going to deep sleep...
void halPowerDown(void)
Powers down microcontroller peripherals and board peripherals.
void halCommonCalibratePads(void)
Calibrates the GPIO pads.
void halPowerUp(void)
Powers up microcontroller peripherals and board peripherals.
void halCommonSeedRandom(uint32_t seed)
Seeds the halCommonGetRandom() pseudorandom number generator.
void halInternalSwitchToXtal(void)
Switches to running off of the 24MHz crystal, including changing the CPU to be 24MHz (FCLK sourced fr...
#define INTERRUPTS_OFF()
Disable global interrupts without regard to the current or previous state.
IAP bootloader specific definitions.
#define IAP_BOOTLOADER_MODE_UART
IAP bootloader uart mode.
Minimal Hal functions common across all microcontroller-specific files.
uint16_t halCommonGetRandom(void)
Runs a standard LFSR to generate pseudorandom numbers.
Header for A/D converter.
void halBoardPowerUp(void)
Perform board specific action to power up the system.
#define FALSE
An alias for zero, used for clarity.
void halReboot(void)
Restarts the microcontroller and therefore everything else.
void halBoardInit(void)
Initialize the board description data structure after autodetect of the boards based on the CIB Board...
void halInternalSetRegTrim(boolean boostMode)
Sets the trim values for the 1.8V and 1.2V regulators based upon manufacturing configuration.
uint16_t halInternalStartSystemTimer(void)
Initializes the system tick.
#define IAP_BOOTLOADER_APP_SWITCH_SIGNATURE
Signature used for switch to application.
Header file for system_timer APIs.
uint8_t StStatus
Return type for St functions.
#define ST_ERR_FATAL(x01)
The generic "fatal error" message.