New HAL and SimpleMAC for STM32W108.
This commit is contained in:
parent
c9af578eab
commit
eb588f1aec
89 changed files with 1503 additions and 1883 deletions
|
@ -6,15 +6,19 @@
|
|||
*/
|
||||
|
||||
#include PLATFORM_HEADER
|
||||
#include BOARD_HEADER
|
||||
#include "error.h"
|
||||
#include "hal/micro/micro-common.h"
|
||||
#include "hal/micro/cortexm3/micro-common.h"
|
||||
#include "micro/system-timer.h"
|
||||
#include "micro/adc.h"
|
||||
#include "micro/cortexm3/memmap.h"
|
||||
#include "micro/cortexm3/iap_bootloader.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
extern void halBoardInit(void);
|
||||
|
||||
void halInit(void)
|
||||
{
|
||||
|
@ -24,6 +28,7 @@ void halInit(void)
|
|||
//be deleted.
|
||||
GPIO_DBGCFG &= ~GPIO_EXTREGEN;
|
||||
halInternalSetRegTrim(FALSE);
|
||||
halBoardInit();
|
||||
halPowerUp();
|
||||
halInternalCalibrateFastRc();
|
||||
|
||||
|
@ -54,6 +59,7 @@ void halReboot(void)
|
|||
|
||||
void halPowerDown(void)
|
||||
{
|
||||
halBoardPowerDown();
|
||||
}
|
||||
|
||||
void halPowerUp(void)
|
||||
|
@ -61,6 +67,7 @@ void halPowerUp(void)
|
|||
halInternalInitAdc();
|
||||
halCommonCalibratePads();
|
||||
halInternalSwitchToXtal();
|
||||
halBoardPowerUp();
|
||||
}
|
||||
|
||||
static int16u seed0 = 0xbeef;
|
||||
|
@ -106,3 +113,43 @@ void halCommonMemSet(void *dest, int8u val, int16u bytes)
|
|||
{
|
||||
memset(dest, val, bytes);
|
||||
}
|
||||
|
||||
#pragma pack(1)
|
||||
typedef struct appSwitchStruct {
|
||||
int32u signature;
|
||||
int8u mode;
|
||||
int8u channel;
|
||||
union {
|
||||
int16u panID;
|
||||
int16u offset;
|
||||
} param;
|
||||
} appSwitchStructType;
|
||||
#pragma pack()
|
||||
static appSwitchStructType *appSwitch = (appSwitchStructType *) RAM_BOTTOM;
|
||||
|
||||
StStatus halBootloaderStart(int8u mode, int8u channel, int16u panID)
|
||||
{
|
||||
if (mode == IAP_BOOTLOADER_MODE_UART) {
|
||||
int8u cut = *(volatile int8u *) 0x08040798;
|
||||
if (!( (halFixedAddressTable.baseTable.type == FIXED_ADDRESS_TABLE_TYPE) &&
|
||||
( ( (halFixedAddressTable.baseTable.version & FAT_MAJOR_VERSION_MASK)
|
||||
== 0x0000 ) &&
|
||||
(halFixedAddressTable.baseTable.version == 0x0003) //checking presence of valid version
|
||||
) && (cut >= 2) && (cut <= 3)))
|
||||
/* Cut not supported */
|
||||
return ST_ERR_FATAL;
|
||||
} else {
|
||||
/* Check that OTA bootloader is at the base of the flash */
|
||||
if (*((int32u *) (MFB_BOTTOM + 28)) == IAP_BOOTLOADER_APP_SWITCH_SIGNATURE) {
|
||||
appSwitch->channel = ((channel >= 11) && (channel <= 26)) ? channel :IAP_BOOTLOADER_DEFAULT_CHANNEL;
|
||||
appSwitch->param.panID = panID;
|
||||
} else {
|
||||
return ST_ERR_FATAL;
|
||||
}
|
||||
}
|
||||
appSwitch->signature = IAP_BOOTLOADER_APP_SWITCH_SIGNATURE;
|
||||
appSwitch->mode = mode;
|
||||
halReboot();
|
||||
|
||||
return (mode <= IAP_BOOTLOADER_MODE_OTA) ? ST_ERR_FATAL: ST_BAD_ARGUMENT;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue