WarpTwin
Documentation for WarpTwin models and classes.
Loading...
Searching...
No Matches
OS.h
Go to the documentation of this file.
1/******************************************************************************
2* Copyright (c) ATTX INC 2025. All Rights Reserved.
3*
4* This software and associated documentation (the "Software") are the
5* proprietary and confidential information of ATTX, INC. The Software is
6* furnished under a license agreement between ATTX and the user organization
7* and may be used or copied only in accordance with the terms of the agreement.
8* Refer to 'license/attx_license.adoc' for standard license terms.
9*
10* EXPORT CONTROL NOTICE: THIS SOFTWARE MAY INCLUDE CONTENT CONTROLLED UNDER THE
11* INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) OR THE EXPORT ADMINISTRATION
12* REGULATIONS (EAR99). No part of the Software may be used, reproduced, or
13* transmitted in any form or by any means, for any purpose, without the express
14* written permission of ATTX, INC.
15******************************************************************************/
16/*
17OSAL header file
18
19Author: Alex Reynolds
20*/
21#ifndef FLIGHT_OS_H
22#define FLIGHT_OS_H
23
24#include "types.h"
25#include "architecture/Time.h"
26
27namespace warpos {
29enum file_descriptors_e : uint8 {
30 WRITE = 0x01,
31 READ = 0x02,
33 CREATE_NEW = 0x08,
35 OPEN_ALWAYS = 0x20,
37};
38
50
51class OS {
52public:
53 OS() {}
54 virtual ~OS() {}
55
58 virtual int16 startup() {return ERROR_BUFFER_NOT_IMPLEMENTED;}
59
71
83
89 virtual int16 delay(const clockwerk::Time& delay_time) {return ERROR_BUFFER_NOT_IMPLEMENTED;}
90
93 virtual int16 yield() {return ERROR_BUFFER_NOT_IMPLEMENTED;}
94
98 virtual int16 delayUntil(const clockwerk::Time& wake_time) {return ERROR_BUFFER_NOT_IMPLEMENTED;}
99
101 virtual void startTimer() {}
102
105 virtual uint64 stopTimer() {return ERROR_BUFFER_NOT_IMPLEMENTED;}
106
115 virtual int16 sysLog(floating_point sys_time, const char* app, const char* message, uint16 msg_size) {return NO_ERROR;}
116
124
130 virtual uint32 fileSize(int32 fd) {return ERROR_BUFFER_NOT_IMPLEMENTED;}
136 virtual int16 closeFile(int32 fd) {return ERROR_BUFFER_NOT_IMPLEMENTED;}
144 virtual int16 writeFile(int32 fd, const char* buffer, uint32 size) {return ERROR_BUFFER_NOT_IMPLEMENTED;}
152 virtual uint32 readFile(int32 fd, char* buffer, int32 size) {return ERROR_BUFFER_NOT_IMPLEMENTED;}
153
157 virtual int16 flushFile(int32 fd) {return ERROR_BUFFER_NOT_IMPLEMENTED;}
158
161 virtual int32 getSysLogFD() {return -1;}
162
179 virtual int16 sendBroadcastSocket(int32 sock_fd, const char* address, uint32 port, const char* buffer, uint32 len) {return ERROR_BUFFER_NOT_IMPLEMENTED;}
187 virtual int32 openListenerSocket(const char* address, uint32 port) {return ERROR_BUFFER_NOT_IMPLEMENTED;}
196 virtual uint32 readListenerSocket(int32 sock_fd, char* buffer, uint32 max_len) {return ERROR_BUFFER_NOT_IMPLEMENTED;}
197protected:
198
199};
200}
201
202#endif
Wrapper to manage and convert time as timespce.
Definition Time.h:53
virtual ~OS()
Definition OS.h:54
virtual int16 delay(const clockwerk::Time &delay_time)
Delay the current task or thread.
Definition OS.h:89
virtual int16 yield()
Yield the current task or thread.
Definition OS.h:93
virtual uint32 readFile(int32 fd, char *buffer, int32 size)
Reads data from an open file.
Definition OS.h:152
virtual int32 openListenerSocket(const char *address, uint32 port)
Opens a listener socket to receive data.
Definition OS.h:187
virtual uint64 stopTimer()
Stop the system timer and return the result.
Definition OS.h:105
virtual int16 writeFile(int32 fd, const char *buffer, uint32 size)
Writes data to an open file.
Definition OS.h:144
virtual int32 openBroadcastSocket()
Opens a broadcast socket for sending data.
Definition OS.h:168
virtual int16 sysLog(floating_point sys_time, const char *app, const char *message, uint16 msg_size)
Write a system log (or terminal output, or file).
Definition OS.h:115
virtual int32 openFile(const char *filename, uint8 desc=file_descriptors_e::WRITE|file_descriptors_e::READ|file_descriptors_e::OPEN_ALWAYS)
Opens a file with the specified filename.
Definition OS.h:123
virtual int16 closeFile(int32 fd)
Close the file at the file descriptor.
Definition OS.h:136
virtual uint32 fileSize(int32 fd)
Opens a file with the specified filename, used for reading.
Definition OS.h:130
virtual int16 startup()
Initialize the os.
Definition OS.h:58
virtual clockwerk::Time systemTime()
Retrieves the system base time.
Definition OS.h:70
OS()
Definition OS.h:53
virtual uint32 readListenerSocket(int32 sock_fd, char *buffer, uint32 max_len)
Reads data from a listener socket.
Definition OS.h:196
virtual void startTimer()
Start a timer in the system.
Definition OS.h:101
virtual int16 flushFile(int32 fd)
Flushes any buffered data to the file associated with the given file descriptor.
Definition OS.h:157
virtual clockwerk::Time navigationTime()
Retrieves the system navigation time.
Definition OS.h:82
virtual int32 getSysLogFD()
Gets the file descriptor for the system log.
Definition OS.h:161
virtual int16 delayUntil(const clockwerk::Time &wake_time)
Delay the current task or thread until the specified time.
Definition OS.h:98
virtual int16 sendBroadcastSocket(int32 sock_fd, const char *address, uint32 port, const char *buffer, uint32 len)
Sends data over a broadcast socket.
Definition OS.h:179
#define NO_ERROR
Error code in the case where matrix math executed successfully.
Definition clockwerkerrors.h:34
#define ERROR_BUFFER_NOT_IMPLEMENTED
Variable to raise an error if an appropriate buffer is not in place.
Definition clockwerkerrors.h:126
Definition DeadReckon.cpp:20
file_descriptors_e
Options when opening files.
Definition OS.h:29
@ CREATE_ALWAYS
Create a new file, delete existing one if present.
Definition OS.h:34
@ OPEN_EXISTING
Open existing file, fails if doesn't exist.
Definition OS.h:32
@ OPEN_ALWAYS
Open file if exists, creates if not.
Definition OS.h:35
@ WRITE
Open file to Write.
Definition OS.h:30
@ CREATE_NEW
Create new file, fails if it exists.
Definition OS.h:33
@ OPEN_APPEND
Same as open always, writes at the end.
Definition OS.h:36
@ READ
Open file to Read.
Definition OS.h:31