PIC24 Support Libraries
Files | Data Structures | Macros | Functions
ESOS_Task_Mail_Service

Files

file  esos_mail.h
 

Data Structures

struct  MAILBOX
 

Macros

#define __MAIL_MSG_MAX_DATA_LEN   16
 
#define ESOS_TASK_HAS_MAIL(pstTask)
 
#define ESOS_TASK_IS_WAITING_MAIL_DELIVERY(TaskHandle)
 
#define ESOS_TASK_IVE_GOT_MAIL()
 
#define ESOS_TASK_WAIT_FOR_MAIL()
 
#define ESOS_TASK_WAIT_ON_TASKS_MAILBOX_HAS_AT_LEAST(pstTask, x)
 
#define ESOS_TASK_WAIT_ON_TASKS_MAILBOX_HAS_ROOM_MESSAGE(pstTask, pstMsg)
 
#define ESOS_TASK_MAILBOX_GET_AVAILABLE_LEN(pstTask)
 
#define ESOS_TASK_MAILBOX_GOT_EXACTLY_DATA_BYTES(pstTask, x)
 
#define ESOS_TASK_MAILBOX_GOT_AT_LEAST_DATA_BYTES(pstTask, x)
 
#define ESOS_TASK_FLUSH_TASK_MAILBOX(pstTask)
 

Functions

void __esos_SendMailUint8 (struct stTask *pst_Task, MAILBOX *pst_Mailbox, uint8_t *pau8_data, uint8_t u8_len)
 

Detailed Description

Macro Definition Documentation

◆ __MAIL_MSG_MAX_DATA_LEN

#define __MAIL_MSG_MAX_DATA_LEN   16

structure to contain a mail message "envelope" – a set of descriptors about a mail message and the contents within

Definition at line 80 of file esos_mail.h.

◆ ESOS_TASK_FLUSH_TASK_MAILBOX

#define ESOS_TASK_FLUSH_TASK_MAILBOX (   pstTask)

Flushes the specified task's mailbox contents. All unread data in the mailbox will be lost.

Parameters
pstTaskpointer to task structure (ESOS_TASK_HANDLE) whose mailbox will be flushed
Note
Use this function only if you want to reset some task's mailbox back to its empty state.
Not really sure why any task would call this except possibly on its own mailbox, e.g. the argument pstTask would be __pstSelf.

Definition at line 230 of file esos_mail.h.

◆ ESOS_TASK_HAS_MAIL

#define ESOS_TASK_HAS_MAIL (   pstTask)

Determines if a task has mail ready to be read/consumed.

Parameters
pstTaskA pointer to the ESOS_TASK_HANDLE of the task being queried
See also
ESOS_TASK_GET_TASK_HANDLE

Definition at line 119 of file esos_mail.h.

◆ ESOS_TASK_IS_WAITING_MAIL_DELIVERY

#define ESOS_TASK_IS_WAITING_MAIL_DELIVERY (   TaskHandle)

Determines if a task is waiting on an acknowledgment from another task reading its mail... a.k.a. "signature confirmation" or "delivery confirmation"

Parameters
TaskHandleThe ESOS_TASK_HANDLE of the task being queried
See also
ESOS_TASK_GET_TASK_HANDLE

Definition at line 129 of file esos_mail.h.

◆ ESOS_TASK_IVE_GOT_MAIL

#define ESOS_TASK_IVE_GOT_MAIL ( )

Determines if the current task has mail to be read

Returns TRUE if the current task has mail ready to be read. else it returns FALSE.

See also
ESOS_TASK_HAS_MAIL

Definition at line 141 of file esos_mail.h.

◆ ESOS_TASK_MAILBOX_GET_AVAILABLE_LEN

#define ESOS_TASK_MAILBOX_GET_AVAILABLE_LEN (   pstTask)

Evaluates to the number of bytes available in the mailbox association with an arbitrary task pstTask

Parameters
pstTaskpointer to task structure
Return values
Nnumber of bytes available for writing in task's mailbox

Definition at line 191 of file esos_mail.h.

◆ ESOS_TASK_MAILBOX_GOT_AT_LEAST_DATA_BYTES

#define ESOS_TASK_MAILBOX_GOT_AT_LEAST_DATA_BYTES (   pstTask,
 
)

Evaluates to the booelan to determine if the specified task's mailbox has at least x bytes available for holding messages

Parameters
pstTaskpointer to task structure (ESOS_TASK_HANDLE)
xnumber of bytes to check for
Return values
TRUEif task's mailbox has x bytes or more
FALSEotherwise

Definition at line 216 of file esos_mail.h.

◆ ESOS_TASK_MAILBOX_GOT_EXACTLY_DATA_BYTES

#define ESOS_TASK_MAILBOX_GOT_EXACTLY_DATA_BYTES (   pstTask,
 
)

Evaluates to the booelan to determine if the specified task's mailbox has exactly x bytes available for holding messages

Parameters
pstTaskpointer to task structure (ESOS_TASK_HANDLE)
xnumber of bytes to check for
Return values
TRUEif task's mailbox has exactly x bytes
FALSEotherwise

Definition at line 203 of file esos_mail.h.

◆ ESOS_TASK_WAIT_FOR_MAIL

#define ESOS_TASK_WAIT_FOR_MAIL ( )

Blocks the current task until a mailbox message has arrived

This function blocks and waits until the task has a message in its mailbox.

Definition at line 150 of file esos_mail.h.

◆ ESOS_TASK_WAIT_ON_TASKS_MAILBOX_HAS_AT_LEAST

#define ESOS_TASK_WAIT_ON_TASKS_MAILBOX_HAS_AT_LEAST (   pstTask,
 
)

Block current task until the specified task's mailbox has at least x bytes available for holding messages

Parameters
pstTaskpointer to task structure (ESOS_TASK_HANDLE)
xnumber of bytes to check for
Return values
TRUEif task's mailbox has x bytes or more
FALSEotherwise

Definition at line 164 of file esos_mail.h.

◆ ESOS_TASK_WAIT_ON_TASKS_MAILBOX_HAS_ROOM_MESSAGE

#define ESOS_TASK_WAIT_ON_TASKS_MAILBOX_HAS_ROOM_MESSAGE (   pstTask,
  pstMsg 
)

Block the current task until the specified recipient task mailbox has room for the specified message

Parameters
pstTaskpointer to task structure (ESOS_TASK_HANDLE)
pstMsgmessage for which room must be found
Return values
TRUEif task's mailbox has x bytes or more;
FALSEotherwise
Todo:
BRAIN-DEAD implementation. needs to properly parse the message header and computer the data payload size. A bit harder than it first appears

Definition at line 180 of file esos_mail.h.

Function Documentation

◆ __esos_SendMailUint8()

void __esos_SendMailUint8 ( struct stTask *  pst_Task,
MAILBOX pst_Mailbox,
uint8_t pau8_data,
uint8_t  u8_len 
)

Writes a mail message into some task's mailbox

Parameters
pst_Taskhandle tretval verNum Version number. Exact value and meaning depends on hardware
pst_MailboxPointer to struct instance of MAILBOX.
pau8_dataPointer to mail data to send.
u8_lenLocal instance of length of message.