CORE

The Core peripheral gives access to the MCU clock and other core features.

Details

define CORE_VERSION

define CORE_IOC_IDENT_CHAR

define I_CORE_GETVERSION

define I_CORE_GETINFO

define I_CORE_SETATTR

define I_CORE_SETACTION

define I_CORE_SETPINFUNC

This request sets the functionality of the specified pin. The following example shows how to set P0.15 to be used with I2C0. If the port/pin combo does not match the peripheral function, the request will fail. This call is not necessary when using the set attribute request. For example, I_I2C_SETATTR will configure the pins according to the pin_assign member.

core_pinfunc_t pinfunc;
pinfunc.periph_port = 0;
pinfunc.periph_func = CORE_PERIPH_I2C;
pinfunc.io.port = 0;
pinfunc.io.pin = 15;
ioctl(core_fd, I_CORE_SETPINFUNC, &pinfunc);

define I_CORE_SETCLKOUT

This configures the clkout functionality.

core_clkout_t clkout;
clkout.src = CORE_CLKOUT_MAIN_OSC;
clkout.div = 8; //output will be the src divided by this value
ioctl(core_fd, I_CORE_SETCLKOUT, &clkout);

define I_CORE_SETCLKDIVIDE

This configures the main clock divide functionality. This can be used to reduce power consumption. This main clock is divided but the peripheral clock stays constant. The CPU clock can’t be divided below the peripheral clock.

ioctl(core_fd, I_CORE_SETCLKDIVIDE, 4);

define I_CORE_GETMCUBOARDCONFIG

This copies the mcu_board_config_t data that is set by the board support package.

mcu_board_config_t config;
ioctl(core_fd, I_CORE_GETMCUBOARDCONFIG, &config);

define I_CORE_INVOKEBOOTLOADER_2

define I_CORE_TOTAL

enum core_flag_t
  • CORE_FLAG_NONE
  • CORE_FLAG_IS_RESET_SOFTWARE Software Reset (default if hardware reset cannot be determined)
  • CORE_FLAG_IS_RESET_POR Power on Reset
  • CORE_FLAG_IS_RESET_EXTERNAL External Reset signal
  • CORE_FLAG_IS_RESET_WDT Watchdog Timer Reset
  • CORE_FLAG_IS_RESET_BOR Brown Out Reset
  • CORE_FLAG_IS_RESET_SYSTEM Software System Reset
  • CORE_FLAG_SET_CLKOUT Use the CPU Clock
  • CORE_FLAG_IS_CLKOUT_CPU Use the CPU Clock
  • CORE_FLAG_IS_CLKOUT_MAIN_OSC Use the Main Oscillator
  • CORE_FLAG_IS_CLKOUT_INTERNAL_OSC Use the Internal Oscillator
  • CORE_FLAG_IS_CLKOUT_USB Use the USB Clock
  • CORE_FLAG_IS_CLKOUT_RTC Use the RTC Clock
  • CORE_FLAG_EXEC_SLEEP Sleep
  • CORE_FLAG_EXEC_DEEPSLEEP Deep sleep (preserve SRAM)
  • CORE_FLAG_EXEC_DEEPSLEEP_STOP Deep sleep (preserve SRAM, stop clocks)
  • CORE_FLAG_EXEC_DEEPSLEEP_STANDBY Turn the device off (lose SRAM)
  • CORE_FLAG_EXEC_RESET Set this flag with I_CORE_SETATTR to reset the device
  • CORE_FLAG_EXEC_INVOKE_BOOTLOADER Set this flag with I_CORE_SETATTR to reset the device and start the bootloader

enum core_periph_t
  • CORE_PERIPH_RESERVED RESERVED
  • CORE_PERIPH_CORE Core Functionality
  • CORE_PERIPH_ADC Analog to Digital Converter
  • CORE_PERIPH_DAC Digital to Analog Converter
  • CORE_PERIPH_UART UART
  • CORE_PERIPH_SPI SPI
  • CORE_PERIPH_USB USB
  • CORE_PERIPH_CAN CAN
  • CORE_PERIPH_ENET ENET
  • CORE_PERIPH_I2C I2C
  • CORE_PERIPH_I2S I2S
  • CORE_PERIPH_MEM External memory interface
  • CORE_PERIPH_RTC RTC
  • CORE_PERIPH_CEC Consumer Electronic Control (Part of HDMI)
  • CORE_PERIPH_QEI Quadrature Encoder Interface
  • CORE_PERIPH_PWM PWM
  • CORE_PERIPH_PIO GPIO
  • CORE_PERIPH_TMR Timer (output compare and input capture)
  • CORE_PERIPH_EINT External interrupts
  • CORE_PERIPH_WDT Watch dog timer
  • CORE_PERIPH_BOD Brown out detection
  • CORE_PERIPH_DMA Direct Memory Access
  • CORE_PERIPH_JTAG JTAG
  • CORE_PERIPH_RESET Reset
  • CORE_PERIPH_CLKOUT Clockout
  • CORE_PERIPH_LCD LCD
  • CORE_PERIPH_LCD1 LCD
  • CORE_PERIPH_LCD2 LCD
  • CORE_PERIPH_LCD3 LCD
  • CORE_PERIPH_EMC External Memory Controller
  • CORE_PERIPH_MCI Multimedia Card Interface
  • CORE_PERIPH_SSP SSP
  • CORE_PERIPH_MCPWM Motor Control PWM
  • CORE_PERIPH_NMI Non-maskable Interrupt
  • CORE_PERIPH_TRACE Trace data
  • CORE_PERIPH_SYS System data
  • CORE_PERIPH_QSPI Quad SPI
  • CORE_PERIPH_USART USART
  • CORE_PERIPH_SDIO SD Input/output
  • CORE_PERIPH_SPDIF SPDIF
  • CORE_PERIPH_HDMI HDMI CEC
  • CORE_PERIPH_MCO MCO Pins
  • CORE_PERIPH_DFSDM DFSDM Pins
  • CORE_PERIPH_FMP_I2C Fast Mode Plus I2C
  • CORE_PERIPH_DCMI Digital Camera interface
  • CORE_PERIPH_TOTAL

This enumerates the valid peripherals supported by Stratify OS.


struct::core_info_t

u32 o_flags

Setting certain flags will configure the core as described

u32 o_events

u32 freq

The current clock speed

mcu_sn_t serial

The serial number of the device (from the silicon)

u32 resd

struct::core_attr_t

This structure defines the attributes structure for configuring the Core port.

u32 o_flags

Setting certain flags will configure the core as described

u32 freq

This is used with the clock out flags to set the output frequency

u32 resd

struct::core_pinfunc_t

This structure is used with I_CORE_SETPINFUNC to set the functionality of pins.

u8 periph_port

Peripheral port value (e.g. 0 for I2C0)

u8 periph_func

Peripheral port function (see core_periph_t)

mcu_pin_t io

PIO port and pin (see mcu_pin_t)


struct::core_irqprio_t

This data structure is used with the I_CORE_SETIRQPRIO request to set the interrupt priority for peripherals.

u8 periph

s8 prio

u8 port

X

Thanks for Coming!

Subscribe to news and updates