XenevaOS
Loading...
Searching...
No Matches
Macros | Functions | Variables
postbox.c File Reference
#include <Ipc/postbox.h>
#include <Hal/AA64/sched.h>
#include <Mm\kmalloc.h>
#include <Mm\pmmngr.h>
#include <Mm\vmmngr.h>
#include <string.h>
#include <_null.h>
#include <Fs\vfs.h>
#include <Fs\dev\devfs.h>
#include <Hal/AA64/aa64lowlevel.h>
#include <Drivers/uart.h>
#include <aucon.h>
Include dependency graph for postbox.c:

Macros

#define POSTEVENT_ALIGN   8
 NOTE: PostBoxIPCManager is aurora's main communication manager between user space processes and kernel, in future drivers will also able to communicate with user processes and kernel through PostBoxIPCManager.
 
#define POSTEVENT_SIZE_ALIGNED   (((sizeof(PostEvent) + (POSTEVENT_ALIGN - 1)) / POSTEVENT_ALIGN) * POSTEVENT_ALIGN)
 

Functions

void PostBoxAdvanceIndex (PostBox *box)
 
void PostBoxRetreat (PostBox *box)
 
bool IsPostBoxEmpty (PostBox *box)
 
bool IsPostBoxFull (PostBox *box)
 
uint64_t read_sp ()
 
void PostBoxCreate (bool root, uint16_t tid)
 PostBoxCreate – creates a postbox.
 
void PostBoxDestroy (PostBox *box)
 PostBoxDestroy – destroy given postbox.
 
void PostBoxDestroyByID (uint16_t id)
 PostBoxDestroyByID – destroys a post box identified by an id.
 
void enscheddebug ()
 
void PostBoxPutEvent (PostEvent *event)
 PostBoxPutEvent – put an event to a specific post box.
 
int PostBoxGetEvent (PostEvent *event, bool root, AA64Thread *curr_thread)
 PostBoxGetEvent – get an event from post box and copy it to a memory area.
 
int PostBoxIOControl (AuVFSNode *file, int code, void *arg)
 PostBoxIOControl – I/O Control function for post box manager.
 
AuVFSNodeAuPostBOXGetNode ()
 
void AuIPCPostBoxInitialise ()
 AuIPCPostBoxInitialise – initialise the post box ipc manager.
 

Variables

PostBoxfirstBox = NULL
 
PostBoxlastBox = NULL
 
bool _PostBoxRootCreated
 
AuVFSNodepbox
 

Detailed Description

BSD 2-Clause License

Copyright (c) 2022-2025, Manas Kamal Choudhury 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.

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.

Macro Definition Documentation

◆ POSTEVENT_ALIGN

#define POSTEVENT_ALIGN   8

NOTE: PostBoxIPCManager is aurora's main communication manager between user space processes and kernel, in future drivers will also able to communicate with user processes and kernel through PostBoxIPCManager.

◆ POSTEVENT_SIZE_ALIGNED

#define POSTEVENT_SIZE_ALIGNED   (((sizeof(PostEvent) + (POSTEVENT_ALIGN - 1)) / POSTEVENT_ALIGN) * POSTEVENT_ALIGN)

Function Documentation

◆ AuIPCPostBoxInitialise()

void AuIPCPostBoxInitialise ( )

AuIPCPostBoxInitialise – initialise the post box ipc manager.

create the postbox file

I dont know, but the sixth item in the device fs list is the postbox file node, but miraculously 6th item disappers from the list when opened from user space that's why we are creating a dummy node in the dev list

◆ AuPostBOXGetNode()

AuVFSNode * AuPostBOXGetNode ( )

◆ enscheddebug()

void enscheddebug ( )
extern

◆ IsPostBoxEmpty()

bool IsPostBoxEmpty ( PostBox box)

◆ IsPostBoxFull()

bool IsPostBoxFull ( PostBox box)

◆ PostBoxAdvanceIndex()

void PostBoxAdvanceIndex ( PostBox box)

◆ PostBoxCreate()

void PostBoxCreate ( bool  root,
uint16_t  tid 
)

PostBoxCreate – creates a postbox.

Parameters
root– is this post box root ?
tid– thread id

◆ PostBoxDestroy()

void PostBoxDestroy ( PostBox box)

PostBoxDestroy – destroy given postbox.

Parameters
box– Pointer to postbox need to destroy

◆ PostBoxDestroyByID()

void PostBoxDestroyByID ( uint16_t  id)

PostBoxDestroyByID – destroys a post box identified by an id.

Parameters
id– id of the postbox

◆ PostBoxGetEvent()

int PostBoxGetEvent ( PostEvent event,
bool  root,
AA64Thread *  curr_thread 
)

PostBoxGetEvent – get an event from post box and copy it to a memory area.

Parameters
event– pointer to a memory area
root– is this post box is root
curr_thread– Pointer to current thread

◆ PostBoxIOControl()

int PostBoxIOControl ( AuVFSNode file,
int  code,
void *  arg 
)

PostBoxIOControl – I/O Control function for post box manager.

Parameters
file– Pointer to postbox file
code– Post Box command
arg– extra data

◆ PostBoxPutEvent()

void PostBoxPutEvent ( PostEvent event)

PostBoxPutEvent – put an event to a specific post box.

Parameters
event– Event to put

◆ PostBoxRetreat()

void PostBoxRetreat ( PostBox box)

◆ read_sp()

uint64_t read_sp ( )
extern

Variable Documentation

◆ _PostBoxRootCreated

bool _PostBoxRootCreated

◆ firstBox

PostBox* firstBox = NULL

◆ lastBox

PostBox* lastBox = NULL

◆ pbox

AuVFSNode* pbox