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 PTR_OFFSET(addr, offset)   ((void *) ((uint8_t *) (addr) + (offset)))
 
#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 OS_INVALID_HANDLE   NULL
 
#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 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 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 osVsnprintf(dest, size, format, ap)   vsnprintf(dest, size, format, ap)
 
#define osStrtoul(s, endptr, base)   strtoul(s, endptr, base)
 
#define osTolower(c)   tolower((uint8_t) (c))
 
#define osToupper(c)   toupper((uint8_t) (c))
 
#define osIsupper(c)   isupper((c))
 
#define osIsdigit(c)   isdigit((uint8_t) (c))
 
#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--;}
 

Detailed Description

RTOS abstraction layer.

License

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

Copyright (C) 2010-2020 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
1.9.8

Definition in file os_port.h.

Macro Definition Documentation

◆ arraysize

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

Definition at line 70 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 74 of file os_port.h.

◆ LSB

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

Definition at line 54 of file os_port.h.

◆ MAX

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

Definition at line 66 of file os_port.h.

◆ MAX_DELAY

#define MAX_DELAY   (INFINITE_DELAY / 2)

Definition at line 76 of file os_port.h.

◆ MIN

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

Definition at line 62 of file os_port.h.

◆ MSB

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

Definition at line 58 of file os_port.h.

◆ OS_INVALID_HANDLE

#define OS_INVALID_HANDLE   NULL

Definition at line 79 of file os_port.h.

◆ osIsdigit

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

Definition at line 242 of file os_port.h.

◆ osIsupper

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

Definition at line 236 of file os_port.h.

◆ osMemcmp

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

Definition at line 146 of file os_port.h.

◆ osMemcpy

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

Definition at line 134 of file os_port.h.

◆ osMemmove

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

Definition at line 140 of file os_port.h.

◆ osMemset

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

Definition at line 128 of file os_port.h.

◆ osSprintf

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

Definition at line 206 of file os_port.h.

◆ osStrcasecmp

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

Definition at line 170 of file os_port.h.

◆ osStrcat

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

Definition at line 194 of file os_port.h.

◆ osStrcmp

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

Definition at line 158 of file os_port.h.

◆ osStrcpy

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

Definition at line 182 of file os_port.h.

◆ osStrlen

#define osStrlen (   s)    strlen(s)

Definition at line 152 of file os_port.h.

◆ osStrncasecmp

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

Definition at line 176 of file os_port.h.

◆ osStrncmp

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

Definition at line 164 of file os_port.h.

◆ osStrncpy

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

Definition at line 188 of file os_port.h.

◆ osStrtok_r

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

Definition at line 200 of file os_port.h.

◆ osStrtoul

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

Definition at line 218 of file os_port.h.

◆ osTolower

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

Definition at line 224 of file os_port.h.

◆ osToupper

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

Definition at line 230 of file os_port.h.

◆ osVsnprintf

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

Definition at line 212 of file os_port.h.

◆ PTR_OFFSET

#define PTR_OFFSET (   addr,
  offset 
)    ((void *) ((uint8_t *) (addr) + (offset)))

Definition at line 40 of file os_port.h.

◆ sleep

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

Definition at line 251 of file os_port.h.

◆ timeCompare

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

Definition at line 42 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 247 of file os_port.h.