Cascoda SDK
Cascoda SDK for building software to run with CA-821x transceivers
Baremetal platform abstraction

Platform abstraction layer definition for baremetal, expands upon Baremetal Core platform abstraction. More...

Collaboration diagram for Baremetal platform abstraction:

Classes

struct  gpio_input_args
 Arguments for the BSP_ModuleRegisterGPIOInput function. More...
 
struct  ModuleSpecialPins
 
struct  RTCDateAndTime
 Interface Structure for RTC Date and Time. More...
 

Macros

#define MSP_DEFAULT   P_NA, P_NA, P_NA, P_NA
 

Typedefs

typedef enum fsys_mhz fsys_mhz
 
typedef enum wakeup_reason wakeup_reason
 
typedef enum dpd_flag dpd_flag
 
typedef enum sysreset_mode sysreset_mode
 
typedef enum module_pin_dir module_pin_dir
 Pin Type. More...
 
typedef enum module_pin_pullup module_pin_pullup
 Pin Pull-Up. More...
 
typedef enum module_pin_debounce module_pin_debounce
 Pin Debounce. More...
 
typedef enum module_pin_type module_pin_type
 Pin is LED? More...
 
typedef enum module_pin_irq module_pin_irq
 Pin Interrupt. More...
 
typedef void(* dispatch_read_t) (struct ca821x_dev *pDeviceRef)
 

Enumerations

enum  fsys_mhz {
  FSYS_4MHZ = 4 , FSYS_12MHZ = 12 , FSYS_16MHZ = 16 , FSYS_24MHZ = 24 ,
  FSYS_32MHZ = 32 , FSYS_48MHZ = 48 , FSYS_64MHZ = 64 , FSYS_EXTERNAL_CA821X = FSYS_4MHZ ,
  FSYS_EXTERNAL_NUMAKER = FSYS_12MHZ , FSYS_INTERNAL_HIRC = FSYS_12MHZ , FSYS_INTERNAL_HIRC48 = FSYS_48MHZ , FSYS_EXTERNAL_SOURCE = FSYS_EXTERNAL_CA821X
}
 
enum  wakeup_reason {
  WAKEUP_POWERON = 0 , WAKEUP_DEEP_POWERDOWN = 1 , WAKEUP_WATCHDOG = 2 , WAKEUP_HARDFAULT = 3 ,
  WAKEUP_SYSRESET = 4 , WAKEUP_RTCALARM = 5
}
 
enum  dpd_flag { DPD_FLAG_NO_DPD = 0 , DPD_FLAG_WAKEUP_ENABLED = 1 , DPD_FLAG_WAKEUP_DISABLED = 2 }
 
enum  sysreset_mode { SYSRESET_APROM = 0 , SYSRESET_DFU = 1 }
 
enum  module_pin_dir { MODULE_PIN_DIR_IN = 0 , MODULE_PIN_DIR_OUT = 1 }
 Pin Type. More...
 
enum  module_pin_pullup { MODULE_PIN_PULLUP_OFF = 0 , MODULE_PIN_PULLUP_ON = 1 }
 Pin Pull-Up. More...
 
enum  module_pin_debounce { MODULE_PIN_DEBOUNCE_OFF = 0 , MODULE_PIN_DEBOUNCE_ON = 1 }
 Pin Debounce. More...
 
enum  module_pin_type { MODULE_PIN_TYPE_GENERIC = 0 , MODULE_PIN_TYPE_LED = 1 }
 Pin is LED? More...
 
enum  module_pin_irq { MODULE_PIN_IRQ_OFF = 0 , MODULE_PIN_IRQ_FALL = 1 , MODULE_PIN_IRQ_RISE = 2 , MODULE_PIN_IRQ_BOTH = 3 }
 Pin Interrupt. More...
 
enum  module_pin_not_available { P_NA = 255 }
 
enum  module_pin_led_set { LED_ON = 0 , LED_OFF = 1 }
 

Functions

void BSP_EnableSerialIRQ (void)
 Enable the serial (usb/uart) irq. More...
 
void BSP_DisableSerialIRQ (void)
 Disable the serial (usb/uart) irq. More...
 
void BSP_PowerDown (u32_t sleeptime_ms, u8_t use_timer0, dpd_flag dpd)
 Set up wake on timer/IRQ, Power down MCU and return on wakeup. More...
 
void BSP_SetPowerDown (void)
 Set flag that system has started power-down sequence. More...
 
void BSP_Initialise (struct ca821x_dev *pDeviceRef)
 Initialise the system for a given ca821x_dev. More...
 
void BSP_UseExternalClock (u8_t useExternalClock)
 Enable or disable the usage of the external clock from the CA821x. More...
 
struct ModuleSpecialPins BSP_GetModuleSpecialPins (void)
 Get the struct of special pins for the platform. More...
 
ca_error BSP_ModuleRegisterGPIOInput (struct gpio_input_args *args)
 Registers GPIO Input Functionality for Module Pin. More...
 
ca_error BSP_ModuleRegisterGPIOOutput (u8_t mpin, module_pin_type isled)
 Registers GPIO Output Functionality for Module Pin. More...
 
ca_error BSP_ModuleRegisterGPIOOutputOD (u8_t mpin, module_pin_type isled)
 Registers GPIO Open Drain Output Functionality for Module Pin. More...
 
ca_error BSP_ModuleRegisterGPIOSharedInputOutputOD (struct gpio_input_args *args, module_pin_type isled)
 Registers GPIO Input AND Open Drain Output Functionality for Module Pin. More...
 
ca_error BSP_ModuleDeregisterGPIOPin (u8_t mpin)
 Unregisters GPIO Functionality for Module Pin to Default Settings. More...
 
u8_t BSP_ModuleIsGPIOPinRegistered (u8_t mpin)
 Checks if a Module Pin is already registered / used. More...
 
ca_error BSP_ModuleSetGPIOPin (u8_t mpin, u8_t val)
 Sets Module Pin GPIO Output Value. More...
 
ca_error BSP_ModuleSenseGPIOPin (u8_t mpin, u8_t *val)
 Senses GPIO Input Value of Module Pin. More...
 
ca_error BSP_ModuleSenseGPIOPinOutput (u8_t mpin, u8_t *val)
 Senses GPIO Output Value of Module Pin. More...
 
ca_error BSP_ModuleSetGPIOOutputPermanent (u8_t mpin)
 Sets Module Pin GPIO Output as permanently driven (don't tristate in Power-Down) More...
 
ca_error BSP_ModuleReadVoltsPin (u8_t mpin, u32_t *val)
 Reads ADC Conversion Value on Module Pin. More...
 
void BSP_SystemReset (sysreset_mode resetMode)
 **OPTIONAL Function Declarations for cascoda_bsp_*.c
More...
 
ca_error BSP_SetBootMode (sysreset_mode bootMode)
 Set the default boot mode for the device. More...
 
u64_t BSP_GetUniqueId (void)
 Get a 64-bit ID that is unique to this device. More...
 
const char * BSP_GetPlatString (void)
 Get a string that describes this device. More...
 
u8_t BSP_GetChargeStat (void)
 Get Microchip MCP73831 Charge Status. More...
 
u8_t BSP_GetVBUSConnected (void)
 Get USB VBUS status (connected/not connected) More...
 
i32_t BSP_GetTemperature (void)
 Measure and Read Temperature Value. More...
 
u32_t BSP_ADCGetVolts (void)
 Measure and Read Battery Volts Value from ADC. More...
 
wakeup_reason BSP_GetWakeupReason (void)
 Reason MCU has woken up after reset. More...
 
void BSP_WatchdogEnable (u32_t timeout_ms)
 Watchdog Enable. More...
 
void BSP_WatchdogReset (void)
 Watchdog Reset and Restart. More...
 
void BSP_WatchdogDisable (void)
 Watchdog Disable. More...
 
u8_t BSP_IsWatchdogTriggered (void)
 Checks if the watchdog has been triggered, clears the warning if so. More...
 
void BSP_EnableUSB (void)
 Enable the USB if connected. More...
 
void BSP_DisableUSB (void)
 Disable the USB. More...
 
u8_t BSP_IsUSBPresent (void)
 Is the USB connected? More...
 
fsys_mhz BSP_GetSystemFrequency (void)
 Returns the system frequency. More...
 
void BSP_SystemConfig (fsys_mhz fsys, u8_t enable_comms)
 re-configures system clock frequency and comms interface More...
 
void BSP_GetFlashInfo (struct ca_flash_info *aFlashInfoOut)
 Get the flashinfo struct for the current platform. More...
 
ca_error BSP_FlashWriteInitial (u32_t startaddr, void *data, u32_t datasize)
 Writes Dataflash Memory, relies on Memory erased. More...
 
ca_error BSP_FlashErase (u32_t startaddr)
 Erases a Dataflash Memory page (All words in page set to 0xFFFFFFFF) More...
 
ca_error BSP_FlashRead (u32_t startaddr, u32_t *data, u32_t datasize)
 Reads Dataflash Memory. More...
 
void BSP_FlashLock (void)
 Prevent ICP access to Flash. More...
 
ca_error BSP_FlashCheck (u32_t startaddr, u32_t checklen, u32_t crc32)
 Check that a given range of flash matches the provided CRC32 checksum. More...
 
void BSP_RTCInitialise (void)
 Initialises RTC. More...
 
ca_error BSP_RTCSetAlarmSeconds (u32_t seconds)
 Sets RTC Alarm in seconds from current time. More...
 
void BSP_RTCDisableAlarm (void)
 Disables RTC Alarm. More...
 
ca_error BSP_RTCSetDateAndTime (struct RTCDateAndTime dateandtime)
 Sets RTC Date+Time. More...
 
void BSP_RTCGetDateAndTime (struct RTCDateAndTime *dateandtime)
 Gets RTC Date+Time. More...
 
void BSP_RTCConvertSecondsToDateAndTime (i64_t seconds, struct RTCDateAndTime *dateandtime)
 Converts Unix Time seconds to RTC Date+Time. More...
 
i64_t BSP_RTCConvertDateAndTimeToSeconds (const struct RTCDateAndTime *dateandtime)
 Converts RTC Date+Time to Unix Time seconds. More...
 
void BSP_RTCRegisterCallback (int(*callback)(void))
 Registers RTC IRQ function callback. More...
 

Detailed Description

Platform abstraction layer definition for baremetal, expands upon Baremetal Core platform abstraction.

Macro Definition Documentation

◆ MSP_DEFAULT

#define MSP_DEFAULT   P_NA, P_NA, P_NA, P_NA

Typedef Documentation

◆ dispatch_read_t

typedef void(* dispatch_read_t) (struct ca821x_dev *pDeviceRef)

◆ dpd_flag

typedef enum dpd_flag dpd_flag

◆ fsys_mhz

typedef enum fsys_mhz fsys_mhz

◆ module_pin_debounce

Pin Debounce.

◆ module_pin_dir

Pin Type.

◆ module_pin_irq

Pin Interrupt.

◆ module_pin_pullup

Pin Pull-Up.

◆ module_pin_type

Pin is LED?

◆ sysreset_mode

◆ wakeup_reason

Enumeration Type Documentation

◆ dpd_flag

enum dpd_flag
Enumerator
DPD_FLAG_NO_DPD 
DPD_FLAG_WAKEUP_ENABLED 
DPD_FLAG_WAKEUP_DISABLED 

◆ fsys_mhz

enum fsys_mhz
Enumerator
FSYS_4MHZ 
FSYS_12MHZ 
FSYS_16MHZ 
FSYS_24MHZ 
FSYS_32MHZ 
FSYS_48MHZ 
FSYS_64MHZ 
FSYS_EXTERNAL_CA821X 
FSYS_EXTERNAL_NUMAKER 
FSYS_INTERNAL_HIRC 
FSYS_INTERNAL_HIRC48 
FSYS_EXTERNAL_SOURCE 

◆ module_pin_debounce

Pin Debounce.

Enumerator
MODULE_PIN_DEBOUNCE_OFF 

debounce off

MODULE_PIN_DEBOUNCE_ON 

debounce on

◆ module_pin_dir

Pin Type.

Enumerator
MODULE_PIN_DIR_IN 

input

MODULE_PIN_DIR_OUT 

output

◆ module_pin_irq

Pin Interrupt.

Enumerator
MODULE_PIN_IRQ_OFF 

irq off

MODULE_PIN_IRQ_FALL 

irq falling edge

MODULE_PIN_IRQ_RISE 

irq rising edge

MODULE_PIN_IRQ_BOTH 

irq both edges

◆ module_pin_led_set

Enumerator
LED_ON 
LED_OFF 

◆ module_pin_not_available

Enumerator
P_NA 

Pin/Port functionality not available.

◆ module_pin_pullup

Pin Pull-Up.

Enumerator
MODULE_PIN_PULLUP_OFF 

pull-up off

MODULE_PIN_PULLUP_ON 

pull-up on

◆ module_pin_type

Pin is LED?

Enumerator
MODULE_PIN_TYPE_GENERIC 

pin not attached to LED

MODULE_PIN_TYPE_LED 

pin is attached to LED

◆ sysreset_mode

Enumerator
SYSRESET_APROM 

Systemreset normally, into application flash.

SYSRESET_DFU 

System reset into Device Firmware Update mode.

◆ wakeup_reason

Enumerator
WAKEUP_POWERON 

power-on

WAKEUP_DEEP_POWERDOWN 

deep-power-down (DPD) with no data retention

WAKEUP_WATCHDOG 

Watchdog Timeout.

WAKEUP_HARDFAULT 

Hardfault.

WAKEUP_SYSRESET 

System Reset.

WAKEUP_RTCALARM 

RTC Alarm.

Function Documentation

◆ BSP_ADCGetVolts()

u32_t BSP_ADCGetVolts ( void  )

Measure and Read Battery Volts Value from ADC.

Returns
ADC output

◆ BSP_DisableSerialIRQ()

void BSP_DisableSerialIRQ ( void  )

Disable the serial (usb/uart) irq.

◆ BSP_DisableUSB()

void BSP_DisableUSB ( void  )

Disable the USB.

◆ BSP_EnableSerialIRQ()

void BSP_EnableSerialIRQ ( void  )

Enable the serial (usb/uart) irq.

◆ BSP_EnableUSB()

void BSP_EnableUSB ( void  )

Enable the USB if connected.

Return values
-0 if successfully enabled, -1 if enable not possible (eg. not connected)

◆ BSP_FlashCheck()

ca_error BSP_FlashCheck ( u32_t  startaddr,
u32_t  checklen,
u32_t  crc32 
)

Check that a given range of flash matches the provided CRC32 checksum.

Parameters
startaddrThe start address to check (must be page-aligned)
checklenThe number of bytes to check (must be page-aligned)
crc32The CRC32 checksum to verify against
Returns
cascoda status
Return values
CA_ERROR_SUCCESSCRC32 matches the data in flash
CA_ERROR_INVALID_ARGSInvalid arguments/flash range
CA_ERROR_FAILCRC32 value does not match the data in flash range

◆ BSP_FlashErase()

ca_error BSP_FlashErase ( u32_t  startaddr)

Erases a Dataflash Memory page (All words in page set to 0xFFFFFFFF)

startaddr is absolute, see the dataFlashBaseAddr of the FlashInfo struct for correct offset. Using any address in a given page will erase that entire page.

Parameters
startaddr- byte address (divisible by 4 (word))
Return values
CA_ERROR_SUCCESSFlash erased successfully
CA_ERROR_INVALID_ARGSInvalid arguments/flash range

◆ BSP_FlashLock()

void BSP_FlashLock ( void  )

Prevent ICP access to Flash.

After calling this function & resetting the microcontroller, reads to APROM & LDROM region using the ICP programming interface will fail.

The lock can only be undone by performing a mass erase of the microcontroller.

◆ BSP_FlashRead()

ca_error BSP_FlashRead ( u32_t  startaddr,
u32_t data,
u32_t  datasize 
)

Reads Dataflash Memory.

startaddr is absolute, see the dataFlashBaseAddr of the FlashInfo struct for correct offset.

Parameters
startaddr- byte address (divisible by 4 (word))
data- pointer to data (words)
datasize- size of data (in words)
Return values
CA_ERROR_SUCCESSFlash read into buffer successfully
CA_ERROR_INVALID_ARGSInvalid arguments/flash range

◆ BSP_FlashWriteInitial()

ca_error BSP_FlashWriteInitial ( u32_t  startaddr,
void *  data,
u32_t  datasize 
)

Writes Dataflash Memory, relies on Memory erased.

startaddr is absolute, see the dataFlashBaseAddr of the FlashInfo struct for correct offset.

Parameters
startaddr- byte address (divisible by 4 (word))
data- pointer to data
datasize- size of data (in bytes)
Return values
CA_ERROR_SUCCESSFlash erased successfully
CA_ERROR_INVALID_ARGSInvalid arguments/flash range

◆ BSP_GetChargeStat()

u8_t BSP_GetChargeStat ( void  )

Get Microchip MCP73831 Charge Status.

Returns
Charging Status

◆ BSP_GetFlashInfo()

void BSP_GetFlashInfo ( struct ca_flash_info aFlashInfoOut)

Get the flashinfo struct for the current platform.

Parameters
aFlashInfoOutPointer to struct to fill with flashinfo

◆ BSP_GetModuleSpecialPins()

struct ModuleSpecialPins BSP_GetModuleSpecialPins ( void  )

Get the struct of special pins for the platform.

Returns
Struct of special function pins for use with the Module system

◆ BSP_GetPlatString()

const char* BSP_GetPlatString ( void  )

Get a string that describes this device.

Returns
A string that describes this device (e.g. "Chili2")

◆ BSP_GetSystemFrequency()

fsys_mhz BSP_GetSystemFrequency ( void  )

Returns the system frequency.

Return values
systemfrequency [MHz], enum type fsys_mhz

◆ BSP_GetTemperature()

i32_t BSP_GetTemperature ( void  )

Measure and Read Temperature Value.

Returns
Temperature in tenths of a degree (celsius)

◆ BSP_GetUniqueId()

u64_t BSP_GetUniqueId ( void  )

Get a 64-bit ID that is unique to this device.

◆ BSP_GetVBUSConnected()

u8_t BSP_GetVBUSConnected ( void  )

Get USB VBUS status (connected/not connected)

Returns
Connection Status

◆ BSP_GetWakeupReason()

wakeup_reason BSP_GetWakeupReason ( void  )

Reason MCU has woken up after reset.

Returns
wakeup reason

◆ BSP_Initialise()

void BSP_Initialise ( struct ca821x_dev pDeviceRef)

Initialise the system for a given ca821x_dev.

◆ BSP_IsUSBPresent()

u8_t BSP_IsUSBPresent ( void  )

Is the USB connected?

Return values
returns1 if connected, 0 if disconnected

◆ BSP_IsWatchdogTriggered()

u8_t BSP_IsWatchdogTriggered ( void  )

Checks if the watchdog has been triggered, clears the warning if so.

Return values
boolean,1triggered, 0: Not triggered

◆ BSP_ModuleDeregisterGPIOPin()

ca_error BSP_ModuleDeregisterGPIOPin ( u8_t  mpin)

Unregisters GPIO Functionality for Module Pin to Default Settings.

Parameters
mpin- module pin number
Returns
status

◆ BSP_ModuleIsGPIOPinRegistered()

u8_t BSP_ModuleIsGPIOPinRegistered ( u8_t  mpin)

Checks if a Module Pin is already registered / used.

Parameters
mpin- module pin number
Returns
status (0: no, 1: yes)

◆ BSP_ModuleReadVoltsPin()

ca_error BSP_ModuleReadVoltsPin ( u8_t  mpin,
u32_t val 
)

Reads ADC Conversion Value on Module Pin.

Pins must NOT be registered if used with this function.

Parameters
mpin- module pin
val- 32-bit conversion value (12-bit resolution ADC: 0-4095)
Returns
status

◆ BSP_ModuleRegisterGPIOInput()

ca_error BSP_ModuleRegisterGPIOInput ( struct gpio_input_args args)

Registers GPIO Input Functionality for Module Pin.

Parameters
argsArguments, see gpio_input_args
Returns
status

◆ BSP_ModuleRegisterGPIOOutput()

ca_error BSP_ModuleRegisterGPIOOutput ( u8_t  mpin,
module_pin_type  isled 
)

Registers GPIO Output Functionality for Module Pin.

Parameters
mpin- module pin number
isled- pin is attached to led (Used to prevent power down leakage)
Returns
status

◆ BSP_ModuleRegisterGPIOOutputOD()

ca_error BSP_ModuleRegisterGPIOOutputOD ( u8_t  mpin,
module_pin_type  isled 
)

Registers GPIO Open Drain Output Functionality for Module Pin.

Parameters
mpin- module pin number
isled- pin is attached to led (Used to prevent power down leakage)
Returns
status

◆ BSP_ModuleRegisterGPIOSharedInputOutputOD()

ca_error BSP_ModuleRegisterGPIOSharedInputOutputOD ( struct gpio_input_args args,
module_pin_type  isled 
)

Registers GPIO Input AND Open Drain Output Functionality for Module Pin.

Parameters
args- gpio input args
isled- pin is attached to led (Used to prevent power down leakage)
Returns
status

◆ BSP_ModuleSenseGPIOPin()

ca_error BSP_ModuleSenseGPIOPin ( u8_t  mpin,
u8_t val 
)

Senses GPIO Input Value of Module Pin.

Input pins must be registered before they can be used. See BSP_ModuleRegisterGPIOInput().

Parameters
mpin- module pin
val- value read
Returns
status

◆ BSP_ModuleSenseGPIOPinOutput()

ca_error BSP_ModuleSenseGPIOPinOutput ( u8_t  mpin,
u8_t val 
)

Senses GPIO Output Value of Module Pin.

Output pins must be registered before they can be used. See BSP_ModuleRegisterGPIOOutput().

Parameters
mpin- module pin
val- value read
Returns
status

◆ BSP_ModuleSetGPIOOutputPermanent()

ca_error BSP_ModuleSetGPIOOutputPermanent ( u8_t  mpin)

Sets Module Pin GPIO Output as permanently driven (don't tristate in Power-Down)

Input pins must be registered before they can be used. See BSP_ModuleRegisterGPIOOutput().

Parameters
mpin- module pin
Returns
status

◆ BSP_ModuleSetGPIOPin()

ca_error BSP_ModuleSetGPIOPin ( u8_t  mpin,
u8_t  val 
)

Sets Module Pin GPIO Output Value.

Output pins must be registered before they can be used. See BSP_ModuleRegisterGPIOOutput().

Parameters
mpin- module pin
val- output value
Returns
status

◆ BSP_PowerDown()

void BSP_PowerDown ( u32_t  sleeptime_ms,
u8_t  use_timer0,
dpd_flag  dpd 
)

Set up wake on timer/IRQ, Power down MCU and return on wakeup.

Parameters
sleeptime_ms- sleep time [milliseconds]
use_timer0- if set to 1, system wake-up by mcu (timer0 or gpio); if set to 0, system wake-up by radio sleep timer.
dpd- flag if to enter deep-power-down without data retention, and whether wakeup pin is enabled

◆ BSP_RTCConvertDateAndTimeToSeconds()

i64_t BSP_RTCConvertDateAndTimeToSeconds ( const struct RTCDateAndTime dateandtime)

Converts RTC Date+Time to Unix Time seconds.

Parameters
dateandtime- RTCDateAndTime structure
Returns
Unix time seconds

◆ BSP_RTCConvertSecondsToDateAndTime()

void BSP_RTCConvertSecondsToDateAndTime ( i64_t  seconds,
struct RTCDateAndTime dateandtime 
)

Converts Unix Time seconds to RTC Date+Time.

Parameters
seconds- Unix time seconds
dateandtime- pointer to RTCDateAndTime structure

◆ BSP_RTCDisableAlarm()

void BSP_RTCDisableAlarm ( void  )

Disables RTC Alarm.

◆ BSP_RTCGetDateAndTime()

void BSP_RTCGetDateAndTime ( struct RTCDateAndTime dateandtime)

Gets RTC Date+Time.

Parameters
dateandtime- pointer to RTCDateAndTime structure
Returns
status

◆ BSP_RTCInitialise()

void BSP_RTCInitialise ( void  )

Initialises RTC.

Initialises RTC.

◆ BSP_RTCRegisterCallback()

void BSP_RTCRegisterCallback ( int(*)(void)  callback)

Registers RTC IRQ function callback.

Parameters
callback- pointer to ISR for input

◆ BSP_RTCSetAlarmSeconds()

ca_error BSP_RTCSetAlarmSeconds ( u32_t  seconds)

Sets RTC Alarm in seconds from current time.

Parameters
seconds- seconds to be added to current time
Returns
status

◆ BSP_RTCSetDateAndTime()

ca_error BSP_RTCSetDateAndTime ( struct RTCDateAndTime  dateandtime)

Sets RTC Date+Time.

Parameters
dateandtime- RTCDateAndTime structure
Returns
status

◆ BSP_SetBootMode()

ca_error BSP_SetBootMode ( sysreset_mode  bootMode)

Set the default boot mode for the device.

Parameters
bootModeThe default mode to boot into
Returns
ca_error code, CA_ERROR_SUCCESS if successful

Here we set bit 7 (BS) of CONFIG0 to set the default boot source of the chip. CONFIG0 is nonvolatile, but BS can be overridden by FMC_ISPCTL_BS when software reboot takes place.

◆ BSP_SetPowerDown()

void BSP_SetPowerDown ( void  )

Set flag that system has started power-down sequence.

◆ BSP_SystemConfig()

void BSP_SystemConfig ( fsys_mhz  fsys,
u8_t  enable_comms 
)

re-configures system clock frequency and comms interface

Parameters
fsys- system frequency [MHz], enum type fsys_mhz
enable_comms- boolean, 1: comms interface enabled 0: disabled

◆ BSP_SystemReset()

void BSP_SystemReset ( sysreset_mode  resetMode)

**OPTIONAL Function Declarations for cascoda_bsp_*.c

(make stubs & return 0 if unused)

Reset the CPU using a soft-reset.

Parameters
resetModeThe mode of reset to use

◆ BSP_UseExternalClock()

void BSP_UseExternalClock ( u8_t  useExternalClock)

Enable or disable the usage of the external clock from the CA821x.

Parameters
useExternalClock- (0: Use internal clock) (1: Use the clock from CA821x)

◆ BSP_WatchdogDisable()

void BSP_WatchdogDisable ( void  )

Watchdog Disable.

◆ BSP_WatchdogEnable()

void BSP_WatchdogEnable ( u32_t  timeout_ms)

Watchdog Enable.

Parameters
timeout_ms- timeout in milliseconds

◆ BSP_WatchdogReset()

void BSP_WatchdogReset ( void  )

Watchdog Reset and Restart.