diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/30pin.h | 9 | ||||
| -rw-r--r-- | include/boot.h | 28 | ||||
| -rw-r--r-- | include/fd.h | 4 | ||||
| -rw-r--r-- | include/mp-bit.h | 10 | ||||
| -rw-r--r-- | include/partition-map.h | 6 | ||||
| -rw-r--r-- | include/pci-tree.h | 34 |
6 files changed, 49 insertions, 42 deletions
diff --git a/include/30pin.h b/include/30pin.h index b7b0924..336f536 100644 --- a/include/30pin.h +++ b/include/30pin.h @@ -37,6 +37,13 @@ enum { TPIN_RECOVERY_PACKET_KIND_EOP = 3, TPIN_RECOVERY_PACKET_KIND_EOP_ACK = 4, TPIN_RECOVERY_PACKET_KIND_EOP_NACK = 5, + TPIN_RECVOERY_PACKET_KIND_RESET = 6, + TPIN_RECOVERY_PACKET_KIND_COUNT = TPIN_RECVOERY_PACKET_KIND_RESET - TPIN_RECOVERY_PACKET_KIND_BOOT + 1 }; -typedef struct _nb_tpin_recovery_packet cb_tpin_recovery_packet_t;
\ No newline at end of file +/// @brief 30pin CRC type. +typedef uint8_t nb_tpin_crc_t[sizeof(uint32_t)]; + +typedef struct _nb_tpin_recovery_packet nb_tpin_recovery_packet_t; + +size_t nb_parse_30pin(voidptr_t blob, size_t* size, size_t* start_lba);
\ No newline at end of file diff --git a/include/boot.h b/include/boot.h index 143714f..02f87c5 100644 --- a/include/boot.h +++ b/include/boot.h @@ -93,7 +93,7 @@ typedef struct nullptr_* nullptr_t; #define NB_UART_BASE 0x10000000 #define NB_FLASH_BASE_ADDR 0x08000000 -#define cb_sync_synchronize() __sync_synchronize() +#define nb_sync_synchronize() __sync_synchronize() #elif defined(__COMPILE_POWERPC__) #define NB_UART_BASE 0x10000000 #define NB_BOOT_ADDR 0x1030000 @@ -101,7 +101,7 @@ typedef struct nullptr_* nullptr_t; #define NB_FRAMEBUFFER_ADDR 0x40000000L #define NB_FLASH_BASE_ADDR 0x08000000 -#define cb_sync_synchronize() __sync_synchronize() +#define nb_sync_synchronize() __sync_synchronize() #elif defined(__COMPILE_ARM64__) #define NB_UART_BASE 0x09000000 @@ -114,7 +114,7 @@ static inline void __sync_synchronize(void) { /// leave it as is. } -#define cb_sync_synchronize() __sync_synchronize() +#define nb_sync_synchronize() __sync_synchronize() #endif // ifndef __COMPILE_POWERPC__ #define NB_BAUDRATE_TABLE {300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200} @@ -131,7 +131,7 @@ static inline void __sync_synchronize(void) { #endif // ifndef _Nonnull #define NB_BOOT_CALL(struct, offset) \ - volatile cb_proc_t proc_##offset = (volatile cb_proc_t)(struct->offset); \ + volatile nb_proc_t proc_##offset = (volatile nb_proc_t)(struct->offset); \ proc_##offset(); /// @brief Binary64 representation (IEE 7554) in a C structure @@ -153,36 +153,36 @@ typedef char ascii_char_t; /// @brief panic the entire system. /// @param reason why text. -void cb_panic(const char* reason); +void nb_panic(const char* reason); /// @brief update the power status of the machine. -void cb_update_power_status(boolean restart); +void nb_update_power_status(boolean restart); /// @brief puts a string in serial /// @param text /// @return -size_t cb_put_string(const ascii_char_t* _Nonnull text); +size_t nb_put_string(const ascii_char_t* _Nonnull text); /// @brief gets a char from serial /// @param /// @return -utf_char_t cb_get_char(void); +utf_char_t nb_get_char(void); /// @brief puts a char in serial /// @param ch -void cb_put_char(utf_char_t ch); +void nb_put_char(utf_char_t ch); /// @brief Hangs the firmware. /// @param void no args. -void cb_restart_machine(void); +void nb_restart_machine(void); /// @brief Flushs the TLB. /// @param void no args. -void cb_flush_tlb(void); +void nb_flush_tlb(void); /// @brief Print current kernel name. /// @param -void cb_print_name(void); +void nb_print_name(void); /// @brief String length getter /// @param str the string. @@ -195,14 +195,14 @@ size_t strlen(_Nonnull caddr_t str); /// @return size_t strcmp(_Nonnull caddr_t src, _Nonnull caddr_t cmp); -typedef void (*cb_proc_t)(); +typedef void (*nb_proc_t)(); /// \brief ASCII character. typedef char ascii_char_t; /// @brief Linear Executable Header /// @author Amlal El Mahrouss (Amlal El Mahrouss) -struct __attribute__((aligned(4))) cb_boot_header { +struct __attribute__((aligned(4))) nb_boot_header { const ascii_char_t h_mag[2]; // magic number const ascii_char_t h_name[10]; // operating system name const uint32_t h_revision; // firmware revision diff --git a/include/fd.h b/include/fd.h index c1dfff4..f0d99a3 100644 --- a/include/fd.h +++ b/include/fd.h @@ -22,9 +22,9 @@ typedef struct _nb_file_descriptor { int (*f_rewind)(struct _nb_file_descriptor* self); int (*f_eof)(struct _nb_file_descriptor* self); int (*f_close)(struct _nb_file_descriptor* self); -} cb_file_descriptor_t; +} nb_file_descriptor_t; /// @brief Grabs a new device reference. /// @param path the device path. /// @return -cb_file_descriptor_t* cb_grab_fd(const char* path); +nb_file_descriptor_t* nb_grab_fd(const char* path); diff --git a/include/mp-bit.h b/include/mp-bit.h index 58111a3..8298084 100644 --- a/include/mp-bit.h +++ b/include/mp-bit.h @@ -9,10 +9,10 @@ /// Name: NeBoot Bits API. /// Purpose: Bit manip helpers. -#define cb_set_bit(X, O) X = (1 << O) | X -#define cb_clear_bit(X, O) X = ~(1 << O) & X -#define cb_toogle(X, O) X = (1 << O) ^ X -#define cb_lsb(X) X = X & -X -#define cb_msb(X) X = -(cb_lsb(X)) & X +#define nb_set_bit(X, O) X = (1 << O) | X +#define nb_clear_bit(X, O) X = ~(1 << O) & X +#define nb_toogle(X, O) X = (1 << O) ^ X +#define nb_lsb(X) X = X & -X +#define nb_msb(X) X = -(nb_lsb(X)) & X #endif // ifndef __BITMANIP_H__ diff --git a/include/partition-map.h b/include/partition-map.h index c3088fe..e12181b 100644 --- a/include/partition-map.h +++ b/include/partition-map.h @@ -91,14 +91,14 @@ enum { }; /// @brief check for supported filesystem. -boolean cb_filesystem_exists(caddr_t fs, size_t len); +boolean nb_filesystem_exists(caddr_t fs, size_t len); /// @brief Parse EPM block from blob. -bool cb_parse_partition_block_data_at(voidptr_t blob, size_t blob_sz, size_t index, size_t* end_lba, +bool nb_parse_partition_block_data_at(voidptr_t blob, size_t blob_sz, size_t index, size_t* end_lba, size_t* start_lba, size_t* sector_sz); /// @brief Parse Partition block info at index. /// @param index the partition block to parse. -part_block_t* cb_parse_partition_block_at(voidptr_t blob, size_t blob_sz, size_t index); +part_block_t* nb_parse_partition_block_at(voidptr_t blob, size_t blob_sz, size_t index); #endif // ifndef __PARTITION_MAP_H__ diff --git a/include/pci-tree.h b/include/pci-tree.h index 574cd1d..b4fd500 100644 --- a/include/pci-tree.h +++ b/include/pci-tree.h @@ -22,7 +22,7 @@ #define NB_PCI_VERSION (0x0100) #define NB_PCI_DEV_MAGIC (0xfeedd00d) -#define NB_PCI_INT_SZ sizeof(cb_pci_num_t) +#define NB_PCI_INT_SZ sizeof(nb_pci_num_t) #define NB_PCI_NAME_LEN (255U) @@ -32,37 +32,37 @@ #define PCI_DEV_MAX (32U) #define PCI_FN_MAX (8U -typedef char cb_pci_char_t; -typedef uintptr_t cb_pci_num_t; +typedef char nb_pci_char_t; +typedef uintptr_t nb_pci_num_t; -typedef uint8_t cb_pci_fn_t; -typedef uint8_t cb_pci_bus_t; -typedef uint8_t cb_pci_device_t; +typedef uint8_t nb_pci_fn_t; +typedef uint8_t nb_pci_bus_t; +typedef uint8_t nb_pci_device_t; /// @brief hardware tree header /// used by guest to resolve hardware peripherals. struct hw_nb_pci_tree { - cb_pci_num_t d_magic; - cb_pci_num_t d_version; - cb_pci_num_t d_off_props; - cb_pci_num_t d_off_struct; - cb_pci_num_t d_sz_props; - cb_pci_num_t d_sz_struct; + nb_pci_num_t d_magic; + nb_pci_num_t d_version; + nb_pci_num_t d_off_props; + nb_pci_num_t d_off_struct; + nb_pci_num_t d_sz_props; + nb_pci_num_t d_sz_struct; - cb_pci_num_t d_first_node; - cb_pci_num_t d_next_sibling; + nb_pci_num_t d_first_node; + nb_pci_num_t d_next_sibling; - cb_pci_char_t d_name[NB_PCI_NAME_LEN]; + nb_pci_char_t d_name[NB_PCI_NAME_LEN]; }; /// @brief Init PCI tree. /// @param void /// @return if it's successful or not. -boolean cb_pci_init_tree(void); +boolean nb_pci_init_tree(void); /// @brief Adds a new tree into the internal data structure. /// @param name device name /// @param struct_ptr device structure /// @param struct_sz the structure size of the device. /// @return if it was successful or not. -boolean cb_pci_append_tree(const caddr_t name, cb_pci_num_t struct_ptr, cb_pci_num_t struct_sz); +boolean nb_pci_append_tree(const caddr_t name, nb_pci_num_t struct_ptr, nb_pci_num_t struct_sz); |
