Contiki 3.x
|
The STM32W MBXXX platform. More...
Modules | |
Board | |
ST board abstraction layer. | |
Files | |
file | board-sensors.h |
Declarations for sensor-related functions that are common to all stm32w platforms. | |
file | cfs-coffee-arch.c |
Coffee architecture-dependent functionality for the STM32W108-based mb851 platform. | |
file | cfs-coffee-arch.h |
Coffee architecture-dependent header for the STM32W108-based mb851 platform. | |
file | clock.c |
Clock. | |
file | leds-arch.c |
Leds. | |
file | rand.c |
Random number functions for STM32W. | |
file | rtimer-arch.c |
Real-timer specific implementation for STM32W. | |
file | rtimer-arch.h |
Real-timer header file for STM32W. | |
file | slip-uart1.c |
Machine dependent STM32W SLIP routines for UART1. | |
file | uip-arch.c |
uip-arch.c | |
file | watchdog.c |
Watchdog | |
file | board.c |
Software layer to support all the ST kits boards | |
file | board.h |
Header file x STM32W108 Kits boards abstraction. | |
file | contiki-conf.h |
Contiki-conf.h for MBXXX. | |
file | contiki-init-net.c |
Functions for net initialization. | |
file | contiki-init-net.h |
Functions for net initialization. | |
file | contiki-main.c |
Contiki main file. | |
file | platform-conf.h |
Platform-conf.h for MBXXX. | |
file | shell-sensors.c |
Shell function for temp and acc sensors. | |
file | shell-sensors.h |
Header file for Contik shell sensors command. | |
file | acc-sensor.c |
Accelerometer. | |
file | acc-sensor.h |
Accelerometer header file. | |
file | button-sensor.c |
Button sensor. | |
file | contact-sensor.c |
Contact sensor. | |
file | contact-sensor.h |
Contact magnetic sensor header file. | |
file | temperature-sensor.c |
Temperature sensor. | |
file | temperature-sensor.h |
Temperature sensor. | |
Data Structures | |
struct | mtarch_thread |
Copyright (c) 2014, Analog Devices, Inc. More... | |
struct | t_mems_data |
Mems data type: three acceleration values each related to a specific direction Watch out: only lower data values (e.g. More... | |
Macros | |
#define | BUTTON_S1 PORTx_PIN(boardDescription->io->buttons[0].gpioPort, boardDescription->io->buttons[0].gpioPin) |
Port and pin for BUTTON0. | |
#define | BUTTON_S1_SEL() do { GPIO_IRQCSEL = BUTTON_S1; } while(0) |
Point the proper IRQ at the desired pin for BUTTON0. | |
#define | BUTTON_S1_ISR halIrqCIsr |
The interrupt service routine for BUTTON_S1. | |
#define | BUTTON_S1_INTCFG GPIO_INTCFGC |
The interrupt configuration register for BUTTON_S1. | |
#define | BUTTON_S1_INT_EN_BIT INT_IRQC |
The interrupt bit for BUTTON_S1. | |
#define | BUTTON_S1_FLAG_BIT INT_IRQCFLAG |
The interrupt bit for BUTTON_S1. | |
#define | BUTTON_S1_MISS_BIT INT_MISSIRQC |
The missed interrupt bit for BUTTON_S1. | |
#define | SUPPLY_OFFSET 500 |
NOTE: For the temperature measurement, the ADC extended range mode is needed; but this is inaccurate due to the high voltage mode bug of the general purpose ADC (see STM32W108 errata). | |
Functions | |
void | board_sensors_power_down (void) |
Remember state of sensors (if active or not), in order to resume their original state after calling board_sensors_power_up(). More... | |
void | board_sensors_power_up (void) |
Resume the state of all on-board sensors on to the state that they had when board_sensors_power_down() was called. More... | |
void | clock_init (void) |
Initialize the clock library. More... | |
clock_time_t | clock_time (void) |
Get the current clock time. More... | |
void | clock_delay (unsigned int i) |
Delay the CPU for a multiple of TODO. More... | |
void | clock_wait (clock_time_t i) |
Wait for a multiple of 1 ms. More... | |
unsigned long | clock_seconds (void) |
Get the current value of the platform seconds. More... | |
void * | elfloader_arch_allocate_ram (int size) |
Allocate RAM for a new module. More... | |
void * | elfloader_arch_allocate_rom (int size) |
Allocate program memory for a new module. More... | |
void | elfloader_arch_write_rom (int fd, unsigned short textoff, unsigned int size, char *mem) |
Write to read-only memory (for example the text segment). More... | |
void | elfloader_arch_relocate (int fd, unsigned int sectionoffset, char *sectionaddr, struct elf32_rela *rela, char *addr) |
Perform a relocation. More... | |
void | leds_arch_init (void) |
Leds implementation. | |
void | rtimer_arch_init (void) |
We don't need to explicitly initialise anything but this routine is required by the API. More... | |
rtimer_clock_t | rtimer_arch_now (void) |
Returns the current real-time clock time. More... | |
void | rtimer_arch_schedule (rtimer_clock_t t) |
Schedules an rtimer task to be triggered at time t. More... | |
void | slip_arch_init (unsigned long ubr) |
Initalize the RS232 port and the SLIP driver. More... | |
void | slip_arch_writeb (unsigned char c) |
Copyright (c) 2014, Analog Devices, Inc. More... | |
void | watchdog_init (void) |
Copyright (c) 2014, Analog Devices, Inc. More... | |
void | watchdog_start (void) |
Starts the WDT in watchdog mode if enabled by user configuration, maximum interval. | |
void | watchdog_periodic (void) |
Writes the WDT clear sequence. More... | |
void | watchdog_stop (void) |
In watchdog mode, the WDT can not be stopped. More... | |
void | watchdog_reboot (void) |
Keeps control until the WDT throws a reset signal. More... | |
void | halBoardInit (void) |
Initialize the board description data structure after autodetect of the boards based on the CIB Board name field content. More... | |
BoardResourcesType const * | halBoardGetDescription (void) |
Return pointer to board description structure. More... | |
void | halBoardPowerDown (void) |
Perform board specific action to power down the system, usually before going to deep sleep. More... | |
void | halBoardPowerUp (void) |
Perform board specific action to power up the system. More... | |
int | main (void) |
This is main... More... | |
Variables | |
SENSORS & | button_sensor |
Copyright (c) 2014, Analog Devices, Inc. More... | |
struct sensors_sensor | temperature_sensor |
NOTE: For the temperature measurement, the ADC extended range mode is needed; but this is inaccurate due to the high voltage mode bug of the general purpose ADC (see STM32W108 errata). | |
The STM32W MBXXX platform.
void board_sensors_power_down | ( | void | ) |
Remember state of sensors (if active or not), in order to resume their original state after calling board_sensors_power_up().
Useful when entering in sleep mode, since all system peripherals have to be reinitialized.
void board_sensors_power_up | ( | void | ) |
Resume the state of all on-board sensors on to the state that they had when board_sensors_power_down() was called.
Useful when sensors have to be used after the micro was put in deep sleep mode.
|
inline |
void clock_init | ( | void | ) |
Initialize the clock library.
This function initializes the clock library and should be called from the main() function of the system.
Initialize the clock library.
Initialize the clock library.
We initialise the SysTick to fire 128 interrupts per second, giving us a value of 128 for CLOCK_SECOND
We also initialise GPT0:Timer A, which is used by clock_delay_usec(). We use 16-bit range (individual), count-down, one-shot, no interrupts. The system clock is at 16MHz giving us 62.5 nano sec ticks for Timer A. Prescaled by 16 gives us a very convenient 1 tick per usec
Definition at line 85 of file clock.c.
References ATOMIC, SysTick_CLKSourceConfig(), SysTick_CounterCmd(), SysTick_ITConfig(), and SysTick_SetReload().
unsigned long clock_seconds | ( | void | ) |
Get the current value of the platform seconds.
This could be the number of seconds since startup, or since a standard epoch.
Get the current value of the platform seconds.
The comparison avoids the need to disable clock interrupts for an atomic read of the four-byte variable.
clock_time_t clock_time | ( | void | ) |
Get the current clock time.
This function returns the current system clock time.
Get the current clock time.
When 16 bit it typically wraps every 10 minutes. The comparison avoids the need to disable clock interrupts for an atomic read of the multi-byte variable.
void clock_wait | ( | clock_time_t | i | ) |
Wait for a multiple of 1 ms.
Wait for a given number of ticks.
Definition at line 120 of file clock.c.
References clock_time().
void* elfloader_arch_allocate_ram | ( | int | size | ) |
Allocate RAM for a new module.
size | The size of the requested memory. |
This function is called from the Contiki ELF loader to allocate RAM for the module to be loaded into.
Definition at line 64 of file elfloader-arch.c.
Referenced by elfloader_load().
void* elfloader_arch_allocate_rom | ( | int | size | ) |
Allocate program memory for a new module.
size | The size of the requested memory. |
This function is called from the Contiki ELF loader to allocate program memory (typically ROM) for the module to be loaded into.
Definition at line 73 of file elfloader-arch.c.
Referenced by elfloader_load().
void elfloader_arch_relocate | ( | int | fd, |
unsigned int | sectionoffset, | ||
char * | sectionaddr, | ||
struct elf32_rela * | rela, | ||
char * | addr | ||
) |
Perform a relocation.
fd | The file descriptor for the ELF file. |
sectionoffset | The file offset at which the relocation can be found. |
sectionaddr | The section start address (absolute runtime). |
rela | A pointer to an ELF32 rela structure (struct elf32_rela). |
addr | The relocated address. This function is called from the Contiki ELF loader to perform a relocation on a piece of code or data. The relocated address is calculated by the Contiki ELF loader, based on information in the ELF file, and it is the responsibility of this function to patch the executable code. The Contiki ELF loader passes a pointer to an ELF32 rela structure (struct elf32_rela) that contains information about how to patch the code. This information is different from processor to processor. |
Definition at line 100 of file elfloader-arch.c.
References cfs_seek(), CFS_SEEK_CUR, CFS_SEEK_SET, and ELFLOADER_UNHANDLED_RELOC.
void elfloader_arch_write_rom | ( | int | fd, |
unsigned short | textoff, | ||
unsigned int | size, | ||
char * | mem | ||
) |
Write to read-only memory (for example the text segment).
fd | The file descriptor for the ELF file. |
textoff | Offset of text segment relative start of file. |
size | The size of the text segment. |
mem | A pointer to the where the text segment should be flashed This function is called from the Contiki ELF loader to write the program code (text segment) of a loaded module into memory. The function is called when all relocations have been performed. |
Definition at line 84 of file elfloader-arch.c.
References cfs_seek(), and CFS_SEEK_SET.
Referenced by elfloader_load().
BoardResourcesType const* halBoardGetDescription | ( | void | ) |
void halBoardInit | ( | void | ) |
Initialize the board description data structure after autodetect of the boards based on the CIB Board name field content.
In case of invalid CIB data it will default to MB851A. Customer normally needs to modify this file to adapt it to their specific board.
Definition at line 387 of file board.c.
References NULL.
void halBoardPowerDown | ( | void | ) |
Perform board specific action to power down the system, usually before going to deep sleep.
This code depends on the actual board features and configure the stm32w and on board devices for minimal power consumption. Customer normally needs to modify this file to adapt it to their specific board.
Definition at line 422 of file board.c.
References BOARD_HAS_PA, BoardIOStruct::buttons, BoardResourcesStruct::buttons, halGpioConfig(), halGpioSet(), BoardResourcesStruct::io, BoardIOStruct::leds, BoardResourcesStruct::leds, PORTB_PIN, and PORTx_PIN.
void halBoardPowerUp | ( | void | ) |
Perform board specific action to power up the system.
This code depends on the actual board features and configure the stm32w and on board devices for proper operation. Customer normally needs to modify this file to adapt it to their specific board.
Definition at line 488 of file board.c.
References BOARD_HAS_EEPROM, BOARD_HAS_MEMS, BOARD_HAS_PA, BOARD_HAS_TEMP_SENSOR, BoardIOStruct::buttons, BoardResourcesStruct::buttons, TempSensorResourceStruct::gpioPin, TempSensorResourceStruct::gpioPort, halGpioConfig(), halGpioSet(), i2c_enable(), BoardResourcesStruct::io, BoardIOStruct::leds, BoardResourcesStruct::leds, PORTA_PIN, PORTB_PIN, PORTC_PIN, PORTx_PIN, and BoardResourcesStruct::temperatureSensor.
int main | ( | void | ) |
This is main...
This is main...
Definition at line 142 of file contiki-main.c.
References ADDR_TENTATIVE, clock_init(), CLOCK_SECOND, ctimer_init(), halInit(), halSleepWithOptions(), IEEE802154_CONF_PANID, INTERRUPTS_ON, linkaddr_node_addr, NULL, process_init(), process_run(), process_start(), rtimer_init(), serial_line_input_byte(), uart1_init(), uip_ds6_set_addr_iid(), uip_ip6addr, uip_lladdr, watchdog_periodic(), and watchdog_start().
void rtimer_arch_init | ( | void | ) |
We don't need to explicitly initialise anything but this routine is required by the API.
The Sleep Timer starts ticking automatically as soon as the device turns on. We don't need to turn on interrupts before the first call to rtimer_arch_schedule()
Definition at line 98 of file rtimer-arch.c.
rtimer_clock_t rtimer_arch_now | ( | void | ) |
Returns the current real-time clock time.
Definition at line 135 of file rtimer-arch.c.
References ATOMIC.
void rtimer_arch_schedule | ( | rtimer_clock_t | t | ) |
Schedules an rtimer task to be triggered at time t.
t | The time when the task will need executed. This is an absolute time, in other words the task will be executed AT time t, not IN t ticks |
Definition at line 145 of file rtimer-arch.c.
References rtimer_arch_now.
void slip_arch_init | ( | unsigned long | ubr | ) |
Initalize the RS232 port and the SLIP driver.
Initalize the RS232 port and the SLIP driver.
ubr | Ignored for the cc2538 |
Definition at line 52 of file slip-uart1.c.
void slip_arch_writeb | ( | unsigned char | c | ) |
Copyright (c) 2014, Analog Devices, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted (subject to the limitations in the disclaimer below) provided that the following conditions are met:
NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Copyright (c) 2014, Analog Devices, Inc.
c | the byte |
Definition at line 58 of file slip-uart1.c.
void watchdog_init | ( | void | ) |
Copyright (c) 2014, Analog Devices, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted (subject to the limitations in the disclaimer below) provided that the following conditions are met:
NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Copyright (c) 2014, Analog Devices, Inc.
Currently simply explicitly sets the WDT interval to max interval
Definition at line 53 of file watchdog.c.
void watchdog_periodic | ( | void | ) |
Writes the WDT clear sequence.
Due to how the SMWDTHROSC_WDCTL works, it is OK to simply write these bits rather than use RMW operations.
Definition at line 69 of file watchdog.c.
void watchdog_reboot | ( | void | ) |
Keeps control until the WDT throws a reset signal.
Starts the WDT if not already started.
Definition at line 82 of file watchdog.c.
References halReboot().
void watchdog_stop | ( | void | ) |
In watchdog mode, the WDT can not be stopped.
This function is defined here to satisfy API requirements.
Definition at line 76 of file watchdog.c.
References halInternalDisableWatchDog(), and MICRO_DISABLE_WATCH_DOG_KEY.
SENSORS& button_sensor |
Copyright (c) 2014, Analog Devices, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted (subject to the limitations in the disclaimer below) provided that the following conditions are met:
NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Definition at line 99 of file contiki-main.c.