Chroma/inc/kernel/system/io.h

80 lines
1.9 KiB
C
Raw Normal View History

2021-04-15 15:33:51 +00:00
#pragma once
#include <kernel/system/descriptors.h>
/************************
*** Team Kitty, 2020 ***
*** Chroma ***
***********************/
2020-08-31 20:51:07 +00:00
#define PAUSE __asm__ __volatile__("pause")
2021-07-15 03:43:46 +00:00
#ifdef __cplusplus
extern "C" {
#endif
typedef struct {
uint8_t ACK;
uint8_t SelfTest;
uint8_t Echo;
uint8_t EchoCount;
uint8_t Error;
} KBD_FLAGS;
2021-07-15 03:43:46 +00:00
extern KBD_FLAGS KbdFlags;
DESC_TBL ReadGDT(void);
void WriteGDT(DESC_TBL GDTData);
DESC_TBL ReadIDT(void);
void WriteIDT(DESC_TBL IDTData);
uint16_t ReadLDT(void);
void WriteLDT(uint16_t LDTData);
uint16_t ReadTSR(void);
void WriteTSR(uint16_t TSRData);
uint32_t ReadPort(uint16_t Port, int Length);
uint32_t WritePort(uint16_t Port, uint32_t Data, int Length);
2020-08-31 20:51:07 +00:00
size_t ReadMMIO(size_t Address, int Length);
void WriteMMIO(size_t Address, size_t Data, int Length);
size_t ReadModelSpecificRegister(size_t MSR);
size_t WriteModelSpecificRegister(size_t MSR, size_t Data);
uint32_t ReadVexMXCSR(void);
uint32_t WriteVexMXCSR(uint32_t Data);
uint32_t ReadMXCSR(void);
uint32_t WriteMXCSR(uint32_t Data);
size_t ReadControlRegister(int CRX);
size_t WriteControlRegister(int CRX, size_t Data);
2020-11-09 18:43:06 +00:00
//size_t ReadExtendedControlRegister(size_t XCRX);
size_t WriteExtendedControlRegister(size_t XCRX, size_t Data);
2020-08-31 20:51:07 +00:00
void InvalidatePage(size_t Page);
// XCS = Extended Code Segment
size_t ReadXCS(void);
void UpdateKeyboard(uint8_t scancode);
void WaitFor8042();
void Send8042(size_t);
void WriteSerialChar(const char);
void WriteSerialString(const char*, size_t);
int SerialPrintf(const char* format, ...);
int Printf(const char* Format, ...);
void* memcpy(void* dest, void const* src, size_t len);
2021-07-04 20:47:09 +00:00
void* memset(void* dst, int src, size_t len);
#ifdef __cplusplus
}
#endif