os_port.h File Reference

RTOS abstraction layer. More...

#include "os_port_config.h"
#include "compiler_port.h"
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>

Go to the source code of this file.

Macros

#define ENABLED   1
 
#define DISABLED   0
 
#define timeCompare(t1, t2)   ((int32_t) ((t1) - (t2)))
 
#define FALSE   0
 
#define TRUE   1
 
#define LSB(x)   ((x) & 0xFF)
 
#define MSB(x)   (((x) >> 8) & 0xFF)
 
#define MIN(a, b)   ((a) < (b) ? (a) : (b))
 
#define MAX(a, b)   ((a) > (b) ? (a) : (b))
 
#define arraysize(a)   (sizeof(a) / sizeof(a[0]))
 
#define INFINITE_DELAY   ((uint_t) -1)
 
#define MAX_DELAY   (INFINITE_DELAY / 2)
 
#define osMemset(p, value, length)   (void) memset(p, value, length)
 
#define osMemcpy(dest, src, length)   (void) memcpy(dest, src, length)
 
#define osMemmove(dest, src, length)   (void) memmove(dest, src, length)
 
#define osMemcmp(p1, p2, length)   memcmp(p1, p2, length)
 
#define osMemchr(p, c, length)   memchr(p, c, length)
 
#define osStrlen(s)   strlen(s)
 
#define osStrcmp(s1, s2)   strcmp(s1, s2)
 
#define osStrncmp(s1, s2, length)   strncmp(s1, s2, length)
 
#define osStrcasecmp(s1, s2)   strcasecmp(s1, s2)
 
#define osStrncasecmp(s1, s2, length)   strncasecmp(s1, s2, length)
 
#define osStrchr(s, c)   strchr(s, c)
 
#define osStrstr(s1, s2)   strstr(s1, s2)
 
#define osStrcpy(s1, s2)   (void) strcpy(s1, s2)
 
#define osStrncpy(s1, s2, length)   (void) strncpy(s1, s2, length)
 
#define osStrcat(s1, s2)   (void) strcat(s1, s2)
 
#define osStrtok_r(s, delim, last)   strtok_r(s, delim, last)
 
#define osSprintf(dest, ...)   sprintf(dest, __VA_ARGS__)
 
#define osSnprintf(dest, size, ...)   snprintf(dest, size, __VA_ARGS__)
 
#define osVsnprintf(dest, size, format, ap)   vsnprintf(dest, size, format, ap)
 
#define osAtoi(s)   atoi(s)
 
#define osStrtoul(s, endptr, base)   strtoul(s, endptr, base)
 
#define osStrtoull(s, endptr, base)   strtoull(s, endptr, base)
 
#define osTolower(c)   tolower((uint8_t) (c))
 
#define osToupper(c)   toupper((uint8_t) (c))
 
#define osIsupper(c)   isupper((uint8_t) (c))
 
#define osIsdigit(c)   isdigit((uint8_t) (c))
 
#define osIsspace(c)   isspace((uint8_t) (c))
 
#define osIsblank(c)   ((c) == ' ' || (c) == '\t')
 
#define usleep(delay)   {volatile uint32_t n = delay * 4; while(n > 0) n--;}
 
#define sleep(delay)   {volatile uint32_t n = delay * 4000; while(n > 0) n--;}
 
#define OsTask   void
 
#define OS_INVALID_HANDLE   OS_INVALID_TASK_ID
 

Detailed Description

RTOS abstraction layer.

License

SPDX-License-Identifier: GPL-2.0-or-later

Copyright (C) 2010-2024 Oryx Embedded SARL. All rights reserved.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

Author
Oryx Embedded SARL (www.oryx-embedded.com)
Version
2.4.4

Definition in file os_port.h.

Macro Definition Documentation

◆ arraysize

#define arraysize (   a)    (sizeof(a) / sizeof(a[0]))

Definition at line 71 of file os_port.h.

◆ DISABLED

#define DISABLED   0

Definition at line 38 of file os_port.h.

◆ ENABLED

#define ENABLED   1

Definition at line 37 of file os_port.h.

◆ FALSE

#define FALSE   0

Definition at line 46 of file os_port.h.

◆ INFINITE_DELAY

#define INFINITE_DELAY   ((uint_t) -1)

Definition at line 75 of file os_port.h.

◆ LSB

#define LSB (   x)    ((x) & 0xFF)

Definition at line 55 of file os_port.h.

◆ MAX

#define MAX (   a,
  b 
)    ((a) > (b) ? (a) : (b))

Definition at line 67 of file os_port.h.

◆ MAX_DELAY

#define MAX_DELAY   (INFINITE_DELAY / 2)

Definition at line 77 of file os_port.h.

◆ MIN

#define MIN (   a,
  b 
)    ((a) < (b) ? (a) : (b))

Definition at line 63 of file os_port.h.

◆ MSB

#define MSB (   x)    (((x) >> 8) & 0xFF)

Definition at line 59 of file os_port.h.

◆ OS_INVALID_HANDLE

#define OS_INVALID_HANDLE   OS_INVALID_TASK_ID

Definition at line 315 of file os_port.h.

◆ osAtoi

#define osAtoi (   s)    atoi(s)

Definition at line 249 of file os_port.h.

◆ osIsblank

#define osIsblank (   c)    ((c) == ' ' || (c) == '\t')

Definition at line 296 of file os_port.h.

◆ osIsdigit

#define osIsdigit (   c)    isdigit((uint8_t) (c))

Definition at line 285 of file os_port.h.

◆ osIsspace

#define osIsspace (   c)    isspace((uint8_t) (c))

Definition at line 291 of file os_port.h.

◆ osIsupper

#define osIsupper (   c)    isupper((uint8_t) (c))

Definition at line 279 of file os_port.h.

◆ osMemchr

#define osMemchr (   p,
  c,
  length 
)    memchr(p, c, length)

Definition at line 159 of file os_port.h.

◆ osMemcmp

#define osMemcmp (   p1,
  p2,
  length 
)    memcmp(p1, p2, length)

Definition at line 153 of file os_port.h.

◆ osMemcpy

#define osMemcpy (   dest,
  src,
  length 
)    (void) memcpy(dest, src, length)

Definition at line 141 of file os_port.h.

◆ osMemmove

#define osMemmove (   dest,
  src,
  length 
)    (void) memmove(dest, src, length)

Definition at line 147 of file os_port.h.

◆ osMemset

#define osMemset (   p,
  value,
  length 
)    (void) memset(p, value, length)

Definition at line 135 of file os_port.h.

◆ osSnprintf

#define osSnprintf (   dest,
  size,
  ... 
)    snprintf(dest, size, __VA_ARGS__)

Definition at line 237 of file os_port.h.

◆ osSprintf

#define osSprintf (   dest,
  ... 
)    sprintf(dest, __VA_ARGS__)

Definition at line 231 of file os_port.h.

◆ osStrcasecmp

#define osStrcasecmp (   s1,
  s2 
)    strcasecmp(s1, s2)

Definition at line 183 of file os_port.h.

◆ osStrcat

#define osStrcat (   s1,
  s2 
)    (void) strcat(s1, s2)

Definition at line 219 of file os_port.h.

◆ osStrchr

#define osStrchr (   s,
  c 
)    strchr(s, c)

Definition at line 195 of file os_port.h.

◆ osStrcmp

#define osStrcmp (   s1,
  s2 
)    strcmp(s1, s2)

Definition at line 171 of file os_port.h.

◆ osStrcpy

#define osStrcpy (   s1,
  s2 
)    (void) strcpy(s1, s2)

Definition at line 207 of file os_port.h.

◆ osStrlen

#define osStrlen (   s)    strlen(s)

Definition at line 165 of file os_port.h.

◆ osStrncasecmp

#define osStrncasecmp (   s1,
  s2,
  length 
)    strncasecmp(s1, s2, length)

Definition at line 189 of file os_port.h.

◆ osStrncmp

#define osStrncmp (   s1,
  s2,
  length 
)    strncmp(s1, s2, length)

Definition at line 177 of file os_port.h.

◆ osStrncpy

#define osStrncpy (   s1,
  s2,
  length 
)    (void) strncpy(s1, s2, length)

Definition at line 213 of file os_port.h.

◆ osStrstr

#define osStrstr (   s1,
  s2 
)    strstr(s1, s2)

Definition at line 201 of file os_port.h.

◆ osStrtok_r

#define osStrtok_r (   s,
  delim,
  last 
)    strtok_r(s, delim, last)

Definition at line 225 of file os_port.h.

◆ osStrtoul

#define osStrtoul (   s,
  endptr,
  base 
)    strtoul(s, endptr, base)

Definition at line 255 of file os_port.h.

◆ osStrtoull

#define osStrtoull (   s,
  endptr,
  base 
)    strtoull(s, endptr, base)

Definition at line 261 of file os_port.h.

◆ OsTask

#define OsTask   void

Definition at line 313 of file os_port.h.

◆ osTolower

#define osTolower (   c)    tolower((uint8_t) (c))

Definition at line 267 of file os_port.h.

◆ osToupper

#define osToupper (   c)    toupper((uint8_t) (c))

Definition at line 273 of file os_port.h.

◆ osVsnprintf

#define osVsnprintf (   dest,
  size,
  format,
  ap 
)    vsnprintf(dest, size, format, ap)

Definition at line 243 of file os_port.h.

◆ sleep

#define sleep (   delay)    {volatile uint32_t n = delay * 4000; while(n > 0) n--;}

Definition at line 307 of file os_port.h.

◆ timeCompare

#define timeCompare (   t1,
  t2 
)    ((int32_t) ((t1) - (t2)))

Definition at line 40 of file os_port.h.

◆ TRUE

#define TRUE   1

Definition at line 50 of file os_port.h.

◆ usleep

#define usleep (   delay)    {volatile uint32_t n = delay * 4; while(n > 0) n--;}

Definition at line 303 of file os_port.h.