Merge bmp.h, boot.h, jpeg.h, and post.h into util.h.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
392d2aacb6
commit
07cf73bad4
15
src/bmp.c
15
src/bmp.c
|
@ -6,9 +6,17 @@
|
|||
*
|
||||
* This work is licensed under the terms of the GNU LGPLv3.
|
||||
*/
|
||||
#include "bmp.h" // struct bmp_decdata
|
||||
#include "malloc.h" // malloc_tmphigh
|
||||
#include "string.h" // memcpy
|
||||
#include "util.h" // struct bmp_decdata
|
||||
|
||||
struct bmp_decdata {
|
||||
struct tagRGBQUAD *quadp;
|
||||
unsigned char *datap;
|
||||
int width;
|
||||
int height;
|
||||
int bpp;
|
||||
};
|
||||
|
||||
#define bmp_load4byte(addr) (*(u32 *)(addr))
|
||||
#define bmp_load2byte(addr) (*(u16 *)(addr))
|
||||
|
@ -59,12 +67,14 @@ static void raw_data_format_adjust_24bpp(u8 *src, u8 *dest, int width,
|
|||
}
|
||||
}
|
||||
|
||||
/* allocate decdata struct */
|
||||
struct bmp_decdata *bmp_alloc(void)
|
||||
{
|
||||
struct bmp_decdata *bmp = malloc_tmphigh(sizeof(*bmp));
|
||||
return bmp;
|
||||
}
|
||||
|
||||
/* extract information from bmp file data */
|
||||
int bmp_decode(struct bmp_decdata *bmp, unsigned char *data, int data_size)
|
||||
{
|
||||
if (data_size < 54)
|
||||
|
@ -84,13 +94,14 @@ int bmp_decode(struct bmp_decdata *bmp, unsigned char *data, int data_size)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* get bmp properties */
|
||||
void bmp_get_size(struct bmp_decdata *bmp, int *width, int *height)
|
||||
{
|
||||
*width = bmp->width;
|
||||
*height = bmp->height;
|
||||
}
|
||||
|
||||
|
||||
/* flush flat picture data to *pc */
|
||||
int bmp_show(struct bmp_decdata *bmp, unsigned char *pic, int width
|
||||
, int height, int depth, int bytes_per_line_dest)
|
||||
{
|
||||
|
|
25
src/bmp.h
25
src/bmp.h
|
@ -1,25 +0,0 @@
|
|||
#ifndef BMP_H
|
||||
#define BMP_H
|
||||
#include "types.h"
|
||||
|
||||
struct bmp_decdata {
|
||||
struct tagRGBQUAD *quadp;
|
||||
unsigned char *datap;
|
||||
int width;
|
||||
int height;
|
||||
int bpp;
|
||||
};
|
||||
|
||||
/* allocate decdata struct */
|
||||
struct bmp_decdata *bmp_alloc(void);
|
||||
|
||||
/* extract information from bmp file data */
|
||||
int bmp_decode(struct bmp_decdata *bmp, unsigned char *data, int data_size);
|
||||
|
||||
/* get bmp properties */
|
||||
void bmp_get_size(struct bmp_decdata *bmp, int *width, int *height);
|
||||
|
||||
/* flush flat picture data to *pc */
|
||||
int bmp_show(struct bmp_decdata *bmp, unsigned char *pic, int width
|
||||
, int height, int depth, int bytes_per_line_dest);
|
||||
#endif
|
|
@ -5,7 +5,6 @@
|
|||
//
|
||||
// This file may be distributed under the terms of the GNU LGPLv3 license.
|
||||
|
||||
#include "boot.h" // boot_init
|
||||
#include "block.h" // struct drive_s
|
||||
#include "bregs.h" // struct bregs
|
||||
#include "config.h" // CONFIG_*
|
||||
|
|
28
src/boot.h
28
src/boot.h
|
@ -1,28 +0,0 @@
|
|||
// Storage for boot definitions.
|
||||
#ifndef __BOOT_H
|
||||
#define __BOOT_H
|
||||
|
||||
#include "types.h" // u16
|
||||
|
||||
// boot.c
|
||||
void boot_init(void);
|
||||
void boot_add_bev(u16 seg, u16 bev, u16 desc, int prio);
|
||||
void boot_add_bcv(u16 seg, u16 ip, u16 desc, int prio);
|
||||
struct drive_s;
|
||||
void boot_add_floppy(struct drive_s *drive_g, const char *desc, int prio);
|
||||
void boot_add_hd(struct drive_s *drive_g, const char *desc, int prio);
|
||||
void boot_add_cd(struct drive_s *drive_g, const char *desc, int prio);
|
||||
void boot_add_cbfs(void *data, const char *desc, int prio);
|
||||
void interactive_bootmenu(void);
|
||||
void bcv_prepboot(void);
|
||||
struct pci_device;
|
||||
int bootprio_find_pci_device(struct pci_device *pci);
|
||||
int bootprio_find_scsi_device(struct pci_device *pci, int target, int lun);
|
||||
int bootprio_find_ata_device(struct pci_device *pci, int chanid, int slave);
|
||||
int bootprio_find_fdc_device(struct pci_device *pci, int port, int fdid);
|
||||
int bootprio_find_pci_rom(struct pci_device *pci, int instance);
|
||||
int bootprio_find_named_rom(const char *name, int instance);
|
||||
struct usbdevice_s;
|
||||
int bootprio_find_usb(struct usbdevice_s *usbdev, int lun);
|
||||
|
||||
#endif // __BOOT_H
|
|
@ -5,11 +5,9 @@
|
|||
//
|
||||
// This file may be distributed under the terms of the GNU LGPLv3 license.
|
||||
|
||||
#include "bmp.h" // bmp_alloc
|
||||
#include "bregs.h" // struct bregs
|
||||
#include "config.h" // CONFIG_*
|
||||
#include "farptr.h" // FLATPTR_TO_SEG
|
||||
#include "jpeg.h" // jpeg_alloc
|
||||
#include "malloc.h" // free
|
||||
#include "output.h" // dprintf
|
||||
#include "romfile.h" // romfile_loadfile
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
// This file may be distributed under the terms of the GNU LGPLv3 license.
|
||||
|
||||
#include "block.h" // MAXDESCSIZE
|
||||
#include "boot.h" // boot_add_cbfs
|
||||
#include "byteorder.h" // be32_to_cpu
|
||||
#include "config.h" // CONFIG_*
|
||||
#include "hw/pci.h" // pci_probe_devices
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
//
|
||||
// This file may be distributed under the terms of the GNU LGPLv3 license.
|
||||
|
||||
#include "boot.h"
|
||||
#include "bregs.h"
|
||||
#include "config.h" // CONFIG_*
|
||||
#include "farptr.h" // MAKE_FLATPTR
|
||||
|
@ -13,7 +12,6 @@
|
|||
#include "malloc.h" // csm_malloc_preinit
|
||||
#include "memmap.h"
|
||||
#include "output.h" // dprintf
|
||||
#include "post.h"
|
||||
#include "stacks.h" // wait_threads
|
||||
#include "std/acpi.h" // RSDP_SIGNATURE
|
||||
#include "std/bda.h" // struct bios_data_area_s
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
#include "ata.h" // ATA_CB_STAT
|
||||
#include "biosvar.h" // GET_GLOBAL
|
||||
#include "blockcmd.h" // CDB_CMD_READ_10
|
||||
#include "boot.h" // add_bcv_hd
|
||||
#include "ioport.h" // inb
|
||||
#include "malloc.h" // free
|
||||
#include "output.h" // dprintf
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
#include "biosvar.h" // GET_GLOBAL
|
||||
#include "block.h" // struct drive_s
|
||||
#include "blockcmd.h" // CDB_CMD_READ_10
|
||||
#include "boot.h" // boot_add_hd
|
||||
#include "byteorder.h" // be16_to_cpu
|
||||
#include "cmos.h" // inb_cmos
|
||||
#include "ioport.h" // inb
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
#include "biosvar.h" // GET_GLOBAL
|
||||
#include "block.h" // struct disk_op_s
|
||||
#include "blockcmd.h" // struct cdb_request_sense
|
||||
#include "boot.h" // boot_add_hd
|
||||
#include "byteorder.h" // be32_to_cpu
|
||||
#include "esp-scsi.h" // esp_scsi_cmd_data
|
||||
#include "lsi-scsi.h" // lsi_scsi_cmd_data
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
#include "biosvar.h" // GET_GLOBAL
|
||||
#include "block.h" // struct drive_s
|
||||
#include "blockcmd.h" // scsi_drive_setup
|
||||
#include "boot.h" // bootprio_find_scsi_device
|
||||
#include "config.h" // CONFIG_*
|
||||
#include "fw/paravirt.h" // runningOnQEMU
|
||||
#include "malloc.h" // free
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
|
||||
#include "biosvar.h" // SET_BDA
|
||||
#include "block.h" // struct drive_s
|
||||
#include "boot.h" // boot_add_floppy
|
||||
#include "bregs.h" // struct bregs
|
||||
#include "cmos.h" // inb_cmos
|
||||
#include "config.h" // CONFIG_FLOPPY
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
#include "biosvar.h" // GET_GLOBAL
|
||||
#include "block.h" // struct drive_s
|
||||
#include "blockcmd.h" // scsi_drive_setup
|
||||
#include "boot.h" // bootprio_find_scsi_device
|
||||
#include "config.h" // CONFIG_*
|
||||
#include "fw/paravirt.h" // runningOnQEMU
|
||||
#include "malloc.h" // free
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
#include "biosvar.h" // GET_GLOBAL
|
||||
#include "block.h" // struct drive_s
|
||||
#include "blockcmd.h" // scsi_drive_setup
|
||||
#include "boot.h" // bootprio_find_scsi_device
|
||||
#include "config.h" // CONFIG_*
|
||||
#include "malloc.h" // free
|
||||
#include "output.h" // dprintf
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
|
||||
#include "biosvar.h" // GET_GLOBAL
|
||||
#include "block.h" // struct drive_s
|
||||
#include "boot.h" // boot_add_floppy
|
||||
#include "bregs.h" // struct bregs
|
||||
#include "malloc.h" // malloc_fseg
|
||||
#include "memmap.h" // add_e820
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
#include "biosvar.h" // GET_GLOBAL
|
||||
#include "block.h" // DTYPE_USB
|
||||
#include "blockcmd.h" // cdb_read
|
||||
#include "boot.h" // bootprio_find_usb
|
||||
#include "config.h" // CONFIG_USB_MSC
|
||||
#include "malloc.h" // free
|
||||
#include "output.h" // dprintf
|
||||
|
@ -15,6 +14,7 @@
|
|||
#include "string.h" // memset
|
||||
#include "usb.h" // struct usb_s
|
||||
#include "usb-msc.h" // usb_msc_setup
|
||||
#include "util.h" // bootprio_find_usb
|
||||
|
||||
struct usbdrive_s {
|
||||
struct drive_s drive;
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
#include "biosvar.h" // GET_GLOBAL
|
||||
#include "block.h" // DTYPE_USB
|
||||
#include "blockcmd.h" // cdb_read
|
||||
#include "boot.h" // bootprio_find_usb
|
||||
#include "config.h" // CONFIG_USB_UAS
|
||||
#include "malloc.h" // free
|
||||
#include "output.h" // dprintf
|
||||
|
@ -25,6 +24,7 @@
|
|||
#include "string.h" // memset
|
||||
#include "usb.h" // struct usb_s
|
||||
#include "usb-uas.h" // usb_uas_init
|
||||
#include "util.h" // bootprio_find_usb
|
||||
|
||||
#define UAS_UI_COMMAND 0x01
|
||||
#define UAS_UI_SENSE 0x03
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
// This file may be distributed under the terms of the GNU LGPLv3 license.
|
||||
|
||||
#include "biosvar.h" // GET_GLOBAL
|
||||
#include "boot.h" // boot_add_hd
|
||||
#include "config.h" // CONFIG_*
|
||||
#include "block.h" // struct drive_s
|
||||
#include "malloc.h" // free
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
#include "biosvar.h" // GET_GLOBAL
|
||||
#include "block.h" // struct drive_s
|
||||
#include "blockcmd.h" // scsi_drive_setup
|
||||
#include "boot.h" // bootprio_find_scsi_device
|
||||
#include "config.h" // CONFIG_*
|
||||
#include "malloc.h" // free
|
||||
#include "output.h" // dprintf
|
||||
|
|
|
@ -41,8 +41,8 @@
|
|||
|
||||
#define __LITTLE_ENDIAN
|
||||
#include "malloc.h"
|
||||
#include "jpeg.h"
|
||||
#include "string.h"
|
||||
#include "util.h"
|
||||
#define ISHIFT 11
|
||||
|
||||
#define IFIX(a) ((int)((a) * (1 << ISHIFT) + .5))
|
||||
|
|
11
src/jpeg.h
11
src/jpeg.h
|
@ -1,11 +0,0 @@
|
|||
#ifndef __JPEG_H
|
||||
#define __JPEG_H
|
||||
|
||||
struct jpeg_decdata;
|
||||
struct jpeg_decdata *jpeg_alloc(void);
|
||||
int jpeg_decode(struct jpeg_decdata *jpeg, unsigned char *buf);
|
||||
void jpeg_get_size(struct jpeg_decdata *jpeg, int *width, int *height);
|
||||
int jpeg_show(struct jpeg_decdata *jpeg, unsigned char *pic, int width
|
||||
, int height, int depth, int bytes_per_line_dest);
|
||||
|
||||
#endif
|
|
@ -5,7 +5,6 @@
|
|||
//
|
||||
// This file may be distributed under the terms of the GNU LGPLv3 license.
|
||||
|
||||
#include "boot.h" // IPL
|
||||
#include "bregs.h" // struct bregs
|
||||
#include "config.h" // CONFIG_*
|
||||
#include "farptr.h" // FLATPTR_TO_SEG
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
// This file may be distributed under the terms of the GNU LGPLv3 license.
|
||||
|
||||
#include "biosvar.h" // SET_BDA
|
||||
#include "boot.h" // boot_init
|
||||
#include "bregs.h" // struct bregs
|
||||
#include "config.h" // CONFIG_*
|
||||
#include "fw/paravirt.h" // qemu_cfg_preinit
|
||||
|
@ -25,7 +24,6 @@
|
|||
#include "malloc.h" // malloc_init
|
||||
#include "memmap.h" // add_e820
|
||||
#include "output.h" // dprintf
|
||||
#include "post.h" // interface_init
|
||||
#include "string.h" // memset
|
||||
#include "util.h" // kbd_init
|
||||
|
||||
|
|
10
src/post.h
10
src/post.h
|
@ -1,10 +0,0 @@
|
|||
#ifndef __POST_H
|
||||
#define __POST_H
|
||||
|
||||
void interface_init(void);
|
||||
void device_hardware_setup(void);
|
||||
void prepareboot(void);
|
||||
void startBoot(void);
|
||||
void reloc_preinit(void *f, void *arg);
|
||||
|
||||
#endif // __POST_H
|
42
src/util.h
42
src/util.h
|
@ -69,6 +69,40 @@ int irqtimer_check(u32 end);
|
|||
void apm_shutdown(void);
|
||||
void handle_1553(struct bregs *regs);
|
||||
|
||||
// bmp.c
|
||||
struct bmp_decdata *bmp_alloc(void);
|
||||
int bmp_decode(struct bmp_decdata *bmp, unsigned char *data, int data_size);
|
||||
void bmp_get_size(struct bmp_decdata *bmp, int *width, int *height);
|
||||
int bmp_show(struct bmp_decdata *bmp, unsigned char *pic, int width
|
||||
, int height, int depth, int bytes_per_line_dest);
|
||||
|
||||
// boot.c
|
||||
void boot_init(void);
|
||||
void boot_add_bev(u16 seg, u16 bev, u16 desc, int prio);
|
||||
void boot_add_bcv(u16 seg, u16 ip, u16 desc, int prio);
|
||||
void boot_add_floppy(struct drive_s *drive_g, const char *desc, int prio);
|
||||
void boot_add_hd(struct drive_s *drive_g, const char *desc, int prio);
|
||||
void boot_add_cd(struct drive_s *drive_g, const char *desc, int prio);
|
||||
void boot_add_cbfs(void *data, const char *desc, int prio);
|
||||
void interactive_bootmenu(void);
|
||||
void bcv_prepboot(void);
|
||||
struct pci_device;
|
||||
int bootprio_find_pci_device(struct pci_device *pci);
|
||||
int bootprio_find_scsi_device(struct pci_device *pci, int target, int lun);
|
||||
int bootprio_find_ata_device(struct pci_device *pci, int chanid, int slave);
|
||||
int bootprio_find_fdc_device(struct pci_device *pci, int port, int fdid);
|
||||
int bootprio_find_pci_rom(struct pci_device *pci, int instance);
|
||||
int bootprio_find_named_rom(const char *name, int instance);
|
||||
struct usbdevice_s;
|
||||
int bootprio_find_usb(struct usbdevice_s *usbdev, int lun);
|
||||
|
||||
// jpeg.c
|
||||
struct jpeg_decdata *jpeg_alloc(void);
|
||||
int jpeg_decode(struct jpeg_decdata *jpeg, unsigned char *buf);
|
||||
void jpeg_get_size(struct jpeg_decdata *jpeg, int *width, int *height);
|
||||
int jpeg_show(struct jpeg_decdata *jpeg, unsigned char *pic, int width
|
||||
, int height, int depth, int bytes_per_line_dest);
|
||||
|
||||
// optionroms.c
|
||||
struct rom_header;
|
||||
void callrom(struct rom_header *rom, u16 bdf);
|
||||
|
@ -77,6 +111,13 @@ void callrom(struct rom_header *rom, u16 bdf);
|
|||
void handle_1ab1(struct bregs *regs);
|
||||
void bios32_init(void);
|
||||
|
||||
// post.c
|
||||
void interface_init(void);
|
||||
void device_hardware_setup(void);
|
||||
void prepareboot(void);
|
||||
void startBoot(void);
|
||||
void reloc_preinit(void *f, void *arg);
|
||||
|
||||
// fw/acpi.c
|
||||
extern struct rsdp_descriptor *RsdpAddr;
|
||||
extern u32 acpi_pm1a_cnt;
|
||||
|
@ -88,7 +129,6 @@ void acpi_set_reset_reg(struct acpi_20_generic_address *reg, u8 val);
|
|||
void acpi_reboot(void);
|
||||
|
||||
// fw/csm.c
|
||||
struct pci_device;
|
||||
int csm_bootprio_fdc(struct pci_device *pci, int port, int fdid);
|
||||
int csm_bootprio_ata(struct pci_device *pci, int chanid, int slave);
|
||||
int csm_bootprio_pci(struct pci_device *pci);
|
||||
|
|
Loading…
Reference in New Issue