PIC24 Support Libraries
Data Structures | Macros | Enumerations
all_generic.h File Reference

Embedded Systems Operating System (ESOS) Definitions to make ESOS code more generic and portable. More...

#include <stdint.h>
#include "pic24_unions.h"

Go to the source code of this file.

Data Structures

union  UINT8
 
union  UINT16
 
union  UINT32
 

Macros

#define LSB(a)
 
#define MSB(a)
 
#define LOWER_WORD(a)
 
#define UPPER_WORD(a)
 
#define LOWER_LSB(a)
 
#define LOWER_MSB(a)
 
#define UPPER_LSB(a)
 
#define UPPER_MSB(a)
 
#define OK   TRUE
 
#define FAIL   FALSE
 
#define NULLPTR   0
 
#define NULLIDX   0xFF
 
#define BIT0   0x0001
 
#define BIT1   0x0002
 
#define BIT2   0x0004
 
#define BIT3   0x0008
 
#define BIT4   0x0010
 
#define BIT5   0x0020
 
#define BIT6   0x0040
 
#define BIT7   0x0080
 
#define BIT8   0x0100
 
#define BIT9   0x0200
 
#define BIT10   0x0400
 
#define BIT11   0x0800
 
#define BIT12   0x1000
 
#define BIT13   0x2000
 
#define BIT14   0x4000
 
#define BIT15   0x8000
 
#define BIT_SET_MASK(var, mask)
 
#define BIT_CLEAR_MASK(var, mask)
 
#define BIT_TOGGLE_MASK(var, mask)
 
#define IS_BIT_SET_MASK(var, mask)
 
#define IS_BIT_CLEAR_MASK(var, mask)
 
#define BIT_SET(var, bitnum)
 
#define BIT_CLEAR(var, bitnum)
 
#define BIT_TOGGLE(var, bitnum)
 
#define IS_BIT_SET(var, bitnum)
 
#define IS_BIT_CLEAR(var, bitnum)
 

Enumerations

enum  BOOL { FALSE = 0, TRUE }
 

Detailed Description

Embedded Systems Operating System (ESOS) Definitions to make ESOS code more generic and portable.

Note
This file is to be included in ESOS builds on all platforms.

Definition in file all_generic.h.

Macro Definition Documentation

◆ BIT0

#define BIT0   0x0001

Mask to represent bit 0 (the LSb)

Definition at line 428 of file all_generic.h.

◆ BIT1

#define BIT1   0x0002

Mask to represent bit 1

Definition at line 430 of file all_generic.h.

◆ BIT10

#define BIT10   0x0400

Mask to represent bit 10

Definition at line 448 of file all_generic.h.

◆ BIT11

#define BIT11   0x0800

Mask to represent bit 11

Definition at line 450 of file all_generic.h.

◆ BIT12

#define BIT12   0x1000

Mask to represent bit 12

Definition at line 452 of file all_generic.h.

◆ BIT13

#define BIT13   0x2000

Mask to represent bit 13

Definition at line 454 of file all_generic.h.

◆ BIT14

#define BIT14   0x4000

Mask to represent bit 14

Definition at line 456 of file all_generic.h.

◆ BIT15

#define BIT15   0x8000

Mask to represent bit 15 (the MSb of an uint16)

Definition at line 458 of file all_generic.h.

◆ BIT2

#define BIT2   0x0004

Mask to represent bit 2

Definition at line 432 of file all_generic.h.

◆ BIT3

#define BIT3   0x0008

Mask to represent bit 3

Definition at line 434 of file all_generic.h.

◆ BIT4

#define BIT4   0x0010

Mask to represent bit 4

Definition at line 436 of file all_generic.h.

◆ BIT5

#define BIT5   0x0020

Mask to represent bit 5

Definition at line 438 of file all_generic.h.

◆ BIT6

#define BIT6   0x0040

Mask to represent bit 6

Definition at line 440 of file all_generic.h.

◆ BIT7

#define BIT7   0x0080

Mask to represent bit 7 (the MSb of a uint8)

Definition at line 442 of file all_generic.h.

◆ BIT8

#define BIT8   0x0100

Mask to represent bit 8 (the LSb of the most-significant byte in an uint8)

Definition at line 444 of file all_generic.h.

◆ BIT9

#define BIT9   0x0200

Mask to represent bit 9

Definition at line 446 of file all_generic.h.

◆ BIT_CLEAR

#define BIT_CLEAR (   var,
  bitnum 
)

Clears a single bit in a variable

Parameters
varvariable
bitnumNumber (0-?) of the bit that should be cleared

Definition at line 515 of file all_generic.h.

◆ BIT_CLEAR_MASK

#define BIT_CLEAR_MASK (   var,
  mask 
)

Clear the bits of a variable according to a mask

Parameters
varvariable containing the bits to "clear"
maskvarable with ONEs in the locations where you want to clear bits

Definition at line 473 of file all_generic.h.

◆ BIT_SET

#define BIT_SET (   var,
  bitnum 
)

Sets a single bit in a variable

Parameters
varvariable
bitnumNumber (0-?) of the bit that should be set

Definition at line 508 of file all_generic.h.

◆ BIT_SET_MASK

#define BIT_SET_MASK (   var,
  mask 
)

Sets the bits of a variable according to a mask

Parameters
varvariable containing the bits to "set"
maskvarable with ONEs in the locations where you want to set bits

Definition at line 466 of file all_generic.h.

◆ BIT_TOGGLE

#define BIT_TOGGLE (   var,
  bitnum 
)

Toggle a single bit in a variable

Parameters
varvariable
bitnumNumber (0-?) of the bit that should be toggleed

Definition at line 522 of file all_generic.h.

◆ BIT_TOGGLE_MASK

#define BIT_TOGGLE_MASK (   var,
  mask 
)

Toggle the bits of a variable according to a mask

Parameters
varvariable containing the bits to "toggle"
maskvarable with ONEs in the locations where you want to toggle bits

Definition at line 480 of file all_generic.h.

◆ FAIL

#define FAIL   FALSE

another way to say FALSE

Definition at line 412 of file all_generic.h.

Referenced by open().

◆ IS_BIT_CLEAR

#define IS_BIT_CLEAR (   var,
  bitnum 
)

Determine if a bit is cleared in a variable

Parameters
varvariable containing the bits to test
bitnumNumber (0-?) of the bit to test for being cleared
Return values
TRUEif the bit is clear
FALSEotherwise

Definition at line 540 of file all_generic.h.

◆ IS_BIT_CLEAR_MASK

#define IS_BIT_CLEAR_MASK (   var,
  mask 
)

Determine if one or more bits are cleared in a variable

Parameters
varvariable containing the bits to test
maskvarable with ONEs in the locations where you want to check for cleared bits
Return values
TRUEif one or more of the mask bits are cleared in the variable
FALSEif none of the mask bits are cleared
Note
Does NOT test to see if you variable has ALL mask bits cleared

Definition at line 500 of file all_generic.h.

◆ IS_BIT_SET

#define IS_BIT_SET (   var,
  bitnum 
)

Determine if a bit is set in a variable

Parameters
varvariable containing the bits to test
bitnumNumber (0-?) of the bit to test for being set
Return values
TRUEif the bit is set
FALSEotherwise

Definition at line 531 of file all_generic.h.

◆ IS_BIT_SET_MASK

#define IS_BIT_SET_MASK (   var,
  mask 
)

Determine if one or more bits are set in a variable

Parameters
varvariable containing the bits to test
maskvarable with ONEs in the locations where you want to check for set bits
Return values
TRUEif one or more of the mask bits are set in the variable
FALSEif none of the mask bits are set
Note
Does NOT test to see if you variable has ALL mask bits set

Definition at line 490 of file all_generic.h.

◆ LOWER_LSB

#define LOWER_LSB (   a)

Returns the Least-Significant-BYTE (uint8) of a UINT32 structure

Parameters
aUINT32 structure holding a 32-bit value
Returns
Byte 0 (LSB) of the 32-bit value in the UINT32 struct

Definition at line 375 of file all_generic.h.

◆ LOWER_MSB

#define LOWER_MSB (   a)

Returns the 2nd most least-Significant-BYTE (uint8) of a UINT32 structure

Parameters
aUINT32 structure holding a 32-bit value
Returns
Byte 1 of the 32-bit value in the UINT32 struct

Definition at line 382 of file all_generic.h.

◆ LOWER_WORD

#define LOWER_WORD (   a)

Returns the Least-Significant-WORD (uint16) of a UINT32 structure

Parameters
aUINT32 structure holding a 32-bit value
Returns
LSW of the 32-bit value in the UINT32 struct

Definition at line 361 of file all_generic.h.

◆ LSB

#define LSB (   a)

Returns the Least-Significant-Byte (LSB)

Parameters
aUINT16 structure holding a 16-bit value
Returns
LSB of the 16-bit value in the UINT16 struct

Definition at line 195 of file all_generic.h.

◆ MSB

#define MSB (   a)

Returns the Most-Significant-Byte (MSB)

Parameters
aUINT16 structure holding a 16-bit value
Returns
MSB of the 16-bit value in the UINT16 struct

Definition at line 202 of file all_generic.h.

◆ NULLIDX

#define NULLIDX   0xFF

An unitialized index value

Definition at line 426 of file all_generic.h.

◆ NULLPTR

#define NULLPTR   0

An uninitialized pointer

Definition at line 424 of file all_generic.h.

Referenced by esos_GetTaskHandle(), and esos_GetTaskHandleFromID().

◆ OK

#define OK   TRUE

another way to say TRUE

Definition at line 410 of file all_generic.h.

◆ UPPER_LSB

#define UPPER_LSB (   a)

Returns the 3nd most least-Significant-BYTE (uint8) of a UINT32 structure

Parameters
aUINT32 structure holding a 32-bit value
Returns
Byte 2 of the 32-bit value in the UINT32 struct

Definition at line 389 of file all_generic.h.

◆ UPPER_MSB

#define UPPER_MSB (   a)

Returns the Most-Significant-BYTE (uint8) of a UINT32 structure

Parameters
aUINT32 structure holding a 32-bit value
Returns
Byte 3 (MSB) of the 32-bit value in the UINT32 struct

Definition at line 396 of file all_generic.h.

◆ UPPER_WORD

#define UPPER_WORD (   a)

Returns the Most-Significant-WORD (uint16) of a UINT32 structure

Parameters
aUINT32 structure holding a 32-bit value
Returns
MSW of the 32-bit value in the UINT32 struct

Definition at line 368 of file all_generic.h.

Enumeration Type Documentation

◆ BOOL

enum BOOL

A single bit quantity. Takes on the value TRUE or FALSE.

Enumerator
FALSE 

False, not true, off, zero

TRUE 

True, not false, on, one

Definition at line 402 of file all_generic.h.