group::StratifyOS

Stratify OS includes two main APIs for users: the STDC and the POSIX API.

Details

defineSOS_VERSION_2_1_0


defineSOS_VERSION_2_2_0


defineSOS_VERSION


defineSOS_TRACE_MESSAGE


defineSOS_TRACE_WARNING


defineSOS_TRACE_CRITICAL


defineSOS_TRACE_FATAL


defineSOS_SCHEDULER_TIMEVAL_SECONDS


defineSTFY_SCHEDULER_TIMEVAL_SECONDS


defineSOS_USECOND_PERIOD


defineSTFY_USECOND_PERIOD


defineSOS_PROCESS_TIMER_COUNT


defineSOS_DEFAULT_START_STACK_SIZE


defineSOS_DECLARE_TASK_TABLE


defineSOS_USER_ROOT


defineSOS_USER


public inthibernate(int seconds)

This function puts the controller in hibernate mode. All CPU and peripheral activity is stopped. The RTC continues running and will wake up the controller after seconds has elapsed. When the controller wakes up, it resumes execution in the same state as before hibernate() was called.

Hibernate corresponds to CORE_SLEEP_DEEPSLEEP. It can be woken up before seconds elapsed if other interrupts are enabled such as pin change interrupts. See the device specific documentation for wakeup events for CORE_SLEEP_DEEPSLEEP.

Parameters

  • seconds Number of seconds to hibernate (zero to hibernate indefinitely)

public voidpowerdown(int seconds)

This function turns the controller off. The RTC stays on and wakes up the controller after seconds has elapsed. When the controller wakes up from power down, it resets.

Parameters

  • seconds Number of seconds to powerdown (zero to powedown indefinitely)

public void *sos_default_thread(void * arg)

This function is weakly bound to code that initializes each filesystem and starts any processes that are designed to auto-run. It can be completely replaced so that users can customize the startup sequence.


public intmkfs(const char * path)

Format the filesystem that is mounted at path.

Returns

Zero on success


public intmount(const char * path)

Mount the filesystem specified at path

Parameters

  • path The path to the filesystem (specified at build time)

Returns

Zero on success


public intunmount(const char * path)

Unmount the filesystem specified at path

Parameters

  • path The path to the filesystem (specified at build time)

Returns

Zero on success


public intlaunch(const char * path,char * exec_path,const char * args,int options,int ram_size,int(*)(const void *, int, int) update_progress,const void * update_context,char *const envp)

Launch an application from a data file system.

The options are:

  • APPFS_FLAG_IS_REPLACE
  • APPFS_FLAG_IS_FLASH
  • APPFS_FLAG_IS_STARTUP (only with APPFS_FLAG_IS_FLASH)
  • APPFS_FLAG_IS_REPLACE
  • APPFS_FLAG_IS_ORPHAN

Here is an example of launching a new application:

#include <caos.h>

pid_t p;
int status;
char exec_path[PATH_MAX];

p = launch("/home/HelloWorld", exec_path, 0, APPFS_FLAG_IS_FLASH, 0, 0, 0);

wait(&status); //wait until hello world is done running
unlink(exec_path); //delete the installed image (or just leave it there to run again)

Parameters

  • path Path to launch binary

  • exec_path The path to store the path where the binary is installed (e.g. /app/flash/0-HelloWorld)

  • args Pointer to the arguments for launch

  • options Install options mask (flash, startup, etc)

  • ram_size The amount of RAM that will be allocated to stack/heap (excludes code even if running from RAM), set to zero for default RAM size

  • update_progress Callback to show progress of install/launch

  • envp Null for this version

Returns

Zero on success


public intinstall(const char * path,char * exec_path,int options,int ram_size,int(*)(const void *, int, int) update_progress,const void * update_context)

This function installs an application in flash or RAM

Parameters

  • path The source path

  • exec_path A destination buffer for the path to execute once installed

  • options Install options

  • ram_size The number of bytes to use for heap/stack

  • update_progress Callback to show progress of the install

Returns

Zero on success


public voidhtoa(char * dest,int num)


public charhtoc(int nibble)


public intkernel_request(int request,void * data)

Parameters

  • request Request to execute

  • data Single argument to the request

Returns

Returns result of request operation


public const void *kernel_request_api(u32 request)

Parameters

  • request The request API unique identifier

Returns

Returns a pointer to the API if it is installed, zero otherwise

This function can be implemented to return libraries that are stored in the kernel and shared between applications.

For example, the following libraries are requests are supported in the StratifyAPI

  • MBED TLS for secure sockets
  • Jansson Json library
  • Stratify Graphics
  • Stratify Object notation




public voidsos_led_startup()


public voidsos_led_root_enable(void * args)


public voidsos_led_root_disable(void * args)


public voidsos_led_root_error(void * args)



date: “2019-06-27” layout: post title: struct::scheduler_fault_t katex: true

categories: struct

Methods

  • public uint32_ttid
  • public uint32_tpid
  • public fault_tfault

Details

public uint32_ttid


public uint32_tpid


public fault_tfault



date: “2019-06-27” layout: post title: struct::sos_process_timer_t katex: true

categories: struct

Methods

Details

public u32o_flags


public struct mcu_timevalvalue


public struct mcu_timevalinterval


public struct sigeventsigevent



date: “2019-06-27” layout: post title: struct::sched_task_t katex: true

categories: struct

Methods

Details

public pthread_attr_tattr

This holds the task’s pthread attributes


public void *block_object

The blocking object


public intexit_status

The task’s exit status


public void *(*init

Task 0 init routine


public union sched_task_t::@1@2


public pthread_mutex_t *signal_delay_mutex

The mutex to lock if the task cannot be interrupted


public struct mcu_timevalwake

When to wake the task


public u16flags

This indicates whether the process is active or not


public trace_id_ttrace_id

Trace ID is PID is being traced (0 otherwise)


public sos_process_timer_ttimer



date: “2019-06-27” layout: post title: struct::sos_board_config_t katex: true

categories: struct

This structure holds the compiler-link time configuration data.

Methods

Details

public u8clk_usecond_tmr

Hardware timer used for usecond counter


public u8task_total

Total number of supported tasks


public u16start_stack_size

Stack size of the first thread (when in doubt use SOS_DEFAULT_START_STACK_SIZE)


public const char *stdin_dev

Device used for standard input


public const char *stdout_dev

Device used for standard output


public const char *stderr_dev

Device used for standard error


public const char *trace_dev

Device used for tracing


public const char *sys_name

System (or board) name


public const char *sys_version

System (or board) version (distinct from kernel version)


public const char *sys_id

System ID (globally unique cloud identifier for board)


public intsys_memory_size

Memory size reserved for the system


public into_sys_flags

System flags


public void *(*start

The start routine (when in doubt use sos_default_thread())


public void *start_args

Arguments passed to the start routine (for sos_default_thread() use a pointer to the link transport driver)


public const sos_socket_api_t *socket_api

Socket API (zero if sockets are not supported)


public void(*trace_event

This will trace an event (zero if not supported)


public void(*request

Send an interrupt request to the link master (0 if not supported)


public const char *git_hash

A pointer to the git hash string


X

Thanks for Coming!

Subscribe to news and updates