From: quzar <qu...@us...> - 2024-09-17 02:19: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 b14b8d0a8f9d9949277637894be77958c4126f0a (commit) via 35e5abd1dc778fb45364275d9d629a71a2b1c856 (commit) via 63b9b9637bd67af8702b40eb0c5389d4f9c21e50 (commit) via 73f9d0ee9faad816bceb2d76fad185808f53cbb2 (commit) via 51e5ffb2a4cdeaf04c119bd133124b26c716f172 (commit) via 2a32b2151a48e051ad091923145f001f4d411c8b (commit) via 30fc866daabd75ed216220a223bb9c0ae9ab9365 (commit) via d8417b4a9a2d3a130f023a8b321190f474436078 (commit) via 86165fbb8d94f083d23437bf86abb697948f119b (commit) via ce249f9a3d72a38b999550065e1c22a00366a74d (commit) via 8a240ed9d9066088a7216ccc11e27425ce141b14 (commit) via 089b5b315e35e9df84ad04f783913d57f4485797 (commit) via bab7e8890ada902608afd34613b988bb34cfed17 (commit) via 06011e1bf40adda17f271741eab65d606a923f95 (commit) via bf189670e954d9036b772d66c823a9f4b6c93c6f (commit) via bab4b3c363b4dc8e84ccb120467f0026df64062b (commit) via e8a3a8539e6fed103cc65e7dd46671e865e25a44 (commit) via 3acda030702cf823712851b296b7591899d8faee (commit) via dccd296d9cfa6fdc396f6c1472518e87216b68cb (commit) via 161ab3fcd7608fb9ff5a0f695c9ed19bc8534122 (commit) from 01555798061d1fbb552dfef251989b2e0555c472 (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 b14b8d0a8f9d9949277637894be77958c4126f0a Merge: 63b9b963 35e5abd1 Author: Donald Haase <qu...@ya...> Date: Mon Sep 16 22:18:48 2024 -0400 Merge pull request #637 from pcercuei/irqsafe Add IRQ-safe mutex / rwsem functions, and scoped mutexes commit 35e5abd1dc778fb45364275d9d629a71a2b1c856 Merge: ce249f9a 63b9b963 Author: Donald Haase <qu...@ya...> Date: Mon Sep 16 22:16:15 2024 -0400 Merge branch 'master' into irqsafe commit 63b9b9637bd67af8702b40eb0c5389d4f9c21e50 Merge: 73f9d0ee 2a32b215 Author: Luke Benstead <ka...@gm...> Date: Sat Sep 7 18:23:00 2024 +0100 Merge pull request #741 from skmp/fixed_aica_lut aica: Fix the volume LUT commit 73f9d0ee9faad816bceb2d76fad185808f53cbb2 Merge: 01555798 51e5ffb2 Author: Luke Benstead <ka...@gm...> Date: Sat Sep 7 18:15:47 2024 +0100 Merge pull request #742 from skmp/aica_channel_shifts aica: Channel masks are 64 bits, use ULL consts commit 51e5ffb2a4cdeaf04c119bd133124b26c716f172 Author: Stefanos Kornilios Mitsis Poiitidis <sk...@ni...> Date: Sat Sep 7 19:25:08 2024 +0300 aica: Channel masks are 64 bits, use ULL consts commit 2a32b2151a48e051ad091923145f001f4d411c8b Author: Stefanos Kornilios Mitsis Poiitidis <sk...@ni...> Date: Sat Sep 7 10:57:23 2024 +0300 aica: remove not required masking from log lookup commit 30fc866daabd75ed216220a223bb9c0ae9ab9365 Author: Stefanos Kornilios Mitsis Poiitidis <sk...@ni...> Date: Sat Sep 7 10:35:17 2024 +0300 Add prebuilt driver commit d8417b4a9a2d3a130f023a8b321190f474436078 Author: Stefanos Kornilios Mitsis Poiitidis <st...@sk...v> Date: Sat Sep 7 10:25:42 2024 +0300 Apply suggestions from code review Co-authored-by: Andy Barajas <and...@gm...> commit 86165fbb8d94f083d23437bf86abb697948f119b Author: Stefanos Kornilios Mitsis Poiitidis <sk...@ni...> Date: Fri Sep 6 18:35:12 2024 +0300 aica: Fix the volume LUT commit ce249f9a3d72a38b999550065e1c22a00366a74d Author: Paul Cercueil <pa...@cr...> Date: Wed Jun 19 20:30:48 2024 +0200 fs: socket: Use mutex_lock_irqsafe() / mutex_lock_scoped() Factorize code by using the new mutex functions and macros. Signed-off-by: Paul Cercueil <pa...@cr...> commit 8a240ed9d9066088a7216ccc11e27425ce141b14 Author: Paul Cercueil <pa...@cr...> Date: Wed Jun 19 20:28:32 2024 +0200 fs: pty: Use mutex_lock_scoped() / mutex_lock_irqsafe() Factorize code by using the new mutex functions and macros. Signed-off-by: Paul Cercueil <pa...@cr...> commit 089b5b315e35e9df84ad04f783913d57f4485797 Author: Paul Cercueil <pa...@cr...> Date: Wed Jun 19 16:31:04 2024 +0200 fs: ramdisk: Use mutex_lock_scoped() Use mutex_lock_scoped() instead of mutex_lock() + mutex_unlock(). Signed-off-by: Paul Cercueil <pa...@cr...> commit bab7e8890ada902608afd34613b988bb34cfed17 Author: Paul Cercueil <pa...@cr...> Date: Wed Jun 19 19:29:19 2024 +0200 fs: dclsocket: Use mutex_lock_irqsafe() Factorize code by using the new mutex function. Signed-off-by: Paul Cercueil <pa...@cr...> commit 06011e1bf40adda17f271741eab65d606a923f95 Author: Paul Cercueil <pa...@cr...> Date: Wed Jun 19 20:32:20 2024 +0200 libc: poll: Use mutex_lock_irqsafe() Factorize code by using the new mutex function. Signed-off-by: Paul Cercueil <pa...@cr...> commit bf189670e954d9036b772d66c823a9f4b6c93c6f Author: Paul Cercueil <pa...@cr...> Date: Wed Jun 19 20:31:29 2024 +0200 exports: Use mutex_lock_irqsafe_scoped() Factorize code by using the new mutex macros. Signed-off-by: Paul Cercueil <pa...@cr...> commit bab4b3c363b4dc8e84ccb120467f0026df64062b Author: Paul Cercueil <pa...@cr...> Date: Wed Jun 19 20:25:36 2024 +0200 cdrom: Use mutex_lock_scoped() / mutex_lock_irqsafe() Factorize code by using the new mutex functions and macros. Signed-off-by: Paul Cercueil <pa...@cr...> commit e8a3a8539e6fed103cc65e7dd46671e865e25a44 Author: Paul Cercueil <pa...@cr...> Date: Wed Jun 19 15:45:24 2024 +0200 net: Use irqsafe mutex/rwmem variants and factorize code - Use irqsafe variants for locking mutexes and semaphores, which translates to the exact same code - Factorize the "lock rwsem, get socket structure, lock socket structure" code Signed-off-by: Paul Cercueil <pa...@cr...> commit 3acda030702cf823712851b296b7591899d8faee Author: Paul Cercueil <pa...@cr...> Date: Wed Jun 19 15:41:41 2024 +0200 rwsem: Add rwsem_write_lock_irqsafe() / rwsem_read_lock_irqsafe() These functions can be from within an interrupt context. In that case, if the semaphore is already locked, an error will be returned. Signed-off-by: Paul Cercueil <pa...@cr...> commit dccd296d9cfa6fdc396f6c1472518e87216b68cb Author: Paul Cercueil <pa...@cr...> Date: Wed Jun 19 16:29:27 2024 +0200 mutex: Add mutex_lock_scoped() This macro will lock a mutex, similarly to mutex_lock, with the difference being that the mutex will automatically be unlocked once the execution exits the functional block in which this macro was called. Signed-off-by: Paul Cercueil <pa...@cr...> commit 161ab3fcd7608fb9ff5a0f695c9ed19bc8534122 Author: Paul Cercueil <pa...@cr...> Date: Wed Jun 19 15:39:24 2024 +0200 mutex: Add mutex_lock_irqsafe() This function can be from within an interrupt context. In that case, if the mutex is already locked, an error will be returned. Signed-off-by: Paul Cercueil <pa...@cr...> ----------------------------------------------------------------------- Summary of changes: include/kos/mutex.h | 45 ++ include/kos/rwsem.h | 42 +- kernel/arch/dreamcast/fs/fs_dclsocket.c | 107 +---- kernel/arch/dreamcast/hardware/cdrom.c | 27 +- kernel/arch/dreamcast/sound/arm/aica.c | 52 +-- .../arch/dreamcast/sound/arm/stream.drv.prebuilt | Bin 3244 -> 3228 bytes kernel/arch/dreamcast/sound/snd_sfxmgr.c | 11 +- kernel/arch/dreamcast/sound/snd_stream.c | 7 +- kernel/exports/nmmgr.c | 6 +- kernel/fs/fs_pty.c | 26 +- kernel/fs/fs_ramdisk.c | 109 ++--- kernel/fs/fs_socket.c | 76 +--- kernel/libc/koslib/poll.c | 22 +- kernel/net/net_dhcp.c | 14 +- kernel/net/net_ipv4_frag.c | 15 +- kernel/net/net_multicast.c | 31 +- kernel/net/net_tcp.c | 459 ++++----------------- kernel/net/net_udp.c | 141 ++----- kernel/thread/mutex.c | 7 + kernel/thread/rwsem.c | 14 + 20 files changed, 353 insertions(+), 858 deletions(-) diff --git a/include/kos/mutex.h b/include/kos/mutex.h index 34094d09..67729b65 100644 --- a/include/kos/mutex.h +++ b/include/kos/mutex.h @@ -167,6 +167,29 @@ int mutex_destroy(mutex_t *m); */ int mutex_lock(mutex_t *m); +/** \brief Lock a mutex. + + This function will lock a mutex, if it is not already locked by another + thread. If it is locked by another thread already, this function will block + until the mutex has been acquired for the calling thread. + This function can be called from within an interrupt context. In that case, + if the mutex is already locked, an error will be returned. + + The semantics of this function depend on the type of mutex that is used. + + \param m The mutex to acquire + \retval 0 On success + \retval -1 On error, sets errno as appropriate + + \par Error Conditions: + \em EINVAL - the mutex has not been initialized properly \n + \em EAGAIN - lock has been acquired too many times (recursive), or the + function was called inside an interrupt and the mutex was + already locked \n + \em EDEADLK - would deadlock (error-checking) +*/ +int mutex_lock_irqsafe(mutex_t *m); + /** \brief Lock a mutex (with a timeout). This function will attempt to lock a mutex. If the lock can be acquired @@ -255,6 +278,28 @@ int mutex_unlock(mutex_t *m); */ int mutex_unlock_as_thread(mutex_t *m, kthread_t *thd); +/** \cond */ +static inline void __mutex_scoped_cleanup(mutex_t **m) { + if(*m) + mutex_unlock(*m); +} + +#define ___mutex_lock_scoped(m, l) \ + mutex_t *__scoped_mutex_##l __attribute__((cleanup(__mutex_scoped_cleanup))) = mutex_lock(m) ? NULL : (m) + +#define __mutex_lock_scoped(m, l) ___mutex_lock_scoped(m, l) +/** \endcond */ + +/** \brief Lock a mutex with scope management + + This macro will lock a mutex, similarly to mutex_lock, with the difference + that the mutex will automatically be unlocked once the execution exits the + functional block in which the macro was called. + + \param m The mutex to acquire +*/ +#define mutex_lock_scoped(m) __mutex_lock_scoped((m), __LINE__) + __END_DECLS #endif /* __KOS_MUTEX_H */ diff --git a/include/kos/rwsem.h b/include/kos/rwsem.h index ed3a1945..ad2a05d2 100644 --- a/include/kos/rwsem.h +++ b/include/kos/rwsem.h @@ -121,7 +121,7 @@ int rwsem_read_lock_timed(rw_semaphore_t *s, int timeout); This function attempts to lock the r/w semaphore for reading. If the semaphore is locked for writing, this function will block until it is possible to obtain the lock for reading. This function is <b>NOT</b> safe to - call inside of an interrupt. + call inside of an interrupt; use rwsem_read_lock_irqsafe instead. \param s The r/w semaphore to lock. \retval 0 On success @@ -133,6 +133,25 @@ int rwsem_read_lock_timed(rw_semaphore_t *s, int timeout); */ int rwsem_read_lock(rw_semaphore_t *s); +/** \brief Lock a reader/writer semaphore for reading. + + This function attempts to lock the r/w semaphore for reading. If the + semaphore is locked for writing, this function will block until it is + possible to obtain the lock for reading. + If called within an interrupt context, and the semaphore is already locked, + this function will return an error. + + \param s The r/w semaphore to lock. + \retval 0 On success + \retval -1 On error, errno will be set as appropriate. + + \par Error Conditions: + \em EINVAL - the semaphore is not initialized \n + \em EWOULDBLOCK - called inside an interrupt and the semaphore was + already locked +*/ +int rwsem_read_lock_irqsafe(rw_semaphore_t *s); + /** \brief Lock a reader/writer semaphore for writing (with a timeout). This function attempts to lock the r/w semaphore for writing. If the @@ -158,7 +177,7 @@ int rwsem_write_lock_timed(rw_semaphore_t *s, int timeout); This function attempts to lock the r/w semaphore for writing. If the semaphore is locked for reading or writing, this function will block until it is possible to obtain the lock for writing. This function is <b>NOT</b> - safe to call inside of an interrupt. + safe to call inside of an interrupt; use rwsem_write_lock_irqsafe instead. \param s The r/w semaphore to lock. \retval 0 On success. @@ -170,6 +189,25 @@ int rwsem_write_lock_timed(rw_semaphore_t *s, int timeout); */ int rwsem_write_lock(rw_semaphore_t *s); +/** \brief Lock a reader/writer semaphore for writing. + + This function attempts to lock the r/w semaphore for writing. If the + semaphore is locked for reading or writing, this function will block until + it is possible to obtain the lock for writing. + If called within an interrupt context, and the semaphore is already locked, + this function will return an error. + + \param s The r/w semaphore to lock. + \retval 0 On success. + \retval -1 On error, errno will be set as appropriate. + + \par Error conditions: + \em EINVAL - the semaphore is not initialized \n + \em EWOULDBLOCK - called inside an interrupt and the semaphore was + already locked +*/ +int rwsem_write_lock_irqsafe(rw_semaphore_t *s); + /** \brief Unlock a reader/writer semaphore from a read lock. This function releases one instance of the read lock on the r/w semaphore. diff --git a/kernel/arch/dreamcast/fs/fs_dclsocket.c b/kernel/arch/dreamcast/fs/fs_dclsocket.c index a965d39c..e3365424 100644 --- a/kernel/arch/dreamcast/fs/fs_dclsocket.c +++ b/kernel/arch/dreamcast/fs/fs_dclsocket.c @@ -206,22 +206,14 @@ static void dcls_recv_loop(void) { } static void *dcls_open(struct vfs_handler *vfs, const char *fn, int mode) { - int hnd, locked; - int dcload_mode = 0; + int hnd, dcload_mode = 0; int mm = (mode & O_MODE_MASK); command_t *cmd = (command_t *)pktbuf; (void)vfs; - locked = mutex_trylock(&mutex); - - if(locked == -1 && irq_inside_int()) { - errno = EAGAIN; - return 0; - } - else if(locked == -1) { - mutex_lock(&mutex); - } + if(mutex_lock_irqsafe(&mutex)) + return NULL; if(mode & O_DIR) { char realfn[fn[0] ? strlen(fn) + 1 : 2]; @@ -286,18 +278,11 @@ static void *dcls_open(struct vfs_handler *vfs, const char *fn, int mode) { } static int dcls_close(void *hnd) { - int fd = (int) hnd, locked; + int fd = (int) hnd; command_int_t *cmd = (command_int_t *)pktbuf; - locked = mutex_trylock(&mutex); - - if(locked == -1 && irq_inside_int()) { - errno = EAGAIN; + if(mutex_lock_irqsafe(&mutex)) return -1; - } - else if(locked == -1) { - mutex_lock(&mutex); - } if(fd > 100) { memcpy(cmd->id, "DC17", 4); @@ -322,21 +307,13 @@ static int dcls_close(void *hnd) { static ssize_t dcls_read(void *hnd, void *buf, size_t cnt) { uint32 fd = (uint32) hnd; - int locked; command_3int_t *cmd = (command_3int_t *)pktbuf; if(!fd) return -1; - locked = mutex_trylock(&mutex); - - if(locked == -1 && irq_inside_int()) { - errno = EAGAIN; + if(mutex_lock_irqsafe(&mutex)) return -1; - } - else if(locked == -1) { - mutex_lock(&mutex); - } --fd; @@ -355,21 +332,13 @@ static ssize_t dcls_read(void *hnd, void *buf, size_t cnt) { static ssize_t dcls_write(void *hnd, const void *buf, size_t cnt) { uint32 fd = (uint32) hnd; - int locked; command_3int_t *cmd = (command_3int_t *)pktbuf; if(!fd) return -1; - locked = mutex_trylock(&mutex); - - if(locked == -1 && irq_inside_int()) { - errno = EAGAIN; + if(mutex_lock_irqsafe(&mutex)) return -1; - } - else if(locked == -1) { - mutex_lock(&mutex); - } --fd; @@ -388,21 +357,13 @@ static ssize_t dcls_write(void *hnd, const void *buf, size_t cnt) { static off_t dcls_seek(void *hnd, off_t offset, int whence) { uint32 fd = (uint32)hnd; - int locked; command_3int_t *command = (command_3int_t *)pktbuf; if(!hnd) return -1; - locked = mutex_trylock(&mutex); - - if(locked == -1 && irq_inside_int()) { - errno = EAGAIN; + if(mutex_lock_irqsafe(&mutex)) return -1; - } - else if(locked == -1) { - mutex_lock(&mutex); - } --fd; @@ -437,7 +398,6 @@ static dirent_t their_dir; static dcload_dirent_t our_dir; static dirent_t *dcls_readdir(void *hnd) { - int locked; uint32 fd = (uint32) hnd; command_3int_t *cmd = (command_3int_t *)pktbuf; @@ -446,15 +406,8 @@ static dirent_t *dcls_readdir(void *hnd) { return NULL; } - locked = mutex_trylock(&mutex); - - if(locked == -1 && irq_inside_int()) { - errno = EAGAIN; + if(mutex_lock_irqsafe(&mutex)) return NULL; - } - else if(locked == -1) { - mutex_lock(&mutex); - } memcpy(cmd->id, "DC18", 4); cmd->value0 = htonl(fd); @@ -507,19 +460,12 @@ static dirent_t *dcls_readdir(void *hnd) { } static int dcls_rename(vfs_handler_t *vfs, const char *fn1, const char *fn2) { - int len1 = strlen(fn1), len2 = strlen(fn2), locked; + int len1 = strlen(fn1), len2 = strlen(fn2); (void)vfs; - locked = mutex_trylock(&mutex); - - if(locked == -1 && irq_inside_int()) { - errno = EAGAIN; + if(mutex_lock_irqsafe(&mutex)) return -1; - } - else if(locked == -1) { - mutex_lock(&mutex); - } memcpy(pktbuf, "DC07", 4); strcpy((char *)(pktbuf + 4), fn1); @@ -544,19 +490,12 @@ static int dcls_rename(vfs_handler_t *vfs, const char *fn1, const char *fn2) { } static int dcls_unlink(vfs_handler_t *vfs, const char *fn) { - int len = strlen(fn) + 5, locked; + int len = strlen(fn) + 5; (void)vfs; - locked = mutex_trylock(&mutex); - - if(locked == -1 && irq_inside_int()) { - errno = EAGAIN; + if(mutex_lock_irqsafe(&mutex)) return -1; - } - else if(locked == -1) { - mutex_lock(&mutex); - } memcpy(pktbuf, "DC08", 4); strcpy((char *)(pktbuf + 4), fn); @@ -574,19 +513,11 @@ static int dcls_stat(vfs_handler_t *vfs, const char *fn, struct stat *rv, int flag) { command_t *cmd = (command_t *)pktbuf; dcload_stat_t filestat; - int locked; (void)flag; - locked = mutex_trylock(&mutex); - - if(locked == -1 && irq_inside_int()) { - errno = EAGAIN; + if(mutex_lock_irqsafe(&mutex)) return -1; - } - else if(locked == -1) { - mutex_lock(&mutex); - } memcpy(cmd->id, "DC13", 4); cmd->address = htonl((uint32) &filestat); @@ -635,7 +566,6 @@ static int dcls_fake_shutdown(void) { } static int dcls_writebuf(const uint8 *buf, int len, int xlat) { - int locked; command_3int_t cmd; (void)xlat; @@ -643,15 +573,8 @@ static int dcls_writebuf(const uint8 *buf, int len, int xlat) { if(initted < 2) return -1; - locked = mutex_trylock(&mutex); - - if(locked == -1 && irq_inside_int()) { - errno = EAGAIN; + if(mutex_lock_irqsafe(&mutex)) return -1; - } - else if(locked == -1) { - mutex_lock(&mutex); - } memcpy(cmd.id, "DD02", 4); cmd.value0 = htonl(1); diff --git a/kernel/arch/dreamcast/hardware/cdrom.c b/kernel/arch/dreamcast/hardware/cdrom.c index e842e336..09ec0ca6 100644 --- a/kernel/arch/dreamcast/hardware/cdrom.c +++ b/kernel/arch/dreamcast/hardware/cdrom.c @@ -77,7 +77,7 @@ int cdrom_exec_cmd_timed(int cmd, void *param, int timeout) { uint64_t begin; assert(cmd > 0 && cmd < CMD_MAX); - mutex_lock(&_g1_ata_mutex); + mutex_lock_scoped(&_g1_ata_mutex); /* Submit the command */ for(n = 0; n < 10; ++n) { @@ -89,10 +89,8 @@ int cdrom_exec_cmd_timed(int cmd, void *param, int timeout) { thd_pass(); } - if(hnd <= 0) { - mutex_unlock(&_g1_ata_mutex); + if(hnd <= 0) return ERR_SYS; - } /* Wait command to finish */ if(timeout) { @@ -117,8 +115,6 @@ int cdrom_exec_cmd_timed(int cmd, void *param, int timeout) { thd_pass(); } while(1); - mutex_unlock(&_g1_ata_mutex); - if(rv != ERR_OK) return rv; else if(n == COMPLETED || n == STREAMING) @@ -147,14 +143,9 @@ int cdrom_get_status(int *status, int *disc_type) { /* We might be called in an interrupt to check for ISO cache flushing, so make sure we're not interrupting something already in progress. */ - if(irq_inside_int()) { - if(mutex_trylock(&_g1_ata_mutex)) - /* DH: Figure out a better return to signal error */ - return -1; - } - else { - mutex_lock(&_g1_ata_mutex); - } + if(mutex_lock_irqsafe(&_g1_ata_mutex)) + /* DH: Figure out a better return to signal error */ + return -1; do { rv = syscall_gdrom_check_drive(params); @@ -192,10 +183,9 @@ int cdrom_change_dataype(int sector_part, int cdxa, int sector_size) { /* Wrapper for the change datatype syscall */ int cdrom_change_datatype(int sector_part, int cdxa, int sector_size) { - int rv = ERR_OK; uint32_t params[4]; - mutex_lock(&_g1_ata_mutex); + mutex_lock_scoped(&_g1_ata_mutex); /* Check if we are using default params */ if(sector_size == 2352) { @@ -224,9 +214,8 @@ int cdrom_change_datatype(int sector_part, int cdxa, int sector_size) { params[1] = sector_part; /* Get Data or Full Sector */ params[2] = cdxa; /* CD-XA mode 1/2 */ params[3] = sector_size; /* sector size */ - rv = syscall_gdrom_sector_mode(params); - mutex_unlock(&_g1_ata_mutex); - return rv; + + return syscall_gdrom_sector_mode(params); } /* Re-init the drive, e.g., after a disc change, etc */ diff --git a/kernel/arch/dreamcast/sound/arm/aica.c b/kernel/arch/dreamcast/sound/arm/aica.c index e116355f..74f30539 100644 --- a/kernel/arch/dreamcast/sound/arm/aica.c +++ b/kernel/arch/dreamcast/sound/arm/aica.c @@ -2,6 +2,7 @@ aica.c (c)2000-2002 Megan Potter + (c)2024 Stefanos Kornilios Mitsis Poiitidis ARM support routines for using the wavetable channels */ @@ -30,31 +31,36 @@ void aica_init(void) { } /* Translates a volume from linear form to logarithmic form (required by - the AICA chip */ -static int logs[] = { - 0, 15, 22, 27, 31, 35, 39, 42, 45, 47, 50, 52, 55, 57, 59, 61, - 63, 65, 67, 69, 71, 73, 74, 76, 78, 79, 81, 82, 84, 85, 87, 88, - 90, 91, 92, 94, 95, 96, 98, 99, 100, 102, 103, 104, 105, 106, - 108, 109, 110, 111, 112, 113, 114, 116, 117, 118, 119, 120, 121, - 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, - 135, 136, 137, 138, 138, 139, 140, 141, 142, 143, 144, 145, 146, - 146, 147, 148, 149, 150, 151, 152, 152, 153, 154, 155, 156, 156, - 157, 158, 159, 160, 160, 161, 162, 163, 164, 164, 165, 166, 167, - 167, 168, 169, 170, 170, 171, 172, 173, 173, 174, 175, 176, 176, - 177, 178, 178, 179, 180, 181, 181, 182, 183, 183, 184, 185, 185, - 186, 187, 187, 188, 189, 189, 190, 191, 191, 192, 193, 193, 194, - 195, 195, 196, 197, 197, 198, 199, 199, 200, 200, 201, 202, 202, - 203, 204, 204, 205, 205, 206, 207, 207, 208, 209, 209, 210, 210, - 211, 212, 212, 213, 213, 214, 215, 215, 216, 216, 217, 217, 218, - 219, 219, 220, 220, 221, 221, 222, 223, 223, 224, 224, 225, 225, - 226, 227, 227, 228, 228, 229, 229, 230, 230, 231, 232, 232, 233, - 233, 234, 234, 235, 235, 236, 236, 237, 237, 238, 239, 239, 240, - 240, 241, 241, 242, 242, 243, 243, 244, 244, 245, 245, 246, 246, - 247, 247, 248, 248, 249, 249, 250, 250, 251, 251, 252, 252, 253, 254, 255 + the AICA chip + + Calculated by + for (int i = 0; i < 256; i++) + if (i == 0) ...<truncated>... hooks/post-receive -- A pseudo Operating System for the Dreamcast. |