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

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

#include "task_scheduler.h"
#include "task_profiler.h"
#include <assert.h>
#include <stdint.h>
#include <stddef.h>
#include "debug.h"
#include "driver/irq.h"
Include dependency graph for task_scheduler.c:

Functions

static void ScheduleNext (scheduler_t *const me)
 
scheduler_t * Scheduler_Init (void)
 Initializes the task scheduler.
 
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.
 
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.
 

Variables

static const uint8_t myLog2Lookup [] = { 0xff, 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3 }
 

Detailed Description

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

This file implements an simple task scheduler.

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.

Function Documentation

◆ ScheduleNext()

static void ScheduleNext ( scheduler_t *const  me)
inlinestatic

Variable Documentation

◆ myLog2Lookup

const uint8_t myLog2Lookup[] = { 0xff, 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3 }
static