initial import from picomap firmware
This commit is contained in:
52
w6300/w6300.h
Normal file
52
w6300/w6300.h
Normal file
@@ -0,0 +1,52 @@
|
||||
#pragma once
|
||||
#include <array>
|
||||
#include <cstdint>
|
||||
#include <expected>
|
||||
#include <span>
|
||||
|
||||
namespace w6300 {
|
||||
|
||||
enum class socket_id : uint8_t {};
|
||||
|
||||
enum class sock_error : int16_t {
|
||||
busy = 0,
|
||||
sock_num = -1,
|
||||
sock_closed = -4,
|
||||
sock_mode = -5,
|
||||
arg = -10,
|
||||
timeout = -13,
|
||||
data_len = -14,
|
||||
fatal_packlen = -1001,
|
||||
};
|
||||
|
||||
enum class protocol : uint8_t {
|
||||
macraw = 0x07,
|
||||
};
|
||||
|
||||
enum class sock_flag : uint8_t {
|
||||
none = 0,
|
||||
};
|
||||
|
||||
enum intr_kind : uint32_t {
|
||||
ik_sock_0 = (1 << 8),
|
||||
ik_int_all = 0x00FFFF97
|
||||
};
|
||||
|
||||
void init_spi();
|
||||
void reset();
|
||||
void init();
|
||||
bool check();
|
||||
|
||||
extern volatile bool irq_pending;
|
||||
|
||||
void clear_interrupt(intr_kind intr);
|
||||
void set_interrupt_mask(intr_kind intr);
|
||||
void rearm_gpio_irq();
|
||||
|
||||
std::expected<socket_id, sock_error> open_socket(socket_id sn, protocol proto, sock_flag flag);
|
||||
std::expected<uint16_t, sock_error> send(socket_id sn, std::span<const uint8_t> buf);
|
||||
std::expected<uint16_t, sock_error> recv(socket_id sn, std::span<uint8_t> buf);
|
||||
|
||||
uint16_t get_socket_recv_buf(socket_id sn);
|
||||
|
||||
} // namespace w6300
|
||||
Reference in New Issue
Block a user