You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(35) |
Dec
(2) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(37) |
Feb
(10) |
Mar
|
Apr
(2) |
May
(17) |
Jun
(1) |
Jul
(14) |
Aug
(14) |
Sep
(4) |
Oct
|
Nov
(14) |
Dec
(4) |
2005 |
Jan
(6) |
Feb
|
Mar
|
Apr
(6) |
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
(92) |
Dec
(12) |
2006 |
Jan
(3) |
Feb
(4) |
Mar
|
Apr
(5) |
May
(3) |
Jun
(15) |
Jul
(3) |
Aug
(1) |
Sep
(29) |
Oct
(1) |
Nov
(6) |
Dec
(5) |
2007 |
Jan
(2) |
Feb
(2) |
Mar
|
Apr
(3) |
May
(14) |
Jun
(2) |
Jul
(16) |
Aug
(73) |
Sep
(12) |
Oct
(9) |
Nov
(27) |
Dec
(3) |
2008 |
Jan
(4) |
Feb
(4) |
Mar
(3) |
Apr
(8) |
May
(23) |
Jun
(4) |
Jul
(1) |
Aug
(3) |
Sep
(7) |
Oct
(5) |
Nov
(1) |
Dec
(1) |
2009 |
Jan
|
Feb
(10) |
Mar
|
Apr
(4) |
May
(4) |
Jun
(10) |
Jul
|
Aug
(1) |
Sep
|
Oct
(7) |
Nov
|
Dec
(1) |
2010 |
Jan
|
Feb
(1) |
Mar
|
Apr
(6) |
May
|
Jun
(3) |
Jul
(11) |
Aug
(1) |
Sep
|
Oct
(15) |
Nov
(1) |
Dec
(5) |
2011 |
Jan
(4) |
Feb
(1) |
Mar
(6) |
Apr
|
May
(22) |
Jun
|
Jul
(8) |
Aug
(2) |
Sep
|
Oct
|
Nov
|
Dec
(2) |
2012 |
Jan
|
Feb
(10) |
Mar
(1) |
Apr
(6) |
May
(27) |
Jun
(48) |
Jul
(30) |
Aug
(4) |
Sep
|
Oct
(3) |
Nov
(1) |
Dec
(11) |
2013 |
Jan
(4) |
Feb
(7) |
Mar
(6) |
Apr
(18) |
May
(28) |
Jun
(20) |
Jul
|
Aug
(4) |
Sep
(1) |
Oct
(1) |
Nov
(2) |
Dec
(7) |
2014 |
Jan
(3) |
Feb
(2) |
Mar
(4) |
Apr
(9) |
May
(11) |
Jun
(10) |
Jul
|
Aug
(18) |
Sep
(12) |
Oct
(17) |
Nov
(10) |
Dec
(16) |
2015 |
Jan
(5) |
Feb
(1) |
Mar
(5) |
Apr
(4) |
May
(28) |
Jun
(2) |
Jul
|
Aug
|
Sep
(6) |
Oct
|
Nov
(2) |
Dec
(1) |
2016 |
Jan
(14) |
Feb
|
Mar
(3) |
Apr
|
May
|
Jun
(3) |
Jul
(4) |
Aug
(4) |
Sep
(1) |
Oct
(1) |
Nov
|
Dec
(1) |
2017 |
Jan
(11) |
Feb
|
Mar
(21) |
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
2018 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
(2) |
Sep
(4) |
Oct
(4) |
Nov
|
Dec
(1) |
2019 |
Jan
(1) |
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
(13) |
Sep
(4) |
Oct
|
Nov
|
Dec
|
2020 |
Jan
(10) |
Feb
(9) |
Mar
(5) |
Apr
(4) |
May
(3) |
Jun
(18) |
Jul
(4) |
Aug
(2) |
Sep
(20) |
Oct
(2) |
Nov
|
Dec
|
2021 |
Jan
|
Feb
|
Mar
|
Apr
(2) |
May
(1) |
Jun
(2) |
Jul
(1) |
Aug
(2) |
Sep
|
Oct
|
Nov
|
Dec
(2) |
2022 |
Jan
(1) |
Feb
(2) |
Mar
(2) |
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
(5) |
Sep
|
Oct
(1) |
Nov
|
Dec
(1) |
2023 |
Jan
(10) |
Feb
(7) |
Mar
(29) |
Apr
(31) |
May
(29) |
Jun
(34) |
Jul
(3) |
Aug
(24) |
Sep
(22) |
Oct
(10) |
Nov
(38) |
Dec
(27) |
2024 |
Jan
(15) |
Feb
(8) |
Mar
(4) |
Apr
(20) |
May
(33) |
Jun
(18) |
Jul
(15) |
Aug
(23) |
Sep
(26) |
Oct
(32) |
Nov
(6) |
Dec
(4) |
2025 |
Jan
(7) |
Feb
(1) |
Mar
(1) |
Apr
(4) |
May
(46) |
Jun
(19) |
Jul
(26) |
Aug
(13) |
Sep
|
Oct
|
Nov
|
Dec
|
From: Lawrence S. <ljs...@us...> - 2019-08-08 04:39:31
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via f93a40f18cf4f537ccbb2e11b0c93b23d717bc63 (commit) from 5218f13d0aec2002f5ad8ada6c71ed0913600f15 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit f93a40f18cf4f537ccbb2e11b0c93b23d717bc63 Author: Lawrence Sebald <ljs...@us...> Date: Thu Aug 8 00:37:13 2019 -0400 Add initial (probably still buggy) verison of libkosfat. Please note, this is currently read-only, but that hopefully should change soon. ----------------------------------------------------------------------- Summary of changes: addons/include/fat/fs_fat.h | 119 +++ addons/libkosfat/Makefile | 10 + addons/libkosfat/bpb.c | 233 +++++ addons/libkosfat/bpb.h | 114 +++ addons/libkosfat/directory.c | 821 +++++++++++++++++ addons/libkosfat/directory.h | 69 ++ addons/libkosfat/fat.c | 322 +++++++ addons/libkosfat/fatfs.c | 400 +++++++++ addons/libkosfat/fatfs.h | 122 +++ addons/libkosfat/fatinternal.h | 51 ++ addons/libkosfat/fs_fat.c | 973 +++++++++++++++++++++ .../{libkosext2fs => libkosfat}/kos/dreamcast.cnf | 0 addons/libkosfat/ucs.c | 126 +++ addons/libkosfat/ucs.h | 23 + doc/CHANGELOG | 1 + doc/FAQ | 20 +- doc/RELNOTES | 9 +- 17 files changed, 3403 insertions(+), 10 deletions(-) create mode 100644 addons/include/fat/fs_fat.h create mode 100644 addons/libkosfat/Makefile create mode 100644 addons/libkosfat/bpb.c create mode 100644 addons/libkosfat/bpb.h create mode 100644 addons/libkosfat/directory.c create mode 100644 addons/libkosfat/directory.h create mode 100644 addons/libkosfat/fat.c create mode 100644 addons/libkosfat/fatfs.c create mode 100644 addons/libkosfat/fatfs.h create mode 100644 addons/libkosfat/fatinternal.h create mode 100644 addons/libkosfat/fs_fat.c copy addons/{libkosext2fs => libkosfat}/kos/dreamcast.cnf (100%) create mode 100644 addons/libkosfat/ucs.c create mode 100644 addons/libkosfat/ucs.h diff --git a/addons/include/fat/fs_fat.h b/addons/include/fat/fs_fat.h new file mode 100644 index 0000000..003892b --- /dev/null +++ b/addons/include/fat/fs_fat.h @@ -0,0 +1,119 @@ +/* KallistiOS ##version## + + ext2/fs_fat.h + Copyright (C) 2012, 2013, 2019 Lawrence Sebald +*/ + +#ifndef __FAT_FS_FAT_H +#define __FAT_FS_FAT_H + +#include <sys/cdefs.h> +__BEGIN_DECLS + +#include <stdint.h> +#include <kos/blockdev.h> + +/** \file fat/fs_fat.h + \brief VFS interface for a FAT filesystem. + + This file defines the public interface to add support for the FAT + filesystem, as in common use on all kinds of systems and popularized by + MS-DOS and Windows. This interface supports FAT12, FAT16, and FAT32, with + both short and long names. + + Note that there is a lower-level interface sitting underneath of this layer. + This lower-level interface (simply called fatfs) should not generally be + used by any normal applications. As of this point, it is completely non + thread-safe and the fs_fat layer takes extreme care to overcome those + issues with the lower-level interface. Over time, I may fix the thread- + safety issues in fatfs, but that is not particularly high on my priority + list at the moment. There shouldn't really be a reason to work directly with + the fatfs layer anyway, as this layer should give you everything you need + by interfacing with the VFS in the normal fashion. + + \author Lawrence Sebald +*/ + +/** \brief Initialize fs_fat. + + This function initializes fs_fat, preparing various internal structures for + use. + + \retval 0 On success. No error conditions currently defined. +*/ +int fs_fat_init(void); + +/** \brief Shut down fs_fat. + + This function shuts down fs_fat, basically undoing what fs_fat_init() did. + + \retval 0 On success. No error conditions currently defined. +*/ +int fs_fat_shutdown(void); + +/** \defgroup fat_mount_flags Mount flags for fs_fat + + These values are the valid flags that can be passed for the flags parameter + to the fs_fat_mount() function. Note that these can be combined, except for + the read-only flag. + + Also, it is not possible to mount some filesystems as read-write. For + instance, if the filesystem was marked as not cleanly unmounted the driver + will fail to mount the device as read-write. Also, if the block device does + not support writing, then the filesystem will not be mounted as read-write + (for obvious reasons). + + These should stay synchronized with the ones in fatfs.h. + + @{ +*/ +#define FS_FAT_MOUNT_READONLY 0x00000000 /**< \brief Mount read-only */ +#define FS_FAT_MOUNT_READWRITE 0x00000001 /**< \brief Mount read-write */ +/** @} */ + +/** \brief Mount a FAT filesystem in the VFS. + + This function mounts an ext2 filesystem to the specified mount point on the + VFS. This function will detect whether or not an FAT filesystem exists on + the given block device and mount it only if there is actually an FAT + filesystem. + + \param mp The path to mount the filesystem at. + \param dev The block device containing the filesystem. + \param flags Mount flags. Bitwise OR of values from fat_mount_flags + \retval 0 On success. + \retval -1 On error. +*/ +int fs_fat_mount(const char *mp, kos_blockdev_t *dev, uint32_t flags); + +/** \brief Unmount a FAT filesystem from the VFS. + + This function unmoutns an FAT filesystem that was previously mounted by the + fs_fat_mount() function. + + \param mp The mount point of the filesystem to be unmounted. + \retval 0 On success. + \retval -1 On error. +*/ +int fs_fat_unmount(const char *mp); + +/** \brief Sync a FAT filesystem, flushing all pending writes to the block + device. + + This function completes all pending writes on the filesystem, making sure + all data and metadata are in a consistent state on the block device. As both + inode and block writes are normally postponed until they are either evicted + from the cache or the filesystem is unmounted, doing this periodically may + be a good idea if there is a chance that the filesystem will not be + unmounted cleanly. + + \param mp The mount point of the filesystem to be synced. + \retval 0 On success. + \retval -1 On error. + + \note This function has no effect if the filesystem was mounted read-only. +*/ +int fs_fat_sync(const char *mp); + +__END_DECLS +#endif /* !__FAT_FS_FAT_H */ diff --git a/addons/libkosfat/Makefile b/addons/libkosfat/Makefile new file mode 100644 index 0000000..66b6667 --- /dev/null +++ b/addons/libkosfat/Makefile @@ -0,0 +1,10 @@ +# libkosfat Makefile +# + +TARGET = libkosfat.a +OBJS = fat.o bpb.o fatfs.o directory.o ucs.o fs_fat.o + +# Make sure everything comiles nice and cleanly (or not at all). +KOS_CFLAGS += -W -Wextra -pedantic -std=c99 -Werror + +include $(KOS_BASE)/addons/Makefile.prefab diff --git a/addons/libkosfat/bpb.c b/addons/libkosfat/bpb.c new file mode 100644 index 0000000..c671296 --- /dev/null +++ b/addons/libkosfat/bpb.c @@ -0,0 +1,233 @@ +/* KallistiOS ##version## + + bpb.c + Copyright (C) 2012, 2019 Lawrence Sebald +*/ + +#include <stdio.h> +#include <errno.h> +#include <stdlib.h> +#include <string.h> +#include <stdint.h> +#include <inttypes.h> + +#include "fatfs.h" +#include "fatinternal.h" + +static int fat_read_raw_boot(fat_bootblock_t *sb, kos_blockdev_t *bd) { + if(bd->l_block_size > 9) { + uint8_t *buf; + + if(!(buf = (uint8_t *)malloc(1 << bd->l_block_size))) + return -ENOMEM; + + if(bd->read_blocks(bd, 0, 1, buf)) + return -EIO; + + memcpy(sb, buf, 512); + free(buf); + return 0; + } + else if(bd->l_block_size == 9) { + return bd->read_blocks(bd, 0, 1, sb); + } + else { + return bd->read_blocks(bd, 0, 512 >> bd->l_block_size, sb); + } +} + +static int fat_read_fsinfo(fat32_fsinfo_t *fsinfo, int s, kos_blockdev_t *bd) { + if(bd->l_block_size > 9) { + uint8_t *buf; + + if(!(buf = (uint8_t *)malloc(1 << bd->l_block_size))) + return -ENOMEM; + + if(bd->read_blocks(bd, s, 1, buf)) + return -EIO; + + memcpy(fsinfo, buf, 512); + free(buf); + return 0; + } + else if(bd->l_block_size == 9) { + /* This should generally be the case... */ + return bd->read_blocks(bd, s, 1, fsinfo); + } + else { + /* This shouldn't happen. */ + return -EIO; + } +} + +static int fat_parse_boot(fat_bootblock_t *bb, fat_superblock_t *sb) { + uint32_t rds, fsz, ts, ds, bps, rs, nc, fds; + + /* Do work needed to determine what type of filesystem we have... */ + rds = bb->bpb.root_dir_entries[0] | (bb->bpb.root_dir_entries[1] << 8); + bps = bb->bpb.bytes_per_sector[0] | (bb->bpb.bytes_per_sector[1] << 8); + rds = ((rds << 5) + (bps - 1)) / bps; + + fsz = bb->bpb.fat_size[0] | (bb->bpb.fat_size[1] << 8); + if(!fsz) + fsz = bb->ebpb.fat32.fat_size[0] | (bb->ebpb.fat32.fat_size[1] << 8) | + (bb->ebpb.fat32.fat_size[2] << 16) | + (bb->ebpb.fat32.fat_size[3] << 24); + + ts = bb->bpb.num_sectors16[0] | (bb->bpb.num_sectors16[1] << 8); + if(!ts) + ts = bb->bpb.num_sectors32[0] | (bb->bpb.num_sectors32[1] << 8) | + (bb->bpb.num_sectors32[2] << 16) | (bb->bpb.num_sectors32[3] << 24); + + rs = bb->bpb.reserved_sectors[0] | (bb->bpb.reserved_sectors[1] << 8); + fds = rs + (bb->bpb.num_fats * fsz) + rds; + ds = ts - fds; + + nc = ds / bb->bpb.sectors_per_cluster; + + /* Fill in stuff in the superblock structure. */ + sb->num_sectors = ts; + sb->fat_size = fsz; + sb->bytes_per_sector = bps; + sb->reserved_sectors = rs; + sb->num_clusters = nc; + sb->num_fats = bb->bpb.num_fats; + sb->sectors_per_cluster = bb->bpb.sectors_per_cluster; + sb->first_data_block = fds; + + if(nc <= FAT_MAX_FAT12_CLUSTERS) + sb->fs_type = FAT_FS_FAT12; + else if(nc <= FAT_MAX_FAT16_CLUSTERS) + sb->fs_type = FAT_FS_FAT16; + else + sb->fs_type = FAT_FS_FAT32; + + if(rds) + sb->root_dir = bb->bpb.root_dir_entries[0] | + (bb->bpb.root_dir_entries[1] << 8); + else + sb->root_dir = bb->ebpb.fat32.rootdir_cluster[0] | + (bb->ebpb.fat32.rootdir_cluster[1] << 8) | + (bb->ebpb.fat32.rootdir_cluster[2] << 16) | + (bb->ebpb.fat32.rootdir_cluster[3] << 24); + + if(sb->fs_type == FAT_FS_FAT32) { + /* Make sure that the filesystem is sane... */ + if(bb->ebpb.fat32.fs_version[0] || bb->ebpb.fat32.fs_version[1]) + return -EINVAL; + + sb->fsinfo_sector = bb->ebpb.fat32.fsinfo_sector[0] | + bb->ebpb.fat32.fsinfo_sector[1]; + + sb->backup_bpb = bb->ebpb.fat32.backup_bpb[0] | + bb->ebpb.fat32.backup_bpb[1]; + + if(bb->ebpb.fat32.ext_boot_sig == 0x28 || + bb->ebpb.fat32.ext_boot_sig == 0x29) + memcpy(sb->volume_id, bb->ebpb.fat32.volume_id, 4); + + if(bb->ebpb.fat32.ext_boot_sig == 0x29) + memcpy(sb->volume_label, bb->ebpb.fat32.volume_label, 11); + } + else { + if(bb->ebpb.fat16.ext_boot_sig == 0x28 || + bb->ebpb.fat16.ext_boot_sig == 0x29) + memcpy(sb->volume_id, bb->ebpb.fat16.volume_id, 4); + + if(bb->ebpb.fat16.ext_boot_sig == 0x29) + memcpy(sb->volume_label, bb->ebpb.fat16.volume_label, 11); + } + + return 0; +} + +int fat_read_boot(fat_superblock_t *sb, kos_blockdev_t *bd) { + int rv; + fat_bootblock_t bb; + fat32_fsinfo_t fsinfo; + + memset(&bb, 0, sizeof(fat_bootblock_t)); + memset(sb, 0, sizeof(fat_superblock_t)); + + if((rv = fat_read_raw_boot(&bb, bd)) < 0) { + return rv; + } + + /* Make sure it looks sane... */ + if(bb.ebpb.fat16.boot_sig[0] != 0x55 || bb.ebpb.fat16.boot_sig[1] != 0xAA) { + return -EINVAL; + } + + if((rv = fat_parse_boot(&bb, sb)) < 0) { + return rv; + } + + /* Make sure our sector sizes match up... */ + if(sb->bytes_per_sector != (1 << bd->l_block_size)) { + return -EINVAL; + } + + /* If we have an fsinfo sector, read it. */ + if(sb->fsinfo_sector) { + memset(&fsinfo, 0, sizeof(fat32_fsinfo_t)); + + if((rv = fat_read_fsinfo(&fsinfo, sb->fsinfo_sector, bd)) < 0) { + return rv; + } + + /* Check it for sanity... */ + if(fsinfo.fsinfo_sig1 != FAT32_FSINFO_SIG1 || + fsinfo.fsinfo_sig2 != FAT32_FSINFO_SIG2 || + fsinfo.fsinfo_sig3 != FAT32_FSINFO_SIG3) { + dbglog(DBG_KDEBUG, "Potentially invalid FSinfo sector: " + "%08" PRIx32 " %08" PRIx32 " %08" PRIx32 "\n", + fsinfo.fsinfo_sig1, fsinfo.fsinfo_sig2, + fsinfo.fsinfo_sig3); + } + else { + /* Parse out what we care about... */ + sb->free_clusters = fsinfo.free_clusters; + sb->last_alloc_cluster = fsinfo.last_alloc_cluster; + } + } + + return 0; +} + +#ifdef FAT_DEBUG +static const char *fs_types[] = { "FAT12", "FAT16", "FAT32" }; +void fat_print_superblock(const fat_superblock_t *sb) { + char label[12]; + + dbglog(DBG_KDEBUG, "FAT Superblock:\n"); + dbglog(DBG_KDEBUG, "Filesystem type: %s\n", fs_types[sb->fs_type]); + dbglog(DBG_KDEBUG, "Sector Count: %" PRIu32 "\n", sb->num_sectors); + dbglog(DBG_KDEBUG, "FAT Size: %" PRIu32 "\n", sb->fat_size); + dbglog(DBG_KDEBUG, "Number of FAT copies: %" PRIu8 "\n", sb->num_fats); + dbglog(DBG_KDEBUG, "Sectors per cluster: %" PRIu16 "\n", + sb->sectors_per_cluster); + dbglog(DBG_KDEBUG, "Bytes per sector: %" PRIu16 "\n", sb->bytes_per_sector); + dbglog(DBG_KDEBUG, "Reserved sectors: %" PRIu16 "\n", sb->reserved_sectors); + dbglog(DBG_KDEBUG, "First data block: %" PRIu32 "\n", sb->first_data_block); + dbglog(DBG_KDEBUG, "Volume ID: %02" PRIx8 "%02" PRIx8 "-%02" PRIx8 "%02" + PRIx8 "\n", sb->volume_id[3], sb->volume_id[2], sb->volume_id[1], + sb->volume_id[0]); + memcpy(label, sb->volume_label, 11); + label[11] = 0; + dbglog(DBG_KDEBUG, "Volume Label: '%s'\n", label); + + if(sb->fs_type == FAT_FS_FAT32) { + dbglog(DBG_KDEBUG, "Root directory cluster: %" PRIu32 "\n", + sb->root_dir); + dbglog(DBG_KDEBUG, "FSinfo Sector: %" PRIu16 "\n", sb->fsinfo_sector); + dbglog(DBG_KDEBUG, "Backup BPB: %" PRIu16 "\n", sb->backup_bpb); + dbglog(DBG_KDEBUG, "Free clusters: %" PRIu32 "\n", + sb->free_clusters); + dbglog(DBG_KDEBUG, "Last used cluster: %" PRIu32 "\n", + sb->last_alloc_cluster); + } + else { + dbglog(DBG_KDEBUG, "Root directory size: %" PRIu32 "\n", sb->root_dir); + } +} +#endif /* FAT_DEBUG */ diff --git a/addons/libkosfat/bpb.h b/addons/libkosfat/bpb.h new file mode 100644 index 0000000..cb34882 --- /dev/null +++ b/addons/libkosfat/bpb.h @@ -0,0 +1,114 @@ +/* KallistiOS ##version## + + bpb.h + Copyright (C) 2019 Lawrence Sebald +*/ + +#ifndef __FAT_BPB_H +#define __FAT_BPB_H + +#include <sys/cdefs.h> +__BEGIN_DECLS + +#include <stdint.h> + +typedef struct fat_bpb { + uint8_t jmp[3]; /* 0xEB 0x?? 0x90 or 0xE9 0x?? 0x?? */ + uint8_t oem_name[8]; + uint8_t bytes_per_sector[2]; + uint8_t sectors_per_cluster; + uint8_t reserved_sectors[2]; + uint8_t num_fats; + uint8_t root_dir_entries[2]; + uint8_t num_sectors16[2]; + uint8_t media_code; + uint8_t fat_size[2]; + uint8_t sectors_per_track[2]; + uint8_t num_heads[2]; + uint8_t hidden_sector_count[4]; + uint8_t num_sectors32[4]; +} __attribute__((packed)) fat_bpb_t; + +typedef struct fat16_ebpb { + uint8_t drive_number; + uint8_t reserved; + uint8_t ext_boot_sig; + uint8_t volume_id[4]; + uint8_t volume_label[11]; + uint8_t fs_type[8]; + uint8_t boot_code[448]; + uint8_t boot_sig[2]; +} __attribute__((packed)) fat16_ebpb_t; + +typedef struct fat32_ebpb { + uint8_t fat_size[4]; + uint8_t flags[2]; + uint8_t fs_version[2]; + uint8_t rootdir_cluster[4]; + uint8_t fsinfo_sector[2]; + uint8_t backup_bpb[2]; + uint8_t reserved[12]; + uint8_t drive_number; + uint8_t reserved2; + uint8_t ext_boot_sig; + uint8_t volume_id[4]; + uint8_t volume_label[11]; + uint8_t fs_type[8]; + uint8_t boot_code[420]; + uint8_t boot_sig[2]; +} __attribute__((packed)) fat32_ebpb_t; + +typedef struct fat_bootblock { + fat_bpb_t bpb; + union { + fat16_ebpb_t fat16; + fat32_ebpb_t fat32; + } ebpb; +} __attribute__((packed)) fat_bootblock_t; + +typedef struct fat32_fsinfo { + uint32_t fsinfo_sig1; + uint8_t reserved[480]; + uint32_t fsinfo_sig2; + uint32_t free_clusters; + uint32_t last_alloc_cluster; + uint8_t reserved2[12]; + uint32_t fsinfo_sig3; +} __attribute__((packed)) fat32_fsinfo_t; + +#define FAT32_FSINFO_SIG1 0x41615252 +#define FAT32_FSINFO_SIG2 0x61417272 +#define FAT32_FSINFO_SIG3 0xAA550000 + +typedef struct fat_superblock { + uint32_t num_sectors; + uint32_t fat_size; + uint32_t root_dir; + uint32_t num_clusters; + uint32_t first_data_block; + + uint32_t free_clusters; + uint32_t last_alloc_cluster; + uint16_t fsinfo_sector; + uint16_t backup_bpb; ...<truncated>... hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2019-08-07 04:21:34
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 5218f13d0aec2002f5ad8ada6c71ed0913600f15 (commit) via 6f7047933763c9b874db2ddda0bbefb6c67671cb (commit) via edc45dc0e27cbb0204e3d5e185b1b38fb502f744 (commit) from 5547ad7d626c6a67579944ef4268b81966a5a39d (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 5218f13d0aec2002f5ad8ada6c71ed0913600f15 Author: Lawrence Sebald <ljs...@us...> Date: Wed Aug 7 00:20:10 2019 -0400 Update copyright. commit 6f7047933763c9b874db2ddda0bbefb6c67671cb Author: Lawrence Sebald <ljs...@us...> Date: Wed Aug 7 00:19:09 2019 -0400 Clean up some comments a bit for cleaner documentation. commit edc45dc0e27cbb0204e3d5e185b1b38fb502f744 Author: Lawrence Sebald <ljs...@us...> Date: Mon Aug 5 21:35:24 2019 -0400 Clean up some comments. ----------------------------------------------------------------------- Summary of changes: AUTHORS | 2 +- doc/README.KOS | 4 ++-- include/kos/mutex.h | 7 ++----- kernel/arch/dreamcast/include/dc/flashrom.h | 10 +++++++--- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/AUTHORS b/AUTHORS index 08eb927..ae18700 100644 --- a/AUTHORS +++ b/AUTHORS @@ -22,7 +22,7 @@ please see the README.KOS file in the doc directory. Contributors list (under the normal KOS license): ------------------------------------------------- Dan Potter: 1997, 2000, 2001, 2002, 2003, 2004 -Lawrence Sebald: 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018 +Lawrence Sebald: 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 Sam Steele: 2004 Gil Megidish: 2002 Florian Schulze: 2002 diff --git a/doc/README.KOS b/doc/README.KOS index cd3bf69..1b7e7cf 100644 --- a/doc/README.KOS +++ b/doc/README.KOS @@ -40,10 +40,10 @@ The actual license terms begin below this line: -------------------------------------------------------------------------------- All of the documentation and software included in the KallistiOS Releases -is copyrighted (C) 1997-2016 by Dan Potter, Lawrence Sebald, and others (as +is copyrighted (C) 1997-2019 by Dan Potter, Lawrence Sebald, and others (as noted in each file). -Copyright (C) 1997-2016 KallistiOS Contributors. All rights reserved. +Copyright (C) 1997-2019 KallistiOS Contributors. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions diff --git a/include/kos/mutex.h b/include/kos/mutex.h index 0807084..b714d8e 100644 --- a/include/kos/mutex.h +++ b/include/kos/mutex.h @@ -6,9 +6,6 @@ */ -/* Other than the old function names, there's basically nothing left of the old - version of mutexes... */ - /** \file kos/mutex.h \brief Mutual exclusion locks. @@ -135,8 +132,8 @@ int mutex_init(mutex_t *m, int mtype); allocated internally for it. It is your responsibility to make sure that all threads waiting on the mutex are taken care of before destroying the mutex. - This function can be called on statically initialized, as well as - dynamically initialized ones. + This function can be called on statically initialized as well as dyanmically + initialized mutexes. \retval 0 On success \retval -1 On error, errno will be set as appropriate diff --git a/kernel/arch/dreamcast/include/dc/flashrom.h b/kernel/arch/dreamcast/include/dc/flashrom.h index 649d970..26569d2 100644 --- a/kernel/arch/dreamcast/include/dc/flashrom.h +++ b/kernel/arch/dreamcast/include/dc/flashrom.h @@ -150,7 +150,8 @@ int flashrom_delete(int offset); \param partid The partition ID to look in. \param blockid The logical block ID to look for. \param buffer_out Space to store the data. Must be at least 60 bytes. - \return 0 on success, <0 on error. \see fr_errs + \return 0 on success, <0 on error. + \see fr_errs */ int flashrom_get_block(int partid, int blockid, uint8 * buffer_out); @@ -188,7 +189,8 @@ typedef struct flashrom_syscfg { /** \brief Retrieve the current system configuration settings. \param out Storage for the configuration. - \return 0 on success, <0 on error. \see fr_errs + \return 0 on success, <0 on error. + \see fr_errs */ int flashrom_get_syscfg(flashrom_syscfg_t * out); @@ -210,7 +212,9 @@ int flashrom_get_syscfg(flashrom_syscfg_t * out); This function attempts to find the region of the Dreamcast. It may or may not work on 100% of Dreamcasts, apparently. - \return A region code (0>=) \see fr_region, or error (<0) \see fr_errs . + \return A region code (>=0), or error (<0). + \see fr_region + \see fr_errs */ int flashrom_get_region(); hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2019-04-23 12:31:14
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 5547ad7d626c6a67579944ef4268b81966a5a39d (commit) via d7a2620d1a223ec864fb27afbb8ccc8851d67017 (commit) from a449e93c615ba2d8c2abf9f4dcc485b6d7d1bfa3 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 5547ad7d626c6a67579944ef4268b81966a5a39d Merge: d7a2620 a449e93 Author: Lawrence Sebald <ljs...@us...> Date: Tue Apr 23 08:28:13 2019 -0400 Merge branch 'master' of ssh://git.code.sf.net/p/cadcdev/kallistios commit d7a2620d1a223ec864fb27afbb8ccc8851d67017 Author: Lawrence Sebald <ljs...@us...> Date: Tue Apr 23 08:27:18 2019 -0400 The __depr macro is in <kos/cdefs.h>, so we need that version here instead of <sys/cdefs.h>. ----------------------------------------------------------------------- Summary of changes: kernel/arch/dreamcast/include/dc/biosfont.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/arch/dreamcast/include/dc/biosfont.h b/kernel/arch/dreamcast/include/dc/biosfont.h index 043fb09..65cb10c 100644 --- a/kernel/arch/dreamcast/include/dc/biosfont.h +++ b/kernel/arch/dreamcast/include/dc/biosfont.h @@ -22,7 +22,7 @@ #ifndef __DC_BIOSFONT_H #define __DC_BIOSFONT_H -#include <sys/cdefs.h> +#include <kos/cdefs.h> __BEGIN_DECLS #include <arch/types.h> hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Donald H. <qu...@us...> - 2019-01-21 19:53:58
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via a449e93c615ba2d8c2abf9f4dcc485b6d7d1bfa3 (commit) from 50f96e5f4ba3d18257d6429c5f4b1e291fc1cdce (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit a449e93c615ba2d8c2abf9f4dcc485b6d7d1bfa3 Author: Donald Haase <qu...@gm...> Date: Mon Jan 21 14:52:35 2019 -0500 Cleanups in BBA/SLA code. -Added defines for more RTL8139 stuff -Replaced timer_spin_sleep with thd_sleep in SLA code to match BBA -Return error defines not 0/1 when applicable. ----------------------------------------------------------------------- Summary of changes: .../dreamcast/hardware/network/broadband_adapter.c | 31 +++++++------- .../arch/dreamcast/hardware/network/lan_adapter.c | 48 +++++++++------------- 2 files changed, 36 insertions(+), 43 deletions(-) diff --git a/kernel/arch/dreamcast/hardware/network/broadband_adapter.c b/kernel/arch/dreamcast/hardware/network/broadband_adapter.c index 0da0a39..c98fcd2 100644 --- a/kernel/arch/dreamcast/hardware/network/broadband_adapter.c +++ b/kernel/arch/dreamcast/hardware/network/broadband_adapter.c @@ -28,16 +28,23 @@ #define RTL_MEM (0x1840000) +#define RX_NOWRAP 1 /* 1 for no wrapping or 0 to use wrapping mode (Ignored for 64Kb buffer length) */ +#define RX_MAX_DMA_BURST 6 /* 2^(4+n) bytes from 0-6 (16b - 1Kb) or 7 for unlimited */ #define RX_BUFFER_LEN_SHIFT 1 /* 0 : 8Kb, 1 : 16Kb, 2 : 32Kb, 3 : 64Kb */ +#define RX_FIFO_THRESHOLD 0 /* 2^(4+n) bytes from 0-6 (16b - 1Kb) or 7 for none */ +#define RX_EARLY_THRESHOLD 0 /* Early RX Threshold multiplier n/16 or 0 for none */ -#define RX_NOWRAP (1<<7) /* or 0 to use wrapping mode */ -#define RX_CONFIG RX_NOWRAP | (0<<24) | (0<<13) | (6<<8) | (RX_BUFFER_LEN_SHIFT<<11) +#define RX_CONFIG (RX_EARLY_THRESHOLD<<24) | (RX_FIFO_THRESHOLD<<13) | \ + (RX_BUFFER_LEN_SHIFT<<11) | (RX_MAX_DMA_BURST<<8) | \ + (RX_NOWRAP<<7) + +#define TX_MAX_DMA_BURST 6 /* 2^(4+n) bytes from 0-7 (16b - 2Kb) */ +#define TX_CONFIG (TX_MAX_DMA_BURST<<8) -#define TX_CONFIG (6<<8) /* 0x00000600 */ - -#define RX_BUFFER_LEN (8192<<RX_BUFFER_LEN_SHIFT) +#define RX_BUFFER_LEN (0x2000<<RX_BUFFER_LEN_SHIFT) #define TX_BUFFER_OFFSET (RX_BUFFER_LEN + 0x2000) +#define TX_BUFFER_LEN (0x800) #define TX_NB_BUFFERS 4 /* original value */ @@ -260,11 +267,6 @@ static int bba_hw_init() { g2_write_8(NIC(RT_CHIPCMD), RT_CMD_RX_ENABLE | RT_CMD_TX_ENABLE); /* Set Rx FIFO threashold to 1K, Rx size to 16k+16, 1024 byte DMA burst */ - /* nic32[RT_RXCONFIG/4] = 0x0000c600; */ - - /* Set Rx FIFO threashold to 1K, Rx size to 8k, 1024 byte DMA burst */ - /* g2_write_32(NIC(RT_RXCONFIG), 0x0000c600); */ - //g2_write_32(NIC(RT_RXCONFIG), 0x00000e00); g2_write_32(NIC(RT_RXCONFIG), RX_CONFIG); /* Set Tx 1024 byte DMA burst */ @@ -279,13 +281,12 @@ static int bba_hw_init() { /* Switch back to normal operation mode */ g2_write_8(NIC(RT_CFG9346), 0); - /* Setup RX/TX buffers */ + /* Setup RX buffer */ g2_write_32(NIC(RT_RXBUF), RTL_MEM); - g2_write_32(NIC(RT_TXADDR0 + 0), RTL_MEM + TX_BUFFER_OFFSET); - g2_write_32(NIC(RT_TXADDR0 + 4), RTL_MEM + 0x0800 + TX_BUFFER_OFFSET); - g2_write_32(NIC(RT_TXADDR0 + 8), RTL_MEM + 0x1000 + TX_BUFFER_OFFSET); - g2_write_32(NIC(RT_TXADDR0 + 12), RTL_MEM + 0x1800 + TX_BUFFER_OFFSET); + /* Setup TX buffers */ + for(i=0; i<TX_NB_BUFFERS; i++) + g2_write_32(NIC(RT_TXADDR0 + (i*4)), RTL_MEM + (i* TX_BUFFER_LEN) + TX_BUFFER_OFFSET); /* Reset RXMISSED counter */ g2_write_32(NIC(RT_RXMISSED), 0); diff --git a/kernel/arch/dreamcast/hardware/network/lan_adapter.c b/kernel/arch/dreamcast/hardware/network/lan_adapter.c index bac6115..f2b361c 100644 --- a/kernel/arch/dreamcast/hardware/network/lan_adapter.c +++ b/kernel/arch/dreamcast/hardware/network/lan_adapter.c @@ -15,7 +15,6 @@ #include <dc/flashrom.h> #include <dc/net/lan_adapter.h> #include <arch/irq.h> -#include <arch/timer.h> #include <kos/net.h> /* @@ -262,16 +261,9 @@ static void la_strobe_eeprom() { la_write(BMPR16, BMPR16_ECS); } static void la_read_eeprom(uint8 *data) { - //uint8 save16, save17 uint8 val; int n, bit; -#if 0 - /* Save the current value of the EEPROM registers */ - save16 = la_read(BMPR16); - save17 = la_read(BMPR17); -#endif - /* Read bytes from EEPROM, two per iteration */ for(n = 0; n < 3; n++) { /* Reset the EEPROM interface */ @@ -331,7 +323,7 @@ static int la_detect() { g2_write_8(G2_8BP_RST, 0); /* Give it a few ms to come back */ - timer_spin_sleep(100); + thd_sleep(100); /* Read the chip type and verify it */ type = DLCR7_IDENT(la_read(DLCR7)); @@ -357,19 +349,19 @@ static int la_hw_init() { la_write(DLCR1, DLCR0_CLEARALL); /* Power down chip */ - timer_spin_sleep(2); + thd_sleep(2); la_write(DLCR7, la_read(DLCR7) & ~DLCR7_NSTBY); - timer_spin_sleep(2); + thd_sleep(2); /* Reset Data Link Control */ - timer_spin_sleep(2); + thd_sleep(2); la_write(DLCR6, la_read(DLCR6) | DLCR6_DLCRST); - timer_spin_sleep(2); + thd_sleep(2); /* Power up the chip */ - timer_spin_sleep(2); + thd_sleep(2); la_write(DLCR7, la_read(DLCR7) | DLCR7_NSTBY); - timer_spin_sleep(2); + thd_sleep(2); /* Read the EEPROM data */ la_read_eeprom(la_mac); @@ -428,7 +420,7 @@ static void la_stop() { /* Make sure we aren't transmitting currently */ while(BMPR10_PKTCNT(la_read(BMPR10)) > 0 && (--timeout) > 0) - timer_spin_sleep(2); + thd_sleep(2); /* Disable all receive */ la_write(DLCR5, (la_read(DLCR5) & ~DLCR5_AM_MASK) | DLCR5_AM_OFF); @@ -438,9 +430,9 @@ static void la_stop() { /* Shut it down for good */ static void la_hw_shutdown() { /* Power down chip */ - timer_spin_sleep(2); + thd_sleep(2); la_write(DLCR7, la_read(DLCR7) & ~DLCR7_NSTBY); - timer_spin_sleep(2); + thd_sleep(2); la_started = LA_NOT_STARTED; @@ -466,7 +458,7 @@ static int la_tx(const uint8 * pkt, int len, int blocking) { timeout = 50; while(BMPR10_PKTCNT(la_read(BMPR10)) > 0 && (--timeout) > 0) - timer_spin_sleep(2); + thd_sleep(2); if(timeout == 0) { dbglog(DBG_ERROR, "la_tx timed out waiting for previous tx\n"); @@ -486,7 +478,7 @@ static int la_tx(const uint8 * pkt, int len, int blocking) { la_write(BMPR8, pkt[i]); /* Start the transmitter */ - timer_spin_sleep(2); + thd_sleep(2); la_write(BMPR10, 1 | BMPR10_TX); /* 1 Packet, Start */ total_pkts_tx++; @@ -517,7 +509,7 @@ static int la_rx() { /* Check for errors */ if((status & 0xF0) != 0x20) { - dbglog(DBG_ERROR, "la_rx: receive error occured (status %02x)\n", status); + dbglog(DBG_ERROR, "la_rx: receive error occurred (status %02x)\n", status); return -1; } @@ -618,11 +610,11 @@ static int la_if_start(netif_t * self) { if(!(self->flags & NETIF_INITIALIZED)) return -1; - /* The Lan adapter seems a bit picky if you try to send packets too soonly + /* The Lan adapter seems a bit picky if you try to send packets too soon after initialization (or at least mine is). 3 seconds seems to be enough of a delay, but 2 seconds certainly is not. Give it 4 seconds, just in case its in a bad mood this run. */ - timer_spin_sleep(4000); + thd_sleep(4000); self->flags |= NETIF_RUNNING; @@ -646,12 +638,12 @@ static int la_if_stop(netif_t * self) { static int la_if_tx(netif_t * self, const uint8 * data, int len, int blocking) { if(!(self->flags & NETIF_RUNNING)) - return -1; + return NETIF_TX_ERROR; if(la_tx(data, len, blocking) != 1) - return -1; + return NETIF_TX_ERROR; - return 0; + return NETIF_TX_OK; } /* We'll auto-commit for now */ @@ -677,9 +669,9 @@ static int la_if_set_mc(netif_t *self, const uint8 *list, int count) { (void)self; /* Reset Data Link Control */ - timer_spin_sleep(2); + thd_sleep(2); la_write(DLCR6, la_read(DLCR6) | DLCR6_DLCRST); - timer_spin_sleep(2); + thd_sleep(2); if(count == 0) { /* Clear the multicast address filter */ hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Donald H. <qu...@us...> - 2018-12-27 23:00:42
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 50f96e5f4ba3d18257d6429c5f4b1e291fc1cdce (commit) via b8a44977450abb37cd7ed314f606a11374b2f69b (commit) via 1dfa5ab920e5ef7690c5abdb3cd9d37acf82a041 (commit) from 89dd38512099ba3b54c65dc846e2b04994313088 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 50f96e5f4ba3d18257d6429c5f4b1e291fc1cdce Author: Donald Haase <qu...@gm...> Date: Mon Dec 24 21:04:20 2018 -0500 Update debug message to properly print VGA usage. - Thanks Chilly Willy. commit b8a44977450abb37cd7ed314f606a11374b2f69b Author: Donald Haase <qu...@gm...> Date: Sat Dec 22 23:56:53 2018 -0500 Minor cleanup of flashrom stuff. Improved some error returns. commit 1dfa5ab920e5ef7690c5abdb3cd9d37acf82a041 Author: Donald Haase <qu...@gm...> Date: Sat Dec 22 01:00:52 2018 -0500 Minor cleanup to snd_sfxmgr. Now uses appropriate error defines. ----------------------------------------------------------------------- Summary of changes: kernel/arch/dreamcast/hardware/flashrom.c | 11 ++-- kernel/arch/dreamcast/hardware/video.c | 2 +- kernel/arch/dreamcast/include/dc/flashrom.h | 7 +-- kernel/arch/dreamcast/sound/snd_sfxmgr.c | 94 ++++++++++++++--------------- 4 files changed, 54 insertions(+), 60 deletions(-) diff --git a/kernel/arch/dreamcast/hardware/flashrom.c b/kernel/arch/dreamcast/hardware/flashrom.c index 9ca3e07..005b662 100644 --- a/kernel/arch/dreamcast/hardware/flashrom.c +++ b/kernel/arch/dreamcast/hardware/flashrom.c @@ -215,18 +215,19 @@ typedef struct { int flashrom_get_syscfg(flashrom_syscfg_t * out) { uint8 buffer[64]; + int rv; syscfg_t *sc = (syscfg_t *)buffer; /* Get the system config block */ - if(flashrom_load_syscfg(buffer) < 0) - return -1; + rv = flashrom_load_syscfg(buffer); + if(rv < 0) return rv; /* Fill in values from it */ out->language = sc->lang; out->audio = sc->mono == 1 ? 0 : 1; out->autostart = sc->autostart == 1 ? 0 : 1; - return 0; + return FLASHROM_ERR_NONE; } int flashrom_get_region() { @@ -236,13 +237,13 @@ int flashrom_get_region() { /* Find the partition */ if(flashrom_info(FLASHROM_PT_SYSTEM, &start, &size)) { dbglog(DBG_ERROR, "flashrom_get_region: can't find partition 0\n"); - return -1; + return FLASHROM_ERR_NO_PARTITION; } /* Read the first 5 characters of that partition */ if(flashrom_read(start, region, 5) < 0) { dbglog(DBG_ERROR, "flashrom_get_region: can't read partition 0\n"); - return -1; + return FLASHROM_ERR_READ_PART; } /* Now compare against known codes */ diff --git a/kernel/arch/dreamcast/hardware/video.c b/kernel/arch/dreamcast/hardware/video.c index d7c6a4d..2e1ebaf 100644 --- a/kernel/arch/dreamcast/hardware/video.c +++ b/kernel/arch/dreamcast/hardware/video.c @@ -525,7 +525,7 @@ void vid_set_mode_ex(vid_mode_t *mode) { dbglog(DBG_INFO, "vid_set_mode: %ix%i%s %s%s\n", mode->width, mode->height, (mode->flags & VID_INTERLACE) ? "IL" : "", - (mode->flags & VID_PAL) ? "PAL" : "NTSC", + (mode->cable_type == CT_VGA) ? "VGA" : (mode->flags & VID_PAL) ? "PAL" : "NTSC", (mode->generic & DM_MULTIBUFFER) ? " multi-buffered" : ""); vid_border_color(0, 0, 0); diff --git a/kernel/arch/dreamcast/include/dc/flashrom.h b/kernel/arch/dreamcast/include/dc/flashrom.h index 16598c9..649d970 100644 --- a/kernel/arch/dreamcast/include/dc/flashrom.h +++ b/kernel/arch/dreamcast/include/dc/flashrom.h @@ -150,7 +150,7 @@ int flashrom_delete(int offset); \param partid The partition ID to look in. \param blockid The logical block ID to look for. \param buffer_out Space to store the data. Must be at least 60 bytes. - \return 0 on success, <0 on error. + \return 0 on success, <0 on error. \see fr_errs */ int flashrom_get_block(int partid, int blockid, uint8 * buffer_out); @@ -188,7 +188,7 @@ typedef struct flashrom_syscfg { /** \brief Retrieve the current system configuration settings. \param out Storage for the configuration. - \return 0 on success, <0 on error. + \return 0 on success, <0 on error. \see fr_errs */ int flashrom_get_syscfg(flashrom_syscfg_t * out); @@ -210,8 +210,7 @@ int flashrom_get_syscfg(flashrom_syscfg_t * out); This function attempts to find the region of the Dreamcast. It may or may not work on 100% of Dreamcasts, apparently. - \return A region code, or -1 on error. - \see fr_region + \return A region code (0>=) \see fr_region, or error (<0) \see fr_errs . */ int flashrom_get_region(); diff --git a/kernel/arch/dreamcast/sound/snd_sfxmgr.c b/kernel/arch/dreamcast/sound/snd_sfxmgr.c index 359e136..c48fb4f 100644 --- a/kernel/arch/dreamcast/sound/snd_sfxmgr.c +++ b/kernel/arch/dreamcast/sound/snd_sfxmgr.c @@ -29,7 +29,7 @@ typedef struct snd_effect { uint32 len; uint32 rate; uint32 used; - int stereo; + uint16 stereo; uint32 fmt; LIST_ENTRY(snd_effect) list; @@ -37,10 +37,10 @@ typedef struct snd_effect { struct selist snd_effects; -// The next channel we'll use to play sound effects. +/* The next channel we'll use to play sound effects. */ static int sfx_nextchan = 0; -// Our channel-in-use mask. +/* Our channel-in-use mask. */ static uint64 sfx_inuse = 0; /* Unload all loaded samples and free their SPU RAM */ @@ -68,7 +68,12 @@ void snd_sfx_unload_all() { /* Unload a single sample */ void snd_sfx_unload(sfxhnd_t idx) { snd_effect_t * t = (snd_effect_t *)idx; - + + if(idx == SFXHND_INVALID) { + dbglog(DBG_WARNING, "snd_sfx: can't unload an invalid SFXHND\n"); + return; + } + snd_mem_free(t->locl); if(t->stereo) @@ -91,8 +96,9 @@ void snd_sfx_unload(sfxhnd_t idx) { /* Load a sound effect from a WAV file and return a handle to it */ sfxhnd_t snd_sfx_load(const char *fn) { - uint32 fd, len, hz; - uint16 *tmp, chn, bitsize, fmt; + file_t fd; + uint32 len, hz; + uint16 *tmp, stereo, bitsize, fmt; snd_effect_t *t; int ownmem; @@ -100,26 +106,26 @@ sfxhnd_t snd_sfx_load(const char *fn) { fd = fs_open(fn, O_RDONLY); - if(fd == 0) { + if(fd <= FILEHND_INVALID) { dbglog(DBG_WARNING, "snd_sfx: can't open sfx %s\n", fn); - return 0; + return SFXHND_INVALID; } /* Check file magic */ hz = 0; - fs_seek(fd, 8, SEEK_SET); + fs_seek(fd, 0x08, SEEK_SET); fs_read(fd, &hz, 4); if(strncmp((char*)&hz, "WAVE", 4)) { dbglog(DBG_WARNING, "snd_sfx: file is not RIFF WAVE\n"); fs_close(fd); - return 0; + return SFXHND_INVALID; } /* Read WAV header info */ fs_seek(fd, 0x14, SEEK_SET); fs_read(fd, &fmt, 2); - fs_read(fd, &chn, 2); + fs_read(fd, &stereo, 2); fs_read(fd, &hz, 4); fs_seek(fd, 0x22, SEEK_SET); fs_read(fd, &bitsize, 2); @@ -129,7 +135,7 @@ sfxhnd_t snd_sfx_load(const char *fn) { fs_read(fd, &len, 4); dbglog(DBG_DEBUG, "WAVE file is %s, %luHZ, %d bits/sample, %lu bytes total," - " format %d\n", chn == 1 ? "mono" : "stereo", hz, bitsize, len, fmt); + " format %d\n", stereo == 1 ? "mono" : "stereo", hz, bitsize, len, fmt); /* Try to mmap it and if that works, no need to copy it again */ ownmem = 0; @@ -148,12 +154,15 @@ sfxhnd_t snd_sfx_load(const char *fn) { t = malloc(sizeof(snd_effect_t)); memset(t, 0, sizeof(snd_effect_t)); + + /* Common characteristics not impacted by stream type */ + t->rate = hz; + t->stereo = stereo - 1; - if(chn == 1) { + if(stereo == 1) { /* Mono PCM/ADPCM */ t->len = len / 2; /* 16-bit samples */ t->rate = hz; - t->used = 1; t->locl = snd_mem_malloc(len); if(t->locl) @@ -169,7 +178,7 @@ sfxhnd_t snd_sfx_load(const char *fn) { else t->fmt = AICA_SM_16BIT; } - else if(chn == 2 && fmt == 1) { + else if(stereo == 2 && fmt == 1) { /* Stereo PCM */ uint32 i; uint16 * sepbuf; @@ -186,7 +195,6 @@ sfxhnd_t snd_sfx_load(const char *fn) { t->len = len / 4; /* Two stereo, 16-bit samples */ t->rate = hz; - t->used = 1; t->locl = snd_mem_malloc(len / 2); t->locr = snd_mem_malloc(len / 2); @@ -201,7 +209,7 @@ sfxhnd_t snd_sfx_load(const char *fn) { free(sepbuf); } - else if(chn == 2 && fmt == 20) { + else if(stereo == 2 && fmt == 20) { /* Stereo ADPCM */ /* We have to be careful here, because the second sample might not @@ -212,7 +220,6 @@ sfxhnd_t snd_sfx_load(const char *fn) { t->len = len; /* Two stereo, 4-bit samples */ t->rate = hz; - t->used = 1; t->locl = snd_mem_malloc(len / 2); t->locr = snd_mem_malloc(len / 2); @@ -229,15 +236,14 @@ sfxhnd_t snd_sfx_load(const char *fn) { } else { free(t); - t = NULL; + t = SFXHND_INVALID; } if(ownmem) free(tmp); - if(t) { + if(t != SFXHND_INVALID) LIST_INSERT_HEAD(&snd_effects, t, list); - } return (sfxhnd_t)t; } @@ -251,37 +257,25 @@ int snd_sfx_play_chn(int chn, sfxhnd_t idx, int vol, int pan) { if(size >= 65535) size = 65534; - if(!t->stereo) { - cmd->cmd = AICA_CMD_CHAN; - cmd->timestamp = 0; - cmd->size = AICA_CMDSTR_CHANNEL_SIZE; - cmd->cmd_id = chn; - chan->cmd = AICA_CH_CMD_START; - chan->base = t->locl; - chan->type = t->fmt; - chan->length = size; - chan->loop = 0; - chan->loopstart = 0; - chan->loopend = size; - chan->freq = t->rate; - chan->vol = vol; + cmd->cmd = AICA_CMD_CHAN; + cmd->timestamp = 0; + cmd->size = AICA_CMDSTR_CHANNEL_SIZE; + cmd->cmd_id = chn; + chan->cmd = AICA_CH_CMD_START; + chan->base = t->locl; + chan->type = t->fmt; + chan->length = size; + chan->loop = 0; + chan->loopstart = 0; + chan->loopend = size; + chan->freq = t->rate; + chan->vol = vol; + + if(!t->stereo) { chan->pan = pan; snd_sh4_to_aica(tmp, cmd->size); } - else { - cmd->cmd = AICA_CMD_CHAN; - cmd->timestamp = 0; - cmd->size = AICA_CMDSTR_CHANNEL_SIZE; - cmd->cmd_id = chn; - chan->cmd = AICA_CH_CMD_START; - chan->base = t->locl; - chan->type = t->fmt; - chan->length = size; - chan->loop = 0; - chan->loopstart = 0; - chan->loopend = size; - chan->freq = t->rate; - chan->vol = vol; + else { chan->pan = 0; snd_sh4_to_aica_stop(); @@ -300,7 +294,7 @@ int snd_sfx_play_chn(int chn, sfxhnd_t idx, int vol, int pan) { int snd_sfx_play(sfxhnd_t idx, int vol, int pan) { int chn, moved, old; - // This isn't perfect.. but it should be good enough. + /* This isn't perfect.. but it should be good enough. */ old = irq_disable(); chn = sfx_nextchan; moved = 0; hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Donald H. <qu...@us...> - 2018-10-26 08:24:58
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 89dd38512099ba3b54c65dc846e2b04994313088 (commit) from b18b9a12a530b73e1d84479270b1442af637532e (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 89dd38512099ba3b54c65dc846e2b04994313088 Author: Donald Haase <qu...@gm...> Date: Fri Oct 26 04:24:16 2018 -0400 Fix missing parens in fs_dclsocket SBIN. ----------------------------------------------------------------------- Summary of changes: kernel/arch/dreamcast/fs/fs_dclsocket.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/arch/dreamcast/fs/fs_dclsocket.c b/kernel/arch/dreamcast/fs/fs_dclsocket.c index 64623ef..897cf3b 100644 --- a/kernel/arch/dreamcast/fs/fs_dclsocket.c +++ b/kernel/arch/dreamcast/fs/fs_dclsocket.c @@ -125,7 +125,7 @@ static void dcls_handle_sbin(command_t *cmd) { left = ntohl(cmd->size); ptr = (uint8 *)ntohl(cmd->address); - count = left + 1023 / 1024; + count = (left + 1023) / 1024; memcpy(resp->id, "SBIN", 4); hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Donald H. <qu...@us...> - 2018-10-26 08:13:33
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via b18b9a12a530b73e1d84479270b1442af637532e (commit) from 4ca03aa04fbf6f2356fdaa2eff45075898548d47 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit b18b9a12a530b73e1d84479270b1442af637532e Author: Donald Haase <qu...@gm...> Date: Fri Oct 26 04:06:02 2018 -0400 Update to Keyboard driver: - Added key repeating function. Holding a key now triggers repeats. - Added defines for hardware and software constants (eliminate magic values). - Small optimizations to key matrix handling. - Example provided that allows for basic keyboard input testing. ----------------------------------------------------------------------- Summary of changes: examples/dreamcast/Makefile | 2 +- examples/dreamcast/keyboard/Makefile | 14 +++ .../cheap_shadow => keyboard/keytest}/Makefile | 12 ++- examples/dreamcast/keyboard/keytest/keytest.c | 89 ++++++++++++++++ kernel/arch/dreamcast/hardware/maple/keyboard.c | 113 ++++++++++++++------- kernel/arch/dreamcast/include/dc/maple/keyboard.h | 41 +++++++- 6 files changed, 226 insertions(+), 45 deletions(-) create mode 100644 examples/dreamcast/keyboard/Makefile copy examples/dreamcast/{pvr/cheap_shadow => keyboard/keytest}/Makefile (62%) create mode 100644 examples/dreamcast/keyboard/keytest/keytest.c diff --git a/examples/dreamcast/Makefile b/examples/dreamcast/Makefile index 22080ec..b9c7dcc 100644 --- a/examples/dreamcast/Makefile +++ b/examples/dreamcast/Makefile @@ -5,7 +5,7 @@ # DIRS = 2ndmix basic libdream kgl hello sound png network vmu conio pvr video \ - lua parallax modem dreameye sd g1ata lightgun + lua parallax modem dreameye sd g1ata lightgun keyboard ifdef KOS_CCPLUS DIRS += cpp tsunami endif diff --git a/examples/dreamcast/keyboard/Makefile b/examples/dreamcast/keyboard/Makefile new file mode 100644 index 0000000..40beb7f --- /dev/null +++ b/examples/dreamcast/keyboard/Makefile @@ -0,0 +1,14 @@ +# KallistiOS ##version## +# +# examples/dreamcast/keyboard/Makefile +# + +all: + $(KOS_MAKE) -C keytest + +clean: + $(KOS_MAKE) -C keytest clean + +dist: + $(KOS_MAKE) -C keytest dist + diff --git a/examples/dreamcast/pvr/cheap_shadow/Makefile b/examples/dreamcast/keyboard/keytest/Makefile similarity index 62% copy from examples/dreamcast/pvr/cheap_shadow/Makefile copy to examples/dreamcast/keyboard/keytest/Makefile index ddce956..0692e64 100644 --- a/examples/dreamcast/pvr/cheap_shadow/Makefile +++ b/examples/dreamcast/keyboard/keytest/Makefile @@ -1,5 +1,10 @@ -TARGET = shadow.elf -OBJS = shadow.o +# KallistiOS ##version## +# +# examples/dreamcast/keyboard/keytest/Makefile +# + +TARGET = keytest.elf +OBJS = keytest.o all: rm-elf $(TARGET) @@ -15,9 +20,8 @@ $(TARGET): $(OBJS) kos-cc -o $(TARGET) $(OBJS) run: $(TARGET) - $(KOS_LOADER) $(TARGET) -n + $(KOS_LOADER) $(TARGET) dist: rm -f $(OBJS) $(KOS_STRIP) $(TARGET) - diff --git a/examples/dreamcast/keyboard/keytest/keytest.c b/examples/dreamcast/keyboard/keytest/keytest.c new file mode 100644 index 0000000..0332dc7 --- /dev/null +++ b/examples/dreamcast/keyboard/keytest/keytest.c @@ -0,0 +1,89 @@ +/* KallistiOS ##version## + + keytest.c + Copyright (C) 2018 Donald Haase + +The Purpose of this program is to provide some testing of the basic keyboard functionality. + +Currently it merely takes in a preset number of printable test characters. This allows for the testing +of basic US keyboard functionality, appropriate shift handling, and the newer key repeating feature. + +Room has been explicitly left open for further tests. It might be useful to include: +-Correct handling of multiple keyboards. +-Handling of non-US keyboards. +-Handling of mod keys and lights. +-Output of keyboard info for comparison to hardware. + + +*/ +#define WIDTH 640 +#define HEIGHT 480 +#define STARTLINE 20 +#define CHARSPERLINE 40 +#define CHARSPERTEST 120 + +#include <assert.h> +#include <kos.h> + +KOS_INIT_FLAGS(INIT_DEFAULT); +extern uint16 *vram_s; + +cont_state_t* first_kbd_state; +maple_device_t* first_kbd_dev = NULL; + +/* Track how many times we try to find a keyboard before just quitting. */ +uint8 no_kbd_loop = 0; +/* This is set up to have multiple tests in the future. */ +uint8 test_phase = 0; + + +void basic_typing (void) +{ + int charcount = 0; + int rv; + int lines = 0; + uint32 offset = ((STARTLINE+(lines*BFONT_HEIGHT)) * WIDTH); + bfont_draw_str(vram_s + offset, WIDTH, 1, "Test of basic typing. Enter 120 characters: "); + offset = ((STARTLINE+((++lines)*BFONT_HEIGHT)) * WIDTH); + + while (charcount < CHARSPERTEST) { + rv = kbd_queue_pop(first_kbd_dev, 1); + if(rv<0) continue; + + bfont_draw(vram_s + offset, WIDTH, 1, (char)rv); + offset += BFONT_THIN_WIDTH; + charcount++; + if(!(charcount%CHARSPERLINE)) offset = ((STARTLINE+((++lines)*BFONT_HEIGHT)) * WIDTH); + } + return; +} + + +int main(void) +{ + for(;;) { + /* If the dev is null, refresh it. */ + while(first_kbd_dev == NULL) { + first_kbd_dev = maple_enum_type(0, MAPLE_FUNC_KEYBOARD); + /* If it's *still* null, wait a bit and check again. */ + if(first_kbd_dev == NULL) { + timer_spin_sleep(500); + no_kbd_loop++; + } + if( no_kbd_loop >= 25 ) return -1; + } + /* Reset the timeout counter */ + no_kbd_loop = 0; + + first_kbd_state = (cont_state_t *) maple_dev_status(first_kbd_dev); + if(first_kbd_state == NULL) assert_msg(0, "Invalid Keyboard state returned"); + + if(test_phase == 0) + basic_typing(); + else + break; + + test_phase++; + } + return 0; +} \ No newline at end of file diff --git a/kernel/arch/dreamcast/hardware/maple/keyboard.c b/kernel/arch/dreamcast/hardware/maple/keyboard.c index 1f522a6..5af52c0 100644 --- a/kernel/arch/dreamcast/hardware/maple/keyboard.c +++ b/kernel/arch/dreamcast/hardware/maple/keyboard.c @@ -3,11 +3,13 @@ keyboard.c Copyright (C) 2002 Dan Potter Copyright (C) 2012 Lawrence Sebald + Copyright (C) 2018 Donald Haase */ #include <assert.h> #include <string.h> #include <stdio.h> +#include <arch/timer.h> #include <dc/maple.h> #include <dc/maple/keyboard.h> @@ -20,6 +22,13 @@ repeat handling. */ +/* These are global timings for key repeat. It would be possible to put + them in the state, but I don't see a reason to. + It seems unreasonable that one might want different repeat + timings set on each keyboard. + The values are arbitrary based off a survey of common values. */ +uint16 kbd_repeat_start = 600, kbd_repeat_interval = 20; + /* Built-in keymaps. */ #define KBD_NUM_KEYMAPS 8 static kbd_keymap_t keymaps[KBD_NUM_KEYMAPS] = { @@ -438,35 +447,76 @@ int kbd_queue_pop(maple_device_t *dev, int xlat) { static void kbd_check_poll(maple_frame_t *frm) { kbd_state_t *state; kbd_cond_t *cond; - int i, p; + int i; int mods; state = (kbd_state_t *)frm->dev->status; cond = (kbd_cond_t *)&state->cond; - /* Check the shift state */ + /* If the modifier keys have changed, end the key repeating. */ + if( state->shift_keys != cond->modifiers ) { + state->kbd_repeat_key = KBD_KEY_NONE; + state->kbd_repeat_timer = 0; + } + + /* Update modifiers and LEDs */ state->shift_keys = cond->modifiers; mods = cond->modifiers | (cond->leds << 8); /* Process all pressed keys */ - for(i = 0; i < 6; i++) { - if(cond->keys[i] > 1) { - p = state->matrix[cond->keys[i]]; - state->matrix[cond->keys[i]] = 2; /* 2 == currently pressed */ - - if(p == 0) - kbd_enqueue(state, cond->keys[i], mods); + for(i = 0; i < MAX_PRESSED_KEYS; i++) { + + /* Once we get to a 'none', the rest will be 'none' */ + if (cond->keys[i] == KBD_KEY_NONE){ + /* This could be used to indicate how many keys are pressed by setting it to ~i or i+1 + or similar. This could be useful, but would make it a weird exception. */ + /* If the first key in the key array is none, there are no non-modifer keys pressed at all. */ + if (i==0)state->matrix[KBD_KEY_NONE] = KEY_STATE_PRESSED; + break; + } + /* Between None and A are error indicators. This would be a good place to do... something. If an error occurs the whole array will be error.*/ + else if (cond->keys[i]>KBD_KEY_NONE && cond->keys[i]<KBD_KEY_A) { + state->matrix[cond->keys[i]] = KEY_STATE_PRESSED; + break; + } + /* The rest of the keys are treated normally */ + else { + /* If the key hadn't been pressed. */ + if (state->matrix[cond->keys[i]] == KEY_STATE_NONE){ + state->matrix[cond->keys[i]] = KEY_STATE_PRESSED; + kbd_enqueue(state, cond->keys[i], mods); + state->kbd_repeat_key = cond->keys[i]; + state->kbd_repeat_timer = timer_ms_gettime64() + kbd_repeat_start; + } + /* If the key was already being pressed and was our one allowed repeating key, then... */ + else if (state->matrix[cond->keys[i]] == KEY_STATE_WAS_PRESSED){ + state->matrix[cond->keys[i]] = KEY_STATE_PRESSED; + if (state->kbd_repeat_key == cond->keys[i]){ + uint64 time = timer_ms_gettime64(); + /* We have passed the prescribed amount of time, and will repeat the key */ + if(time >= (state->kbd_repeat_timer)){ + kbd_enqueue(state, cond->keys[i], mods); + state->kbd_repeat_timer = time + kbd_repeat_interval; + } + } + } + else assert_msg(0, "invalid key matrix array detected"); } } /* Now normalize the key matrix */ - for(i = 0; i < 256; i++) { - if(state->matrix[i] == 1) - state->matrix[i] = 0; - else if(state->matrix[i] == 2) - state->matrix[i] = 1; - else if(state->matrix[i] != 0) { - assert_msg(0, "invalid key matrix array detected"); + /* If it was determined no keys are pressed, wipe the matrix */ + if (state->matrix[KBD_KEY_NONE] == KEY_STATE_PRESSED) + memset (state->matrix, KEY_STATE_NONE, MAX_KBD_KEYS); + /* Otherwise, walk through the whole matrix */ + else { + for(i = 0; i < MAX_KBD_KEYS; i++) { + if (state->matrix[i] == KEY_STATE_NONE) continue; + + else if (state->matrix[i] == KEY_STATE_WAS_PRESSED) state->matrix[i] = KEY_STATE_NONE; + + else if (state->matrix[i] == KEY_STATE_PRESSED) state->matrix[i] = KEY_STATE_WAS_PRESSED; + else assert_msg(0, "invalid key matrix array detected"); } } } @@ -495,7 +545,7 @@ static void kbd_reply(maple_frame_t *frm) { if(frm->dev) { state = (kbd_state_t *)frm->dev->status; cond = (kbd_cond_t *)&state->cond; - memcpy(cond, respbuf + 1, (resp->data_len - 1) * 4); + memcpy(cond, respbuf + 1, (resp->data_len - 1) * sizeof(*respbuf)); frm->dev->status_valid = 1; kbd_check_poll(frm); } @@ -527,27 +577,16 @@ static void kbd_periodic(maple_driver_t *drv) { static int kbd_attach(maple_driver_t *drv, maple_device_t *dev) { kbd_state_t *state = (kbd_state_t *)dev->status; - uint32 f = dev->info.functions, tmp = MAPLE_FUNC_KEYBOARD; int d = 0; (void)drv; - - /* Figure out which function data we want to look at. This is borrowed from - the maple_enum_type_ex function and isn't really pretty... */ - while(tmp != 0x80000000) { - if(f & 0x80000000) { - ++d; - } - - f <<= 1; - tmp <<= 1; - } - - if(d > 2) - /* Punt. */ - state->region = KBD_REGION_US; - else - state->region = dev->info.function_data[d] & 0xFF; + /* Maple functions are enumerated, from MSB, to determine which functions + are on each device. The only one above the keyboard function is lightgun. + Only if it is ALSO a lightgun, will the keyboard function be second. */ + if(dev->info.functions&MAPLE_FUNC_LIGHTGUN) d = 1; + + /* Retrieve the region data */ + state->region = dev->info.function_data[d] & 0xFF; if (state->region > KBD_NUM_KEYMAPS) /* Unrecognized keyboards will appear as US keyboards... */ @@ -555,6 +594,10 @@ static int kbd_attach(maple_driver_t *drv, maple_device_t *dev) { /* Make sure all the queue variables are set up properly... */ state->queue_tail = state->queue_head = state->queue_len = 0; + + /* Make sure all the key repeat variables are set up properly too */ + state->kbd_repeat_key = KBD_KEY_NONE; + state->kbd_repeat_timer = 0; return 0; } diff --git a/kernel/arch/dreamcast/include/dc/maple/keyboard.h b/kernel/arch/dreamcast/include/dc/maple/keyboard.h index 5751846..0d885bf 100644 --- a/kernel/arch/dreamcast/include/dc/maple/keyboard.h +++ b/kernel/arch/dreamcast/include/dc/maple/keyboard.h @@ -66,6 +66,8 @@ __BEGIN_DECLS */ #define KBD_KEY_NONE 0x00 #define KBD_KEY_ERROR 0x01 +#define KBD_KEY_ERR2 0x02 +#define KBD_KEY_ERR3 0x03 #define KBD_KEY_A 0x04 #define KBD_KEY_B 0x05 #define KBD_KEY_C 0x06 @@ -179,6 +181,32 @@ __BEGIN_DECLS #define KBD_REGION_ES 7 /**< \brief Spanish keyboard */ /** @} */ +/** \defgroup key_states States each key can be in. + + These are the different 'states' each key can be in. They are stored in + kbd_state_t->matrix, and manipulated/checked by kbd_check_poll. + + none-> pressed or none + was pressed-> pressed or none + pressed-> was_pressed + @{ +*/ + +#define KEY_STATE_NONE 0 +#define KEY_STATE_WAS_PRESSED 1 +#define KEY_STATE_PRESSED 2 + +/** @} */ +/** \brief Maximum number of keys the DC can read simultaneously. + This is a hardware constant. The define prevents the magic number '6' from appearing. +**/ +#define MAX_PRESSED_KEYS 6 + +/** \brief Maximum number of keys a DC keyboard can have. + This is a hardware constant. The define prevents the magic number '256' from appearing. +**/ +#define MAX_KBD_KEYS 256 + /** \brief Size of a keyboard queue. Each keyboard queue will hold this many elements. Once the queue fills, no @@ -198,9 +226,9 @@ __BEGIN_DECLS \headerfile dc/maple/keyboard.h */ typedef struct kbd_keymap { - uint8 base[256]; - uint8 shifted[256]; - uint8 alt[256]; + uint8 base[MAX_KBD_KEYS]; + uint8 shifted[MAX_KBD_KEYS]; + uint8 alt[MAX_KBD_KEYS]; } kbd_keymap_t; /** \brief Keyboard raw condition structure. @@ -212,7 +240,7 @@ typedef struct kbd_keymap { typedef struct { uint8 modifiers; /**< \brief Bitmask of set modifiers. */ uint8 leds; /**< \brief Bitmask of set LEDs */ - uint8 keys[6]; /**< \brief Key codes for currently pressed keys. */ + uint8 keys[MAX_PRESSED_KEYS]; /**< \brief Key codes for currently pressed keys. */ } kbd_cond_t; /** \brief Keyboard status structure. @@ -234,7 +262,7 @@ typedef struct kbd_state { \see kbd_keys */ - uint8 matrix[256]; + uint8 matrix[MAX_KBD_KEYS]; /** \brief Modifier key status. */ int shift_keys; @@ -249,6 +277,9 @@ typedef struct kbd_state { int queue_tail; /**< \brief Key queue tail. */ int queue_head; /**< \brief Key queue head. */ int queue_len; /**< \brief Current length of queue. */ + + uint8 kbd_repeat_key; /**< \brief Key that is repeating. */ + uint64 kbd_repeat_timer; /**< \brief Time that the next repeat will trigger. */ } kbd_state_t; /** \brief Activate or deactivate global key queueing. hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2018-10-23 14:42:10
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 4ca03aa04fbf6f2356fdaa2eff45075898548d47 (commit) via 9c90fad6fe27c8af7d712d619db27aa5ce393189 (commit) via 2f27f6cc06936766eca8d7d2012b9f6c560e4c72 (commit) from 11d4192b41935feead6c079cf3f81a6c1b4e41ea (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 4ca03aa04fbf6f2356fdaa2eff45075898548d47 Author: Donald Haase <qu...@gm...> Date: Mon Oct 22 23:19:16 2018 -0400 Update to BIOS font code: - Access to Dreamcast-specific font characters such as buttons. - Allows drawing BIOS font to any buffer pixel size (4,8,16, and 32 bpp). - Refactored private functions. commit 9c90fad6fe27c8af7d712d619db27aa5ce393189 Merge: 11d4192 2f27f6c Author: Lawrence Sebald <ljs...@us...> Date: Tue Oct 23 09:33:38 2018 -0400 Merge pull request #11 from sizious/git-ignore-updating Add windows binary files to the .gitignore. commit 2f27f6cc06936766eca8d7d2012b9f6c560e4c72 Author: sizious <si...@gm...> Date: Tue Oct 23 11:02:10 2018 +0200 Ignoring Microsoft Windows binaries. ----------------------------------------------------------------------- Summary of changes: .gitignore | 2 + kernel/arch/dreamcast/hardware/biosfont.c | 346 +++++++++++----------------- kernel/arch/dreamcast/include/dc/biosfont.h | 128 ++++++++-- 3 files changed, 256 insertions(+), 220 deletions(-) diff --git a/.gitignore b/.gitignore index 7e40810..8f219c2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,7 @@ *.o *.elf +*.exe +*.dll *.map *~ .*.swp diff --git a/kernel/arch/dreamcast/hardware/biosfont.c b/kernel/arch/dreamcast/hardware/biosfont.c index c6a2b61..8536b99 100644 --- a/kernel/arch/dreamcast/hardware/biosfont.c +++ b/kernel/arch/dreamcast/hardware/biosfont.c @@ -4,10 +4,13 @@ Copyright (C) 2000-2002 Dan Potter Japanese code Copyright (C) Kazuaki Matsumoto - */ + Copyright (C) 2017 Donald Haase +*/ #include <assert.h> #include <dc/biosfont.h> +#include <dc/video.h> +#include <kos/dbglog.h> /* @@ -23,10 +26,12 @@ All the Japanese code is by Kazuaki Matsumoto. Foreground/background color switching based on code by Chilly Willy. +Expansion to 4 and 8 bpp by Donald Haase. + */ /* Our current conversion mode */ -static int bfont_code_mode = BFONT_CODE_ISO8859_1; +static uint8 bfont_code_mode = BFONT_CODE_ISO8859_1; /* Current colors/pixel format. Default to white foreground, black background and 16-bit drawing, so the default behavior doesn't change from what it has @@ -36,12 +41,11 @@ static uint32 bfont_bgcolor = 0x00000000; static int bfont_32bit = 0; /* Select an encoding for Japanese (or disable) */ -void bfont_set_encoding(int enc) { - if(enc < BFONT_CODE_ISO8859_1 || enc > BFONT_CODE_SJIS) { - assert_msg(0, "Unknown bfont encoding mode"); - } - - bfont_code_mode = enc; +void bfont_set_encoding(uint8 enc) { + if(enc <= BFONT_CODE_RAW) + bfont_code_mode = enc; + else + assert_msg(0, "Unknown bfont encoding mode"); } /* Set the foreground color and return the old color */ @@ -58,7 +62,9 @@ uint32 bfont_set_background_color(uint32 c) { return rv; } -/* Set the font to draw in 32 or 16 bit mode */ +/* Set the font to draw in 32 or 16 bit mode. + Deprecated: This will only impact compat functions for now. + Moving forward, the compat will be 16bit only. */ int bfont_set_32bit_mode(int on) { int rv = bfont_32bit; bfont_32bit = !!on; @@ -79,9 +85,8 @@ __asm__(" .text\n" "syscall_b4:\n" " .long 0x8c0000b4\n"); - /* Shift-JIS -> JIS conversion */ -unsigned int sjis2jis(unsigned int sjis) { +uint32 sjis2jis(uint32 sjis) { unsigned int hib, lob; hib = (sjis >> 8) & 0xff; @@ -103,34 +108,31 @@ unsigned int sjis2jis(unsigned int sjis) { /* EUC -> JIS conversion */ -unsigned int euc2jis(unsigned int euc) { +uint32 euc2jis(uint32 euc) { return euc & ~0x8080; } /* Given an ASCII character, find it in the BIOS font if possible */ -uint8 *bfont_find_char(int ch) { - int index = -1; +uint8 *bfont_find_char(uint32 ch) { uint8 *fa = get_font_address(); + /* By default, map to a space */ + uint32 index = 72 << 2; /* 33-126 in ASCII are 1-94 in the font */ if(ch >= 33 && ch <= 126) index = ch - 32; /* 160-255 in ASCII are 96-161 in the font */ - if(ch >= 160 && ch <= 255) + else if(ch >= 160 && ch <= 255) index = ch - (160 - 96); - /* Map anything else to a space */ - if(index == -1) - index = 72 << 2; - - return fa + index * 36; + return fa + index * (BFONT_THIN_WIDTH*BFONT_HEIGHT/8); } /* JIS -> (kuten) -> address conversion */ -uint8 *bfont_find_char_jp(int ch) { +uint8 *bfont_find_char_jp(uint32 ch) { uint8 *fa = get_font_address(); - int ku, ten, kuten = 0; + uint32 ku, ten, kuten = 0; /* Do the requested code conversion */ switch(bfont_code_mode) { @@ -156,205 +158,136 @@ uint8 *bfont_find_char_jp(int ch) { kuten = (ku - 0x21) * 94 + ten - 0x21; } - return fa + (kuten + 144) * 72; + return fa + (kuten + 144) * (BFONT_WIDE_WIDTH*BFONT_HEIGHT/8); } /* Half-width kana -> address conversion */ -uint8 *bfont_find_char_jp_half(int ch) { +uint8 *bfont_find_char_jp_half(uint32 ch) { uint8 *fa = get_font_address(); - return fa + (32 + ch) * 36; + return fa + (32 + ch) * (BFONT_THIN_WIDTH*BFONT_HEIGHT/8); } -/* Draw half-width kana */ -void bfont_draw_thin(void *b, int bufwidth, int opaque, int c, int iskana) { - uint8 *ch; - uint16 word; - int x, y; - - if(iskana) - ch = bfont_find_char_jp_half(c); - else - ch = bfont_find_char(c); - - if(!bfont_32bit) { - uint16 *buffer = (uint16 *)b; - - for(y = 0; y < 24;) { - /* Do the first row */ - word = (((uint16)ch[0]) << 4) | ((ch[1] >> 4) & 0x0f); - - for(x = 0; x < 12; x++) { - if(word & (0x0800 >> x)) - *buffer = bfont_fgcolor; - else { - if(opaque) - *buffer = bfont_bgcolor; - } - - buffer++; +/* Draws one half-width row of a character to an output buffer of bit depth in bits per pixel */ +uint16 *bfont_draw_one_row(uint16 *b, uint16 word, uint8 opaque, uint32 fg, uint32 bg, uint8 bpp) { + uint8 x; + uint32 color = 0x0000; + uint16 write16 = 0x0000; + uint16 oldcolor = *b; + + if ((bpp == 4)||(bpp == 8)) { + /* For 4 or 8bpp we have to go 2 or 4 pixels at a time to properly write out in all cases. */ + uint8 bMask = (bpp==4) ? 0xf : 0xff; + uint8 pix = 16/bpp; + for(x = 0; x < BFONT_THIN_WIDTH; x++) { + if(x%pix == 0) { + oldcolor = *b; + write16 = 0x0000; } - - buffer += bufwidth - 12; - y++; - - /* Do the second row */ - word = ((((uint16)ch[1]) << 8) & 0xf00) | ch[2]; - - for(x = 0; x < 12; x++) { - if(word & (0x0800 >> x)) - *buffer = bfont_fgcolor; - else { - if(opaque) - *buffer = bfont_bgcolor; - } - - buffer++; + + if(word & (0x0800 >> x)) write16 |= fg<<(bpp*(x%pix)); + else { + if(opaque) write16 |= bg<<(bpp*(x%pix)); + else write16 |= oldcolor&(bMask<<(bpp*(x%pix))); } - - buffer += bufwidth - 12; - y++; - - ch += 3; - } + if(x%pix == (pix-1)) *b++ = write16; + } } - else { - uint32 *buffer = (uint32 *)b; - - for(y = 0; y < 24;) { - /* Do the first row */ - word = (((uint16)ch[0]) << 4) | ((ch[1] >> 4) & 0x0f); - - for(x = 0; x < 12; x++) { - if(word & (0x0800 >> x)) - *buffer = bfont_fgcolor; - else { - if(opaque) - *buffer = bfont_bgcolor; - } - - buffer++; - } - - buffer += bufwidth - 12; - y++; - - /* Do the second row */ - word = ((((uint16)ch[1]) << 8) & 0xf00) | ch[2]; - - for(x = 0; x < 12; x++) { - if(word & (0x0800 >> x)) - *buffer = bfont_fgcolor; - else { - if(opaque) - *buffer = bfont_bgcolor; - } - - buffer++; + else {/* 16 or 32 */ + + for(x = 0; x < BFONT_THIN_WIDTH; x++, b++) { + if(word & (0x0800 >> x)) + color = fg; + else { + if(opaque) color = bg; + else continue; } - - buffer += bufwidth - 12; - y++; - - ch += 3; + if(bpp==16) *b = color & 0xffff; + else if(bpp == 32) {*(uint32 *)b = color; b++;} } } + + return b; } -/* Compat function */ -void bfont_draw(void *buffer, int bufwidth, int opaque, int c) { - bfont_draw_thin(buffer, bufwidth, opaque, c, 0); -} - -/* Draw wide character */ -void bfont_draw_wide(void *b, int bufwidth, int opaque, int c) { - uint8 *ch = bfont_find_char_jp(c); - uint16 word; - int x, y; - - if(!bfont_32bit) { - uint16 *buffer = (uint16 *)b; - - for(y = 0; y < 24;) { - /* Do the first row */ - word = (((uint16)ch[0]) << 4) | ((ch[1] >> 4) & 0x0f); - - for(x = 0; x < 12; x++) { - if(word & (0x0800 >> x)) - *buffer = bfont_fgcolor; - else { - if(opaque) - *buffer = bfont_bgcolor; - } - - buffer++; - } - - word = ((((uint16)ch[1]) << 8) & 0xf00) | ch[2]; - - for(x = 0; x < 12; x++) { - if(word & (0x0800 >> x)) - *buffer = bfont_fgcolor; - else { - if(opaque) - *buffer = bfont_bgcolor; - } - - buffer++; - } - - buffer += bufwidth - 24; - y++; - - ch += 3; - } +unsigned char bfont_draw_ex(uint8 *buffer, uint32 bufwidth, uint32 fg, uint32 bg, uint8 bpp, uint8 opaque, uint32 c, uint8 wide, uint8 iskana) { + uint8 *ch; + uint16 word; + uint8 y; + + /* If they're requesting a wide char and in the wrong format, kick this out */ + if (wide && (bfont_code_mode == BFONT_CODE_ISO8859_1)) { + dbglog(DBG_ERROR, "bfont_draw_ex: can't draw wide in bfont mode %d\n", bfont_code_mode); + return 0; } + + /* Just making sure we can draw the character we want to */ + if (bufwidth < (uint32)(BFONT_THIN_WIDTH*(wide+1))) { + dbglog(DBG_ERROR, "bfont_draw_ex: buffer is too small to draw into\n"); + return 0; + } + + /* Translate the character */ + if (bfont_code_mode == BFONT_CODE_RAW) + ch = get_font_address() + c; + else if (wide && ((bfont_code_mode == BFONT_CODE_EUC) || (bfont_code_mode == BFONT_CODE_SJIS))) + ch = bfont_find_char_jp(c); else { - uint32 *buffer = (uint32 *)b; - - for(y = 0; y < 24;) { - /* Do the first row */ - word = (((uint16)ch[0]) << 4) | ((ch[1] >> 4) & 0x0f); - - for(x = 0; x < 12; x++) { - if(word & (0x0800 >> x)) - *buffer = bfont_fgcolor; - else { - if(opaque) - *buffer = bfont_bgcolor; - } - - buffer++; - } - - word = ((((uint16)ch[1]) << 8) & 0xf00) | ch[2]; - - for(x = 0; x < 12; x++) { - if(word & (0x0800 >> x)) - *buffer = bfont_fgcolor; - else { - if(opaque) - *buffer = bfont_bgcolor; - } - - buffer++; - } + if(iskana) + ch = bfont_find_char_jp_half(c); + else + ch = bfont_find_char(c); + } + + /* Increment over the height of the font. 3bytes at a time (2 thin or 1 wide row) */ + for(y = 0; y < BFONT_HEIGHT; y+= (2-wide),ch+=((BFONT_THIN_WIDTH*2)/8)) { + /* Do the first row, or half row */ + word = (((uint16)ch[0]) << 4) | ((ch[1] >> 4) & 0x0f); + buffer = (uint8*)bfont_draw_one_row((uint16*)buffer, word, opaque, fg, bg, bpp); + + /* If we're thin, increment to next row, otherwise continue the row */ + if(!wide) buffer += ((bufwidth - BFONT_THIN_WIDTH)*bpp)/8; + + /* Do the second row, or second half */ + word = ((((uint16)ch[1]) << 8) & 0xf00) | ch[2]; + + buffer = (uint8*)bfont_draw_one_row((uint16*)buffer, word, opaque, fg, bg, bpp); + + /* Increment to the next row. */ + if(!wide) buffer += ((bufwidth - BFONT_THIN_WIDTH)*bpp)/8; + else buffer += ((bufwidth - BFONT_WIDE_WIDTH)*bpp)/8; + } + + /* Return the horizontal distance covered in bytes */ + if (wide) + return (BFONT_WIDE_WIDTH*bpp)/8; + else + return (BFONT_THIN_WIDTH*bpp)/8; +} - buffer += bufwidth - 24; - y++; +/* Draw half-width kana */ +unsigned char bfont_draw_thin(void *b, uint32 bufwidth, uint8 opaque, uint32 c, uint8 iskana) { + return bfont_draw_ex((uint8 *)b, bufwidth, bfont_fgcolor, bfont_bgcolor, (bfont_32bit ? (sizeof (uint32)) : (sizeof (uint16))) << 3, opaque, c, 0, iskana); +} - ch += 3; - } - } +/* Compat function */ +unsigned char bfont_draw(void *buffer, uint32 bufwidth, uint8 opaque, uint32 c) { + return bfont_draw_ex((uint8 *)buffer, bufwidth, bfont_fgcolor, bfont_bgcolor, (bfont_32bit ? (sizeof (uint32)) : (sizeof (uint16))) << 3, opaque, c, 0, 0); } +/* Draw wide character */ +unsigned char bfont_draw_wide(void *b, uint32 bufwidth, uint8 opaque, uint32 c) { + return bfont_draw_ex((uint8 *)b, bufwidth, bfont_fgcolor, bfont_bgcolor, (bfont_32bit ? (sizeof (uint32)) : (sizeof (uint16))) << 3, opaque, c, 1, 0); +} /* Draw string of full-width (wide) and half-width (thin) characters Note that this handles the case of mixed encodings unless Japanese - support is disabled (BFONT_CODE_ISO8859_1). */ -void bfont_draw_str(void *b, int width, int opaque, char *str) { - uint16 nChr, nMask, nFlag; - int adv = bfont_32bit ? 48 : 24; /* Amount to advance, in bytes */ + support is disabled (BFONT_CODE_ISO8859_1). + XXX: Seems like this can be shrunk to use uint8 for nChr/Mask/Flag and + getting rid of nMask. + */ +void bfont_draw_str_ex(void *b, uint32 width, uint32 fg, uint32 bg, uint8 bpp, uint8 opaque, char *str) { + uint16 nChr, nMask, nFlag; uint8 *buffer = (uint8 *)b; while(*str) { @@ -390,20 +323,19 @@ void bfont_draw_str(void *b, int width, int opaque, char *str) { if(nFlag == 1) { str++; nChr = (nChr << 8) | (*str & 0xff); - bfont_draw_wide(buffer, width, opaque, nChr); - buffer += adv + adv; - } - else { - bfont_draw_thin(buffer, width, opaque, nChr, 1); - buffer += adv; + buffer += bfont_draw_ex(buffer, width, fg, bg, bpp, opaque, nChr, 1, 0); } + else + buffer += bfont_draw_ex(buffer, width, fg, bg, bpp, opaque, nChr, 0, 1); } - else { - bfont_draw_thin(buffer, width, opaque, nChr, 0); - buffer += adv; - } + else + buffer += bfont_draw_ex(buffer, width, fg, bg, bpp, opaque, nChr, 0, 0); str++; } } +void bfont_draw_str(void *b, uint32 width, uint8 opaque, char *str) { + bfont_draw_str_ex(b, width, bfont_fgcolor, bfont_bgcolor, (bfont_32bit ? (sizeof (uint32)) : (sizeof (uint16))) << 3, opaque, str); +} + diff --git a/kernel/arch/dreamcast/include/dc/biosfont.h b/kernel/arch/dreamcast/include/dc/biosfont.h index 7e92a10..043fb09 100644 --- a/kernel/arch/dreamcast/include/dc/biosfont.h +++ b/kernel/arch/dreamcast/include/dc/biosfont.h @@ -3,6 +3,7 @@ dc/biosfont.h (c)2000-2001 Dan Potter Japanese Functions (c)2002 Kazuaki Matsumoto + (c)2017 Donald Haase */ @@ -15,6 +16,7 @@ \author Dan Potter \author Kazuaki Matsumoto + \author Donald Haase */ #ifndef __DC_BIOSFONT_H @@ -25,6 +27,60 @@ __BEGIN_DECLS #include <arch/types.h> +/** \defgroup bfont_size Dimensions of the Bios Font + @{ +*/ +#define BFONT_THIN_WIDTH 12 /**< \brief Width of Thin Font (ISO8859_1, half-JP) */ +#define BFONT_WIDE_WIDTH BFONT_THIN_WIDTH * 2 /**< \brief Width of Wide Font (full-JP) */ +#define BFONT_HEIGHT 24 /**< \brief Height of All Fonts */ +/** @} */ + +#define JISX_0208_ROW_SIZE 94 +/** \defgroup bfont_indecies Structure of the Bios Font + @{ +*/ +#define BFONT_NARROW_START 0 /**< \brief Start of Narrow Characters in Font Block */ ...<truncated>... hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2018-10-18 14:10:37
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 11d4192b41935feead6c079cf3f81a6c1b4e41ea (commit) from 82447a3bae32e3c3ae2cb39e533f37ce161e8ced (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 11d4192b41935feead6c079cf3f81a6c1b4e41ea Author: Gerrit Pannek <nold@gnu.one> Date: Sun Oct 7 13:52:38 2018 +0200 Fix: make_banner.sh - fallback if 'git describe' fails ----------------------------------------------------------------------- Summary of changes: kernel/arch/dreamcast/kernel/make_banner.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/arch/dreamcast/kernel/make_banner.sh b/kernel/arch/dreamcast/kernel/make_banner.sh index 1b26d9a..248a12f 100755 --- a/kernel/arch/dreamcast/kernel/make_banner.sh +++ b/kernel/arch/dreamcast/kernel/make_banner.sh @@ -10,7 +10,7 @@ relver='##version##' printf '"KallistiOS ' >> banner.h if [ -d "$KOS_BASE/.git" ]; then printf 'Git revision ' >> banner.h - gitrev=`git describe --dirty` + gitrev=`git describe --dirty --always` printf "$gitrev" >> banner.h printf ':\\n"\n' >> banner.h else hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2018-09-18 16:45:37
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 82447a3bae32e3c3ae2cb39e533f37ce161e8ced (commit) from dd6425c529e0a04ead6357f6500aba7aa097710a (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 82447a3bae32e3c3ae2cb39e533f37ce161e8ced Author: Lawrence Sebald <ljs...@us...> Date: Tue Sep 18 12:44:25 2018 -0400 Clean up the environ script and some definitions within the code that may break with potential updated toolchain tools. ----------------------------------------------------------------------- Summary of changes: environ_base.sh | 12 ++++++------ include/kos/cdefs.h | 32 ++++++++++++++++++++++++-------- kernel/fs/fs_ramdisk.c | 2 +- kernel/libc/koslib/realpath.c | 4 ++-- 4 files changed, 33 insertions(+), 17 deletions(-) diff --git a/environ_base.sh b/environ_base.sh index ff2bcfe..8d7378d 100644 --- a/environ_base.sh +++ b/environ_base.sh @@ -42,18 +42,18 @@ export KOS_CPPSTD="-std=gnu++98" export KOS_GCCVER="`kos-cc -dumpversion`" case $KOS_GCCVER in - 4*) - export KOS_LDFLAGS="${KOS_LDFLAGS} ${KOS_LD_SCRIPT} -nodefaultlibs ${KOS_LIB_PATHS}" ;; - *) + 2* | 3*) export KOS_LDFLAGS="${KOS_LDFLAGS} -nostartfiles -nostdlib ${KOS_LIB_PATHS}" ;; + *) + export KOS_LDFLAGS="${KOS_LDFLAGS} ${KOS_LD_SCRIPT} -nodefaultlibs ${KOS_LIB_PATHS}" ;; esac # Some extra vars based on architecture export KOS_ARCH_DIR="${KOS_BASE}/kernel/arch/${KOS_ARCH}" case $KOS_GCCVER in - 4*) - export KOS_START="" ;; - *) + 2* | 3*) export KOS_START="${KOS_ARCH_DIR}/kernel/startup.o" ;; + *) + export KOS_START="" ;; esac diff --git a/include/kos/cdefs.h b/include/kos/cdefs.h index 9b4259d..01e173e 100644 --- a/include/kos/cdefs.h +++ b/include/kos/cdefs.h @@ -21,39 +21,50 @@ #include <sys/cdefs.h> /* Check GCC version */ -#ifndef _arch_ps2 -# if __GNUC__ < 2 -# warning Your GCC is too old. This will probably not work right. -# endif +#if __GNUC__ < 2 +# warning Your GCC is too old. This will probably not work right. +#endif -# if __GNUC__ == 2 && __GNUC_MINOR__ < 97 -# warning Your GCC is too old. This will probably not work right. -# endif -#endif /* _arch_ps2 */ +#if __GNUC__ == 2 && __GNUC_MINOR__ < 97 +# warning Your GCC is too old. This will probably not work right. +#endif /* Special function/variable attributes */ +#ifndef __noreturn /** \brief Identify a function that will never return. */ #define __noreturn __attribute__((__noreturn__)) +#endif +#ifndef __pure /** \brief Identify a function that has no side effects other than its return, and only uses its arguments for any work. */ #define __pure __attribute__((__const__)) +#endif +#ifndef __unused /** \brief Identify a function or variable that may be unused. */ #define __unused __attribute__((__unused__)) +#endif +#ifndef __dead2 /** \brief Alias for \ref __noreturn. For BSD compatibility. */ #define __dead2 __noreturn /* BSD compat */ +#endif +#ifndef __pure2 /** \brief Alias for \ref __pure. For BSD compatibility. */ #define __pure2 __pure /* ditto */ +#endif +#ifndef __deprecated /** \brief Mark something as deprecated. This should be used to warn users that a function/type/etc will be removed in a future version of KOS. */ #define __deprecated __attribute__((deprecated)) +#endif +#ifndef __depr /** \brief Mark something as deprecated, with an informative message. This should be used to warn users that a function/type/etc will be removed in a future version of KOS and to suggest an alternative that they can use @@ -61,8 +72,10 @@ \param m A string literal that is included with the warning message at compile time. */ #define __depr(m) __attribute__((deprecated(m))) +#endif /* Printf/Scanf-like declaration */ +#ifndef __printflike /** \brief Identify a function as accepting formatting like printf(). Using this macro allows GCC to typecheck calls to printf-like functions, @@ -73,7 +86,9 @@ */ #define __printflike(fmtarg, firstvararg) \ __attribute__((__format__ (__printf__, fmtarg, firstvararg))) +#endif +#ifndef __scanflike /** \brief Identify a function as accepting formatting like scanf(). Using this macro allows GCC to typecheck calls to scanf-like functions, @@ -84,6 +99,7 @@ */ #define __scanflike(fmtarg, firstvararg) \ __attribute__((__format__ (__scanf__, fmtarg, firstvararg))) +#endif /* GCC macros for special cases */ /* #if __GNUC__ == */ diff --git a/kernel/fs/fs_ramdisk.c b/kernel/fs/fs_ramdisk.c index 0d5d891..eb6d18c 100644 --- a/kernel/fs/fs_ramdisk.c +++ b/kernel/fs/fs_ramdisk.c @@ -46,7 +46,7 @@ cache data from disk rather than as a general purpose file system. /* Newlib doesn't prototype this function in strict standards compliant mode, so we'll do it here. It is still provided either way, but it isn't prototyped if we use -std=c99 (or any other non-gnuXX value). */ -char *_EXFUN(strdup,(const char *)); +char *strdup(const char *); #endif /* File definition */ diff --git a/kernel/libc/koslib/realpath.c b/kernel/libc/koslib/realpath.c index caabd4d..0a4ab96 100644 --- a/kernel/libc/koslib/realpath.c +++ b/kernel/libc/koslib/realpath.c @@ -43,8 +43,8 @@ /* Newlib doesn't prototype these two functions in strict standards compliant mode, so we'll do it here. They're still provided either way, but they're not prototyped if we use -std=c99 (or any other non-gnuXX value). */ -size_t _EXFUN(strlcat,(char *, const char *, size_t)); -size_t _EXFUN(strlcpy,(char *, const char *, size_t)); +size_t strlcat(char *, const char *, size_t); +size_t strlcpy(char *, const char *, size_t); #endif /* hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2018-09-18 16:17:52
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via dd6425c529e0a04ead6357f6500aba7aa097710a (commit) from b03dd965b2dec35de2cd04b96c133e81c95ac789 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit dd6425c529e0a04ead6357f6500aba7aa097710a Author: Lawrence Sebald <ljs...@us...> Date: Tue Sep 18 12:17:28 2018 -0400 Update binutils version to 2.31.1 in dc-chain. ----------------------------------------------------------------------- Summary of changes: utils/dc-chain/Makefile | 4 +--- utils/dc-chain/cleanup.sh | 4 ++-- utils/dc-chain/download.sh | 6 +++--- utils/dc-chain/unpack.sh | 8 ++++---- 4 files changed, 10 insertions(+), 12 deletions(-) diff --git a/utils/dc-chain/Makefile b/utils/dc-chain/Makefile index 39ba7f2..ac0dddc 100644 --- a/utils/dc-chain/Makefile +++ b/utils/dc-chain/Makefile @@ -28,7 +28,7 @@ arm_prefix := /opt/toolchains/dc/$(arm_target) kos_root=$(CURDIR)/../../.. # kos_base: equivalent of KOS_BASE (contains include/ and kernel/) kos_base=$(CURDIR)/../.. -binutils_ver=2.27 +binutils_ver=2.31.1 gcc_ver=4.7.3 newlib_ver=2.0.0 gdb_ver=7.11.1 @@ -148,8 +148,6 @@ $(build_binutils): src_dir = binutils-$(binutils_ver) $(build_binutils): log = $(logdir)/$(build).log $(build_binutils): logdir @echo "+++ Building $(src_dir) to $(build)..." - sed -e 's/ @colophon/ @@colophon/' -e 's/do...@cy.../doc@@cygnus.com/' $(src_dir)/bfd/doc/bfd.texinfo > $(src_dir)/bfd/doc/bfd.texinfo2 - mv $(src_dir)/bfd/doc/bfd.texinfo2 $(src_dir)/bfd/doc/bfd.texinfo -mkdir -p $(build) > $(log) cd $(build); ../$(src_dir)/configure --target=$(target) --prefix=$(prefix) --disable-werror CXX=$(CXX) $(to_log) diff --git a/utils/dc-chain/cleanup.sh b/utils/dc-chain/cleanup.sh index cf73a8e..71c74d9 100755 --- a/utils/dc-chain/cleanup.sh +++ b/utils/dc-chain/cleanup.sh @@ -2,7 +2,7 @@ # These version numbers are all that should ever have to be changed. export GCC_VER=4.7.3 -export BINUTILS_VER=2.27 +export BINUTILS_VER=2.31.1 export NEWLIB_VER=2.0.0 export GMP_VER=4.3.2 export MPFR_VER=2.4.2 @@ -35,7 +35,7 @@ done # Clean up downloaded tarballs... echo "Deleting downloaded packages..." -rm -f binutils-$BINUTILS_VER.tar.bz2 +rm -f binutils-$BINUTILS_VER.tar.xz rm -f gcc-$GCC_VER.tar.bz2 rm -f newlib-$NEWLIB_VER.tar.gz diff --git a/utils/dc-chain/download.sh b/utils/dc-chain/download.sh index 67f17b5..d96b28f 100755 --- a/utils/dc-chain/download.sh +++ b/utils/dc-chain/download.sh @@ -2,7 +2,7 @@ # These version numbers are all that should ever have to be changed. export GCC_VER=4.7.3 -export BINUTILS_VER=2.27 +export BINUTILS_VER=2.31.1 export NEWLIB_VER=2.0.0 export GMP_VER=4.3.2 export MPFR_VER=2.4.2 @@ -36,7 +36,7 @@ done # Download everything. if command -v wget >/dev/null 2>&1; then echo "Downloading binutils-$BINUTILS_VER..." - wget -c ftp://ftp.gnu.org/gnu/binutils/binutils-$BINUTILS_VER.tar.bz2 || exit 1 + wget -c ftp://ftp.gnu.org/gnu/binutils/binutils-$BINUTILS_VER.tar.xz || exit 1 echo "Downloading GCC $GCC_VER..." wget -c ftp://ftp.gnu.org/gnu/gcc/gcc-$GCC_VER/gcc-$GCC_VER.tar.bz2 || exit 1 echo "Downloading Newlib $NEWLIB_VER..." @@ -58,7 +58,7 @@ if command -v wget >/dev/null 2>&1; then fi elif command -v curl >/dev/null 2>&1; then echo "Downloading Binutils $BINUTILS_VER..." - curl -C - -O ftp://ftp.gnu.org/gnu/binutils/binutils-$BINUTILS_VER.tar.bz2 || exit 1 + curl -C - -O ftp://ftp.gnu.org/gnu/binutils/binutils-$BINUTILS_VER.tar.xz || exit 1 echo "Downloading GCC $GCC_VER..." curl -C - -O ftp://ftp.gnu.org/gnu/gcc/gcc-$GCC_VER/gcc-$GCC_VER.tar.bz2 || exit 1 echo "Downloading Newlib $NEWLIB_VER..." diff --git a/utils/dc-chain/unpack.sh b/utils/dc-chain/unpack.sh index 25d39f9..8a6b25e 100755 --- a/utils/dc-chain/unpack.sh +++ b/utils/dc-chain/unpack.sh @@ -2,7 +2,7 @@ # These version numbers are all that should ever have to be changed. export GCC_VER=4.7.3 -export BINUTILS_VER=2.27 +export BINUTILS_VER=2.31.1 export NEWLIB_VER=2.0.0 export GMP_VER=4.3.2 export MPFR_VER=2.4.2 @@ -38,9 +38,9 @@ rm -rf binutils-$BINUTILS_VER gcc-$GCC_VER newlib-$NEWLIB_VER rm -rf gmp-$GMP_VER mpfr-$MPFR_VER mpc-$MPC_VER # Unpack everything. -tar jxf binutils-$BINUTILS_VER.tar.bz2 || exit 1 -tar jxf gcc-$GCC_VER.tar.bz2 || exit 1 -tar zxf newlib-$NEWLIB_VER.tar.gz || exit 1 +tar xf binutils-$BINUTILS_VER.tar.xz || exit 1 +tar xf gcc-$GCC_VER.tar.bz2 || exit 1 +tar xf newlib-$NEWLIB_VER.tar.gz || exit 1 # Unpack the GCC dependencies and move them into their required locations. if [ -n "$GMP_VER" ]; then hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2018-09-13 12:36:04
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via b03dd965b2dec35de2cd04b96c133e81c95ac789 (commit) from 123a7c30f75419b4710ad5ed976547f7db32b739 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit b03dd965b2dec35de2cd04b96c133e81c95ac789 Author: Lawrence Sebald <ljs...@us...> Date: Thu Sep 13 08:35:33 2018 -0400 Fix the banner generation script. ----------------------------------------------------------------------- Summary of changes: kernel/arch/dreamcast/kernel/make_banner.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/kernel/arch/dreamcast/kernel/make_banner.sh b/kernel/arch/dreamcast/kernel/make_banner.sh index c79ad9e..1b26d9a 100755 --- a/kernel/arch/dreamcast/kernel/make_banner.sh +++ b/kernel/arch/dreamcast/kernel/make_banner.sh @@ -12,10 +12,10 @@ if [ -d "$KOS_BASE/.git" ]; then printf 'Git revision ' >> banner.h gitrev=`git describe --dirty` printf "$gitrev" >> banner.h - printf ':\\n\"\n' >> banner.h + printf ':\\n"\n' >> banner.h else printf "$relver" >> banner.h - printf ':\\n\"\n' >> banner.h + printf ':\\n"\n' >> banner.h fi printf '" ' >> banner.h @@ -44,7 +44,7 @@ printf ';\n' >> banner.h printf 'static const char kern_version[] = \n"' >> banner.h -if [ "$gitrev" == "" ]; then +if [ -n "$gitrev" ]; then printf "$relver" >> banner.h else printf "${gitrev#?}" >> banner.h hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2018-09-04 22:07:19
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 123a7c30f75419b4710ad5ed976547f7db32b739 (commit) from f475e44de2a1e28ac298abdb713d4e253b02dc6c (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 123a7c30f75419b4710ad5ed976547f7db32b739 Author: Lawrence Sebald <ljs...@us...> Date: Tue Sep 4 18:06:31 2018 -0400 Remove --broken flag from the banner generation for git revisions. ----------------------------------------------------------------------- Summary of changes: doc/CHANGELOG | 1 + kernel/arch/dreamcast/kernel/make_banner.sh | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/CHANGELOG b/doc/CHANGELOG index cda3dbe..d35789f 100644 --- a/doc/CHANGELOG +++ b/doc/CHANGELOG @@ -95,6 +95,7 @@ KallistiOS version 2.1.0 ----------------------------------------------- attached [Joe Fenton = JF] - DC Fixed the clobber list of several matrix-related assembly blobs. Thanks to kazade at DCEmulation for pointing out the issue [LS] +- *** Added the uname() function to retrieve the current kernel version [LS] KallistiOS version 2.0.0 ----------------------------------------------- - DC Broadband Adapter driver fixes [Dan Potter == DP] diff --git a/kernel/arch/dreamcast/kernel/make_banner.sh b/kernel/arch/dreamcast/kernel/make_banner.sh index 9b2479d..c79ad9e 100755 --- a/kernel/arch/dreamcast/kernel/make_banner.sh +++ b/kernel/arch/dreamcast/kernel/make_banner.sh @@ -10,7 +10,7 @@ relver='##version##' printf '"KallistiOS ' >> banner.h if [ -d "$KOS_BASE/.git" ]; then printf 'Git revision ' >> banner.h - gitrev=`git describe --dirty --broken` + gitrev=`git describe --dirty` printf "$gitrev" >> banner.h printf ':\\n\"\n' >> banner.h else hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2018-08-31 22:47:00
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via f475e44de2a1e28ac298abdb713d4e253b02dc6c (commit) from 90b4e4334958d169cf484ec4a596f43e9c98f24a (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit f475e44de2a1e28ac298abdb713d4e253b02dc6c Author: Lawrence Sebald <ljs...@us...> Date: Fri Aug 31 18:46:35 2018 -0400 Need to clean these two files up each build to ensure they're always re-built. ----------------------------------------------------------------------- Summary of changes: kernel/arch/dreamcast/kernel/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/arch/dreamcast/kernel/Makefile b/kernel/arch/dreamcast/kernel/Makefile index 1e73140..14c4245 100644 --- a/kernel/arch/dreamcast/kernel/Makefile +++ b/kernel/arch/dreamcast/kernel/Makefile @@ -20,7 +20,7 @@ SUBDIRS = myall: $(OBJS) -cp $(COPYOBJS) $(KOS_BASE)/kernel/build/ - -rm banner.h authors.h + -rm banner.h authors.h banner.o uname.o include $(KOS_BASE)/Makefile.prefab hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2018-08-31 22:34:11
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 90b4e4334958d169cf484ec4a596f43e9c98f24a (commit) from 832ea65b43c8b402f19f3b6b3ecb8804f73c948a (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 90b4e4334958d169cf484ec4a596f43e9c98f24a Author: Lawrence Sebald <ljs...@us...> Date: Fri Aug 31 18:33:26 2018 -0400 Add uname function to query the current version string. ----------------------------------------------------------------------- Summary of changes: include/sys/utsname.h | 54 +++++++++++++++++++++++++++++ kernel/arch/dreamcast/kernel/Makefile | 11 ++++-- kernel/arch/dreamcast/kernel/make_banner.sh | 22 ++++++++++-- kernel/arch/dreamcast/kernel/uname.c | 31 +++++++++++++++++ 4 files changed, 112 insertions(+), 6 deletions(-) create mode 100644 include/sys/utsname.h create mode 100644 kernel/arch/dreamcast/kernel/uname.c diff --git a/include/sys/utsname.h b/include/sys/utsname.h new file mode 100644 index 0000000..d874003 --- /dev/null +++ b/include/sys/utsname.h @@ -0,0 +1,54 @@ +/* KallistiOS ##version## + + sys/utsname.h + Copyright (C) 2018 Lawrence Sebald + +*/ + +/** \file utsname.h + \brief Definitions for the uname() function. + + This file contains the definitions needed for using the uname() function, + as directed by the POSIX 2008 standard (aka The Open Group Base + Specifications Issue 7). + + \author Lawrence Sebald +*/ + +#ifndef __SYS_UTSNAME_H +#define __SYS_UTSNAME_H + +#include <sys/cdefs.h> + +__BEGIN_DECLS + +#define _UTSNAME_LENGTH 64 + +/** \brief Kernel name/information structure. + + This structure contains information about the kernel and is used by the + uname() function for returning that information to a program. + + \headerfile sys/utsname.h + */ +struct utsname { + char sysname[_UTSNAME_LENGTH]; /**< \brief OS Name ("KallistiOS"). */ + char nodename[_UTSNAME_LENGTH]; /**< \brief Name on network, if any. */ + char release[_UTSNAME_LENGTH]; /**< \brief Kernel release ("2.1.0"). */ + char version[_UTSNAME_LENGTH]; /**< \brief Kernel version string. */ + char machine[_UTSNAME_LENGTH]; /**< \brief Hardware identifier. */ +}; + +/** \brief Retrieve version and other similar information about the kernel. + + This function retrieves information about the current version of the kernel + that is running, storing it in the provided buffer. + + \param n The buffer to store version information in. + \return 0 on success, -1 on error (setting errno appropriately). +*/ +int uname(struct utsname *n); + +__END_DECLS + +#endif /* !__SYS_UTSNAME_H */ diff --git a/kernel/arch/dreamcast/kernel/Makefile b/kernel/arch/dreamcast/kernel/Makefile index c813216..1e73140 100644 --- a/kernel/arch/dreamcast/kernel/Makefile +++ b/kernel/arch/dreamcast/kernel/Makefile @@ -14,20 +14,25 @@ COPYOBJS += rtc.o timer.o COPYOBJS += init_flags_default.o init_romdisk_default.o COPYOBJS += mmu.o itlb.o COPYOBJS += exec.o execasm.o stack.o gdb_stub.o thdswitch.o arch_exports.o +COPYOBJS += uname.o OBJS = $(COPYOBJS) startup.o -SUBDIRS = +SUBDIRS = myall: $(OBJS) -cp $(COPYOBJS) $(KOS_BASE)/kernel/build/ - -rm banner.h banner.o authors.h + -rm banner.h authors.h include $(KOS_BASE)/Makefile.prefab +uname.o: uname.c + +uname.c: banner.h + banner.o: banner.c banner.c: banner.h authors.h -banner.h: make_banner.sh +banner.h: make_banner.sh ./make_banner.sh authors.h: make_authors.awk diff --git a/kernel/arch/dreamcast/kernel/make_banner.sh b/kernel/arch/dreamcast/kernel/make_banner.sh index 35dd72d..9b2479d 100755 --- a/kernel/arch/dreamcast/kernel/make_banner.sh +++ b/kernel/arch/dreamcast/kernel/make_banner.sh @@ -4,15 +4,21 @@ printf 'static const char banner[] = \n' > banner.h +gitrev='' +relver='##version##' + printf '"KallistiOS ' >> banner.h if [ -d "$KOS_BASE/.git" ]; then printf 'Git revision ' >> banner.h - printf `git rev-list --full-history --all --abbrev-commit | head -1` >> banner.h - printf ': ' >> banner.h + gitrev=`git describe --dirty --broken` + printf "$gitrev" >> banner.h + printf ':\\n\"\n' >> banner.h else - printf '##version##: ' >> banner.h + printf "$relver" >> banner.h + printf ':\\n\"\n' >> banner.h fi +printf '" ' >> banner.h tmp=`date` printf "$tmp" >> banner.h printf '\\n"\n' >> banner.h @@ -35,3 +41,13 @@ printf "$KOS_BASE" >> banner.h printf '\\n"\n' >> banner.h printf ';\n' >> banner.h + +printf 'static const char kern_version[] = \n"' >> banner.h + +if [ "$gitrev" == "" ]; then + printf "$relver" >> banner.h +else + printf "${gitrev#?}" >> banner.h +fi + +printf '";\n' >> banner.h diff --git a/kernel/arch/dreamcast/kernel/uname.c b/kernel/arch/dreamcast/kernel/uname.c new file mode 100644 index 0000000..aa0ef75 --- /dev/null +++ b/kernel/arch/dreamcast/kernel/uname.c @@ -0,0 +1,31 @@ +/* KallistiOS ##version## + + uname.c + Copyright (C) 2018 Lawrence Sebald + +*/ + +#include <errno.h> +#include <stdio.h> +#include <string.h> +#include <sys/utsname.h> + +#include "banner.h" + +#define UNAME_KERNEL "KallistiOS" +#define UNAME_MACHINE "Dreamcast" + +int uname(struct utsname *n) { + if(!n) { + errno = EFAULT; + return -1; + } + + memset(n, 0, sizeof(struct utsname)); + strcpy(n->sysname, UNAME_KERNEL); + strcpy(n->release, kern_version); + snprintf(n->version, 64, "%s %s", UNAME_KERNEL, kern_version); + strcpy(n->machine, UNAME_MACHINE); + + return 0; +} hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2018-05-17 03:37:51
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 832ea65b43c8b402f19f3b6b3ecb8804f73c948a (commit) from a84fe5eded5e0406acbadb92c96ae546964a588b (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 832ea65b43c8b402f19f3b6b3ecb8804f73c948a Author: Lawrence Sebald <ljs...@us...> Date: Wed May 16 23:36:58 2018 -0400 Fix the clobber list of several of the matrix math macros. Thanks to kazade at DCEmulation for pointing out the issue. ----------------------------------------------------------------------- Summary of changes: AUTHORS | 2 +- doc/CHANGELOG | 2 ++ kernel/arch/dreamcast/include/dc/matrix.h | 26 ++++++++++++++++---------- kernel/arch/dreamcast/kernel/banner.c | 2 +- 4 files changed, 20 insertions(+), 12 deletions(-) diff --git a/AUTHORS b/AUTHORS index 3101f38..08eb927 100644 --- a/AUTHORS +++ b/AUTHORS @@ -22,7 +22,7 @@ please see the README.KOS file in the doc directory. Contributors list (under the normal KOS license): ------------------------------------------------- Dan Potter: 1997, 2000, 2001, 2002, 2003, 2004 -Lawrence Sebald: 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017 +Lawrence Sebald: 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018 Sam Steele: 2004 Gil Megidish: 2002 Florian Schulze: 2002 diff --git a/doc/CHANGELOG b/doc/CHANGELOG index 6c945b3..cda3dbe 100644 --- a/doc/CHANGELOG +++ b/doc/CHANGELOG @@ -93,6 +93,8 @@ KallistiOS version 2.1.0 ----------------------------------------------- as it should be to ensure GCC doesn't mess with it any [LS] - DC Copy function data from maple device during hot-swap poll if already attached [Joe Fenton = JF] +- DC Fixed the clobber list of several matrix-related assembly blobs. Thanks to + kazade at DCEmulation for pointing out the issue [LS] KallistiOS version 2.0.0 ----------------------------------------------- - DC Broadband Adapter driver fixes [Dan Potter == DP] diff --git a/kernel/arch/dreamcast/include/dc/matrix.h b/kernel/arch/dreamcast/include/dc/matrix.h index 57285ff..7a1d8c1 100644 --- a/kernel/arch/dreamcast/include/dc/matrix.h +++ b/kernel/arch/dreamcast/include/dc/matrix.h @@ -3,6 +3,7 @@ dc/matrix.h Copyright (C) 2000 Dan Potter Copyright (C) 2013, 2014 Josh "PH3NOM" Pearson + Copyright (C) 2018 Lawrence Sebald */ @@ -220,7 +221,8 @@ void mat_transform_sq(void *input, void *output, int veccnt); "fldi1 fr15\n" \ "ftrv xmtrx, fv12\n" \ : "=f" (__x), "=f" (__y), "=f" (__z) \ - : "0" (__x), "1" (__y), "2" (__z) ); \ + : "0" (__x), "1" (__y), "2" (__z) \ + : "fr15" ); \ x = __x; y = __y; z = __z; \ } @@ -281,7 +283,8 @@ void mat_transform_sq(void *input, void *output, int veccnt); "fldi1 fr15\n" \ "ftrv xmtrx, fv12\n" \ : "=f" (__x), "=f" (__y), "=f" (__z) \ - : "0" (__x), "1" (__y), "2" (__z) ); \ + : "0" (__x), "1" (__y), "2" (__z) \ + : "fr15" ); \ x2 = __x; y2 = __y; z2 = __z; \ } @@ -303,12 +306,11 @@ void mat_transform_sq(void *input, void *output, int veccnt); register float __x __asm__("fr12") = (x); \ register float __y __asm__("fr13") = (y); \ register float __z __asm__("fr14") = (z); \ - register float __w __asm__("fr15"); \ + register float __w __asm__("fr15") = 1.0f; \ __asm__ __volatile__( \ - "fldi1 fr15\n" \ "ftrv xmtrx, fv12\n" \ - : "=f" (__x), "=f" (__y), "=f" (__z) \ - : "0" (__x), "1" (__y), "2" (__z) ); \ + : "=f" (__x), "=f" (__y), "=f" (__z), "=f" (__w) \ + : "0" (__x), "1" (__y), "2" (__z), "3" (__w) ); \ x = __x; y = __y; z = __z; w = __w; \ } @@ -351,8 +353,10 @@ void mat_transform_sq(void *input, void *output, int veccnt); "fdiv fr7, fr6\n" \ "fmul fr6, fr4\n" \ "fmul fr6, fr5\n" \ - : "=f" (__x), "=f" (__y), "=f" (__z) \ - : "0" (__x), "1" (__y), "2" (__z) ); \ + : "=f" (__x), "=f" (__y), "=f" (__z), \ + "=f" (__xd), "=f" (__yd), "=f" (__zd) \ + : "0" (__x), "1" (__y), "2" (__z) \ + : "fr3" ); \ x = __x; y = __y; z = __z; xd = __xd; yd = __yd; zd = __zd; \ } @@ -376,7 +380,8 @@ void mat_transform_sq(void *input, void *output, int veccnt); "fldi0 fr11\n" \ "ftrv xmtrx, fv8\n" \ : "=f" (__x), "=f" (__y), "=f" (__z) \ - : "0" (__x), "1" (__y), "2" (__z) ); \ + : "0" (__x), "1" (__y), "2" (__z) \ + : "fr11" ); \ x = __x; y = __y; z = __z; \ } @@ -403,7 +408,8 @@ void mat_transform_sq(void *input, void *output, int veccnt); "fldi0 fr11\n" \ "ftrv xmtrx, fv8\n" \ : "=f" (__x), "=f" (__y), "=f" (__z) \ - : "0" (__x), "1" (__y), "2" (__z) ); \ + : "0" (__x), "1" (__y), "2" (__z) \ + : "fr11" ); \ x2 = __x; y2 = __y; z2 = __z; \ } diff --git a/kernel/arch/dreamcast/kernel/banner.c b/kernel/arch/dreamcast/kernel/banner.c index 2843462..b1e1850 100644 --- a/kernel/arch/dreamcast/kernel/banner.c +++ b/kernel/arch/dreamcast/kernel/banner.c @@ -8,7 +8,7 @@ #include "authors.h" static const char license[] = -"Copyright (C) 1997-2015 KallistiOS Contributors. All rights reserved.\n" +"Copyright (C) 1997-2018 KallistiOS Contributors. All rights reserved.\n" "\n" "Redistribution and use in source and binary forms, with or without\n" "modification, are permitted provided that the following conditions\n" hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@sf...> - 2018-03-05 03:51:16
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via a84fe5eded5e0406acbadb92c96ae546964a588b (commit) from e92de2996feff8a68a7cd6d25be472efb84e3852 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit a84fe5eded5e0406acbadb92c96ae546964a588b Author: Lawrence Sebald <ljs...@us...> Date: Sun Mar 4 22:50:26 2018 -0500 Update some comments in the <dc/flashrom.h> ----------------------------------------------------------------------- Summary of changes: kernel/arch/dreamcast/include/dc/flashrom.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/kernel/arch/dreamcast/include/dc/flashrom.h b/kernel/arch/dreamcast/include/dc/flashrom.h index f035f54..16598c9 100644 --- a/kernel/arch/dreamcast/include/dc/flashrom.h +++ b/kernel/arch/dreamcast/include/dc/flashrom.h @@ -13,10 +13,8 @@ utilities to make it easier to use the flashrom info. Note that because the flash writing can be such a dangerous thing potentially (I haven't deleted my flash to see what happens, but given the info stored here it sounds like - a Bad Idea(tm)) the syscalls for the WRITE and DELETE operations are not - enabled by default. If you are 100% sure you really want to be writing to - the flash and you know what you're doing, then you can edit flashrom.c and - re-enable them there. + a Bad Idea(tm)), extreme care should be taken if you choose to use these + functions! \author Dan Potter \author Lawrence Sebald @@ -133,7 +131,10 @@ int flashrom_write(int offset, void * buffer, int bytes); offset, that entire partition of the flashrom will be deleted and all data will be reset to 0xFF bytes. - \param offset The partition to erase. + \note This does not rewrite the magic block to the start of the partition. + It is your responsibility to do this after running this function. + + \param offset The offset of the start of the partition to erase. \retval 0 On success. \retval -1 On error. */ hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2017-12-29 22:39:13
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via e92de2996feff8a68a7cd6d25be472efb84e3852 (commit) from 198f072630df60b4629d91352867460d9be026bd (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit e92de2996feff8a68a7cd6d25be472efb84e3852 Author: Lawrence Sebald <ljs...@us...> Date: Fri Dec 29 17:37:14 2017 -0500 Remove unneeded instruction from _arch_exec_template that probably screwed up the CCR setting a bit. Thanks to MetalliC at DCEmulation for pointing out the issue (see this thread: https://dcemulation.org/phpBB/viewtopic.php?f=29&t=104466 ). ----------------------------------------------------------------------- Summary of changes: kernel/arch/dreamcast/kernel/execasm.s | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/kernel/arch/dreamcast/kernel/execasm.s b/kernel/arch/dreamcast/kernel/execasm.s index 107c573..3ba261f 100644 --- a/kernel/arch/dreamcast/kernel/execasm.s +++ b/kernel/arch/dreamcast/kernel/execasm.s @@ -1,7 +1,7 @@ ! KallistiOS ##version## ! ! arch/dreamcast/kernel/execasm.s -! (c)2002 Dan Potter +! Copyright (C) 2002 Dan Potter ! ! This is the assembler code on which exec.c bases its trampoline. ! @@ -15,9 +15,8 @@ __arch_exec_template: mov.l .ccraddr,r0 ! Disable/invalidate cache mov.l .ccrdata,r1 - mov.l @r1,r1 mov.l r1,@r0 - + mov.l .srcval,r0 ! Get src/dst pointers mov.l .dstval,r1 mov.l .count,r2 ! Get uint32 count hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2017-05-23 13:12:32
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The KallistiOS port of OpenGL.". The branch, master has been updated via a1185f3369895df4b29cd476e4a53e70b53d7a4e (commit) from c960b24f07d3982c47b7c8555050f1e76a735b2d (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit a1185f3369895df4b29cd476e4a53e70b53d7a4e Author: Lawrence Sebald <ljs...@us...> Date: Tue May 23 09:11:52 2017 -0400 glIsEnabled(GL_CULL_FACE) should return the status of culling, not fog. ----------------------------------------------------------------------- Summary of changes: gl-cap.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/gl-cap.c b/gl-cap.c index af4ac60..d479f99 100644 --- a/gl-cap.c +++ b/gl-cap.c @@ -9,9 +9,6 @@ #include "gl.h" #include "gl-api.h" -#include <malloc.h> -#include <stdio.h> - //===============================================================================// //== Enable Bit Flags ==// @@ -128,7 +125,7 @@ GLboolean APIENTRY glIsEnabled(GLenum cap) { return _glKosEnabledScissorTest() ? GL_TRUE : GL_FALSE; case GL_CULL_FACE: - return _glKosEnabledFog() ? GL_TRUE : GL_FALSE; + return _glKosEnabledCulling() ? GL_TRUE : GL_FALSE; case GL_FOG: return _glKosEnabledFog() ? GL_TRUE : GL_FALSE; hooks/post-receive -- The KallistiOS port of OpenGL. |
From: Lawrence S. <ljs...@us...> - 2017-03-12 02:49:02
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 198f072630df60b4629d91352867460d9be026bd (commit) from 1c5450162ebb7b7a4f24fbf8cb0ee408b587171c (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 198f072630df60b4629d91352867460d9be026bd Author: Lawrence Sebald <ljs...@us...> Date: Sat Mar 11 21:48:48 2017 -0500 Update the ARM driver. ----------------------------------------------------------------------- Summary of changes: kernel/arch/dreamcast/sound/arm/stream.drv | Bin 3336 -> 3332 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/kernel/arch/dreamcast/sound/arm/stream.drv b/kernel/arch/dreamcast/sound/arm/stream.drv index d5c91b5..ab87097 100755 Binary files a/kernel/arch/dreamcast/sound/arm/stream.drv and b/kernel/arch/dreamcast/sound/arm/stream.drv differ hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2017-03-12 02:45:53
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 1c5450162ebb7b7a4f24fbf8cb0ee408b587171c (commit) from 44bd3f3def622e724a90e7786a1f7e16986e0034 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 1c5450162ebb7b7a4f24fbf8cb0ee408b587171c Author: Lawrence Sebald <ljs...@us...> Date: Sat Mar 11 21:45:29 2017 -0500 Fix bin2o's use of an incorrect environment variable. ----------------------------------------------------------------------- Summary of changes: utils/bin2o/bin2o | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/utils/bin2o/bin2o b/utils/bin2o/bin2o index af5e3de..9ee444c 100755 --- a/utils/bin2o/bin2o +++ b/utils/bin2o/bin2o @@ -9,7 +9,7 @@ if [ $# != 3 ]; then exit 0 fi -for i in KOS_ARCH KOS_AS KOS_ASFLAGS KOS_LD; do +for i in KOS_ARCH KOS_AS KOS_AFLAGS KOS_LD; do if [ -z "$(eval "echo \"\$$i\"")" ]; then echo "Environment variable $i is undefined." error=1 @@ -45,4 +45,3 @@ elif [ "$KOS_ARCH" = ps2 ]; then fi rm -f /tmp/script.ld - hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: bogglez <bo...@us...> - 2017-03-10 20:45:13
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 44bd3f3def622e724a90e7786a1f7e16986e0034 (commit) from 7c3d2f03fb46a25c107466f710d2e746ec2df99c (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 44bd3f3def622e724a90e7786a1f7e16986e0034 Author: bogglez <bo...@pr...> Date: Fri Mar 10 21:44:51 2017 +0100 bin2o: shellcheck, error on missing env vars ----------------------------------------------------------------------- Summary of changes: utils/bin2o/bin2o | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/utils/bin2o/bin2o b/utils/bin2o/bin2o index 0216f61..af5e3de 100755 --- a/utils/bin2o/bin2o +++ b/utils/bin2o/bin2o @@ -5,34 +5,43 @@ # (c)2000 Dan Potter if [ $# != 3 ]; then - echo usage: $0 \<input file\> \<symbol\> \<output file\> + echo "usage: $0 \<input file\> \<symbol\> \<output file\>" exit 0 fi +for i in KOS_ARCH KOS_AS KOS_ASFLAGS KOS_LD; do + if [ -z "$(eval "echo \"\$$i\"")" ]; then + echo "Environment variable $i is undefined." + error=1 + fi +done + +if [ -n "$error" ]; then + exit 1 +fi + TMPFILE1=/tmp/script$$.ld TMPFILE2=/tmp/obja$$.o TMPFILE3=/tmp/objb$$.o # Gotta do a different binary target here depending on the target -if [ $KOS_ARCH = "dreamcast" ]; then - echo ".section .rodata; .align 2; " | $KOS_AS $KOS_AFLAGS -o $TMPFILE3 +if [ "$KOS_ARCH" = dreamcast ]; then + echo ".section .rodata; .align 2; " | "$KOS_AS" $KOS_AFLAGS -o "$TMPFILE3" if [ $? -ne 0 ]; then exit 1; fi - echo "SECTIONS { .rodata : { _$2 = .; *(.data); _$2_end = .; } }" > $TMPFILE1 - $KOS_LD --no-warn-mismatch --format binary --oformat elf32-shl $1 --format elf32-shl $TMPFILE3 -o $TMPFILE2 -r -EL -T $TMPFILE1 + echo "SECTIONS { .rodata : { _$2 = .; *(.data); _$2_end = .; } }" > "$TMPFILE1" + "$KOS_LD" --no-warn-mismatch --format binary --oformat elf32-shl "$1" --format elf32-shl "$TMPFILE3" -o "$TMPFILE2" -r -EL -T "$TMPFILE1" if [ $? -ne 0 ]; then exit 1; fi - $KOS_OBJCOPY --set-section-flags .rodata=alloc,load,data,readonly $TMPFILE2 $3 + "$KOS_OBJCOPY" --set-section-flags .rodata=alloc,load,data,readonly "$TMPFILE2" "$3" if [ $? -ne 0 ]; then exit 1; fi - rm -f $TMPFILE1 $TMPFILE2 $TMPFILE3 -fi + rm -f "$TMPFILE1" "$TMPFILE2" "$TMPFILE3" -if [ $KOS_ARCH = "gba" ]; then +elif [ "$KOS_ARCH" = gba ]; then echo "SECTIONS { .rodata : { $2 = .; *(.data); $2_end = .; } }" > /tmp/script.ld - $KOS_LD --no-warn-mismatch --format binary --oformat elf32-littlearm $1 -o $3 -r -EL -T /tmp/script.ld -fi + "$KOS_LD" --no-warn-mismatch --format binary --oformat elf32-littlearm "$1" -o "$3" -r -EL -T /tmp/script.ld -if [ $KOS_ARCH = "ps2" ]; then +elif [ "$KOS_ARCH" = ps2 ]; then echo "OUTPUT_ARCH(mips:5900) SECTIONS { .rodata : { _$2 = .; *(.data); _$2_end = .; } }" > /tmp/script.ld - $KOS_LD --no-warn-mismatch --format binary --oformat elf64-littlemips -mips3 $1 -o $3 -r -EL -T /tmp/script.ld + "$KOS_LD" --no-warn-mismatch --format binary --oformat elf64-littlemips -mips3 "$1" -o "$3" -r -EL -T /tmp/script.ld fi rm -f /tmp/script.ld hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: bogglez <bo...@us...> - 2017-03-10 17:45:30
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 7c3d2f03fb46a25c107466f710d2e746ec2df99c (commit) via 2ac08e14432b80a3007d35254a83515b30761e2d (commit) from c05fead1a9c03b70ff9511bcc080d9354d62cfda (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 7c3d2f03fb46a25c107466f710d2e746ec2df99c Author: bogglez <bo...@pr...> Date: Fri Mar 10 18:45:05 2017 +0100 README -> README.md, added a bit more info commit 2ac08e14432b80a3007d35254a83515b30761e2d Author: bogglez <bo...@pr...> Date: Fri Mar 10 18:44:32 2017 +0100 Turn another C++ comment into C ----------------------------------------------------------------------- Summary of changes: README | 3 --- README.md | 22 ++++++++++++++++++++++ utils/isotest/isotest.c | 2 +- 3 files changed, 23 insertions(+), 4 deletions(-) delete mode 100644 README create mode 100644 README.md diff --git a/README b/README deleted file mode 100644 index 169c4b4..0000000 --- a/README +++ /dev/null @@ -1,3 +0,0 @@ -For all documentation, please look in the "doc" directory. Please read AT -LEAST the main README file before trying to begin! Thanks! - diff --git a/README.md b/README.md new file mode 100644 index 0000000..4a3ac08 --- /dev/null +++ b/README.md @@ -0,0 +1,22 @@ +KOS +=== + +KOS is an unofficial development environment for the SEGA Dreamcast game console. + +It was developed from scratch over the internet by a group of free software developers, and has no relation to the old Katana or WinCE development kits for the DC. + + +Documentation +------------- + +For all documentation, please look in the *doc* directory. +Please read *at least* the main README file before trying to begin! + +You will need to set up an environment variable file, build an SH4 and ARM cross-compiler, build *KOS* and optionally *kos-ports*. + +An installation script, guide as well as programming tutorials may be found +in the wiki at http://dcemulation.org/?title=Development + +Ask for help on the forums: http://dcemulation.org/phpBB/viewforum.php?f=29 + +IRC chat: irc.freenode.net #dreamcastdev diff --git a/utils/isotest/isotest.c b/utils/isotest/isotest.c index 16963ac..b6f9dcb 100644 --- a/utils/isotest/isotest.c +++ b/utils/isotest/isotest.c @@ -748,7 +748,7 @@ int main() { printf("%s\t%d\n", de->name, de->size); if(!strcmp(de->name, "R_WAR.ZIP")) { - // what's this test for? + /* what's this test for? */ } } hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: bogglez <bo...@us...> - 2017-03-10 17:09:21
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via c05fead1a9c03b70ff9511bcc080d9354d62cfda (commit) via 9a8efc21a0bbb1d3e70d2913f48c15cbb0eb6348 (commit) via 3342f3920c878b316a52fe8acdbb962bd9da3df4 (commit) from b8155f31289146d91eb7bbe38846b50ba621abdd (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit c05fead1a9c03b70ff9511bcc080d9354d62cfda Author: bogglez <bo...@pr...> Date: Fri Mar 10 18:08:58 2017 +0100 Turn C++-style comments into C style comments (for old C std) commit 9a8efc21a0bbb1d3e70d2913f48c15cbb0eb6348 Author: bogglez <bo...@pr...> Date: Fri Mar 10 18:07:58 2017 +0100 arm: use correct int type everywhere commit 3342f3920c878b316a52fe8acdbb962bd9da3df4 Author: bogglez <bo...@pr...> Date: Fri Mar 10 18:04:49 2017 +0100 Sound: remove empty lines ----------------------------------------------------------------------- Summary of changes: kernel/arch/dreamcast/hardware/spu.c | 2 -- kernel/arch/dreamcast/sound/arm/aica.c | 25 +++++++++++++------------ kernel/arch/dreamcast/sound/arm/crt0.s | 6 ------ kernel/arch/dreamcast/sound/arm/main.c | 4 ++-- utils/bincnv/bincnv.c | 1 - utils/dcbumpgen/get_image_jpg.c | 2 +- utils/kmgenc/get_image_jpg.c | 2 +- utils/kmgenc/kmgenc.c | 8 ++++---- utils/kmgenc/kmgenc.h | 12 +++++------- utils/rdtest/rdtest.c | 1 - utils/vqenc/get_image_jpg.c | 2 +- utils/wav2adpcm/wav2adpcm.c | 4 ++-- 12 files changed, 29 insertions(+), 40 deletions(-) diff --git a/kernel/arch/dreamcast/hardware/spu.c b/kernel/arch/dreamcast/hardware/spu.c index f8555e1..dc6fb12 100644 --- a/kernel/arch/dreamcast/hardware/spu.c +++ b/kernel/arch/dreamcast/hardware/spu.c @@ -234,5 +234,3 @@ int spu_shutdown() { spu_memset(0, 0, 0x200000); return 0; } - - diff --git a/kernel/arch/dreamcast/sound/arm/aica.c b/kernel/arch/dreamcast/sound/arm/aica.c index 84428ac..2ff2ca1 100644 --- a/kernel/arch/dreamcast/sound/arm/aica.c +++ b/kernel/arch/dreamcast/sound/arm/aica.c @@ -85,17 +85,18 @@ static inline int calc_aica_pan(int x) { This routine (and the similar ones) owe a lot to Marcus' sound example -- I hadn't gotten quite this far into dissecting the individual regs yet. */ void aica_play(int ch, int delay) { - unsigned long smpptr = chans[ch].base; - int mode = chans[ch].type; - int loopst = chans[ch].loopstart; - int loopend = chans[ch].loopend; - int freq = chans[ch].freq; - int vol = chans[ch].vol; - int pan = chans[ch].pan; - int loopflag = chans[ch].loop; - unsigned long freq_lo, freq_base = 5644800; + uint32 smpptr = chans[ch].base; + uint32 mode = chans[ch].type; + uint32 loopst = chans[ch].loopstart; + uint32 loopend = chans[ch].loopend; + uint32 freq = chans[ch].freq; + uint32 vol = chans[ch].vol; + uint32 pan = chans[ch].pan; + uint32 loopflag = chans[ch].loop; + + uint32 freq_lo, freq_base = 5644800; int freq_hi = 7; - int i; + uint32 i; uint32 playCont; /* Stop the channel (if it's already playing) */ @@ -200,8 +201,8 @@ void aica_pan(int ch) { /* Set channel frequency */ void aica_freq(int ch) { - int freq = chans[ch].freq; - unsigned long freq_lo, freq_base = 5644800; + uint32 freq = chans[ch].freq; + uint32 freq_lo, freq_base = 5644800; int freq_hi = 7; while(freq < freq_base && freq_hi > -8) { diff --git a/kernel/arch/dreamcast/sound/arm/crt0.s b/kernel/arch/dreamcast/sound/arm/crt0.s index 395d917..80857b2 100644 --- a/kernel/arch/dreamcast/sound/arm/crt0.s +++ b/kernel/arch/dreamcast/sound/arm/crt0.s @@ -129,9 +129,3 @@ data_abort: irq: rsrvd: sub pc,r14,#4 - - - - - - diff --git a/kernel/arch/dreamcast/sound/arm/main.c b/kernel/arch/dreamcast/sound/arm/main.c index b9a3145..6979182 100644 --- a/kernel/arch/dreamcast/sound/arm/main.c +++ b/kernel/arch/dreamcast/sound/arm/main.c @@ -17,8 +17,8 @@ #define timer (*((volatile uint32 *)AICA_MEM_CLOCK)) -void timer_wait(int jiffies) { - int fin = timer + jiffies; +void timer_wait(uint32 jiffies) { + uint32 fin = timer + jiffies; while(timer <= fin) ; diff --git a/utils/bincnv/bincnv.c b/utils/bincnv/bincnv.c index 516bd56..4cfc92a 100644 --- a/utils/bincnv/bincnv.c +++ b/utils/bincnv/bincnv.c @@ -152,7 +152,6 @@ static int read_file_contents(char const * const filename, char **data, size_t * f = fopen(filename, "rb"); - // Read texture from file if(!f) { return 1; } diff --git a/utils/dcbumpgen/get_image_jpg.c b/utils/dcbumpgen/get_image_jpg.c index 2211187..0d53afd 100644 --- a/utils/dcbumpgen/get_image_jpg.c +++ b/utils/dcbumpgen/get_image_jpg.c @@ -101,7 +101,7 @@ int get_image_jpg(const char *filename, image_t *image) image->data[offs + i*4 + 2] = buffer[0][i*3 + 1]; image->data[offs + i*4 + 3] = buffer[0][i*3 + 2]; } - // memcpy(image->data + (cinfo.output_scanline-1) * image->stride, buffer[0], image->stride); + /* memcpy(image->data + (cinfo.output_scanline-1) * image->stride, buffer[0], image->stride); */ } /* Step 7: Finish decompression */ diff --git a/utils/kmgenc/get_image_jpg.c b/utils/kmgenc/get_image_jpg.c index 4d7379e..42f93f5 100644 --- a/utils/kmgenc/get_image_jpg.c +++ b/utils/kmgenc/get_image_jpg.c @@ -103,7 +103,7 @@ int get_image_jpg(const char *filename, image_t *image) { image->data[offs + i * 4 + 3] = buffer[0][i * 3 + 2]; } - // memcpy(image->data + (cinfo.output_scanline-1) * image->stride, buffer[0], image->stride); + /* memcpy(image->data + (cinfo.output_scanline-1) * image->stride, buffer[0], image->stride); */ } /* Step 7: Finish decompression */ diff --git a/utils/kmgenc/kmgenc.c b/utils/kmgenc/kmgenc.c index 0b0ee27..f0195ef 100644 --- a/utils/kmgenc/kmgenc.c +++ b/utils/kmgenc/kmgenc.c @@ -63,7 +63,7 @@ static void twiddle(image_t * src, uint16 * output) { int x, y, yout; for(y = 0; y < h; y++) { - // yout = ((h - 1) - y); + /* yout = ((h - 1) - y); */ yout = y; for(x = 0; x < w; x++) { @@ -177,11 +177,11 @@ static void banner(const char *progname) { printf("Usage: %s [options] image1 [image2..]\n", progname); printf("\n"); printf("Options:\n"); - // printf("\t-t, --twiddle\tcreate twiddled textures\n"); - // printf("\t-m, --mipmap\tcreate mipmapped textures (EXPERIMENTAL)\n"); + /* printf("\t-t, --twiddle\tcreate twiddled textures\n"); */ + /* printf("\t-m, --mipmap\tcreate mipmapped textures (EXPERIMENTAL)\n"); */ printf("\t-v, --verbose\tverbose\n"); printf("\t-d, --debug\tshow debug information\n"); - // printf("\t-q, --highq\thigher quality (much slower)\n"); + /* printf("\t-q, --highq\thigher quality (much slower)\n"); */ printf("\t-a4, --argb4444\tuse alpha channel (and output ARGB4444)\n"); printf("\t-a1, --argb1555\tuse alpha channel (and output ARGB1555)\n"); } diff --git a/utils/kmgenc/kmgenc.h b/utils/kmgenc/kmgenc.h index 8724d3b..1db6571 100644 --- a/utils/kmgenc/kmgenc.h +++ b/utils/kmgenc/kmgenc.h @@ -1,7 +1,6 @@ #ifndef __KMGENC_H #define __KMGENC_H -// Some useful global headers #include <stdio.h> #include <fcntl.h> #include <stdlib.h> @@ -10,11 +9,10 @@ #include <unistd.h> #include <errno.h> -// For outputting KMG files +/* For outputting KMG files */ #define NEED_KOS_TYPES #include "kmg.h" -// A single color value typedef struct fcolor { float a; float r; @@ -22,7 +20,7 @@ typedef struct fcolor { float b; } fcolor_t; -// A few useful macros for color manipulation + #define PACK4444(a, r, g, b) ( \ ( (((int)((a)*15))) << 12) | \ ( (((int)((r)*15))) << 8) | \ @@ -62,7 +60,7 @@ static inline void get_fcolor_32(fcolor_t *c, uint8 *pixels) { c->b = pixels[3] / 255.0f; } -// Endian fixing +/* Endian fixing */ static int is_le = -1; static inline int le_detect() { @@ -100,8 +98,8 @@ static inline int le32(int x) { ((val >> 24) & 0x000000ff); } -// Internal includes +/* Internal includes */ #include "get_image.h" -#endif // __KMGENC_H +#endif diff --git a/utils/rdtest/rdtest.c b/utils/rdtest/rdtest.c index 549ac97..ce74a00 100644 --- a/utils/rdtest/rdtest.c +++ b/utils/rdtest/rdtest.c @@ -464,7 +464,6 @@ static int read_file_contents(char const * const filename, char **data, size_t * f = fopen(filename, "rb"); - // Read texture from file if(!f) { return 1; } diff --git a/utils/vqenc/get_image_jpg.c b/utils/vqenc/get_image_jpg.c index 4d7379e..42f93f5 100644 --- a/utils/vqenc/get_image_jpg.c +++ b/utils/vqenc/get_image_jpg.c @@ -103,7 +103,7 @@ int get_image_jpg(const char *filename, image_t *image) { image->data[offs + i * 4 + 3] = buffer[0][i * 3 + 2]; } - // memcpy(image->data + (cinfo.output_scanline-1) * image->stride, buffer[0], image->stride); + /* memcpy(image->data + (cinfo.output_scanline-1) * image->stride, buffer[0], image->stride); */ } /* Step 7: Finish decompression */ diff --git a/utils/wav2adpcm/wav2adpcm.c b/utils/wav2adpcm/wav2adpcm.c index 02e5a5f..5bafd9b 100644 --- a/utils/wav2adpcm/wav2adpcm.c +++ b/utils/wav2adpcm/wav2adpcm.c @@ -26,7 +26,7 @@ static int diff_lookup[16] = { static int index_scale[16] = { 0x0e6, 0x0e6, 0x0e6, 0x0e6, 0x133, 0x199, 0x200, 0x266, - 0x0e6, 0x0e6, 0x0e6, 0x0e6, 0x133, 0x199, 0x200, 0x266 //same value for speedup + 0x0e6, 0x0e6, 0x0e6, 0x0e6, 0x133, 0x199, 0x200, 0x266 /* same value for speedup */ }; static inline int limit(int val, int min, int max) { @@ -40,7 +40,7 @@ void pcm2adpcm(unsigned char *dst, const short *src, size_t length) { signal = 0; step = 0x7f; - // length/=4; + /* length /= 4; */ length = (length + 3) / 4; do { hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2017-03-10 04:35:16
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via b8155f31289146d91eb7bbe38846b50ba621abdd (commit) via 35676807c3f05eb601547f961ed3c4954cf32882 (commit) from e7f452c1498a2453d6ed0a07e1dff988ed4b2fe0 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit b8155f31289146d91eb7bbe38846b50ba621abdd Merge: 3567680 e7f452c Author: Lawrence Sebald <ljs...@us...> Date: Thu Mar 9 23:34:43 2017 -0500 Merge branch 'master' of ssh://git.code.sf.net/p/cadcdev/kallistios commit 35676807c3f05eb601547f961ed3c4954cf32882 Author: Lawrence Sebald <ljs...@us...> Date: Thu Mar 2 11:07:12 2017 -0500 Fix a typo... ----------------------------------------------------------------------- Summary of changes: include/kos/cond.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/kos/cond.h b/include/kos/cond.h index 0b4c1cb..24ae2b2 100644 --- a/include/kos/cond.h +++ b/include/kos/cond.h @@ -14,7 +14,7 @@ Basically, things work as follows (for the thread doing work): \li The associated mutex is locked. - \li A predicate is checked to see if its safe to do something. + \li A predicate is checked to see if it is safe to do something. \li If it is not safe, you call cond_wait(), which releases the mutex. \li When cond_wait() returns, the mutex is reaquired, and work can go on. \li Update any predicates so that we konw that the work is done, and unlock hooks/post-receive -- A pseudo Operating System for the Dreamcast. |