AFBR-S50 API Reference Manual v1.5.6
AFBR-S50 Time-of-Flight Sensor SDK for Embedded Software
Loading...
Searching...
No Matches
task_scheduler.h File Reference

This file is part of the AFBR-S50 Explorer example application. More...

#include <stdint.h>
#include <stddef.h>
#include <stdbool.h>
#include "task_status.h"
Include dependency graph for task_scheduler.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define SCHEDULER_MAX_TASKS   8U
 Maximum Number of tasks.
 

Typedefs

typedef uint8_t task_prio_t
 Definition of the task priority (and unique task ID).
 
typedef void * task_event_t
 Task event type definition.
 
typedef void(* task_function_t) (task_event_t e)
 Task functions definition.
 

Functions

scheduler_t * Scheduler_Init (void)
 Initializes the task scheduler.
 
void Scheduler_Run (scheduler_t *const me)
 Runs the task scheduler.
 
void Scheduler_SwitchContext (scheduler_t *const me)
 Suspends the current task and runs another task.
 
status_t Scheduler_AddTask (scheduler_t *const me, task_function_t task, task_prio_t priority, task_event_t eventQ, size_t eventQSize, const char *name)
 Adds an new task to the scheduler.
 
status_t Scheduler_PostEvent (scheduler_t *const me, task_prio_t priority, task_event_t event)
 Posts an event to the scheduler and executes it as soon as possible.
 
bool Scheduler_IsTaskPending (scheduler_t *const me, task_prio_t priority)
 Checks whether a specified task is pending for execution.
 

Detailed Description

This file is part of the AFBR-S50 Explorer example application.

This file implements an simple task scheduler.

Warning
Confidential under NDA!

Copyright (c) 2023, Broadcom Inc. All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

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 HOLDER 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.