#pragma once
namespace risc0 {
constexpr size_t kGPIO_SHA = 0x01F00000;
constexpr size_t kGPIO_Commit = 0x01F00004;
constexpr size_t kGPIO_Fault = 0x01F00008;
constexpr size_t kGPIO_Log = 0x01F0000C;
constexpr size_t kGPIO_GetKey = 0x01F0010;
constexpr size_t kGPIO_SendRecvChannel = 0x01F00014;
constexpr size_t kGPIO_SendRecvSize = 0x01F00018;
constexpr size_t kGPIO_SendRecvAddr = 0x01F0001C;
constexpr uint32_t kSendRecvChannel_InitialInput = 0;
constexpr uint32_t kSendRecvChannel_Stdout = 1;
constexpr uint32_t kSendRecvChannel_Stderr = 2;
struct ShaDescriptor {
uint32_t typeAndCount;
uint32_t idx;
uint32_t source;
uint32_t digest;
};
inline volatile ShaDescriptor* volatile* GPIO_SHA() {
return reinterpret_cast<volatile ShaDescriptor* volatile*>(kGPIO_SHA);
}
struct IoDescriptor {
uint32_t size;
uint32_t addr;
};
inline volatile IoDescriptor* volatile* GPIO_Commit() {
return reinterpret_cast<volatile IoDescriptor* volatile*>(kGPIO_Commit);
}
inline uint32_t volatile* GPIO_SendRecvChannel() {
return reinterpret_cast<uint32_t volatile*>(kGPIO_SendRecvChannel);
}
inline uint32_t volatile* GPIO_SendRecvSize() {
return reinterpret_cast<uint32_t volatile*>(kGPIO_SendRecvSize);
}
inline const void* volatile* GPIO_SendRecvAddr() {
return reinterpret_cast<const void* volatile*>(kGPIO_SendRecvAddr);
}
inline const char* volatile* GPIO_Fault() {
return reinterpret_cast<const char* volatile*>(kGPIO_Fault);
}
inline const char* volatile* GPIO_Log() {
return reinterpret_cast<const char* volatile*>(kGPIO_Log);
}
struct GetKeyDescriptor {
uint32_t name;
uint32_t addr;
uint32_t mode;
};
inline volatile GetKeyDescriptor* volatile* GPIO_GetKey() {
return reinterpret_cast<volatile GetKeyDescriptor* volatile*>(kGPIO_GetKey);
}
}