From: <ljs...@us...> - 2008-07-25 06:09:41
|
Revision: 600 http://cadcdev.svn.sourceforge.net/cadcdev/?rev=600&view=rev Author: ljsebald Date: 2008-07-25 06:09:39 +0000 (Fri, 25 Jul 2008) Log Message: ----------- - Add g2_memset_8 function. - Handle misaligned outgoing packets in the bba driver. - Pad small packets with NULL bytes, rather than whatever junk is in the bba's tx buffer. Modified Paths: -------------- kos/doc/CHANGELOG kos/kernel/arch/dreamcast/hardware/g2bus.c kos/kernel/arch/dreamcast/hardware/network/broadband_adapter.c kos/kernel/arch/dreamcast/include/dc/g2bus.h Modified: kos/doc/CHANGELOG =================================================================== --- kos/doc/CHANGELOG 2008-06-23 23:42:13 UTC (rev 599) +++ kos/doc/CHANGELOG 2008-07-25 06:09:39 UTC (rev 600) @@ -157,6 +157,11 @@ - *** Moved checking for free(NULL) up in code to avoid potential problems [HL] - DC fs_ramdisk.c: Don't allow opening a file with O_DIR [CG] - *** Removed legacy libc and libm [HL] +- DC Handle potentially misaligned outgoing packets in the BBA driver [LS] +- DC Added g2_memset_8 function for doing a memset over G2 with locking [LS] +- DC If a packet is < 60 bytes, pad it with null bytes for clarity, rather than + just transmitting whatever random junk was in the transmit buffer from + previous sends [LS] KallistiOS version 1.2.0 ----------------------------------------------- - DC Fix to use DCARM7_CFLAGS when compiling ARM driver [Christian Groessler == CG] Modified: kos/kernel/arch/dreamcast/hardware/g2bus.c =================================================================== --- kos/kernel/arch/dreamcast/hardware/g2bus.c 2008-06-23 23:42:13 UTC (rev 599) +++ kos/kernel/arch/dreamcast/hardware/g2bus.c 2008-07-25 06:09:39 UTC (rev 600) @@ -201,6 +201,20 @@ G2_UNLOCK(old1, old2); } +/* A memset-like function for G2 */ +void g2_memset_8(uint32 address, uint8 c, int amt) { + vuint8 * output = (vuint8 *)address; + int old1, old2; + + G2_LOCK(old1, old2); + + while (amt--) { + *output++ = c; + } + + G2_UNLOCK(old1, old2); +} + /* When writing to the SPU RAM, this is required at least every 8 32-bit writes that you execute */ void g2_fifo_wait() { Modified: kos/kernel/arch/dreamcast/hardware/network/broadband_adapter.c =================================================================== --- kos/kernel/arch/dreamcast/hardware/network/broadband_adapter.c 2008-06-23 23:42:13 UTC (rev 599) +++ kos/kernel/arch/dreamcast/hardware/network/broadband_adapter.c 2008-07-25 06:09:39 UTC (rev 600) @@ -4,7 +4,7 @@ Copyright (C)2001,2003,2005 Dan Potter Copyright (C)2004 Vincent Penne - Copyright (C)2007 Lawrence Sebald + Copyright (C)2007, 2008 Lawrence Sebald */ @@ -647,12 +647,25 @@ //g2_write_block_8(pkt, txdesc[rtl.cur_tx], len); - /* VP : g2_write_block_32 works here, use it , it's faster ! */ - g2_write_block_32((uint32 *) pkt, txdesc[rtl.cur_tx], (len + 3) >> 2); + /* Check alignment of the packet, if its 32-bit aligned, use + g2_write_block_32, if its 16-bit aligned, use g2_write_block_16, + otherwise, use g2_write_block_8. */ + if(!((uint32)pkt & 0x03)) { + g2_write_block_32((uint32 *) pkt, txdesc[rtl.cur_tx], (len + 3) >> 2); + } + else if(!((uint32)pkt & 0x01)) { + g2_write_block_16((uint16 *) pkt, txdesc[rtl.cur_tx], (len + 1) >> 1); + } + else { + g2_write_block_8(pkt, txdesc[rtl.cur_tx], len); + } - /* All packets must be at least 60 bytes */ - if (len < 60) + /* All packets must be at least 60 bytes, pad them with null bytes if + they are not already of an appropriate size. */ + if (len < 60) { + g2_memset_8(txdesc[rtl.cur_tx] + len, 0, 60 - len); len = 60; + } /* Transmit from the current TX buffer */ g2_write_32(NIC(RT_TXSTATUS0 + 4 * rtl.cur_tx), len); @@ -988,20 +1001,20 @@ /* Set ISP configuration from the flashrom, as long as we're configured staticly */ static void bba_set_ispcfg() { - flashrom_ispcfg_t isp; + flashrom_ispcfg_t isp; - if(flashrom_get_ispcfg(&isp) == -1) - return; + if(flashrom_get_ispcfg(&isp) == -1) + return; - if(!isp.ip_valid) - return; + if(!isp.ip_valid) + return; - if(isp.method != FLASHROM_ISP_STATIC) - return; + if(isp.method != FLASHROM_ISP_STATIC) + return; - memcpy(bba_if.ip_addr, isp.ip, 4); - memcpy(bba_if.netmask, isp.nm, 4); - memcpy(bba_if.gateway, isp.gw, 4); + memcpy(bba_if.ip_addr, isp.ip, 4); + memcpy(bba_if.netmask, isp.nm, 4); + memcpy(bba_if.gateway, isp.gw, 4); } /* Initialize */ @@ -1040,8 +1053,8 @@ bba_if.if_rx_poll = bba_if_rx_poll; bba_if.if_set_flags = bba_if_set_flags; - /* Attempt to set up our IP address et al from the flashrom */ - bba_set_ispcfg(); + /* Attempt to set up our IP address et al from the flashrom */ + bba_set_ispcfg(); #if 0 /* Try to detect/init us */ Modified: kos/kernel/arch/dreamcast/include/dc/g2bus.h =================================================================== --- kos/kernel/arch/dreamcast/include/dc/g2bus.h 2008-06-23 23:42:13 UTC (rev 599) +++ kos/kernel/arch/dreamcast/include/dc/g2bus.h 2008-07-25 06:09:39 UTC (rev 600) @@ -93,6 +93,9 @@ /* Write a block of 32-bit values to G2 */ void g2_write_block_32(const uint32 * input, uint32 address, int amt); +/* memset(), but for use on G2. */ +void g2_memset_8(uint32 address, uint8 c, int amt); + /* When writing to the SPU RAM, this is required at least every 8 32-bit writes that you execute */ void g2_fifo_wait(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ljs...@us...> - 2008-08-30 19:52:42
|
Revision: 603 http://cadcdev.svn.sourceforge.net/cadcdev/?rev=603&view=rev Author: ljsebald Date: 2008-08-30 19:52:37 +0000 (Sat, 30 Aug 2008) Log Message: ----------- Adding in rewritten microphone driver that now supports more than just the 16-bit signed @ 11025Hz encoding for samples. Modified Paths: -------------- kos/doc/CHANGELOG kos/kernel/arch/dreamcast/hardware/maple/sip.c kos/kernel/arch/dreamcast/include/dc/maple/sip.h Modified: kos/doc/CHANGELOG =================================================================== --- kos/doc/CHANGELOG 2008-08-18 00:08:44 UTC (rev 602) +++ kos/doc/CHANGELOG 2008-08-30 19:52:37 UTC (rev 603) @@ -162,6 +162,8 @@ - DC If a packet is < 60 bytes, pad it with null bytes for clarity, rather than just transmitting whatever random junk was in the transmit buffer from previous sends [LS] +- DC Rewrote microphone driver to make it support the different encodings + available to the hardware [LS] KallistiOS version 1.2.0 ----------------------------------------------- - DC Fix to use DCARM7_CFLAGS when compiling ARM driver [Christian Groessler == CG] Modified: kos/kernel/arch/dreamcast/hardware/maple/sip.c =================================================================== --- kos/kernel/arch/dreamcast/hardware/maple/sip.c 2008-08-18 00:08:44 UTC (rev 602) +++ kos/kernel/arch/dreamcast/hardware/maple/sip.c 2008-08-30 19:52:37 UTC (rev 603) @@ -1,279 +1,402 @@ /* KallistiOS ##version## sip.c - Copyright (C) 2005 Lawrence Sebald + Copyright (C) 2005, 2008 Lawrence Sebald */ #include <assert.h> #include <stdio.h> #include <string.h> #include <stdlib.h> +#include <arch/irq.h> #include <kos/genwait.h> #include <dc/maple.h> #include <dc/maple/sip.h> -static void sip_generic_cb(maple_frame_t *frame) { - /* Unlock the frame */ - maple_frame_unlock(frame); - - /* Wake up! */ - genwait_wake_all(frame); +#define SIP_START_SAMPLING 0x80 + +static void sip_start_sampling_cb(maple_frame_t *frame) { + sip_state_t *sip; + maple_response_t *resp; + + /* Unlock the frame */ + maple_frame_unlock(frame); + + /* Make sure we got a valid response */ + resp = (maple_response_t *)frame->recv_buf; + + if(resp->response != MAPLE_RESPONSE_OK) + return; + + /* Set the is_sampling flag. */ + sip = (sip_state_t *)frame->dev->status; + sip->is_sampling = 1; + + /* Wake up! */ + genwait_wake_all(frame); } -int sip_set_gain(maple_device_t *dev, uint8 g) { - sip_state_t *sip; +static void sip_stop_sampling_cb(maple_frame_t *frame) { + sip_state_t *sip; + maple_response_t *resp; - assert( dev != NULL ); - - sip = (sip_state_t *)dev->status; + /* Unlock the frame */ + maple_frame_unlock(frame); - /* Check the gain value for validity */ - if(g > 0x1F) - return MAPLE_EINVALID; + /* Make sure we got a valid response */ + resp = (maple_response_t *)frame->recv_buf; - sip->amp_gain = g; + if(resp->response != MAPLE_RESPONSE_OK) + return; - return MAPLE_EOK; + /* Clear the is_sampling flag. */ + sip = (sip_state_t *)frame->dev->status; + sip->is_sampling = 0; + + /* Wake up! */ + genwait_wake_all(frame); } -int sip_start_sampling(maple_device_t *dev) { - sip_state_t *sip; - uint32 *send_buf; - - assert( dev != NULL ); - - sip = (sip_state_t *)dev->status; - - /* Make sure we aren't yet sampling */ - if(sip->is_sampling) - return MAPLE_EFAIL; - - /* Lock the frame */ - if(maple_frame_lock(&dev->frame) < 0) - return MAPLE_EAGAIN; - - /* Reset the frame */ - maple_frame_init(&dev->frame); - send_buf = (uint32 *)dev->frame.recv_buf; - send_buf[0] = MAPLE_FUNC_MICROPHONE; - send_buf[1] = 0x02 | (0x80 << 8); /* Start sampling */ - dev->frame.cmd = MAPLE_COMMAND_MICCONTROL; - dev->frame.dst_port = dev->port; - dev->frame.dst_unit = dev->unit; - dev->frame.length = 2; - dev->frame.callback = sip_generic_cb; - dev->frame.send_buf = send_buf; - maple_queue_frame(&dev->frame); - - /* Wait for the SIP to accept it */ - if(genwait_wait(&dev->frame, "sip_start_sampling", 500, NULL) < 0) { - if(dev->frame.state != MAPLE_FRAME_VACANT) { - /* Something went wrong.... */ - dev->frame.state = MAPLE_FRAME_VACANT; - dbglog(DBG_ERROR, "sip_start_sampling: timeout to unit %c%c\n", - dev->port + 'A', dev->unit + '0'); - return MAPLE_ETIMEOUT; - } - } - - sip->is_sampling = 1; - - return MAPLE_EOK; +int sip_set_gain(maple_device_t *dev, unsigned int g) { + sip_state_t *sip; + + assert( dev != NULL ); + + /* Check the gain value for validity */ + if(g > SIP_MAX_GAIN) + return MAPLE_EINVALID; + + sip = (sip_state_t *)dev->status; + sip->amp_gain = g; + + return MAPLE_EOK; } -int sip_stop_sampling(maple_device_t *dev) { - sip_state_t *sip; - uint32 *send_buf; +int sip_set_sample_type(maple_device_t *dev, unsigned int type) { + sip_state_t *sip; - assert( dev != NULL ); + assert( dev != NULL ); - sip = (sip_state_t *)dev->status; + /* Check the sample type value for validity. */ + if(type > SIP_SAMPLE_8BIT_ULAW) + return MAPLE_EINVALID; - /* Make sure we actually are sampling */ - if(!sip->is_sampling) - return MAPLE_EFAIL; + sip = (sip_state_t *)dev->status; - /* Lock the frame */ - if(maple_frame_lock(&dev->frame) < 0) - return MAPLE_EAGAIN; + /* Make sure we aren't sampling already. */ + if(sip->is_sampling) + return MAPLE_EFAIL; - /* Reset the frame */ - maple_frame_init(&dev->frame); - send_buf = (uint32 *)dev->frame.recv_buf; - send_buf[0] = MAPLE_FUNC_MICROPHONE; - send_buf[1] = 0x02; /* Stop sampling */ - dev->frame.cmd = MAPLE_COMMAND_MICCONTROL; - dev->frame.dst_port = dev->port; - dev->frame.dst_unit = dev->unit; - dev->frame.length = 2; - dev->frame.callback = sip_generic_cb; - dev->frame.send_buf = send_buf; - maple_queue_frame(&dev->frame); + sip->sample_type = type; - /* Wait for the SIP to accept it */ - if(genwait_wait(&dev->frame, "sip_stop_sampling", 500, NULL) < 0) { - if(dev->frame.state != MAPLE_FRAME_VACANT) { - /* Something went wrong.... */ - dev->frame.state = MAPLE_FRAME_VACANT; - dbglog(DBG_ERROR, "sip_stop_sampling: timeout to unit %c%c\n", - dev->port + 'A', dev->unit + '0'); - return MAPLE_ETIMEOUT; - } - } + return MAPLE_EOK; +} - sip->is_sampling = 0; +int sip_set_frequency(maple_device_t *dev, unsigned int freq) { + sip_state_t *sip; - return MAPLE_EOK; + assert( dev != NULL ); + + /* Check the frequency value for validity. */ + if(freq > SIP_SAMPLE_8KHZ) + return MAPLE_EINVALID; + + sip = (sip_state_t *)dev->status; + + /* Make sure we aren't sampling already. */ + if(sip->is_sampling) + return MAPLE_EFAIL; + + sip->frequency = freq; + + return MAPLE_EOK; } -int sip_get_samples(maple_device_t *dev, uint8 *buf, size_t len) { - sip_state_t *sip; - size_t sz; +int sip_start_sampling(maple_device_t *dev, int block) { + sip_state_t *sip; + uint32 *send_buf; - sip = (sip_state_t *)dev->status; + assert( dev != NULL ); - if(sip->is_sampling) - return MAPLE_EFAIL; + sip = (sip_state_t *)dev->status; - sz = sip->buf_pos > len ? len : sip->buf_pos; + /* Make sure we aren't yet sampling */ + if(sip->is_sampling) + return MAPLE_EFAIL; - memcpy(buf, sip->samples_buf, sz); + /* Lock the frame */ + if(maple_frame_lock(&dev->frame) < 0) + return MAPLE_EAGAIN; - if(sz == sip->buf_pos) { - sip->buf_pos = 0; - } - else { - memcpy(sip->samples_buf + sz, sip->samples_buf, sip->buf_pos - sz); - sip->buf_pos -= sz; - } + /* Reset the frame */ + maple_frame_init(&dev->frame); + send_buf = (uint32 *)dev->frame.recv_buf; + send_buf[0] = MAPLE_FUNC_MICROPHONE; + send_buf[1] = SIP_SUBCOMMAND_BASIC_CTRL | + (((sip->sample_type) | (sip->frequency << 2) | + SIP_START_SAMPLING) << 8); + dev->frame.cmd = MAPLE_COMMAND_MICCONTROL; + dev->frame.dst_port = dev->port; + dev->frame.dst_unit = dev->unit; + dev->frame.length = 2; + dev->frame.callback = sip_start_sampling_cb; + dev->frame.send_buf = send_buf; + maple_queue_frame(&dev->frame); - return sz; + if(block) { + /* Wait for the SIP to accept it */ + if(genwait_wait(&dev->frame, "sip_start_sampling", 500, NULL) < 0) { + if(dev->frame.state != MAPLE_FRAME_VACANT) { + /* Something went wrong.... */ + dev->frame.state = MAPLE_FRAME_VACANT; + dbglog(DBG_ERROR, "sip_start_sampling: timeout to unit %c%c\n", + dev->port + 'A', dev->unit + '0'); + return MAPLE_ETIMEOUT; + } + } + } + + return MAPLE_EOK; } -int sip_clear_samples(maple_device_t *dev) { - sip_state_t *sip; +int sip_stop_sampling(maple_device_t *dev, int block) { + sip_state_t *sip; + uint32 *send_buf; - sip = (sip_state_t *)dev->status; + assert( dev != NULL ); - if(sip->is_sampling) - return MAPLE_EFAIL; + sip = (sip_state_t *)dev->status; - sip->buf_pos = 0; + /* Make sure we actually are sampling */ + if(!sip->is_sampling) + return MAPLE_EFAIL; - return MAPLE_EOK; + /* Lock the frame */ + if(maple_frame_lock(&dev->frame) < 0) + return MAPLE_EAGAIN; + + /* Reset the frame */ + maple_frame_init(&dev->frame); + send_buf = (uint32 *)dev->frame.recv_buf; + send_buf[0] = MAPLE_FUNC_MICROPHONE; + send_buf[1] = SIP_SUBCOMMAND_BASIC_CTRL; + dev->frame.cmd = MAPLE_COMMAND_MICCONTROL; + dev->frame.dst_port = dev->port; + dev->frame.dst_unit = dev->unit; + dev->frame.length = 2; + dev->frame.callback = sip_stop_sampling_cb; + dev->frame.send_buf = send_buf; + maple_queue_frame(&dev->frame); + + if(block) { + /* Wait for the SIP to accept it */ + if(genwait_wait(&dev->frame, "sip_stop_sampling", 500, NULL) < 0) { + if(dev->frame.state != MAPLE_FRAME_VACANT) { + /* Something went wrong.... */ + dev->frame.state = MAPLE_FRAME_VACANT; + dbglog(DBG_ERROR, "sip_stop_sampling: timeout to unit %c%c\n", + dev->port + 'A', dev->unit + '0'); + return MAPLE_ETIMEOUT; + } + } + } + + return MAPLE_EOK; } -static void sip_reply(maple_frame_t *frm) { - maple_response_t *resp; - uint32 *respbuf; - size_t sz, i; - sip_state_t *sip; - - /* Unlock the frame now (it's ok, we're in an IRQ) */ - maple_frame_unlock(frm); - - /* Make sure we got a valid response */ - resp = (maple_response_t *)frm->recv_buf; - - if (resp->response != MAPLE_RESPONSE_DATATRF) - return; - respbuf = (uint32 *)resp->data; - if (respbuf[0] != MAPLE_FUNC_MICROPHONE) - return; - - if(frm->dev) { - sip = (sip_state_t *)frm->dev->status; - frm->dev->status_valid = 1; +uint8 *sip_get_samples(maple_device_t *dev, size_t *sz) { + sip_state_t *sip; + uint8 *rv; + uint32 old; - if(sip->is_sampling) { - sz = resp->data_len * 4 - 8; + assert( dev != NULL ); + assert( sz != NULL ); - /* Make sure we don't overflow the buffer */ - if(sz + sip->buf_pos <= sip->buf_len) { - for(i = 0; i < sz; i++) { - sip->samples_buf[i + sip->buf_pos] = resp->data[i + 8]; - } - sip->buf_pos += sz; - } - } - } + /* Disable interrupts so that nothing changes underneath us. */ + old = irq_disable(); + + sip = (sip_state_t *)dev->status; + + /* Make sure that we're not currently sampling. */ + if(sip->is_sampling) { + irq_restore(old); + *sz = (size_t)-1; + return NULL; + } + + /* Grab the values to return. */ + *sz = sip->buf_pos; + rv = sip->samples_buf; + + /* Allocate us a new buffer. */ + sip->buf_pos = 0; + sip->samples_buf = (uint8 *)malloc(11025 * 2 * 10); + + if(sip->samples_buf == NULL) { + sip->buf_len = 0; + dev->status_valid = 0; + } + else { + sip->buf_len = 11025 * 2 * 10; + dev->status_valid = 1; + } + + irq_restore(old); + return rv; } +int sip_clear_samples(maple_device_t *dev) { + sip_state_t *sip; + uint32 old; -static int sip_poll(maple_device_t *dev) { - sip_state_t *sip; - uint32 *send_buf; + assert( dev != NULL ); - /* Test to make sure that the particular mic is enabled */ - sip = (sip_state_t *)dev->status; + /* Disable IRQs so that nothing changes under us */ + old = irq_disable(); - /* Lock the frame, or die trying */ - if(maple_frame_lock(&dev->frame) < 0) - return 0; + sip = (sip_state_t *)dev->status; - maple_frame_init(&dev->frame); - send_buf = (uint32 *)dev->frame.recv_buf; - send_buf[0] = MAPLE_FUNC_MICROPHONE; - send_buf[1] = 0x01 | (sip->amp_gain << 8); /* Get samples/status */ - dev->frame.cmd = MAPLE_COMMAND_MICCONTROL; - dev->frame.dst_port = dev->port; - dev->frame.dst_unit = dev->unit; - dev->frame.length = 2; - dev->frame.callback = sip_reply; - dev->frame.send_buf = send_buf; - maple_queue_frame(&dev->frame); + if(sip->is_sampling) { + irq_restore(old); + return MAPLE_EFAIL; + } - return 0; + sip->buf_pos = 0; + + irq_restore(old); + + return MAPLE_EOK; } +static void sip_reply(maple_frame_t *frm) { + maple_response_t *resp; + uint32 *respbuf; + size_t sz; + sip_state_t *sip; + void *tmp; + + /* Unlock the frame now (it's ok, we're in an IRQ) */ + maple_frame_unlock(frm); + + /* Make sure we got a valid response */ + resp = (maple_response_t *)frm->recv_buf; + + if(resp->response != MAPLE_RESPONSE_DATATRF) + return; + + respbuf = (uint32 *)resp->data; + + if(respbuf[0] != MAPLE_FUNC_MICROPHONE) + return; + + if(frm->dev) { + sip = (sip_state_t *)frm->dev->status; + frm->dev->status_valid = 1; + + if(sip->is_sampling) { + sz = resp->data_len * 4 - 8; + + /* Resize the buffer, if it is needed. */ + if(sz + sip->buf_pos > sip->buf_len) { + /* Attempt to double the buffer size. */ + tmp = realloc(sip->samples_buf, sip->buf_len << 1); + + if(!tmp) { + return; + } + + sip->samples_buf = tmp; + sip->buf_len <<= 1; + } + + memcpy(sip->samples_buf + sip->buf_pos, resp->data + 8, sz); + sip->buf_pos += sz; + } + } +} + +static int sip_poll(maple_device_t *dev) { + sip_state_t *sip; + uint32 *send_buf; + + sip = (sip_state_t *)dev->status; + + /* Test to make sure that the particular mic is enabled */ + if(!sip->is_sampling) { + return 0; + } + + /* Lock the frame, or die trying */ + if(maple_frame_lock(&dev->frame) < 0) + return 0; + + maple_frame_init(&dev->frame); + send_buf = (uint32 *)dev->frame.recv_buf; + send_buf[0] = MAPLE_FUNC_MICROPHONE; + send_buf[1] = SIP_SUBCOMMAND_GET_SAMPLES | + (sip->amp_gain << 8); + dev->frame.cmd = MAPLE_COMMAND_MICCONTROL; + dev->frame.dst_port = dev->port; + dev->frame.dst_unit = dev->unit; + dev->frame.length = 2; + dev->frame.callback = sip_reply; + dev->frame.send_buf = send_buf; + maple_queue_frame(&dev->frame); + + return 0; +} + static void sip_periodic(maple_driver_t *drv) { - maple_driver_foreach(drv, sip_poll); + maple_driver_foreach(drv, sip_poll); } static int sip_attach(maple_driver_t *drv, maple_device_t *dev) { - sip_state_t *sip; + sip_state_t *sip; - /* Allocate the sample buffer for 10 seconds worth of samples */ - sip = (sip_state_t *)dev->status; - sip->is_sampling = 0; - sip->amp_gain = 0; - sip->buf_pos = 0; - sip->samples_buf = (uint8 *)malloc(11025 * 2 * 10); + /* Allocate the sample buffer for 10 seconds worth of samples (11.025kHz, + 16-bit signed samples). */ + sip = (sip_state_t *)dev->status; + sip->is_sampling = 0; + sip->amp_gain = SIP_DEFAULT_GAIN; + sip->buf_pos = 0; + sip->samples_buf = (uint8 *)malloc(11025 * 2 * 10); - if(sip->samples_buf == NULL) { - dev->status_valid = 0; - sip->buf_len = 0; - return -1; - } - else { - dev->status_valid = 1; - sip->buf_len = 11025 * 2 * 10; - return 0; - } + if(sip->samples_buf == NULL) { + dev->status_valid = 0; + sip->buf_len = 0; + return -1; + } + else { + dev->status_valid = 1; + sip->buf_len = 11025 * 2 * 10; + return 0; + } } static void sip_detach(maple_driver_t *drv, maple_device_t *dev) { - sip_state_t *sip; + sip_state_t *sip; - sip = (sip_state_t *)dev->status; - free(sip->samples_buf); + sip = (sip_state_t *)dev->status; + + if(sip->samples_buf) { + free(sip->samples_buf); + } } /* Device Driver Struct */ static maple_driver_t sip_drv = { - functions: MAPLE_FUNC_MICROPHONE, - name: "Sound Input Peripheral", - periodic: sip_periodic, - attach: sip_attach, - detach: sip_detach + functions: MAPLE_FUNC_MICROPHONE, + name: "Sound Input Peripheral", + periodic: sip_periodic, + attach: sip_attach, + detach: sip_detach }; /* Add the SIP to the driver chain */ int sip_init() { - return maple_driver_reg(&sip_drv); + return maple_driver_reg(&sip_drv); } void sip_shutdown() { - maple_driver_unreg(&sip_drv); + maple_driver_unreg(&sip_drv); } - Modified: kos/kernel/arch/dreamcast/include/dc/maple/sip.h =================================================================== --- kos/kernel/arch/dreamcast/include/dc/maple/sip.h 2008-08-18 00:08:44 UTC (rev 602) +++ kos/kernel/arch/dreamcast/include/dc/maple/sip.h 2008-08-30 19:52:37 UTC (rev 603) @@ -1,7 +1,7 @@ /* KallistiOS ##version## dc/maple/sip.h - Copyright (C) 2005 Lawrence Sebald + Copyright (C) 2005, 2008 Lawrence Sebald */ @@ -13,40 +13,75 @@ #include <sys/types.h> -/* This driver controls the Sound Input Peripheral for the maple - bus (the microphone). Many thanks go out to ZeZu for pointing - me towards what some commands actually do. +/* This driver controls the Sound Input Peripheral for the maple bus (aka, the + microphone that came with Seaman and the Dreameye). Many thanks go out to + ZeZu for pointing me towards what some commands actually do in the original + version of this driver. */ -/* SIP Status structure */ +/* SIP Status structure. Everything in here should be considered to be read-only + from user programs. */ typedef struct sip_state { - uint8 amp_gain; - uint8 is_sampling; - size_t buf_len; - off_t buf_pos; - uint8 *samples_buf; + int amp_gain; + int sample_type; + int frequency; + int is_sampling; + size_t buf_len; + off_t buf_pos; + uint8 *samples_buf; } sip_state_t; -/* The maximum gain value to be passed to the function - below. */ -#define SIP_MAX_GAIN 0x1F +/* Subcommands of the Microphone command. */ +#define SIP_SUBCOMMAND_GET_SAMPLES 0x01 +#define SIP_SUBCOMMAND_BASIC_CTRL 0x02 -/* Set the amplifier's gain. This should only be called prior - to sampling, to ensure that the sound returned is of the - same volume. */ -int sip_set_gain(maple_device_t *dev, uint8 g); +/* The minimum, maximum, and default gain values that can be passed to the + sip_set_gain function. */ +#define SIP_MIN_GAIN 0x00 +#define SIP_DEFAULT_GAIN 0x0F +#define SIP_MAX_GAIN 0x1F -/* Start sampling. */ -int sip_start_sampling(maple_device_t *dev); +/* Set the amplifier's gain. This should only be called prior to sampling, to + ensure that the sound returned is of the same volume (unlike the other + functions below, this is not strictly a requirement, as this gets sent + with all of the get samples packets). */ +int sip_set_gain(maple_device_t *dev, unsigned int g); -/* Stop sampling. */ -int sip_stop_sampling(maple_device_t *dev); +/* Sample types. These two values are the only defined types of samples that + the SIP can output. 16-bit signed is your standard 16-bit signed samples, + where 8-bit ulaw is obvously encoded as ulaw. */ +#define SIP_SAMPLE_16BIT_SIGNED 0x00 +#define SIP_SAMPLE_8BIT_ULAW 0x01 -/* Get samples out of the buffer. This can ONLY be called after - sampling has been stopped. Returns the size in bytes of the - filled buffer. */ -int sip_get_samples(maple_device_t *dev, uint8 *buf, size_t len); +/* Set the sample type to be returned by the microphone. This must be called + prior to a sip_start_sampling if you want to change it from the default + (16-bit signed is the default). */ +int sip_set_sample_type(maple_device_t *dev, unsigned int type); +/* Sampling frequencies. The SIP supports sampling at either 8kHz or 11.025 kHz. + One of these values should be passed to the sip_set_frequency function. */ +#define SIP_SAMPLE_11KHZ 0x00 +#define SIP_SAMPLE_8KHZ 0x01 + +/* Set the sampling frequency to be returned by the microphone. This must be + called prior to a sip_start_sampling if you want to change it from the + default (11kHz is the default). */ +int sip_set_frequency(maple_device_t *dev, unsigned int freq); + +/* Start sampling. If you want the function to block until sampling has started, + set the block argument to something other than zero. Otherwise, check the + is_sampling member of the device status to know when sampling has started. */ +int sip_start_sampling(maple_device_t *dev, int block); + +/* Stop sampling. Same comment about blocking above applies here too. */ +int sip_stop_sampling(maple_device_t *dev, int block); + +/* Grab the samples buffer from the device. This function can only be called + when the microphone is not sampling. Once you call this function, you are + responsible for the buffer, so you must free it when you're done. The sz + pointer is used to return how long the sample data is. */ +uint8 *sip_get_samples(maple_device_t *dev, size_t *sz); + /* Clear the internal sample buffer. */ int sip_clear_samples(maple_device_t *dev); @@ -57,4 +92,3 @@ __END_DECLS #endif /* __DC_MAPLE_SIP_H */ - This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ljs...@us...> - 2008-09-04 02:58:28
|
Revision: 604 http://cadcdev.svn.sourceforge.net/cadcdev/?rev=604&view=rev Author: ljsebald Date: 2008-09-04 02:58:25 +0000 (Thu, 04 Sep 2008) Log Message: ----------- Add maple_enum_type_ex function and capability defines for the controller to go along with it. Modified Paths: -------------- kos/doc/CHANGELOG kos/kernel/arch/dreamcast/hardware/maple/maple_enum.c kos/kernel/arch/dreamcast/include/dc/maple/controller.h kos/kernel/arch/dreamcast/include/dc/maple.h Modified: kos/doc/CHANGELOG =================================================================== --- kos/doc/CHANGELOG 2008-08-30 19:52:37 UTC (rev 603) +++ kos/doc/CHANGELOG 2008-09-04 02:58:25 UTC (rev 604) @@ -164,6 +164,10 @@ previous sends [LS] - DC Rewrote microphone driver to make it support the different encodings available to the hardware [LS] +- DC Add maple_enum_type_ex function to return the nth device that is of the + requested type and supports the list of capabilities listed (i.e, the + function_data of devinfo for that function has all the bits set that are + set in the cap parameter [LS] KallistiOS version 1.2.0 ----------------------------------------------- - DC Fix to use DCARM7_CFLAGS when compiling ARM driver [Christian Groessler == CG] Modified: kos/kernel/arch/dreamcast/hardware/maple/maple_enum.c =================================================================== --- kos/kernel/arch/dreamcast/hardware/maple/maple_enum.c 2008-08-30 19:52:37 UTC (rev 603) +++ kos/kernel/arch/dreamcast/hardware/maple/maple_enum.c 2008-09-04 02:58:25 UTC (rev 604) @@ -2,6 +2,7 @@ maple_enum.c (c)2002 Dan Potter + (c)2008 Lawrence Sebald */ #include <dc/maple.h> @@ -48,6 +49,52 @@ return NULL; } +/* Return the Nth device that is of the requested type and supports the list of + capabilities given. */ +maple_device_t * maple_enum_type_ex(int n, uint32 func, uint32 cap) { + int p, u, d; + maple_device_t *dev; + uint32 f, tmp; + + for(p = 0; p < MAPLE_PORT_COUNT; ++p) { + for(u = 0; u < MAPLE_UNIT_COUNT; ++u) { + dev = maple_enum_dev(p, u); + + /* If the device supports the function code we passed in, check + if it supports the capabilities that the user requested. */ + if(dev != NULL && (dev->info.functions & func)) { + f = dev->info.functions; + d = 0; + tmp = func; + + /* Figure out which function data we want to look at. Function + data entries are arranged by the function code, most + significant bit first. This is really not pretty, and is + rather inefficient, but its the best I could think of off the + top of my head (i.e, replace me later). */ + while(tmp != 0x80000000) { + if(f & 0x80000000) { + ++d; + } + + f <<= 1; + tmp <<= 1; + } + + /* Check if the function data for the function type checks out + with what it should be. */ + if((dev->info.function_data[d] & cap) == cap) { + if(!n) + return dev; + --n; + } + } + } + } + + return NULL; +} + /* Get the status struct for the requested maple device; wait until it's valid before returning. Cast to the appropriate type you're expecting. */ void * maple_dev_status(maple_device_t *dev) { Modified: kos/kernel/arch/dreamcast/include/dc/maple/controller.h =================================================================== --- kos/kernel/arch/dreamcast/include/dc/maple/controller.h 2008-08-30 19:52:37 UTC (rev 603) +++ kos/kernel/arch/dreamcast/include/dc/maple/controller.h 2008-09-04 02:58:25 UTC (rev 604) @@ -75,6 +75,32 @@ typedef void (*cont_btn_callback_t)(uint8 addr, uint32 btns); void cont_btn_callback(uint8 addr, uint32 btns, cont_btn_callback_t cb); +/* Capability bits - These will be set in the function_data for the controller + in the reply to the devinfo command if the controller supports the + corresponding feature. */ +#define CONT_CAPABILITY_C (1<<0) +#define CONT_CAPABILITY_B (1<<1) +#define CONT_CAPABILITY_A (1<<2) +#define CONT_CAPABILITY_START (1<<3) +#define CONT_CAPABILITY_DPAD_UP (1<<4) +#define CONT_CAPABILITY_DPAD_DOWN (1<<5) +#define CONT_CAPABILITY_DPAD_LEFT (1<<6) +#define CONT_CAPABILITY_DPAD_RIGHT (1<<7) +#define CONT_CAPABILITY_Z (1<<8) +#define CONT_CAPABILITY_Y (1<<9) +#define CONT_CAPABILITY_X (1<<10) +#define CONT_CAPABILITY_D (1<<11) +#define CONT_CAPABILITY_DPAD2_UP (1<<12) +#define CONT_CAPABILITY_DPAD2_DOWN (1<<13) +#define CONT_CAPABILITY_DPAD2_LEFT (1<<14) +#define CONT_CAPABILITY_DPAD2_RIGHT (1<<15) +#define CONT_CAPABILITY_RTRIG (1<<16) +#define CONT_CAPABILITY_LTRIG (1<<17) +#define CONT_CAPABILITY_ANALOG_X (1<<18) +#define CONT_CAPABILITY_ANALOG_Y (1<<19) +#define CONT_CAPABILITY_ANALOG2_X (1<<20) +#define CONT_CAPABILITY_ANALOG2_Y (1<<21) + __END_DECLS #endif /* __DC_MAPLE_CONTROLLER_H */ Modified: kos/kernel/arch/dreamcast/include/dc/maple.h =================================================================== --- kos/kernel/arch/dreamcast/include/dc/maple.h 2008-08-30 19:52:37 UTC (rev 603) +++ kos/kernel/arch/dreamcast/include/dc/maple.h 2008-09-04 02:58:25 UTC (rev 604) @@ -341,6 +341,13 @@ /* Return the Nth device of the requested type (where N is zero-indexed) */ maple_device_t * maple_enum_type(int n, uint32 func); +/* Return the Nth device that is of the requested type and supports the list of + capabilities given. Note, this only currently makes sense for controllers, + since some devices don't necessarily use the function data in the same manner + that controllers do (and controllers are the only devices where we have a + list of what all the bits mean at the moment). */ +maple_device_t * maple_enum_type_ex(int n, uint32 func, uint32 cap); + /* Get the status struct for the requested maple device; wait until it's valid before returning. Cast to the appropriate type you're expecting. */ void * maple_dev_status(maple_device_t *dev); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ljs...@us...> - 2008-09-04 03:22:26
|
Revision: 605 http://cadcdev.svn.sourceforge.net/cadcdev/?rev=605&view=rev Author: ljsebald Date: 2008-09-04 03:22:20 +0000 (Thu, 04 Sep 2008) Log Message: ----------- Committing Donald Haase's vid_screen_shot patch (Tracker Item #2088266). Modified Paths: -------------- kos/doc/CHANGELOG kos/kernel/arch/dreamcast/util/screenshot.c Modified: kos/doc/CHANGELOG =================================================================== --- kos/doc/CHANGELOG 2008-09-04 02:58:25 UTC (rev 604) +++ kos/doc/CHANGELOG 2008-09-04 03:22:20 UTC (rev 605) @@ -168,6 +168,7 @@ requested type and supports the list of capabilities listed (i.e, the function_data of devinfo for that function has all the bits set that are set in the cap parameter [LS] +- DC Made vid_screen_shot support any of the video modes [DH] KallistiOS version 1.2.0 ----------------------------------------------- - DC Fix to use DCARM7_CFLAGS when compiling ARM driver [Christian Groessler == CG] Modified: kos/kernel/arch/dreamcast/util/screenshot.c =================================================================== --- kos/kernel/arch/dreamcast/util/screenshot.c 2008-09-04 02:58:25 UTC (rev 604) +++ kos/kernel/arch/dreamcast/util/screenshot.c 2008-09-04 03:22:20 UTC (rev 605) @@ -2,6 +2,7 @@ screenshot.c (c)2002 Dan Potter + (c)2008 Donald Haase */ #include <stdio.h> @@ -11,8 +12,6 @@ #include <kos/fs.h> #include <arch/irq.h> -CVSID("$Id: screenshot.c,v 1.3 2003/02/14 08:13:18 bardtx Exp $"); - /* Provides a very simple screen shot facility (dumps raw RGB PPM files from the @@ -20,47 +19,90 @@ Destination file system must be writeable and have enough free space. -Assumes display is in 16-bit mode. +This will now work with any of the supported video modes. */ int vid_screen_shot(const char *destfn) { file_t f; - int i, bsize; + int i, numpix; uint8 *buffer; - uint16 pixel; - uint8 r, g, b; char header[256]; uint32 save; + uint32 pixel; /* to fit 888 mode */ + uint8 r, g, b; + uint8 bpp; + bpp = 3; /* output to ppm is 3 bytes per pixel */ + numpix = vid_mode->width * vid_mode->height; + /* Allocate a new buffer so we can blast it all at once */ - bsize = vid_mode->width * vid_mode->height * 3; - buffer = (uint8 *)malloc(bsize); + buffer = (uint8 *)malloc(numpix * bpp); if (buffer == NULL) { - dbglog(DBG_ERROR, "video_screen_shot: can't allocate ss memory\n"); + dbglog(DBG_ERROR, "vid_screen_shot: can't allocate ss memory\n"); return -1; } /* Disable interrupts */ save = irq_disable(); - /* Write out each 16-bit pixel as 24 bits */ - for (i=0; i<vid_mode->width*vid_mode->height; i++) { - pixel = vram_s[i]; - r = ((pixel >> 11) & 0x1f) << 3; - g = ((pixel >> 5) & 0x3f) << 2; - b = ((pixel >> 0) & 0x1f) << 3; - buffer[i*3+0] = r; - buffer[i*3+1] = g; - buffer[i*3+2] = b; - } + /* Write out each pixel as 24 bits */ + switch(vid_mode->pm) + { + case(PM_RGB555): + { + for (i = 0; i < numpix; i++) { + pixel = vram_s[i]; + r = (((pixel >> 10) & 0x1f) << 3); + b = (((pixel >> 5) & 0x1f) << 3); + g = (((pixel >> 0) & 0x1f) << 3); + buffer[i * 3 + 0] = r; + buffer[i * 3 + 1] = g; + buffer[i * 3 + 2] = b; + } + break; + } + case(PM_RGB565): + { + for (i = 0; i < numpix; i++) { + pixel = vram_s[i]; + r = (((pixel >> 11) & 0x1f) << 3); + b = (((pixel >> 5) & 0x3f) << 2); + g = (((pixel >> 0) & 0x1f) << 3); + buffer[i * 3 + 0] = r; + buffer[i * 3 + 1] = g; + buffer[i * 3 + 2] = b; + } + break; + } + case(PM_RGB888): + { + for (i = 0; i < numpix; i++) { + pixel = vram_l[i]; + r = (((pixel >> 16) & 0xff)); + b = (((pixel >> 8) & 0xff)); + g = (((pixel >> 0) & 0xff)); + buffer[i * 3 + 0] = r; + buffer[i * 3 + 1] = g; + buffer[i * 3 + 2] = b; + } + break; + } + default: + { + dbglog(DBG_ERROR, "vid_screen_shot: can't process pixel mode %d\n", vid_mode->pm); + irq_restore(save); + free(buffer); + return -1; + } + } irq_restore(save); /* Open output file */ f = fs_open(destfn, O_WRONLY | O_TRUNC); if (!f) { - dbglog(DBG_ERROR, "video_screen_shot: can't open output file '%s'\n", destfn); + dbglog(DBG_ERROR, "vid_screen_shot: can't open output file '%s'\n", destfn); free(buffer); return -1; } @@ -68,15 +110,15 @@ /* Write a small header */ sprintf(header, "P6\n#KallistiOS Screen Shot\n%d %d\n255\n", vid_mode->width, vid_mode->height); if (fs_write(f, header, strlen(header)) != strlen(header)) { - dbglog(DBG_ERROR, "video_screen_shot: can't write header to output file '%s'\n", destfn); + dbglog(DBG_ERROR, "vid_screen_shot: can't write header to output file '%s'\n", destfn); fs_close(f); free(buffer); return -1; } /* Write the data */ - if (fs_write(f, buffer, bsize) != (ssize_t)bsize) { - dbglog(DBG_ERROR, "video_screen_shot: can't write data to output file '%s'\n", destfn); + if (fs_write(f, buffer, numpix * bpp) != (ssize_t)(numpix * bpp)) { + dbglog(DBG_ERROR, "vid_screen_shot: can't write data to output file '%s'\n", destfn); fs_close(f); free(buffer); return -1; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ljs...@us...> - 2008-09-10 01:31:34
|
Revision: 606 http://cadcdev.svn.sourceforge.net/cadcdev/?rev=606&view=rev Author: ljsebald Date: 2008-09-10 01:31:31 +0000 (Wed, 10 Sep 2008) Log Message: ----------- A few changes in the network code to support sending/receiving broadcast packets properly. Also, catch all of 127.x.y.z as loopback addresses, as it is supposed to be. Modified Paths: -------------- kos/doc/CHANGELOG kos/include/kos/net.h kos/kernel/arch/dreamcast/hardware/network/broadband_adapter.c kos/kernel/arch/dreamcast/hardware/network/lan_adapter.c kos/kernel/net/net_icmp.c kos/kernel/net/net_ipv4.c Modified: kos/doc/CHANGELOG =================================================================== --- kos/doc/CHANGELOG 2008-09-04 03:22:20 UTC (rev 605) +++ kos/doc/CHANGELOG 2008-09-10 01:31:31 UTC (rev 606) @@ -169,6 +169,8 @@ function_data of devinfo for that function has all the bits set that are set in the cap parameter [LS] - DC Made vid_screen_shot support any of the video modes [DH] +- *** Fixes to the network stack to support sending/receiving broadcast packets + properly [LS] KallistiOS version 1.2.0 ----------------------------------------------- - DC Fix to use DCARM7_CFLAGS when compiling ARM driver [Christian Groessler == CG] Modified: kos/include/kos/net.h =================================================================== --- kos/include/kos/net.h 2008-09-04 03:22:20 UTC (rev 605) +++ kos/include/kos/net.h 2008-09-10 01:31:31 UTC (rev 606) @@ -55,6 +55,9 @@ /* The device's gateway's IP address */ uint8 gateway[4]; + /* The device's broadcast address */ + uint8 broadcast[4]; + /* All of the following callback functions should return a negative value on failure, and a zero or positive value on success. Some functions have special values, as noted. */ Modified: kos/kernel/arch/dreamcast/hardware/network/broadband_adapter.c =================================================================== --- kos/kernel/arch/dreamcast/hardware/network/broadband_adapter.c 2008-09-04 03:22:20 UTC (rev 605) +++ kos/kernel/arch/dreamcast/hardware/network/broadband_adapter.c 2008-09-10 01:31:31 UTC (rev 606) @@ -1015,6 +1015,7 @@ memcpy(bba_if.ip_addr, isp.ip, 4); memcpy(bba_if.netmask, isp.nm, 4); memcpy(bba_if.gateway, isp.gw, 4); + memcpy(bba_if.broadcast, isp.bc, 4); } /* Initialize */ Modified: kos/kernel/arch/dreamcast/hardware/network/lan_adapter.c =================================================================== --- kos/kernel/arch/dreamcast/hardware/network/lan_adapter.c 2008-09-04 03:22:20 UTC (rev 605) +++ kos/kernel/arch/dreamcast/hardware/network/lan_adapter.c 2008-09-10 01:31:31 UTC (rev 606) @@ -649,6 +649,7 @@ memcpy(la_if.ip_addr, isp.ip, 4); memcpy(la_if.netmask, isp.nm, 4); memcpy(la_if.gateway, isp.gw, 4); + memcpy(la_if.broadcast, isp.bc, 4); } /* Initialize */ Modified: kos/kernel/net/net_icmp.c =================================================================== --- kos/kernel/net/net_icmp.c 2008-09-04 03:22:20 UTC (rev 605) +++ kos/kernel/net/net_icmp.c 2008-09-10 01:31:31 UTC (rev 606) @@ -90,15 +90,14 @@ /* Handle Echo (ICMP type 8) packets */ static void net_icmp_input_8(netif_t *src, ip_hdr_t *ip, icmp_hdr_t *icmp, const uint8 *d, int s) { - int i; - /* Set type to echo reply */ icmp->type = 0; - /* Swap source and dest ip addresses */ - i = ip->src; - ip->src = ip->dest; - ip->dest = i; + /* Set the destination to the original source, and substitute in our IP + for the src (done this way so that pings that are broadcasted get an + appropriate reply). */ + ip->dest = ip->src; + ip->src = htonl(net_ipv4_address(src->ip_addr)); /* Recompute the IP header checksum */ ip->checksum = 0; Modified: kos/kernel/net/net_ipv4.c =================================================================== --- kos/kernel/net/net_ipv4.c 2008-09-04 03:22:20 UTC (rev 605) +++ kos/kernel/net/net_ipv4.c 2008-09-10 01:31:31 UTC (rev 606) @@ -73,6 +73,18 @@ return 1; } +/* Determine if a given IP is the adapter's broadcast address. */ +static int is_broadcast(const uint8 dest[4], const uint8 bc[4]) { + int i; + + for(i = 0; i < 4; ++i) { + if(dest[i] != bc[i]) + return 0; + } + + return 1; +} + /* Send a packet on the specified network adapter */ int net_ipv4_send_packet(netif_t *net, ip_hdr_t *hdr, const uint8 *data, int size) { @@ -88,8 +100,8 @@ net_ipv4_parse_address(ntohl(hdr->dest), dest_ip); - /* Is this the loopback address (127.0.0.1)? */ - if(ntohl(hdr->dest) == 0x7F000001) { + /* Is this a loopback address (127/8)? */ + if((dest_ip[0] & 0xFF) == 0x7F) { /* Put the IP header / data into our packet */ memcpy(pkt, hdr, 4 * (hdr->version_ihl & 0x0f)); memcpy(pkt + 4 * (hdr->version_ihl & 0x0f), data, size); @@ -99,23 +111,30 @@ return 0; } - - /* Is it in our network? */ - if(!is_in_network(net->ip_addr, dest_ip, net->netmask)) { - memcpy(dest_ip, net->gateway, 4); + + /* Are we sending a broadcast packet? */ + if(hdr->dest == 0xFFFFFFFF || is_broadcast(dest_ip, net->broadcast)) { + /* Set the destination to the datalink layer broadcast address. */ + memset(dest_mac, 0xFF, 6); } + else { + /* Is it in our network? */ + if(!is_in_network(net->ip_addr, dest_ip, net->netmask)) { + memcpy(dest_ip, net->gateway, 4); + } - /* Get our destination's MAC address. If we do not have the MAC address - cached, return a distinguished error to the upper-level protocol so - that it can decide what to do. */ - err = net_arp_lookup(net, dest_ip, dest_mac); - if(err == -1) { - errno = ENETUNREACH; - return -1; + /* Get our destination's MAC address. If we do not have the MAC address + cached, return a distinguished error to the upper-level protocol so + that it can decide what to do. */ + err = net_arp_lookup(net, dest_ip, dest_mac); + if(err == -1) { + errno = ENETUNREACH; + return -1; + } + else if(err == -2) { + return -2; + } } - else if(err == -2) { - return -2; - } /* Fill in the ethernet header */ ehdr = (eth_hdr_t *)pkt; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <los...@us...> - 2008-09-12 23:08:41
|
Revision: 607 http://cadcdev.svn.sourceforge.net/cadcdev/?rev=607&view=rev Author: lostgeneration Date: 2008-09-12 19:18:31 +0000 (Fri, 12 Sep 2008) Log Message: ----------- Fixed GBA arch/types.h so cross compiler can be made. Modified Paths: -------------- kos/doc/CHANGELOG kos/kernel/arch/gba/include/arch/types.h Modified: kos/doc/CHANGELOG =================================================================== --- kos/doc/CHANGELOG 2008-09-10 01:31:31 UTC (rev 606) +++ kos/doc/CHANGELOG 2008-09-12 19:18:31 UTC (rev 607) @@ -171,6 +171,7 @@ - DC Made vid_screen_shot support any of the video modes [DH] - *** Fixes to the network stack to support sending/receiving broadcast packets properly [LS] +- GBA Fixed arch/types.h so the toolchain can compile. [HL] KallistiOS version 1.2.0 ----------------------------------------------- - DC Fix to use DCARM7_CFLAGS when compiling ARM driver [Christian Groessler == CG] Modified: kos/kernel/arch/gba/include/arch/types.h =================================================================== --- kos/kernel/arch/gba/include/arch/types.h 2008-09-10 01:31:31 UTC (rev 606) +++ kos/kernel/arch/gba/include/arch/types.h 2008-09-12 19:18:31 UTC (rev 607) @@ -61,9 +61,11 @@ typedef unsigned short ushort; typedef unsigned int uint; +#if 0 /* File-specific types */ typedef size_t ssize_t; typedef size_t off_t; +#endif /* This type may be used for any generic handle type that is allowed to be negative (for errors) and has no specific bit count This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ljs...@us...> - 2008-09-17 09:10:19
|
Revision: 609 http://cadcdev.svn.sourceforge.net/cadcdev/?rev=609&view=rev Author: ljsebald Date: 2008-09-17 16:10:14 +0000 (Wed, 17 Sep 2008) Log Message: ----------- Adding in code to fetch ISP settings that are set by PlanetWeb. Also, this commit includes various fixups for the fact that the flashrom_ispcfg_t struct got a bit of a makeover in the process so that it supports both PlanetWeb and DreamPassport in a generic fashion. Modified Paths: -------------- kos/addons/libkosutils/netcfg.c kos/doc/CHANGELOG kos/kernel/arch/dreamcast/hardware/flashrom.c kos/kernel/arch/dreamcast/hardware/network/broadband_adapter.c kos/kernel/arch/dreamcast/hardware/network/lan_adapter.c kos/kernel/arch/dreamcast/include/dc/flashrom.h Modified: kos/addons/libkosutils/netcfg.c =================================================================== --- kos/addons/libkosutils/netcfg.c 2008-09-14 03:54:09 UTC (rev 608) +++ kos/addons/libkosutils/netcfg.c 2008-09-17 16:10:14 UTC (rev 609) @@ -175,32 +175,37 @@ ((src[2]) << 8) | \ ((src[3]) << 0) - if (cfg.ip_valid) { + if (cfg.valid_fields & FLASHROM_ISP_IP) READIP(out->ip, cfg.ip); + if (cfg.valid_fields & FLASHROM_ISP_GATEWAY) READIP(out->gateway, cfg.gw); + if (cfg.valid_fields & FLASHROM_ISP_NETMASK) READIP(out->netmask, cfg.nm); + if (cfg.valid_fields & FLASHROM_ISP_BROADCAST) READIP(out->broadcast, cfg.bc); + if (cfg.valid_fields & FLASHROM_ISP_DNS) { READIP(out->dns[0], cfg.dns[0]); READIP(out->dns[1], cfg.dns[1]); + } + if (cfg.valid_fields & FLASHROM_ISP_HOSTNAME) strcpy(out->hostname, cfg.hostname); - } - if (cfg.email_valid) + if (cfg.valid_fields & FLASHROM_ISP_EMAIL) strcpy(out->email, cfg.email); - if (cfg.smtp_valid) + if (cfg.valid_fields & FLASHROM_ISP_SMTP) strcpy(out->smtp, cfg.smtp); - if (cfg.pop3_valid) + if (cfg.valid_fields & FLASHROM_ISP_POP3) strcpy(out->pop3, cfg.pop3); - if (cfg.pop3_login_valid) + if (cfg.valid_fields & FLASHROM_ISP_POP3_USER) strcpy(out->pop3_login, cfg.pop3_login); - if (cfg.pop3_passwd_valid) { + if (cfg.valid_fields & FLASHROM_ISP_POP3_PASS) strcpy(out->pop3_passwd, cfg.pop3_passwd); + if (cfg.valid_fields & FLASHROM_ISP_PROXY_PORT) out->proxy_port = cfg.proxy_port; - } - if (cfg.ppp_login_valid) { + if (cfg.valid_fields & FLASHROM_ISP_PROXY_HOST) strcpy(out->proxy_host, cfg.proxy_host); + if (cfg.valid_fields & FLASHROM_ISP_PPP_USER) strcpy(out->ppp_login, cfg.ppp_login); - } - if (cfg.ppp_passwd_valid) + if (cfg.valid_fields & FLASHROM_ISP_PPP_PASS) strcpy(out->ppp_passwd, cfg.ppp_passwd); #undef READIP Modified: kos/doc/CHANGELOG =================================================================== --- kos/doc/CHANGELOG 2008-09-14 03:54:09 UTC (rev 608) +++ kos/doc/CHANGELOG 2008-09-17 16:10:14 UTC (rev 609) @@ -172,6 +172,10 @@ - *** Fixes to the network stack to support sending/receiving broadcast packets properly [LS] - GBA Fixed arch/types.h so the toolchain can compile. [HL] +- DC Adjusted the flashrom_ispcfg_t structure to account for differences + between PlanetWeb and DreamPassport [LS] +- DC Added reading of the ISP settings from PlanetWeb to the flashrom code [LS] +- DC Fixed various pieces of code that rely on flashrom_ispcfg_t [LS] KallistiOS version 1.2.0 ----------------------------------------------- - DC Fix to use DCARM7_CFLAGS when compiling ARM driver [Christian Groessler == CG] Modified: kos/kernel/arch/dreamcast/hardware/flashrom.c =================================================================== --- kos/kernel/arch/dreamcast/hardware/flashrom.c 2008-09-14 03:54:09 UTC (rev 608) +++ kos/kernel/arch/dreamcast/hardware/flashrom.c 2008-09-17 16:10:14 UTC (rev 609) @@ -2,6 +2,7 @@ flashrom.c Copyright (c)2003 Dan Potter + Copyright (C)2008 Lawrence Sebald */ /* @@ -21,8 +22,6 @@ #include <dc/flashrom.h> #include <arch/irq.h> -CVSID("$Id: flashrom.c,v 1.4 2003/03/10 01:45:31 bardtx Exp $"); - /* This is the fateful define. Re-enable this at the peril of your Dreamcast's soul ;) */ /* #define ENABLE_WRITES 1 */ @@ -371,7 +370,9 @@ memcpy(out->dns[1], isp->e0.dns2, 4); memcpy(out->hostname, isp->e0.hostname, 24); - out->ip_valid = 1; + out->valid_fields |= FLASHROM_ISP_IP | FLASHROM_ISP_NETMASK | + FLASHROM_ISP_BROADCAST | FLASHROM_ISP_GATEWAY | FLASHROM_ISP_DNS | + FLASHROM_ISP_HOSTNAME; found++; } @@ -380,7 +381,7 @@ /* Fill in the values from it */ memcpy(out->email, isp->e2.email, 48); - out->email_valid = 1; + out->valid_fields |= FLASHROM_ISP_EMAIL; found++; } @@ -389,7 +390,7 @@ /* Fill in the values from it */ memcpy(out->smtp, isp->e4.smtp, 28); - out->smtp_valid = 1; + out->valid_fields |= FLASHROM_ISP_SMTP; found++; } @@ -398,7 +399,7 @@ /* Fill in the values from it */ memcpy(out->pop3, isp->e5.pop3, 24); - out->pop3_valid = 1; + out->valid_fields |= FLASHROM_ISP_POP3; found++; } @@ -407,7 +408,7 @@ /* Fill in the values from it */ memcpy(out->pop3_login, isp->e6.pop3_login, 20); - out->pop3_login_valid = 1; + out->valid_fields |= FLASHROM_ISP_POP3_USER; found++; } @@ -417,7 +418,7 @@ memcpy(out->pop3_passwd, isp->e7.pop3_passwd, 32); memcpy(out->proxy_host, isp->e7.proxy_host, 16); - out->pop3_passwd_valid = 1; + out->valid_fields |= FLASHROM_ISP_POP3_PASS | FLASHROM_ISP_PROXY_HOST; found++; } @@ -427,7 +428,7 @@ out->proxy_port = isp->e8.proxy_port; memcpy(out->ppp_login, isp->e8.ppp_login, 8); - out->ppp_login_valid = 1; + out->valid_fields |= FLASHROM_ISP_PROXY_PORT | FLASHROM_ISP_PPP_USER; found++; } @@ -436,9 +437,353 @@ /* Fill in the values from it */ memcpy(out->ppp_passwd, isp->e9.ppp_passwd, 20); - out->ppp_passwd_valid = 1; + out->valid_fields |= FLASHROM_ISP_PPP_PASS; found++; } return found > 0 ? 0 : -1; } + +/* Structure of the ISP configuration blocks created by PlanetWeb (confirmed on + version 1.0 and 2.1; some fields are longer on 2.1, but they always extend + into what would be padding in 1.0). */ +typedef struct { + union { + struct { + /* Block 0x80 */ + uint16 blockid; /* Should be 0x80 */ + char prodname[9]; /* Should be 'PWBrowser' */ + uint8 unk1[2]; /* Unknown: 00 16 (1.0), 00 1C (2.1) */ + uint8 dial_areacode; /* 1 = Dial area code, 0 = don't */ + char out_prefix[8]; /* Outside dial prefix */ + uint8 padding1[8]; + char email_pt2[16]; /* Second? part of email address (2.1) */ + char cw_prefix[8]; /* Call waiting prefix */ + uint8 padding2[8]; + uint16 crc; + } b80; + + struct { + /* Block 0x81 */ + uint16 blockid; /* Should be 0x81 */ + char email_pt3[14]; /* Third? part of email address (2.1)*/ + uint8 padding1[2]; + char real_name[30]; /* The "Real Name" (21 bytes on 1.0) */ + uint8 padding2[14]; + uint16 crc; + } b81; + + struct { + /* Block 0x82 */ + uint16 blockid; /* Should be 0x82 */ + uint8 padding1[30]; + char modem_str[30]; /* Modem init string (confirmed on 2.1) */ + uint16 crc; + } b82; + + struct { + /* Block 0x83 */ + uint16 blockid; /* Should be 0x83 */ + uint8 modem_str2[2]; /* Modem init string continued */ + char area_code[3]; + uint8 padding2[29]; + char ld_prefix[20]; /* Long-distance prefix */ + uint8 padding3[6]; + uint16 crc; + } b83; + + struct { + /* Block 0x84 -- This one is pretty much mostly a mystery. */ + uint16 blockid; /* Should be 0x84 */ + uint8 unk1[6]; /* Might be padding, all 0x00s */ + uint8 use_proxy; /* 1 = use proxy, 0 = don't */ + uint8 unk2[53]; /* No idea on this stuff... */ + uint16 crc; + } b84; + + /* Other 0x80 range blocks might be used, but I don't really know what + would be in them. */ + + struct { + /* Block 0xC0 */ + uint16 blockid; /* Should be 0xC0 */ + uint8 unk1; /* Might be padding? (0x00) */ + uint8 settings; /* Bitfield: + bit 0 = pulse dial (1) or tone dial (0), + bit 7 = blind dial (1) or not (0) */ + uint8 unk2[2]; /* Might be padding (0x00 0x00) */ + char prodname[4]; /* Should be 'SEGA' */ + char ppp_login[28]; + char ppp_passwd[16]; + char ac1[5]; /* Area code for phone 1, in parenthesis */ + char phone1_pt1[3]; /* First three digits of phone 1 */ + uint16 crc; + } c0; + + struct { + /* Block 0xC1 */ + uint16 blockid; /* Should be 0xC1 */ + char phone1_pt2[22]; /* Rest of phone 1 */ + uint8 padding[10]; + char ac2[5]; /* Area code for phone 2, in parenthesis */ + char phone2_pt1[23]; /* First 23 digits of phone 2 */ + uint16 crc; + } c1; + + struct { + /* Block 0xC2 */ + uint16 blockid; /* Should be 0xC2 */ + char phone2_pt2[2]; /* Last two digits of phone 2 */ + uint8 padding[50]; + uint8 dns1[4]; /* DNS 1, big endian notation */ + uint8 dns2[4]; /* DNS 2, big endian notation */ + uint16 crc; + } c2; + + struct { + /* Block 0xC3 */ + uint16 blockid; /* Should be 0xC3 */ + char email_p1[32]; /* First? part of the email address + (This is the only part on 1.0) */ + uint8 padding[16]; + char out_srv_p1[12]; /* Outgoing email server, first 12 chars */ + uint16 crc; + } c3; + + struct { + /* Block 0xC4 */ + uint16 blockid; /* Should be 0xC4 */ + char out_srv_p2[18]; /* Rest of outgoing email server */ + uint8 padding1[2]; + char in_srv[30]; /* Incoming email server */ + uint8 padding2[2]; + char em_login_p1[8]; /* Email login, first 8 chars */ + uint16 crc; + } c4; + + struct { + /* Block 0xC5 */ + uint16 blockid; /* Should be 0xC5 */ + char em_login_p2[8]; /* Rest of email login */ + char em_passwd[16]; /* Email password */ + char proxy_srv[30]; /* Proxy Server */ + uint8 padding1[2]; + uint16 proxy_port; /* Proxy port, little endian notation */ + uint8 padding2[2]; + uint16 crc; + } c5; + + /* Blocks 0xC6 - 0xCB also appear to be used by PlanetWeb, but are + always blank in my tests. My only guess is that they were storage + for a potential second ISP setting set. */ + }; +} pw_isp_settings_t; + +int flashrom_get_pw_ispcfg(flashrom_ispcfg_t *out) { + uint8 buffer[64]; + pw_isp_settings_t *isp = (pw_isp_settings_t *)buffer; + + /* Clear our output buffer completely. */ + memset(out, 0, sizeof(flashrom_ispcfg_t)); + + /* Get the 0x80 block first, and check if its valid. */ + if(flashrom_get_block(FLASHROM_PT_BLOCK_1, FLASHROM_B1_PW_SETTINGS_1, buffer) >= 0) { + /* Make sure the product name is 'PWBrowser' */ + if(strncmp(isp->b80.prodname, "PWBrowser", 9)) { + return -1; + } + + /* Determine if the dial area code option is set or not. */ + if(isp->b80.dial_areacode) { + out->flags |= FLASHROM_ISP_DIAL_AREACODE; + } + + /* Copy out the outside dial prefix. */ + strncpy(out->out_prefix, isp->b80.out_prefix, 8); + out->out_prefix[8] = '\0'; + out->valid_fields |= FLASHROM_ISP_OUT_PREFIX; + + /* Copy out the call waiting prefix. */ + strncpy(out->cw_prefix, isp->b80.cw_prefix, 8); + out->cw_prefix[8] = '\0'; + out->valid_fields |= FLASHROM_ISP_CW_PREFIX; + + /* Copy the second part of the email address (if it exists). We don't + set the email as valid here, since that really depends on the first + part being found (PW 1.0 doesn't store anything in this place). */ + strncpy(out->email + 32, isp->b80.email_pt2, 16); + } + else { + /* If we couldn't find the PWBrowser block, punt, the PlanetWeb settings + most likely do not exist. */ + return -1; + } + + /* Grab block 0x81 */ + if(flashrom_get_block(FLASHROM_PT_BLOCK_1, FLASHROM_B1_PW_SETTINGS_2, buffer) >= 0) { + /* Copy the third part of the email address to the appropriate place. + Note that PlanetWeb 1.0 doesn't store anything here, thus we'll just + copy a null terminator. */ + strncpy(out->email + 32 + 16, isp->b81.email_pt3, 14); + + /* Copy out the "Real Name" field. */ + strncpy(out->real_name, isp->b81.real_name, 30); + out->real_name[30] = '\0'; + out->valid_fields |= FLASHROM_ISP_REAL_NAME; + } + + /* Grab block 0x82 */ + if(flashrom_get_block(FLASHROM_PT_BLOCK_1, FLASHROM_B1_PW_SETTINGS_3, buffer) >= 0) { + /* The only thing in this block is the modem init string, go ahead and + copy it to our destination. */ + strncpy(out->modem_init, isp->b82.modem_str, 30); + out->modem_init[30] = '\0'; + out->valid_fields |= FLASHROM_ISP_MODEM_INIT; + } + + /* Grab block 0x83 */ + if(flashrom_get_block(FLASHROM_PT_BLOCK_1, FLASHROM_B1_PW_SETTINGS_4, buffer) >= 0) { + /* The modem init string continues at the start of this block. */ + strncpy(out->modem_init + 30, isp->b83.modem_str2, 2); + out->modem_init[32] = '\0'; + + /* Copy out the area code next. */ + strncpy(out->area_code, isp->b83.area_code, 3); + out->area_code[3] = '\0'; + out->valid_fields |= FLASHROM_ISP_AREA_CODE; + + /* Copy the long-distance dial prefix */ + strncpy(out->ld_prefix, isp->b83.ld_prefix, 20); + out->ld_prefix[20] = '\0'; + out->valid_fields |= FLASHROM_ISP_LD_PREFIX; + } + + /* Grab block 0x84 -- Most of this block is currently unknown */ + if(flashrom_get_block(FLASHROM_PT_BLOCK_1, FLASHROM_B1_PW_SETTINGS_5, buffer) >= 0) { + /* The only thing currently known in here is the use proxy flag. */ + if(isp->b84.use_proxy) { + out->flags |= FLASHROM_ISP_USE_PROXY; + } + } + + /* Other 0x85-0x8F blocks might be used, but I have no ideas on their use. */ + + /* Grab block 0xC0 */ + if(flashrom_get_block(FLASHROM_PT_BLOCK_1, FLASHROM_B1_PW_PPP1, buffer) >= 0) { + /* Make sure the product id is "SEGA". */ + if(strncmp(isp->c0.prodname, "SEGA", 4)) { + return -1; + } + + /* Check the settings first. */ + if(isp->c0.settings & 0x01) { + out->flags |= FLASHROM_ISP_PULSE_DIAL; + } + + if(isp->c0.settings & 0x80) { + out->flags |= FLASHROM_ISP_BLIND_DIAL; + } + + /* Grab the PPP Username. */ + strncpy(out->ppp_login, isp->c0.ppp_login, 28); + out->ppp_login[28] = '\0'; + out->valid_fields |= FLASHROM_ISP_PPP_USER; + + /* Grab the PPP Password. */ + strncpy(out->ppp_passwd, isp->c0.ppp_passwd, 16); + out->ppp_passwd[16] = '\0'; + out->valid_fields |= FLASHROM_ISP_PPP_PASS; + + /* Grab the area code for phone 1, stripping away the parenthesis. */ + strncpy(out->p1_areacode, isp->c0.ac1 + 1, 3); + out->p1_areacode[3] = '\0'; + + /* Grab the start of phone number 1. */ + strncpy(out->phone1, isp->c0.phone1_pt1, 3); + out->phone1[3] = '\0'; + } + + /* Grab block 0xC1 */ + if(flashrom_get_block(FLASHROM_PT_BLOCK_1, FLASHROM_B1_PW_PPP2, buffer) >= 0) { + /* Grab the rest of phone number 1. */ + strncpy(out->phone1 + 3, isp->c1.phone1_pt2, 22); + out->phone1[25] = '\0'; + out->valid_fields |= FLASHROM_ISP_PHONE1; + + /* Grab the area code for phone 2, stripping away the parenthesis. */ + strncpy(out->p2_areacode, isp->c1.ac2 + 1, 3); + out->p2_areacode[3] = '\0'; + + /* Grab the start of phone number 2. */ + strncpy(out->phone2, isp->c1.phone2_pt1, 23); + out->phone2[23] = '\0'; + } + + /* Grab block 0xC2 */ + if(flashrom_get_block(FLASHROM_PT_BLOCK_1, FLASHROM_B1_PW_DNS, buffer) >= 0) { + /* Grab the last two digits of phone number 2. */ + out->phone2[23] = isp->c2.phone2_pt2[0]; + out->phone2[24] = isp->c2.phone2_pt2[1]; + out->phone2[25] = '\0'; + out->valid_fields |= FLASHROM_ISP_PHONE2; + + /* Grab the two DNS addresses. */ + memcpy(out->dns[0], isp->c2.dns1, 4); + memcpy(out->dns[1], isp->c2.dns2, 4); + out->valid_fields |= FLASHROM_ISP_DNS; + } + + /* Grab block 0xC3 */ + if(flashrom_get_block(FLASHROM_PT_BLOCK_1, FLASHROM_B1_PW_EMAIL1, buffer) >= 0) { + /* Grab the beginning of the email address (or all of it in PW 1.0). */ + strncpy(out->email, isp->c3.email_p1, 32); + out->valid_fields |= FLASHROM_ISP_EMAIL; + + /* Grab the beginning of the SMTP server. */ + strncpy(out->smtp, isp->c3.out_srv_p1, 12); + out->smtp[12] = '\0'; + } + + /* Grab block 0xC4 */ + if(flashrom_get_block(FLASHROM_PT_BLOCK_1, FLASHROM_B1_PW_EMAIL2, buffer) >= 0) { + /* Grab the end of the SMTP server. */ + strncpy(out->smtp + 12, isp->c4.out_srv_p2, 18); + out->smtp[30] = '\0'; + out->valid_fields |= FLASHROM_ISP_SMTP; + + /* Grab the POP3 server. */ + strncpy(out->pop3, isp->c4.in_srv, 30); + out->pop3[30] = '\0'; + out->valid_fields |= FLASHROM_ISP_POP3; + + /* Grab the beginning of the POP3 login. */ + strncpy(out->pop3_login, isp->c4.em_login_p1, 8); + out->pop3_login[8] = '\0'; + } + + /* Grab block 0xC5 */ + if(flashrom_get_block(FLASHROM_PT_BLOCK_1, FLASHROM_B1_PW_EMAIL_PROXY, buffer) >= 0) { + /* Grab the end of the POP3 login. */ + strncpy(out->pop3_login + 8, isp->c5.em_login_p2, 8); + out->pop3_login[16] = '\0'; + out->valid_fields |= FLASHROM_ISP_POP3_USER; + + /* Grab the POP3 password. */ + strncpy(out->pop3_passwd, isp->c5.em_passwd, 16); + out->pop3_passwd[16] = '\0'; + out->valid_fields |= FLASHROM_ISP_POP3_PASS; + + /* Grab the proxy server. */ + strncpy(out->proxy_host, isp->c5.proxy_srv, 30); + out->proxy_host[30] = '\0'; + out->valid_fields |= FLASHROM_ISP_PROXY_HOST; + + /* Grab the proxy port. */ + out->proxy_port = isp->c5.proxy_port; + out->valid_fields |= FLASHROM_ISP_PROXY_PORT; + } + + out->method = FLASHROM_ISP_DIALUP; + + return out->valid_fields == 0 ? -2 : 0; +} Modified: kos/kernel/arch/dreamcast/hardware/network/broadband_adapter.c =================================================================== --- kos/kernel/arch/dreamcast/hardware/network/broadband_adapter.c 2008-09-14 03:54:09 UTC (rev 608) +++ kos/kernel/arch/dreamcast/hardware/network/broadband_adapter.c 2008-09-17 16:10:14 UTC (rev 609) @@ -1002,11 +1002,13 @@ /* Set ISP configuration from the flashrom, as long as we're configured staticly */ static void bba_set_ispcfg() { flashrom_ispcfg_t isp; + uint32 fields = FLASHROM_ISP_IP | FLASHROM_ISP_NETMASK | + FLASHROM_ISP_BROADCAST | FLASHROM_ISP_GATEWAY; if(flashrom_get_ispcfg(&isp) == -1) return; - if(!isp.ip_valid) + if((isp.valid_fields & fields) != fields) return; if(isp.method != FLASHROM_ISP_STATIC) Modified: kos/kernel/arch/dreamcast/hardware/network/lan_adapter.c =================================================================== --- kos/kernel/arch/dreamcast/hardware/network/lan_adapter.c 2008-09-14 03:54:09 UTC (rev 608) +++ kos/kernel/arch/dreamcast/hardware/network/lan_adapter.c 2008-09-17 16:10:14 UTC (rev 609) @@ -636,11 +636,13 @@ /* Set ISP configuration from the flashrom, as long as we're configured staticly */ static void la_set_ispcfg() { flashrom_ispcfg_t isp; + uint32 fields = FLASHROM_ISP_IP | FLASHROM_ISP_NETMASK | + FLASHROM_ISP_BROADCAST | FLASHROM_ISP_GATEWAY; if(flashrom_get_ispcfg(&isp) == -1) return; - if(!isp.ip_valid) + if((isp.valid_fields & fields) != fields) return; if(isp.method != FLASHROM_ISP_STATIC) Modified: kos/kernel/arch/dreamcast/include/dc/flashrom.h =================================================================== --- kos/kernel/arch/dreamcast/include/dc/flashrom.h 2008-09-14 03:54:09 UTC (rev 608) +++ kos/kernel/arch/dreamcast/include/dc/flashrom.h 2008-09-17 16:10:14 UTC (rev 609) @@ -2,8 +2,8 @@ kernel/arch/dreamcast/include/dc/flashrom.h Copyright (C)2003 Dan Potter + Copyright (C)2008 Lawrence Sebald - $Id: flashrom.h,v 1.4 2003/03/10 01:45:32 bardtx Exp $ */ @@ -36,15 +36,26 @@ /** An enumeration of logical blocks available in the flashrom. */ -#define FLASHROM_B1_SYSCFG 0x05 /*< System config (BLOCK_1) */ -#define FLASHROM_B1_IP_SETTINGS 0xE0 /*< IP settings for BBA (BLOCK_1) */ -#define FLASHROM_B1_EMAIL 0xE2 /*< Email address (BLOCK_1) */ -#define FLASHROM_B1_SMTP 0xE4 /*< SMTP server setting (BLOCK_1) */ -#define FLASHROM_B1_POP3 0xE5 /*< POP3 server setting (BLOCK_1) */ -#define FLASHROM_B1_POP3LOGIN 0xE6 /*< POP3 login setting (BLOCK_1) */ -#define FLASHROM_B1_POP3PASSWD 0xE7 /*< POP3 password setting + proxy (BLOCK_1) */ -#define FLASHROM_B1_PPPLOGIN 0xE8 /*< PPP username + proxy (BLOCK_1) */ -#define FLASHROM_B1_PPPPASSWD 0xE9 /*< PPP passwd (BLOCK_1) */ +#define FLASHROM_B1_SYSCFG 0x05 /*< System config (BLOCK_1) */ +#define FLASHROM_B1_PW_SETTINGS_1 0x80 /*< PlanetWeb settings (BLOCK_1) */ +#define FLASHROM_B1_PW_SETTINGS_2 0x81 /*< PlanetWeb settings (BLOCK_1) */ +#define FLASHROM_B1_PW_SETTINGS_3 0x82 /*< PlanetWeb settings (BLOCK_1) */ +#define FLASHROM_B1_PW_SETTINGS_4 0x83 /*< PlanetWeb settings (BLOCK_1) */ +#define FLASHROM_B1_PW_SETTINGS_5 0x84 /*< PlanetWeb settings (BLOCK_1) */ +#define FLASHROM_B1_PW_PPP1 0xC0 /*< PlanetWeb PPP settings (BLOCK_1) */ +#define FLASHROM_B1_PW_PPP2 0xC1 /*< PlanetWeb PPP settings (BLOCK_1) */ +#define FLASHROM_B1_PW_DNS 0xC2 /*< PlanetWeb DNS settings (BLOCK_1) */ +#define FLASHROM_B1_PW_EMAIL1 0xC3 /*< PlanetWeb Email settings (BLOCK_1) */ +#define FLASHROM_B1_PW_EMAIL2 0xC4 /*< PlanetWeb Email settings (BLOCK_1) */ +#define FLASHROM_B1_PW_EMAIL_PROXY 0xC5 /*< PlanetWeb Email/Proxy settings (BLOCK_1) */ +#define FLASHROM_B1_IP_SETTINGS 0xE0 /*< IP settings for BBA (BLOCK_1) */ +#define FLASHROM_B1_EMAIL 0xE2 /*< Email address (BLOCK_1) */ +#define FLASHROM_B1_SMTP 0xE4 /*< SMTP server setting (BLOCK_1) */ +#define FLASHROM_B1_POP3 0xE5 /*< POP3 server setting (BLOCK_1) */ +#define FLASHROM_B1_POP3LOGIN 0xE6 /*< POP3 login setting (BLOCK_1) */ +#define FLASHROM_B1_POP3PASSWD 0xE7 /*< POP3 password setting + proxy (BLOCK_1) */ +#define FLASHROM_B1_PPPLOGIN 0xE8 /*< PPP username + proxy (BLOCK_1) */ +#define FLASHROM_B1_PPPPASSWD 0xE9 /*< PPP passwd (BLOCK_1) */ /** Implements the FLASHROM_INFO syscall; given a partition ID, @@ -133,50 +144,90 @@ #define FLASHROM_ISP_PPPOE 4 /** - This struct will be filled by calling flashrom_get_isp_settings below. - Thanks to Sam Steele for this info. */ + Valid field constants in the ispcfg structure. */ +#define FLASHROM_ISP_IP (1 << 0) +#define FLASHROM_ISP_NETMASK (1 << 1) +#define FLASHROM_ISP_BROADCAST (1 << 2) +#define FLASHROM_ISP_GATEWAY (1 << 3) +#define FLASHROM_ISP_DNS (1 << 4) +#define FLASHROM_ISP_HOSTNAME (1 << 5) +#define FLASHROM_ISP_EMAIL (1 << 6) +#define FLASHROM_ISP_SMTP (1 << 7) +#define FLASHROM_ISP_POP3 (1 << 8) +#define FLASHROM_ISP_POP3_USER (1 << 9) +#define FLASHROM_ISP_POP3_PASS (1 << 10) +#define FLASHROM_ISP_PROXY_HOST (1 << 11) +#define FLASHROM_ISP_PROXY_PORT (1 << 12) +#define FLASHROM_ISP_PPP_USER (1 << 13) +#define FLASHROM_ISP_PPP_PASS (1 << 14) +#define FLASHROM_ISP_OUT_PREFIX (1 << 15) +#define FLASHROM_ISP_CW_PREFIX (1 << 16) +#define FLASHROM_ISP_REAL_NAME (1 << 17) +#define FLASHROM_ISP_MODEM_INIT (1 << 18) +#define FLASHROM_ISP_AREA_CODE (1 << 19) +#define FLASHROM_ISP_LD_PREFIX (1 << 20) +#define FLASHROM_ISP_PHONE1 (1 << 21) +#define FLASHROM_ISP_PHONE2 (1 << 22) + +/** + Flags for the ispcfg structure */ +#define FLASHROM_ISP_DIAL_AREACODE (1 << 0) +#define FLASHROM_ISP_USE_PROXY (1 << 1) +#define FLASHROM_ISP_PULSE_DIAL (1 << 2) +#define FLASHROM_ISP_BLIND_DIAL (1 << 3) + +/** + This struct will be filled by calling flashrom_get_ispcfg below. + Thanks to Sam Steele for the information on DreamPassport's ISP settings. + Note that this structure has been completely reworked so that it is more + generic and can support both DreamPassport and PlanetWeb's settings. */ typedef struct flashrom_ispcfg { - int ip_valid; /*< >0 if the IP settings are valid */ int method; /*< DHCP, Static, dialup(?), PPPoE */ + uint32 valid_fields; /*< Which fields are valid? */ + uint32 flags; /*< Various flags that can be set in options */ + uint8 ip[4]; /*< Host IP address */ uint8 nm[4]; /*< Netmask */ uint8 bc[4]; /*< Broadcast address */ uint8 gw[4]; /*< Gateway address */ uint8 dns[2][4]; /*< DNS servers (2) */ + int proxy_port; /*< Proxy server port */ char hostname[24]; /*< DHCP/Host name */ - - int email_valid; /*< >0 if the email setting is valid */ - char email[48]; /*< Email address */ - - int smtp_valid; /*< >0 if the smtp setting is valid */ - char smtp[28]; /*< SMTP server */ - - int pop3_valid; /*< >0 if the pop3 setting is valid */ - char pop3[24]; /*< POP3 server */ - - int pop3_login_valid; /*< >0 if the login setting is valid */ + char email[64]; /*< Email address */ + char smtp[31]; /*< SMTP server */ + char pop3[31]; /*< POP3 server */ char pop3_login[20]; /*< POP3 login */ - - int pop3_passwd_valid; /*< >0 if the passwd/proxy setting is valid */ char pop3_passwd[32]; /*< POP3 passwd */ - char proxy_host[16]; /*< Proxy server hostname */ - - int ppp_login_valid; /*< >0 if the PPP login/proxy setting is valid */ - int proxy_port; /*< Proxy server port */ - char ppp_login[8]; /*< PPP login */ - - int ppp_passwd_valid; /*< >0 if the PPP passwd setting is valid */ + char proxy_host[31]; /*< Proxy server hostname */ + char ppp_login[29]; /*< PPP login */ char ppp_passwd[20]; /*< PPP password */ + char out_prefix[9]; /*< Outside dial prefix */ + char cw_prefix[9]; /*< Call waiting prefix */ + char real_name[31]; /*< The "Real Name" field of PlanetWeb */ + char modem_init[33]; /*< The modem init string to use */ + char area_code[4]; /*< The area code the user is in */ + char ld_prefix[21]; /*< The long-distance dial prefix */ + char p1_areacode[4]; /*< Phone number 1's area code */ + char phone1[26]; /*< Phone number 1 */ + char p2_areacode[4]; /*< Phone number 2's area code */ + char phone2[26]; /*< Phone number 2 */ } flashrom_ispcfg_t; /** - Retrieves the console's ISP settings, if they exist. These are set by - programs like Dream Passport 3. Returns -1 on error (none of the settings - can be found, or some other error), or >=0 on success. You should check - the _valid member of the matching part of the struct before relying on - the data. */ + Retrieves the console's ISP settings as set by DreamPassport, if they exist. + Returns -1 on error (none of the settings can be found, or some other error), + or >=0 on success. You should check the valid_fields bitfield for the part of + the struct you want before relying on the data. */ int flashrom_get_ispcfg(flashrom_ispcfg_t * out); +/** + Retrieves the console's ISP settings as set by PlanetWeb (1.0 and 2.1 have + been verified to work), if they exist. Returns -1 on error (generally if the + PlanetWeb settings are non-existant) or >= 0 on success. You should check the + valid_fields bitfield for the part of the struct you want before relying on + the data. */ +int flashrom_get_pw_ispcfg(flashrom_ispcfg_t *out); + /* More to come later */ __END_DECLS This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ljs...@us...> - 2008-09-21 18:39:11
|
Revision: 610 http://cadcdev.svn.sourceforge.net/cadcdev/?rev=610&view=rev Author: ljsebald Date: 2008-09-21 18:39:06 +0000 (Sun, 21 Sep 2008) Log Message: ----------- Adding in an implementation of DHCP to the network stack. Modified Paths: -------------- kos/doc/CHANGELOG kos/kernel/arch/dreamcast/hardware/network/broadband_adapter.c kos/kernel/arch/dreamcast/hardware/network/lan_adapter.c kos/kernel/net/Makefile kos/kernel/net/net_core.c Added Paths: ----------- kos/kernel/net/net_dhcp.c kos/kernel/net/net_dhcp.h Modified: kos/doc/CHANGELOG =================================================================== --- kos/doc/CHANGELOG 2008-09-17 16:10:14 UTC (rev 609) +++ kos/doc/CHANGELOG 2008-09-21 18:39:06 UTC (rev 610) @@ -176,6 +176,7 @@ between PlanetWeb and DreamPassport [LS] - DC Added reading of the ISP settings from PlanetWeb to the flashrom code [LS] - DC Fixed various pieces of code that rely on flashrom_ispcfg_t [LS] +- *** Added an implementation of DHCP to the network stack [LS] KallistiOS version 1.2.0 ----------------------------------------------- - DC Fix to use DCARM7_CFLAGS when compiling ARM driver [Christian Groessler == CG] Modified: kos/kernel/arch/dreamcast/hardware/network/broadband_adapter.c =================================================================== --- kos/kernel/arch/dreamcast/hardware/network/broadband_adapter.c 2008-09-17 16:10:14 UTC (rev 609) +++ kos/kernel/arch/dreamcast/hardware/network/broadband_adapter.c 2008-09-21 18:39:06 UTC (rev 610) @@ -1044,8 +1044,9 @@ bba_if.flags = NETIF_NO_FLAGS; bba_get_mac(bba_if.mac_addr); memset(bba_if.ip_addr, 0, sizeof(bba_if.ip_addr)); - memset(bba_if.netmask, 0, sizeof(bba_if.netmask)); - memset(bba_if.gateway, 0, sizeof(bba_if.gateway)); + memset(bba_if.netmask, 0, sizeof(bba_if.netmask)); + memset(bba_if.gateway, 0, sizeof(bba_if.gateway)); + memset(bba_if.broadcast, 0, sizeof(bba_if.broadcast)); bba_if.if_detect = bba_if_detect; bba_if.if_init = bba_if_init; bba_if.if_shutdown = bba_if_shutdown; Modified: kos/kernel/arch/dreamcast/hardware/network/lan_adapter.c =================================================================== --- kos/kernel/arch/dreamcast/hardware/network/lan_adapter.c 2008-09-17 16:10:14 UTC (rev 609) +++ kos/kernel/arch/dreamcast/hardware/network/lan_adapter.c 2008-09-21 18:39:06 UTC (rev 610) @@ -668,6 +668,7 @@ memset(la_if.ip_addr, 0, sizeof(la_if.ip_addr)); memset(la_if.netmask, 0, sizeof(la_if.netmask)); memset(la_if.gateway, 0, sizeof(la_if.gateway)); + memset(la_if.broadcast, 0, sizeof(la_if.broadcast)); la_if.if_detect = la_if_detect; la_if.if_init = la_if_init; la_if.if_shutdown = la_if_shutdown; Modified: kos/kernel/net/Makefile =================================================================== --- kos/kernel/net/Makefile 2008-09-17 16:10:14 UTC (rev 609) +++ kos/kernel/net/Makefile 2008-09-21 18:39:06 UTC (rev 610) @@ -5,7 +5,7 @@ # # $Id: Makefile,v 1.2 2002/02/10 20:31:43 bardtx Exp $ -OBJS = net_core.o net_arp.o net_input.o net_icmp.o net_ipv4.o net_udp.o +OBJS = net_core.o net_arp.o net_input.o net_icmp.o net_ipv4.o net_udp.o net_dhcp.o SUBDIRS = include $(KOS_BASE)/Makefile.prefab Modified: kos/kernel/net/net_core.c =================================================================== --- kos/kernel/net/net_core.c 2008-09-17 16:10:14 UTC (rev 609) +++ kos/kernel/net/net_core.c 2008-09-21 18:39:06 UTC (rev 610) @@ -12,7 +12,7 @@ #include <kos/net.h> #include <kos/fs_socket.h> -CVSID("$Id: net_core.c,v 1.5 2002/10/26 07:59:50 bardtx Exp $"); +#include "net_dhcp.h" /* @@ -151,6 +151,13 @@ /* Initialize the sockets-like interface */ fs_socket_init(); + /* Initialize the DHCP system */ + net_dhcp_init(); + + if(net_default_dev && !net_default_dev->ip_addr[0]) { + return net_dhcp_request(); + } + return 0; } @@ -158,6 +165,9 @@ void net_shutdown() { netif_t *cur; + /* Shut down DHCP */ + net_dhcp_shutdown(); + /* Shut down the sockets-like interface */ fs_socket_shutdown(); Added: kos/kernel/net/net_dhcp.c =================================================================== --- kos/kernel/net/net_dhcp.c (rev 0) +++ kos/kernel/net/net_dhcp.c 2008-09-21 18:39:06 UTC (rev 610) @@ -0,0 +1,652 @@ +/* KallistiOS ##version## + + kernel/net/net_dhcp.c + Copyright (C) 2008 Lawrence Sebald + +*/ + +#include <sys/types.h> +#include <sys/queue.h> +#include <sys/socket.h> +#include <arpa/inet.h> +#include <netinet/in.h> + +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <time.h> + +#include <kos/net.h> +#include <kos/thread.h> +#include <kos/genwait.h> +#include <kos/recursive_lock.h> +#include <kos/fs_socket.h> + +#include <arch/timer.h> + +#include "net_dhcp.h" + +#define DHCP_SERVER_PORT 67 +#define DHCP_CLIENT_PORT 68 + +static int dhcp_sock = -1; +struct sockaddr_in srv_addr; + +struct dhcp_pkt_out { + STAILQ_ENTRY(dhcp_pkt_out) pkt_queue; + uint8 *buf; + int size; + int pkt_type; + int next_delay; + uint64 next_send; +}; + +STAILQ_HEAD(dhcp_pkt_queue, dhcp_pkt_out); + +static struct dhcp_pkt_queue dhcp_pkts = STAILQ_HEAD_INITIALIZER(dhcp_pkts); +static recursive_lock_t *dhcp_lock = NULL; +static kthread_t *dhcp_thd = NULL; +static uint64 renew_time = 0xFFFFFFFFFFFFFFFFULL; +static uint64 rebind_time = 0xFFFFFFFFFFFFFFFFULL; +static uint64 lease_expires = 0xFFFFFFFFFFFFFFFFULL; +static int state = DHCP_STATE_INIT; + +static int net_dhcp_fill_options(netif_t *net, dhcp_pkt_t *req, uint8 msgtype, + uint32 serverid, uint32 reqip) { + int pos = 0; + + /* DHCP Magic Cookie */ + req->options[pos++] = 0x63; + req->options[pos++] = 0x82; + req->options[pos++] = 0x53; + req->options[pos++] = 0x63; + + /* Message Type: DHCPDISCOVER */ + req->options[pos++] = DHCP_OPTION_MESSAGE_TYPE; + req->options[pos++] = 1; /* Length = 1 */ + req->options[pos++] = msgtype; + + req->options[pos++] = DHCP_OPTION_PAD; /* Pad for alignment */ + + /* Max Message Length: 1024 octets */ + req->options[pos++] = DHCP_OPTION_MAX_MESSAGE; + req->options[pos++] = 2; /* Length = 2 */ + *((uint16 *)(req->options + pos)) = htons(1024); + pos += 2; + + /* Host Name: Dreamcast */ + req->options[pos++] = DHCP_OPTION_HOST_NAME; + req->options[pos++] = 10; /* Length = 10 */ + strcpy(req->options + pos, "KallistiOS"); + pos += 10; + + /* Client Identifier: The network adapter's MAC address */ + req->options[pos++] = DHCP_OPTION_CLIENT_ID; + req->options[pos++] = 1 + DHCP_HLEN_ETHERNET; /* Length = 7 */ + req->options[pos++] = DHCP_HTYPE_10MB_ETHERNET; + memcpy(req->options + pos, net->mac_addr, DHCP_HLEN_ETHERNET); + pos += DHCP_HLEN_ETHERNET; + + req->options[pos++] = DHCP_OPTION_PAD; /* Pad for alignment */ + req->options[pos++] = DHCP_OPTION_PAD; + req->options[pos++] = DHCP_OPTION_PAD; + + /* Parameters requested: Subnet, Router, DNS, Broadcast */ + req->options[pos++] = DHCP_OPTION_PARAMETER_REQUEST; + req->options[pos++] = 4; /* Length = 4 */ + req->options[pos++] = DHCP_OPTION_SUBNET_MASK; + req->options[pos++] = DHCP_OPTION_ROUTER; + req->options[pos++] = DHCP_OPTION_DOMAIN_NAME_SERVER; + req->options[pos++] = DHCP_OPTION_BROADCAST_ADDR; + + if(serverid) { + /* Add the Server identifier option */ + req->options[pos++] = DHCP_OPTION_SERVER_ID; + req->options[pos++] = 4; /* Length = 4 */ + req->options[pos++] = (serverid >> 24) & 0xFF; + req->options[pos++] = (serverid >> 16) & 0xFF; + req->options[pos++] = (serverid >> 8) & 0xFF; + req->options[pos++] = (serverid >> 0) & 0xFF; + } + + if(reqip) { + /* Add the requested IP address option */ + req->options[pos++] = DHCP_OPTION_REQ_IP_ADDR; + req->options[pos++] = 4; /* Length = 4 */ + req->options[pos++] = (reqip >> 24) & 0xFF; + req->options[pos++] = (reqip >> 16) & 0xFF; + req->options[pos++] = (reqip >> 8) & 0xFF; + req->options[pos++] = (reqip >> 0) & 0xFF; + } + + /* Pad so that we have an even number of octets */ + req->options[pos++] = DHCP_OPTION_PAD; + + /* The End */ + req->options[pos++] = DHCP_OPTION_END; + + return pos; +} + +static int net_dhcp_get_message_type(dhcp_pkt_t *pkt, int len) { + int i; + + len -= sizeof(dhcp_pkt_t); + + /* Read each byte of the options field looking for the message type option. + when we find it, return the message type. */ + for(i = 4; i < len;) { + if(pkt->options[i] == DHCP_OPTION_MESSAGE_TYPE) { + return pkt->options[i + 2]; + } + else if(pkt->options[i] == DHCP_OPTION_PAD || + pkt->options[i] == DHCP_OPTION_END) { + ++i; + } + else { + i += pkt->options[i + 1]; + } + } + + return -1; +} + +static uint32 net_dhcp_get_32bit(dhcp_pkt_t *pkt, uint8 opt, int len) { + int i; + + len -= sizeof(dhcp_pkt_t); + + /* Read each byte of the options field looking for the specified option, + return it when found. */ + for(i = 4; i < len;) { + if(pkt->options[i] == opt) { + return (pkt->options[i + 2] << 24) | (pkt->options[i + 3] << 16) | + (pkt->options[i + 4] << 8) | (pkt->options[i + 5]); + } + else if(pkt->options[i] == DHCP_OPTION_PAD || + pkt->options[i] == DHCP_OPTION_END) { + ++i; + } + else { + i += pkt->options[i + 1]; + } + } + + return 0; +} + +int net_dhcp_request() { + uint8 pkt[1024]; + dhcp_pkt_t *req = (dhcp_pkt_t *)pkt; + int optlen; + struct dhcp_pkt_out *qpkt; + uint32 old; + int rv = 0; + + if(dhcp_sock == -1) { + return -1; + } + + if(!irq_inside_int()) { + rlock_lock(dhcp_lock); + } + else { + if(rlock_trylock(dhcp_lock)) { + return -1; + } + } + + /* Fill in the initial DHCPDISCOVER packet */ + req->op = DHCP_OP_BOOTREQUEST; + req->htype = DHCP_HTYPE_10MB_ETHERNET; + req->hlen = DHCP_HLEN_ETHERNET; + req->hops = 0; + req->xid = htonl(time(NULL) ^ 0xDEADBEEF); + req->secs = 0; + req->flags = 0; + req->ciaddr = 0; + req->yiaddr = 0; + req->siaddr = 0; + req->giaddr = 0; + memcpy(req->chaddr, net_default_dev->mac_addr, DHCP_HLEN_ETHERNET); + memset(req->chaddr + DHCP_HLEN_ETHERNET, 0, sizeof(req->chaddr) - + DHCP_HLEN_ETHERNET); + memset(req->sname, 0, sizeof(req->sname)); + memset(req->file, 0, sizeof(req->file)); + + /* Fill in options */ + optlen = net_dhcp_fill_options(net_default_dev, req, DHCP_MSG_DHCPDISCOVER, + 0, 0); + + /* Add to our packet queue */ + qpkt = (struct dhcp_pkt_out *)malloc(sizeof(struct dhcp_pkt_out)); + + if(!qpkt) { + rlock_unlock(dhcp_lock); + return -1; + } + + qpkt->buf = (uint8 *)malloc(sizeof(dhcp_pkt_t) + optlen); + + if(!qpkt->buf) { + free(qpkt); + rlock_unlock(dhcp_lock); + return -1; + } + + qpkt->size = sizeof(dhcp_pkt_t) + optlen; + memcpy(qpkt->buf, pkt, sizeof(dhcp_pkt_t) + optlen); + qpkt->pkt_type = DHCP_MSG_DHCPDISCOVER; + qpkt->next_send = 0; + qpkt->next_delay = 2000; + + STAILQ_INSERT_TAIL(&dhcp_pkts, qpkt, pkt_queue); + + state = DHCP_STATE_SELECTING; + + old = irq_disable(); + rlock_unlock(dhcp_lock); + + /* We need to wait til we're either bound to an IP address, or until we give + up all hope of doing so (give us 60 seconds). */ + + if(thd_current != dhcp_thd) { + rv = genwait_wait(qpkt, "net_dhcp_request", 60 * 1000, NULL); + } + + irq_restore(old); + + return rv; +} + +static void net_dhcp_send_request(dhcp_pkt_t *pkt, int pktlen, dhcp_pkt_t *pkt2, + int pkt2len) { + uint8 buf[1024]; + dhcp_pkt_t *req = (dhcp_pkt_t *)buf; + int optlen; + struct dhcp_pkt_out *qpkt; + uint32 serverid = net_dhcp_get_32bit(pkt, DHCP_OPTION_SERVER_ID, pktlen); + + if(serverid == 0) + return; + + /* Fill in the DHCP request */ + req->op = DHCP_OP_BOOTREQUEST; + req->htype = DHCP_HTYPE_10MB_ETHERNET; + req->hlen = DHCP_HLEN_ETHERNET; + req->hops = 0; + req->xid = pkt->xid; + req->secs = 0; + req->flags = 0; + req->ciaddr = 0; + req->yiaddr = 0; + req->siaddr = 0; + req->giaddr = 0; + memcpy(req->chaddr, net_default_dev->mac_addr, DHCP_HLEN_ETHERNET); + memset(req->chaddr + DHCP_HLEN_ETHERNET, 0, sizeof(req->chaddr) - + DHCP_HLEN_ETHERNET); + memset(req->sname, 0, sizeof(req->sname)); + memset(req->file, 0, sizeof(req->file)); + + /* Fill in options */ + optlen = net_dhcp_fill_options(net_default_dev, req, DHCP_MSG_DHCPREQUEST, + serverid, ntohl(pkt->yiaddr)); + + /* Add to our packet queue */ + qpkt = (struct dhcp_pkt_out *)malloc(sizeof(struct dhcp_pkt_out)); + + if(!qpkt) { + return; + } + + qpkt->buf = (uint8 *)malloc(sizeof(dhcp_pkt_t) + optlen); + + if(!qpkt->buf) { + free(qpkt); + return; + } + + qpkt->size = sizeof(dhcp_pkt_t) + optlen; + memcpy(qpkt->buf, buf, sizeof(dhcp_pkt_t) + optlen); + qpkt->pkt_type = DHCP_MSG_DHCPREQUEST; + qpkt->next_send = 0; + qpkt->next_delay = 2000; + + STAILQ_INSERT_TAIL(&dhcp_pkts, qpkt, pkt_queue); + + state = DHCP_STATE_REQUESTING; +} + +static void net_dhcp_renew() { + uint8 buf[1024]; + dhcp_pkt_t *req = (dhcp_pkt_t *)buf; + int optlen; + struct dhcp_pkt_out *qpkt; + + /* Fill in the DHCP request */ + req->op = DHCP_OP_BOOTREQUEST; + req->htype = DHCP_HTYPE_10MB_ETHERNET; + req->hlen = DHCP_HLEN_ETHERNET; + req->hops = 0; + req->xid = time(NULL) ^ 0xDEADBEEF; + req->secs = 0; + req->flags = 0; + req->ciaddr = htonl(net_ipv4_address(net_default_dev->ip_addr)); + req->yiaddr = 0; + req->siaddr = 0; + req->giaddr = 0; + memcpy(req->chaddr, net_default_dev->mac_addr, DHCP_HLEN_ETHERNET); + memset(req->chaddr + DHCP_HLEN_ETHERNET, 0, sizeof(req->chaddr) - + DHCP_HLEN_ETHERNET); + memset(req->sname, 0, sizeof(req->sname)); + memset(req->file, 0, sizeof(req->file)); + + /* Fill in options */ + optlen = net_dhcp_fill_options(net_default_dev, req, DHCP_MSG_DHCPREQUEST, + 0, ntohl(req->ciaddr)); + + /* Add to our packet queue */ + qpkt = (struct dhcp_pkt_out *)malloc(sizeof(struct dhcp_pkt_out)); + + if(!qpkt) { + return; + } + + qpkt->buf = (uint8 *)malloc(sizeof(dhcp_pkt_t) + optlen); + + if(!qpkt->buf) { + free(qpkt); + return; + } + + qpkt->size = sizeof(dhcp_pkt_t) + optlen; + memcpy(qpkt->buf, buf, sizeof(dhcp_pkt_t) + optlen); + qpkt->pkt_type = DHCP_MSG_DHCPREQUEST; + qpkt->next_send = 0; + qpkt->next_delay = 60000; + + STAILQ_INSERT_TAIL(&dhcp_pkts, qpkt, pkt_queue); +} + +static void net_dhcp_bind(dhcp_pkt_t *pkt, int len) { + uint32 tmp = ntohl(pkt->yiaddr); + uint32 old = irq_disable(); + + /* Bind the IP address first */ + net_default_dev->ip_addr[0] = (tmp >> 24) & 0xFF; + net_default_dev->ip_addr[1] = (tmp >> 16) & 0xFF; + net_default_dev->ip_addr[2] = (tmp >> 8) & 0xFF; + net_default_dev->ip_addr[3] = (tmp >> 0) & 0xFF; + + /* Grab the netmask if it was returned to us */ + tmp = net_dhcp_get_32bit(pkt, DHCP_OPTION_SUBNET_MASK, len); + + if(tmp != 0) { + net_default_dev->netmask[0] = (tmp >> 24) & 0xFF; + net_default_dev->netmask[1] = (tmp >> 16) & 0xFF; + net_default_dev->netmask[2] = (tmp >> 8) & 0xFF; + net_default_dev->netmask[3] = (tmp >> 0) & 0xFF; + } + + /* Grab the router address, if it was returned to us */ + tmp = net_dhcp_get_32bit(pkt, DHCP_OPTION_ROUTER, len); + + if(tmp != 0) { + net_default_dev->gateway[0] = (tmp >> 24) & 0xFF; + net_default_dev->gateway[1] = (tmp >> 16) & 0xFF; + net_default_dev->gateway[2] = (tmp >> 8) & 0xFF; + net_default_dev->gateway[3] = (tmp >> 0) & 0xFF; + } + + /* Grab the DNS address if it was returned to us */ + tmp = net_dhcp_get_32bit(pkt, DHCP_OPTION_NAME_SERVER, len); + + if(tmp != 0) { + net_default_dev->gateway[0] = (tmp >> 24) & 0xFF; + net_default_dev->gateway[1] = (tmp >> 16) & 0xFF; + net_default_dev->gateway[2] = (tmp >> 8) & 0xFF; + net_default_dev->gateway[3] = (tmp >> 0) & 0xFF; + } + + /* Grab the broadcast address if it was sent to us, otherwise infer it from + the netmask and IP address. */ + tmp = net_dhcp_get_32bit(pkt, DHCP_OPTION_BROADCAST_ADDR, len); + + if(tmp != 0) { + net_default_dev->broadcast[0] = (tmp >> 24) & 0xFF; + net_default_dev->broadcast[1] = (tmp >> 16) & 0xFF; + net_default_dev->broadcast[2] = (tmp >> 8) & 0xFF; + net_default_dev->broadcast[3] = (tmp >> 0) & 0xFF; + } + else { + net_default_dev->broadcast[0] = + net_default_dev->ip_addr[0] | (~net_default_dev->netmask[0]); + net_default_dev->broadcast[1] = + net_default_dev->ip_addr[1] | (~net_default_dev->netmask[1]); + net_default_dev->broadcast[2] = + net_default_dev->ip_addr[2] | (~net_default_dev->netmask[2]); + net_default_dev->broadcast[3] = + net_default_dev->ip_addr[3] | (~net_default_dev->netmask[3]); + } + + /* Grab the Lease expiry time */ + tmp = net_dhcp_get_32bit(pkt, DHCP_OPTION_IP_LEASE_TIME, len); + + if(tmp != 0 && tmp != 0xFFFFFFFF) { + /* Set our renewal timer to half the lease time and the rebinding timer + to .875 * lease time. */ + uint64 now = timer_ms_gettime64(); + int expiry = ntohl(tmp) * 1000; + + renew_time = now + (expiry >> 1); + rebind_time = now + (uint64)(expiry * 0.875); + lease_expires = now + expiry; + } + else if(tmp == 0xFFFFFFFF) { + renew_time = rebind_time = lease_expires = 0xFFFFFFFFFFFFFFFFULL; + } + + state = DHCP_STATE_BOUND; + + irq_restore(old); +} + +static void net_dhcp_thd(void *obj __attribute__((unused))) { + struct dhcp_pkt_out *qpkt; + uint64 now; + struct sockaddr_in addr; + uint8 buf[1024]; + ssize_t len = 0; + socklen_t addr_len = sizeof(struct sockaddr_in); + dhcp_pkt_t *pkt = (dhcp_pkt_t *)buf, *pkt2; + int found; + + for(;;) { + now = timer_ms_gettime64(); + len = 0; + + rlock_lock(dhcp_lock); + + /* Make sure we don't need to renew our lease */ + if(lease_expires <= now && (state == DHCP_STATE_BOUND || + state == DHCP_STATE_RENEWING || state == DHCP_STATE_REBINDING)) { + STAILQ_FOREACH(qpkt, &dhcp_pkts, pkt_queue) { + STAILQ_REMOVE(&dhcp_pkts, qpkt, dhcp_pkt_out, pkt_queue); + free(qpkt->buf); + free(qpkt); + } + + state = DHCP_STATE_INIT; + srv_addr.sin_addr.s_addr = INADDR_BROADCAST; + memset(net_default_dev->ip_addr, 0, 4); + net_dhcp_request(); + } + else if(rebind_time <= now && + (state == DHCP_STATE_BOUND || state == DHCP_STATE_RENEWING)) { + /* Clear out any existing packets. */ + STAILQ_FOREACH(qpkt, &dhcp_pkts, pkt_queue) { + STAILQ_REMOVE(&dhcp_pkts, qpkt, dhcp_pkt_out, pkt_queue); + free(qpkt->buf); + free(qpkt); + } + + state = DHCP_STATE_REBINDING; + srv_addr.sin_addr.s_addr = INADDR_BROADCAST; + net_dhcp_renew(); + } + else if(renew_time <= now && state == DHCP_STATE_BOUND) { + state = DHCP_STATE_RENEWING; + net_dhcp_renew(); + } + + /* Check if we have any packets waiting to come in. */ + while((len = recvfrom(dhcp_sock, buf, 1024, 0, + (struct sockaddr *)&addr, &addr_len)) != -1) { + /* Ignore any boot request packets -- they shouldn't be sent to + the port we're monitoring anyway. */ + if(pkt->op != DHCP_OP_BOOTREPLY) { + continue; + } + + /* Check the magic cookie to make sure we've actually got a DHCP + packet coming in. */ + if(pkt->options[0] != 0x63 || pkt->options[1] != 0x82 || + pkt->options[2] != 0x53 || pkt->options[3] != 0x63) { + continue; + } + + found = 0; + + /* Check the xid field of the new packet versus what we're still + waiting on responses for. */ + STAILQ_FOREACH(qpkt, &dhcp_pkts, pkt_queue) { + pkt2 = (dhcp_pkt_t *)qpkt->buf; + + if(pkt2->xid == pkt->xid) { + found = 1; + break; + } + } + + /* If we've found a pending request, act on the message received. */ + if(found) { + switch(net_dhcp_get_message_type(pkt2, qpkt->size)) { + case DHCP_MSG_DHCPDISCOVER: + if(net_dhcp_get_message_type(pkt, len) != + DHCP_MSG_DHCPOFFER) { + break; + } + + /* Send our DHCPREQUEST packet */ + net_dhcp_send_request(pkt, len, pkt2, qpkt->size); + + /* Remove the old packet from our queue */ + STAILQ_REMOVE(&dhcp_pkts, qpkt, dhcp_pkt_out, + pkt_queue); + free(qpkt->buf); + free(qpkt); + break; + + case DHCP_MSG_DHCPREQUEST: + found = net_dhcp_get_message_type(pkt, len); + + if(found == DHCP_MSG_DHCPACK) { + srv_addr.sin_addr.s_addr = addr.sin_addr.s_addr; + + /* Bind to the specified IP address */ + net_dhcp_bind(pkt, len); + genwait_wake_all(qpkt); + } + else if(found == DHCP_MSG_DHCPNAK) { + /* We got a NAK, try to discover again. */ + state = DHCP_STATE_INIT; + net_dhcp_request(); + } + + /* Remove the old packet from our queue */ + STAILQ_REMOVE(&dhcp_pkts, qpkt, dhcp_pkt_out, + pkt_queue); + free(qpkt->buf); + free(qpkt); + break; + + /* Currently, these are the only two DHCP packets the code + here sends out, so other packet types are omitted for + the time being. */ + } + } + } + + /* Send any packets that need to be sent. */ + STAILQ_FOREACH(qpkt, &dhcp_pkts, pkt_queue) { + if(qpkt->next_send <= now) { + sendto(dhcp_sock, qpkt->buf, qpkt->size, 0, + (struct sockaddr *)&srv_addr, sizeof(srv_addr)); + qpkt->next_send = now + qpkt->next_delay; + qpkt->next_delay <<= 1; + } + } + + rlock_unlock(dhcp_lock); + + /* Sleep for a while. */ + thd_sleep(25); + } +} + +int net_dhcp_init() { + struct sockaddr_in addr; + + /* Create our lock */ + dhcp_lock = rlock_create(); + + if(dhcp_lock == NULL) { + return -1; + } + + /* Create the DHCP socket */ + dhcp_sock = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP); + + if(dhcp_sock == -1) { + return -1; + } + + /* Bind the socket to the DHCP "Client" port */ + addr.sin_family = AF_INET; + addr.sin_port = htons(DHCP_CLIENT_PORT); + addr.sin_addr.s_addr = INADDR_ANY; + memset(addr.sin_zero, 0, sizeof(addr.sin_zero)); + + if(bind(dhcp_sock, (struct sockaddr *)&addr, sizeof(addr)) == -1) { + return -2; + } + + /* Set up the server address */ + srv_addr.sin_family = AF_INET; + srv_addr.sin_port = htons(DHCP_SERVER_PORT); + srv_addr.sin_addr.s_addr = INADDR_BROADCAST; + memset(srv_addr.sin_zero, 0, sizeof(addr.sin_zero)); + + /* Make the socket non-blocking */ + fs_socket_setflags(dhcp_sock, O_NONBLOCK); + + /* Create the thread for processing DHCP packets */ + dhcp_thd = thd_create(&net_dhcp_thd, NULL); + + return 0; +} + +void net_dhcp_shutdown() { + int old = irq_disable(); + + if(dhcp_lock) { + rlock_destroy(dhcp_lock); + dhcp_lock = NULL; + } + + irq_restore(old); + + if(dhcp_sock != -1) { + close(dhcp_sock); + } +} Added: kos/kernel/net/net_dhcp.h =================================================================== --- kos/kernel/net/net_dhcp.h (rev 0) +++ kos/kernel/net/net_dhcp.h 2008-09-21 18:39:06 UTC (rev 610) @@ -0,0 +1,154 @@ +/* KallistiOS ##version## + + kernel/net/net_dhcp.h + Copyright (C) 2008 Lawrence Sebald + +*/ + +#ifndef __LOCAL_NET_DHCP_H +#define __LOCAL_NET_DHCP_H + +#include <sys/cdefs.h> + +__BEGIN_DECLS + +#include <arch/types.h> + +/* Available values for the op fields of dhcp_pkt_t */ +#define DHCP_OP_BOOTREQUEST 1 +#define DHCP_OP_BOOTREPLY 2 + +/* The defined htype for Ethernet */ +#define DHCP_HTYPE_10MB_ETHERNET 1 + +/* The length of an Ethernet hardware address */ +#define DHCP_HLEN_ETHERNET 6 + +/* DHCP Option types, as defined in RFC 2132. + Note that most of these aren't actually supported/used, but they're here + for completeness. */ +#define DHCP_OPTION_PAD 0 +#define DHCP_OPTION_SUBNET_MASK 1 +#define DHCP_OPTION_TIME_OFFSET 2 +#define DHCP_OPTION_ROUTER 3 +#define DHCP_OPTION_TIME_SERVER 4 +#define DHCP_OPTION_NAME_SERVER 5 +#define DHCP_OPTION_DOMAIN_NAME_SERVER 6 +#define DHCP_OPTION_LOG_SERVER 7 +#define DHCP_OPTION_COOKIE_SERVER 8 +#define DHCP_OPTION_LPR_SERVER 9 +#define DHCP_OPTION_IMPRESS_SERVER 10 +#define DHCP_OPTION_RESOURCE_LOC_SERVER 11 +#define DHCP_OPTION_HOST_NAME 12 +#define DHCP_OPTION_BOOT_FILE_SIZE 13 +#define DHCP_OPTION_MERIT_DUMP_FILE 14 +#define DHCP_OPTION_DOMAIN_NAME 15 +#define DHCP_OPTION_SWAP 16 +#define DHCP_OPTION_ROOT_PATH 17 +#define DHCP_OPTION_EXTENSIONS_PATH 18 +#define DHCP_OPTION_IP_FORWARDING 19 +#define DHCP_OPTION_NON_LOCAL_SRC_ROUTE 20 +#define DHCP_OPTION_POLICY_FILTER 21 +#define DHCP_OPTION_MAX_REASSEMBLY 22 +#define DHCP_OPTION_DEFAULT_TTL 23 +#define DHCP_OPTION_PATH_MTU_AGING_TIME 24 +#define DHCP_OPTION_PATH_MTU_PLATEAU 25 +#define DHCP_OPTION_INTERFACE_MTU 26 +#define DHCP_OPTION_ALL_SUBNETS_LOCAL 27 +#define DHCP_OPTION_BROADCAST_ADDR 28 +#define DHCP_OPTION_PERFORM_MASK_DISC 29 +#define DHCP_OPTION_MASK_SUPPLIER 30 +#define DHCP_OPTION_PERFORM_ROUTER_DISC 31 +#define DHCP_OPTION_ROUTER_SOLICT_ADDR 32 +#define DHCP_OPTION_STATIC_ROUTE 33 +#define DHCP_OPTION_TRAILER_ENCAPS 34 +#define DHCP_OPTION_ARP_CACHE_TIMEOUT 35 +#define DHCP_OPTION_ETHERNET_ENCAPS 36 +#define DHCP_OPTION_TCP_TTL 37 +#define DHCP_OPTION_TCP_KEEPALIVE_INT 38 +#define DHCP_OPTION_TCP_KEEPALIVE_GARB 39 +#define DHCP_OPTION_NIS_DOMAIN 40 +#define DHCP_OPTION_NIS_SERVER 41 +#define DHCP_OPTION_NTP_SERVER 42 +#define DHCP_OPTION_VENDOR 43 +#define DHCP_OPTION_NBNS_NAME_SERVER 44 +#define DHCP_OPTION_NBDD_SERVER 45 +#define DHCP_OPTION_NB_NODE_TYPE 46 +#define DHCP_OPTION_NB_SCOPE 47 +#define DHCP_OPTION_X_FONT_SERVER 48 +#define DHCP_OPTION_X_DISPLAY_MGR 49 +#define DHCP_OPTION_REQ_IP_ADDR 50 +#define DHCP_OPTION_IP_LEASE_TIME 51 +#define DHCP_OPTION_OVERLOAD 52 +#define DHCP_OPTION_MESSAGE_TYPE 53 +#define DHCP_OPTION_SERVER_ID 54 +#define DHCP_OPTION_PARAMETER_REQUEST 55 +#define DHCP_OPTION_MESSAGE 56 +#define DHCP_OPTION_MAX_MESSAGE 57 +#define DHCP_OPTION_RENEWAL_TIME 58 +#define DHCP_OPTION_REBINDING_TIME 59 +#define DHCP_OPTION_VENDOR_CLASS_ID 60 +#define DHCP_OPTION_CLIENT_ID 61 +/* 62 and 63 undefined by RFC 2132 */ +#define DHCP_OPTION_NISPLUS_DOMAIN 64 +#define DHCP_OPTION_NISPLUS_SERVER 65 +#define DHCP_OPTION_TFTP_SERVER 66 +#define DHCP_OPTION_BOOTFILE_NAME 67 +#define DHCP_OPTION_MIP_HOME_AGENT 68 +#define DHCP_OPTION_SMTP_SERVER 69 +#define DHCP_OPTION_POP3_SERVER 70 +#define DHCP_OPTION_NNTP_SERVER 71 +#define DHCP_OPTION_WWW_SERVER 72 +#define DHCP_OPTION_FINGER_SERVER 73 +#define DHCP_OPTION_IRC_SERVER 74 +#define DHCP_OPTION_STREETTALK_SERVER 75 +#define DHCP_OPTION_STDA_SERVER 76 +#define DHCP_OPTION_END 255 + +/* DHCP Message Types, as defined in RFC 2132. */ +#define DHCP_MSG_DHCPDISCOVER 1 +#define DHCP_MSG_DHCPOFFER 2 +#define DHCP_MSG_DHCPREQUEST 3 +#define DHCP_MSG_DHCPDECLINE 4 +#define DHCP_MSG_DHCPACK 5 +#define DHCP_MSG_DHCPNAK 6 +#define DHCP_MSG_DHCPRELEASE 7 +#define DHCP_MSG_DHCPINFORM 8 + +/* DHCP Client States */ +#define DHCP_STATE_INIT 0 +#define DHCP_STATE_SELECTING 1 +#define DHCP_STATE_REQUESTING 2 +#define DHCP_STATE_BOUND 3 +#define DHCP_STATE_RENEWING 4 +#define DHCP_STATE_REBINDING 5 +#define DHCP_STATE_INIT_REBOOT 6 +#define DHCP_STATE_REBOOTING 7 + +typedef struct dhcp_pkt { + uint8 op; + uint8 htype; + uint8 hlen; + uint8 hops; + uint32 xid; + uint16 secs; + uint16 flags; + uint32 ciaddr; + uint32 yiaddr; + uint32 siaddr; + uint32 giaddr; + uint8 chaddr[16]; + char sname[64]; + char file[128]; + uint8 options[]; +} __attribute__((packed)) dhcp_pkt_t; + +int net_dhcp_init(); + +void net_dhcp_shutdown(); + +int net_dhcp_request(); + +__END_DECLS + +#endif /* !__LOCAL_NET_DHCP_H */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ljs...@us...> - 2008-09-23 00:00:50
|
Revision: 611 http://cadcdev.svn.sourceforge.net/cadcdev/?rev=611&view=rev Author: ljsebald Date: 2008-09-22 23:59:53 +0000 (Mon, 22 Sep 2008) Log Message: ----------- I apologize for the huge email this will probably generate, but it really needed to be done. Removing all the old CVSID stuff from the kos tree. Modified Paths: -------------- kos/Makefile kos/Makefile.prefab kos/Makefile.rules kos/addons/Makefile kos/addons/Makefile.prefab kos/addons/include/kos/bspline.h kos/addons/include/kos/img.h kos/addons/include/kos/netcfg.h kos/addons/include/kos/pcx.h kos/addons/include/kos/vector.h kos/addons/libkosutils/Makefile kos/addons/libkosutils/img.c kos/addons/libkosutils/pcx_small.c kos/doc/CHANGELOG kos/doc/FAQ kos/doc/LICENSE kos/doc/README kos/doc/README.BSD kos/doc/README.GPL kos/doc/README.KOS kos/doc/RELNOTES kos/doc/coding_style.txt kos/doc/goals.txt kos/examples/Makefile kos/examples/dreamcast/2ndmix/2ndmix.c kos/examples/dreamcast/2ndmix/Makefile kos/examples/dreamcast/Makefile kos/examples/dreamcast/basic/Makefile kos/examples/dreamcast/basic/fpu/Makefile kos/examples/dreamcast/basic/mmu/Makefile kos/examples/dreamcast/basic/threading/Makefile kos/examples/dreamcast/basic/threading/general/Makefile kos/examples/dreamcast/conio/Makefile kos/examples/dreamcast/conio/adventure/Makefile kos/examples/dreamcast/conio/basic/Makefile kos/examples/dreamcast/conio/wump/Makefile kos/examples/dreamcast/cpp/Makefile kos/examples/dreamcast/kgl/Makefile kos/examples/dreamcast/kgl/basic/Makefile kos/examples/dreamcast/kgl/basic/scissor/Makefile kos/examples/dreamcast/kgl/basic/scissor/scissor.c kos/examples/dreamcast/kgl/basic/texwrap/Makefile kos/examples/dreamcast/kgl/basic/texwrap/texwrap.c kos/examples/dreamcast/kgl/basic/vfzclip/Makefile kos/examples/dreamcast/kgl/basic/vfzclip/vfzclip.c kos/examples/dreamcast/kgl/benchmarks/Makefile kos/examples/dreamcast/kgl/benchmarks/quadmark/quadmark.c kos/examples/dreamcast/kgl/benchmarks/trimark/trimark.c kos/examples/dreamcast/kgl/demos/Makefile kos/examples/dreamcast/kgl/demos/tunnel/Makefile kos/examples/dreamcast/kgl/demos/tunnel/menu.cpp kos/examples/dreamcast/kgl/demos/tunnel/menu.h kos/examples/dreamcast/kgl/demos/tunnel/plprint.cpp kos/examples/dreamcast/kgl/demos/tunnel/plprint.h kos/examples/dreamcast/kgl/demos/tunnel/tunnel.cpp kos/examples/dreamcast/kgl/nehe/Makefile kos/examples/dreamcast/kgl/nehe/nehe26/data/Makefile kos/examples/dreamcast/lua/Makefile kos/examples/dreamcast/lua/basic/Makefile kos/examples/dreamcast/lua/basic/lua.c kos/examples/dreamcast/modem/Makefile kos/examples/dreamcast/network/Makefile kos/examples/dreamcast/network/httpd/httpd.c kos/examples/dreamcast/parallax/Makefile kos/examples/dreamcast/pvr/Makefile kos/examples/dreamcast/sound/Makefile kos/examples/dreamcast/sound/cdda/Makefile kos/examples/dreamcast/tsunami/Makefile kos/examples/dreamcast/video/Makefile kos/examples/dreamcast/video/bfont/Makefile kos/examples/dreamcast/vmu/Makefile kos/examples/gba/Makefile kos/examples/gba/pogo-keen/Makefile kos/examples/ps2/Makefile kos/examples/ps2/basic/Makefile kos/include/assert.h kos/include/endian.h kos/include/kos/cdefs.h kos/include/kos/cond.h kos/include/kos/dbgio.h kos/include/kos/dbglog.h kos/include/kos/elf.h kos/include/kos/exports.h kos/include/kos/fs.h kos/include/kos/fs_builtin.h kos/include/kos/fs_pty.h kos/include/kos/fs_ramdisk.h kos/include/kos/fs_romdisk.h kos/include/kos/genwait.h kos/include/kos/iovec.h kos/include/kos/library.h kos/include/kos/limits.h kos/include/kos/mutex.h kos/include/kos/net.h kos/include/kos/nmmgr.h kos/include/kos/sem.h kos/include/kos/thread.h kos/include/kos.h kos/include/malloc.h kos/include/pthread.h kos/kernel/Makefile kos/kernel/arch/Makefile kos/kernel/arch/dreamcast/Makefile kos/kernel/arch/dreamcast/fs/Makefile kos/kernel/arch/dreamcast/fs/dcload-syscall.s kos/kernel/arch/dreamcast/fs/fs_dclnative.c kos/kernel/arch/dreamcast/fs/fs_dcload.c kos/kernel/arch/dreamcast/fs/fs_iso9660.c kos/kernel/arch/dreamcast/fs/fs_vmu.c kos/kernel/arch/dreamcast/fs/vmufs.c kos/kernel/arch/dreamcast/hardware/Makefile kos/kernel/arch/dreamcast/hardware/asic.c kos/kernel/arch/dreamcast/hardware/cdrom.c kos/kernel/arch/dreamcast/hardware/g2bus.c kos/kernel/arch/dreamcast/hardware/hardware.c kos/kernel/arch/dreamcast/hardware/maple/Makefile kos/kernel/arch/dreamcast/hardware/maple/controller.c kos/kernel/arch/dreamcast/hardware/maple/keyboard.c kos/kernel/arch/dreamcast/hardware/maple/maple_compat.c kos/kernel/arch/dreamcast/hardware/maple/maple_enum.c kos/kernel/arch/dreamcast/hardware/maple/maple_irq.c kos/kernel/arch/dreamcast/hardware/maple/maple_queue.c kos/kernel/arch/dreamcast/hardware/maple/maple_utils.c kos/kernel/arch/dreamcast/hardware/maple/mouse.c kos/kernel/arch/dreamcast/hardware/maple/vmu.c kos/kernel/arch/dreamcast/hardware/modem/Makefile kos/kernel/arch/dreamcast/hardware/modem/mintern.h kos/kernel/arch/dreamcast/hardware/modem/mintr.c kos/kernel/arch/dreamcast/hardware/modem/modem.c kos/kernel/arch/dreamcast/hardware/network/Makefile kos/kernel/arch/dreamcast/hardware/network/lan_adapter.c kos/kernel/arch/dreamcast/hardware/pvr/Makefile kos/kernel/arch/dreamcast/hardware/pvr/pvr_buffers.c kos/kernel/arch/dreamcast/hardware/pvr/pvr_dma.c kos/kernel/arch/dreamcast/hardware/pvr/pvr_fog.c kos/kernel/arch/dreamcast/hardware/pvr/pvr_fog_tables.h kos/kernel/arch/dreamcast/hardware/pvr/pvr_globals.c kos/kernel/arch/dreamcast/hardware/pvr/pvr_init_shutdown.c kos/kernel/arch/dreamcast/hardware/pvr/pvr_irq.c kos/kernel/arch/dreamcast/hardware/pvr/pvr_mem.c kos/kernel/arch/dreamcast/hardware/pvr/pvr_mem_core.c kos/kernel/arch/dreamcast/hardware/pvr/pvr_mem_core.h kos/kernel/arch/dreamcast/hardware/pvr/pvr_misc.c kos/kernel/arch/dreamcast/hardware/pvr/pvr_palette.c kos/kernel/arch/dreamcast/hardware/pvr/pvr_prim.c kos/kernel/arch/dreamcast/hardware/pvr/pvr_scene.c kos/kernel/arch/dreamcast/hardware/pvr/pvr_texture.c kos/kernel/arch/dreamcast/hardware/spudma.c kos/kernel/arch/dreamcast/hardware/video.c kos/kernel/arch/dreamcast/include/arch/arch.h kos/kernel/arch/dreamcast/include/arch/cache.h kos/kernel/arch/dreamcast/include/arch/exec.h kos/kernel/arch/dreamcast/include/arch/gdb.h kos/kernel/arch/dreamcast/include/arch/irq.h kos/kernel/arch/dreamcast/include/arch/mmu.h kos/kernel/arch/dreamcast/include/arch/rtc.h kos/kernel/arch/dreamcast/include/arch/spinlock.h kos/kernel/arch/dreamcast/include/arch/stack.h kos/kernel/arch/dreamcast/include/arch/timer.h kos/kernel/arch/dreamcast/include/arch/types.h kos/kernel/arch/dreamcast/include/dc/asic.h kos/kernel/arch/dreamcast/include/dc/biosfont.h kos/kernel/arch/dreamcast/include/dc/cdrom.h kos/kernel/arch/dreamcast/include/dc/fmath.h kos/kernel/arch/dreamcast/include/dc/fs_iso9660.h kos/kernel/arch/dreamcast/include/dc/fs_vmu.h kos/kernel/arch/dreamcast/include/dc/g2bus.h kos/kernel/arch/dreamcast/include/dc/maple/controller.h kos/kernel/arch/dreamcast/include/dc/maple/keyboard.h kos/kernel/arch/dreamcast/include/dc/maple/mouse.h kos/kernel/arch/dreamcast/include/dc/maple/purupuru.h kos/kernel/arch/dreamcast/include/dc/maple/vmu.h kos/kernel/arch/dreamcast/include/dc/maple.h kos/kernel/arch/dreamcast/include/dc/matrix.h kos/kernel/arch/dreamcast/include/dc/matrix3d.h kos/kernel/arch/dreamcast/include/dc/modem/mconst.h kos/kernel/arch/dreamcast/include/dc/modem/modem.h kos/kernel/arch/dreamcast/include/dc/net/broadband_adapter.h kos/kernel/arch/dreamcast/include/dc/net/lan_adapter.h kos/kernel/arch/dreamcast/include/dc/pvr.h kos/kernel/arch/dreamcast/include/dc/sound/sfxmgr.h kos/kernel/arch/dreamcast/include/dc/sound/sound.h kos/kernel/arch/dreamcast/include/dc/sound/stream.h kos/kernel/arch/dreamcast/include/dc/spu.h kos/kernel/arch/dreamcast/include/dc/sq.h kos/kernel/arch/dreamcast/include/dc/ubc.h kos/kernel/arch/dreamcast/include/dc/vblank.h kos/kernel/arch/dreamcast/include/dc/video.h kos/kernel/arch/dreamcast/include/dc/vmu_pkg.h kos/kernel/arch/dreamcast/include/navi/flash.h kos/kernel/arch/dreamcast/include/navi/ide.h kos/kernel/arch/dreamcast/kernel/Makefile kos/kernel/arch/dreamcast/kernel/cache.s kos/kernel/arch/dreamcast/kernel/entry.s kos/kernel/arch/dreamcast/kernel/exec.c kos/kernel/arch/dreamcast/kernel/execasm.s kos/kernel/arch/dreamcast/kernel/init.c kos/kernel/arch/dreamcast/kernel/init_flags_default.c kos/kernel/arch/dreamcast/kernel/init_romdisk_default.c kos/kernel/arch/dreamcast/kernel/irq.c kos/kernel/arch/dreamcast/kernel/itlb.s kos/kernel/arch/dreamcast/kernel/mmu.c kos/kernel/arch/dreamcast/kernel/panic.c kos/kernel/arch/dreamcast/kernel/ser_console.c kos/kernel/arch/dreamcast/kernel/stack.c kos/kernel/arch/dreamcast/kernel/startup.s kos/kernel/arch/dreamcast/kernel/thdswitch.s kos/kernel/arch/dreamcast/kernel/timer.c kos/kernel/arch/dreamcast/math/Makefile kos/kernel/arch/dreamcast/math/matrix3d.c kos/kernel/arch/dreamcast/navi/Makefile kos/kernel/arch/dreamcast/navi/navi_flash.c kos/kernel/arch/dreamcast/navi/navi_ide.c kos/kernel/arch/dreamcast/sound/Makefile kos/kernel/arch/dreamcast/sound/arm/aica_cmd_iface.h kos/kernel/arch/dreamcast/sound/snd_iface.c kos/kernel/arch/dreamcast/sound/snd_mem.c kos/kernel/arch/dreamcast/sound/snd_sfxmgr.c kos/kernel/arch/dreamcast/sound/snd_stream.c kos/kernel/arch/dreamcast/util/Makefile kos/kernel/arch/dreamcast/util/vmu_pkg.c kos/kernel/arch/gba/Makefile kos/kernel/arch/gba/gba.ld.script kos/kernel/arch/gba/include/arch/arch.h kos/kernel/arch/gba/include/arch/dbgio.h kos/kernel/arch/gba/include/arch/irq.h kos/kernel/arch/gba/include/arch/spinlock.h kos/kernel/arch/gba/include/arch/syscall.h kos/kernel/arch/gba/include/arch/timer.h kos/kernel/arch/gba/include/arch/types.h kos/kernel/arch/gba/include/gba/dma.h kos/kernel/arch/gba/include/gba/keys.h kos/kernel/arch/gba/include/gba/sound.h kos/kernel/arch/gba/include/gba/sprite.h kos/kernel/arch/gba/include/gba/video.h kos/kernel/arch/gba/kernel/Makefile kos/kernel/arch/gba/kernel/dbgio.c kos/kernel/arch/gba/kernel/init_flags_default.c kos/kernel/arch/gba/kernel/init_romdisk_default.c kos/kernel/arch/gba/kernel/main.c kos/kernel/arch/gba/kernel/mm.c kos/kernel/arch/gba/kernel/panic.c kos/kernel/arch/gba/kernel/startup.s kos/kernel/arch/ia32/Makefile kos/kernel/arch/ia32/boot/Makefile kos/kernel/arch/ia32/include/arch/arch.h kos/kernel/arch/ia32/include/arch/cache.h kos/kernel/arch/ia32/include/arch/dbgio.h kos/kernel/arch/ia32/include/arch/exec.h kos/kernel/arch/ia32/include/arch/gdb.h kos/kernel/arch/ia32/include/arch/irq.h kos/kernel/arch/ia32/include/arch/mmu.h kos/kernel/arch/ia32/include/arch/rtc.h kos/kernel/arch/ia32/include/arch/spinlock.h kos/kernel/arch/ia32/include/arch/stack.h kos/kernel/arch/ia32/include/arch/timer.h kos/kernel/arch/ia32/include/arch/types.h kos/kernel/arch/ia32/include/ia32/ports.h kos/kernel/arch/ia32/kernel/Makefile kos/kernel/arch/ia32/kernel/dbgio.c kos/kernel/arch/ia32/kernel/exec.c kos/kernel/arch/ia32/kernel/init_flags_default.c kos/kernel/arch/ia32/kernel/mmu.c kos/kernel/arch/ia32/kernel/panic.c kos/kernel/arch/ia32/kernel/rtc.c kos/kernel/arch/ia32/kernel/stack.c kos/kernel/arch/ia32/kernel/timer.c kos/kernel/arch/ps2/Makefile kos/kernel/arch/ps2/fs/Makefile kos/kernel/arch/ps2/fs/fs_ps2load.c kos/kernel/arch/ps2/include/arch/arch.h kos/kernel/arch/ps2/include/arch/atexit.h kos/kernel/arch/ps2/include/arch/cache.h kos/kernel/arch/ps2/include/arch/dbgio.h kos/kernel/arch/ps2/include/arch/irq.h kos/kernel/arch/ps2/include/arch/rtc.h kos/kernel/arch/ps2/include/arch/spinlock.h kos/kernel/arch/ps2/include/arch/syscall.h kos/kernel/arch/ps2/include/arch/timer.h kos/kernel/arch/ps2/include/arch/types.h kos/kernel/arch/ps2/include/ps2/asmregs.h kos/kernel/arch/ps2/include/ps2/ioports.h kos/kernel/arch/ps2/include/ps2/sbios.h kos/kernel/arch/ps2/kernel/Makefile kos/kernel/arch/ps2/kernel/atexit.c kos/kernel/arch/ps2/kernel/cache.S kos/kernel/arch/ps2/kernel/crtbegin.c kos/kernel/arch/ps2/kernel/crtend.c kos/kernel/arch/ps2/kernel/dbgio.c kos/kernel/arch/ps2/kernel/entry.S kos/kernel/arch/ps2/kernel/init_flags_default.c kos/kernel/arch/ps2/kernel/init_romdisk_default.c kos/kernel/arch/ps2/kernel/main.c kos/kernel/arch/ps2/kernel/mm.c kos/kernel/arch/ps2/kernel/panic.c kos/kernel/arch/ps2/kernel/startup.S kos/kernel/arch/ps2/kernel/syscall.c kos/kernel/arch/ps2/kernel/timer.c kos/kernel/arch/ps2/sbios/Makefile kos/kernel/arch/ps2/sbios/sbios_init_shutdown.c kos/kernel/debug/Makefile kos/kernel/exports/Makefile kos/kernel/exports/library.c kos/kernel/exports/nmmgr.c kos/kernel/fs/Makefile kos/kernel/fs/elf.c kos/kernel/fs/fs.c kos/kernel/fs/fs_pty.c kos/kernel/fs/fs_ramdisk.c kos/kernel/fs/fs_romdisk.c kos/kernel/fs/fs_utils.c kos/kernel/libc/koslib/abort.c kos/kernel/libc/koslib/assert.c kos/kernel/libc/koslib/byteorder.c kos/kernel/libc/koslib/memcpy2.c kos/kernel/libc/koslib/memcpy4.c kos/kernel/libc/koslib/memset2.c kos/kernel/libc/koslib/memset4.c kos/kernel/libc/koslib/usleep.c kos/kernel/mm/Makefile kos/kernel/mm/cplusplus.c kos/kernel/mm/malloc_debug.c kos/kernel/net/Makefile kos/kernel/net/net_arp.c kos/kernel/net/net_icmp.c kos/kernel/net/net_input.c kos/kernel/thread/Makefile kos/kernel/thread/cond.c kos/kernel/thread/genwait.c kos/kernel/thread/mutex.c kos/kernel/thread/sem.c kos/kernel/thread/thread.c kos/libk++/mem.cc kos/libk++/pure_virtual.c kos/loadable/Makefile.prefab kos/utils/Makefile kos/utils/bin2c/Makefile kos/utils/bin2c/bin2c.c kos/utils/bin2o/bin2o kos/utils/bincnv/Makefile kos/utils/bincnv/bincnv.c kos/utils/cvs_utils/vcheck.py kos/utils/gba-crcfix/gba-crcfix.c kos/utils/gba-elf2bin/gba-elf2bin kos/utils/ipload/ipload.py kos/utils/isotest/Makefile kos/utils/isotest/isotest.c kos/utils/kmgenc/readpng.c kos/utils/rdtest/Makefile kos/utils/rdtest/rdtest.c kos/utils/version/version.sh kos/utils/vqenc/readpng.c Modified: kos/Makefile =================================================================== --- kos/Makefile 2008-09-21 18:39:06 UTC (rev 610) +++ kos/Makefile 2008-09-22 23:59:53 UTC (rev 611) @@ -2,8 +2,7 @@ # # Root Makefile # Copyright (C)2003 Dan Potter -# -# $Id: Makefile,v 1.5 2002/04/20 17:23:31 bardtx Exp $ +# # Add stuff to DIRS to auto-compile it with the big tree. DIRS = utils Modified: kos/Makefile.prefab =================================================================== --- kos/Makefile.prefab 2008-09-21 18:39:06 UTC (rev 610) +++ kos/Makefile.prefab 2008-09-22 23:59:53 UTC (rev 611) @@ -2,10 +2,8 @@ # # Root Makefile.prefab # (c)2000 Dan Potter -# -# $Id: Makefile.prefab,v 1.2 2002/02/09 06:16:00 bardtx Exp $ +# - # Global KallistiOS Makefile include # Define "SUBDIRS" and "OBJS", and then include this file; # it will handle a lot of your build process. Modified: kos/Makefile.rules =================================================================== --- kos/Makefile.rules 2008-09-21 18:39:06 UTC (rev 610) +++ kos/Makefile.rules 2008-09-22 23:59:53 UTC (rev 611) @@ -2,8 +2,7 @@ # # Makefile.rules # (c)2000-2001 Dan Potter -# -# $Id: Makefile.rules,v 1.9 2003/02/27 04:49:53 bardtx Exp $ +# # Global KallistiOS Makefile include Modified: kos/addons/Makefile =================================================================== --- kos/addons/Makefile 2008-09-21 18:39:06 UTC (rev 610) +++ kos/addons/Makefile 2008-09-22 23:59:53 UTC (rev 611) @@ -2,8 +2,7 @@ # # addons/Makefile # Copyright (C)2003 Dan Potter -# -# $Id: Makefile,v 1.21 2003/04/24 02:52:42 bardtx Exp $ +# # What we want to do here, unlike previous versions, is to setup a system # where you can just untar/unzip any port you want into here and it Modified: kos/addons/Makefile.prefab =================================================================== --- kos/addons/Makefile.prefab 2008-09-21 18:39:06 UTC (rev 610) +++ kos/addons/Makefile.prefab 2008-09-22 23:59:53 UTC (rev 611) @@ -2,10 +2,8 @@ # # Addons Makefile.prefab # Copyright (C)2003 Dan Potter -# -# $Id: Makefile.prefab,v 1.2 2002/02/09 06:16:00 bardtx Exp $ +# - # KallistiOS addons Makefile include # # Define "TARGET", "SUBDIRS" and "OBJS", and then include this file; Modified: kos/addons/include/kos/bspline.h =================================================================== --- kos/addons/include/kos/bspline.h 2008-09-21 18:39:06 UTC (rev 610) +++ kos/addons/include/kos/bspline.h 2008-09-22 23:59:53 UTC (rev 611) @@ -3,7 +3,6 @@ bspline.h (c)2000 Dan Potter - $Id: bspline.h,v 1.1 2002/09/05 07:31:55 bardtx Exp $ */ #ifndef __KOS_BSPLINE_H Modified: kos/addons/include/kos/img.h =================================================================== --- kos/addons/include/kos/img.h 2008-09-21 18:39:06 UTC (rev 610) +++ kos/addons/include/kos/img.h 2008-09-22 23:59:53 UTC (rev 611) @@ -3,8 +3,6 @@ kos/img.h (c)2002 Dan Potter - $Id: img.h,v 1.4 2003/04/24 03:00:44 bardtx Exp $ - */ #ifndef __KOS_IMG_H Modified: kos/addons/include/kos/netcfg.h =================================================================== --- kos/addons/include/kos/netcfg.h 2008-09-21 18:39:06 UTC (rev 610) +++ kos/addons/include/kos/netcfg.h 2008-09-22 23:59:53 UTC (rev 611) @@ -3,8 +3,6 @@ kos/netcfg.h Copyright (C)2003 Dan Potter - $Id: netcfg.h,v 1.1 2003/07/15 07:58:28 bardtx Exp $ - */ #ifndef __KOS_NETCFG_H Modified: kos/addons/include/kos/pcx.h =================================================================== --- kos/addons/include/kos/pcx.h 2008-09-21 18:39:06 UTC (rev 610) +++ kos/addons/include/kos/pcx.h 2008-09-22 23:59:53 UTC (rev 611) @@ -3,8 +3,6 @@ kos/pcx.h (c)2000-2001 Dan Potter - $Id: pcx.h,v 1.2 2002/01/05 07:23:32 bardtx Exp $ - */ #ifndef __KOS_PCX_H Modified: kos/addons/include/kos/vector.h =================================================================== --- kos/addons/include/kos/vector.h 2008-09-21 18:39:06 UTC (rev 610) +++ kos/addons/include/kos/vector.h 2008-09-22 23:59:53 UTC (rev 611) @@ -3,8 +3,6 @@ kos/vector.h (c)2002 Dan Potter - $Id: vector.h,v 1.1 2002/09/05 07:31:55 bardtx Exp $ - */ #ifndef __KOS_VECTOR_H Modified: kos/addons/libkosutils/Makefile =================================================================== --- kos/addons/libkosutils/Makefile 2008-09-21 18:39:06 UTC (rev 610) +++ kos/addons/libkosutils/Makefile 2008-09-22 23:59:53 UTC (rev 611) @@ -1,6 +1,5 @@ # libkosutils Makefile # -# $Id: Makefile,v 1.2 2003/02/27 04:25:40 bardtx Exp $ TARGET = libkosutils.a OBJS = bspline.o img.o pcx_small.o Modified: kos/addons/libkosutils/img.c =================================================================== --- kos/addons/libkosutils/img.c 2008-09-21 18:39:06 UTC (rev 610) +++ kos/addons/libkosutils/img.c 2008-09-22 23:59:53 UTC (rev 611) @@ -10,8 +10,6 @@ #include <assert.h> #include <kos/img.h> -CVSID("$Id: img.c,v 1.2 2003/04/24 03:17:44 bardtx Exp $"); - /* Free a kos_img_t which was created by an image loader; set struct_also to non-zero if you want it to free the struct itself as well. */ void kos_img_free(kos_img_t *img, int struct_also) { Modified: kos/addons/libkosutils/pcx_small.c =================================================================== --- kos/addons/libkosutils/pcx_small.c 2008-09-21 18:39:06 UTC (rev 610) +++ kos/addons/libkosutils/pcx_small.c 2008-09-22 23:59:53 UTC (rev 611) @@ -6,15 +6,11 @@ PCX image loader */ -/* XXX This needs to go elsewhere... */ - #include <stdio.h> #include <arch/types.h> #include <kos/fs.h> #include <kos/pcx.h> -CVSID("$Id: pcx_small.c,v 1.2 2002/01/06 01:14:48 bardtx Exp $"); - /* PCX header structure */ typedef struct { char mfg; /* manufacturer, always 0xa0 */ Modified: kos/doc/CHANGELOG =================================================================== --- kos/doc/CHANGELOG 2008-09-21 18:39:06 UTC (rev 610) +++ kos/doc/CHANGELOG 2008-09-22 23:59:53 UTC (rev 611) @@ -834,7 +834,3 @@ KallistiOS version 0.6 -------------------------------------------------- - First release - - -KOS Version Id: $Id: CHANGELOG,v 1.212.2.2 2003/08/02 01:51:55 bardtx Exp $ - Modified: kos/doc/FAQ =================================================================== --- kos/doc/FAQ 2008-09-21 18:39:06 UTC (rev 610) +++ kos/doc/FAQ 2008-09-22 23:59:53 UTC (rev 611) @@ -404,7 +404,3 @@ --- End ------------------------------------------------------------ - -KOS Version Id: $Id: FAQ,v 1.5 2002/11/06 08:30:57 bardtx Exp $ - - Modified: kos/doc/LICENSE =================================================================== --- kos/doc/LICENSE 2008-09-21 18:39:06 UTC (rev 610) +++ kos/doc/LICENSE 2008-09-22 23:59:53 UTC (rev 611) @@ -81,7 +81,3 @@ This software is based in part on the work of the Independent JPEG Group (see addons/libjpeg/README). - - -KOS Version Id: $Id: LICENSE,v 1.2 2002/04/20 03:23:57 bardtx Exp $ - Modified: kos/doc/README =================================================================== --- kos/doc/README 2008-09-21 18:39:06 UTC (rev 610) +++ kos/doc/README 2008-09-22 23:59:53 UTC (rev 611) @@ -269,6 +269,3 @@ "PlayStation" is a registered trademark of Sony Computer Entertainment America "Intel" is a registered trademark of Intel, Inc. Any other trademarks are trademarks of their respective owners. - -KOS Version Id: $Id: README,v 1.12 2003/05/23 03:08:00 bardtx Exp $ - Modified: kos/doc/README.BSD =================================================================== --- kos/doc/README.BSD 2008-09-21 18:39:06 UTC (rev 610) +++ kos/doc/README.BSD 2008-09-22 23:59:53 UTC (rev 611) @@ -7,9 +7,7 @@ Dan Potter -KOS Version Id: $Id: README.BSD,v 1.1.1.1 2001/09/26 07:05:00 bardtx Exp $ - # $FreeBSD: src/COPYRIGHT,v 1.4 1999/09/05 21:33:47 obrien Exp $ # @(#)COPYRIGHT 8.2 (Berkeley) 3/21/94 Modified: kos/doc/README.GPL =================================================================== --- kos/doc/README.GPL 2008-09-21 18:39:06 UTC (rev 610) +++ kos/doc/README.GPL 2008-09-22 23:59:53 UTC (rev 611) @@ -21,10 +21,7 @@ Dan Potter -KOS Version Id: $Id: README.GPL,v 1.1.1.1 2001/09/26 07:05:00 bardtx Exp $ - - GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Modified: kos/doc/README.KOS =================================================================== --- kos/doc/README.KOS 2008-09-21 18:39:06 UTC (rev 610) +++ kos/doc/README.KOS 2008-09-22 23:59:53 UTC (rev 611) @@ -25,11 +25,8 @@ derived source files and binary compilations; a credit in the documentation is ok) and there is no warranty. - Dan Potter + Dan Potter -KOS Version Id: $Id: README.KOS,v 1.2 2002/04/20 03:23:57 bardtx Exp $ - - All of the documentation and software included in the KallistiOS Releases is copyrighted (c)2000-2002 by Dan Potter and others (as noted in each file). Modified: kos/doc/RELNOTES =================================================================== --- kos/doc/RELNOTES 2008-09-21 18:39:06 UTC (rev 610) +++ kos/doc/RELNOTES 2008-09-22 23:59:53 UTC (rev 611) @@ -276,7 +276,3 @@ building any C++ targets. Conversely, if you have a working G++, make sure you have a KOS_CCPLUS line so that all of the libraries and examples will get built. - - -KOS Version Id: $Id: RELNOTES,v 1.20 2003/05/23 03:08:00 bardtx Exp $ - Modified: kos/doc/coding_style.txt =================================================================== --- kos/doc/coding_style.txt 2008-09-21 18:39:06 UTC (rev 610) +++ kos/doc/coding_style.txt 2008-09-22 23:59:53 UTC (rev 611) @@ -258,7 +258,6 @@ foobar.h (c)2002 Joe Sixpack Developer - $Id: coding_style.txt,v 1.1 2002/02/11 06:05:52 bardtx Exp $ */ @@ -342,15 +341,6 @@ #include <dc/net/broadband_adapter.h> #include <arch/types.h> -After that, you'll want a CVSID line. If you have included no other headers -then you'll need to manually include sys/cdefs.h, and then put a line much -like this: - -CVSID("$Id: coding_style.txt,v 1.1 2002/02/11 06:05:52 bardtx Exp $"); - -Later when this is checked in, it will expand to useful version info which -is placed in the object files. - After that, feel free to put a block comment explaining what's in the file and describing any notes about the module, if neccessary / warranted, followed by the functions/variables themselves. Modified: kos/doc/goals.txt =================================================================== --- kos/doc/goals.txt 2008-09-21 18:39:06 UTC (rev 610) +++ kos/doc/goals.txt 2008-09-22 23:59:53 UTC (rev 611) @@ -105,7 +105,3 @@ - Ethernet - Bitmaster bus device? * TCP/IP stack - - -KOS Version Id: $Id: goals.txt,v 1.1.1.1 2001/09/26 07:05:00 bardtx Exp $ - Modified: kos/examples/Makefile =================================================================== --- kos/examples/Makefile 2008-09-21 18:39:06 UTC (rev 610) +++ kos/examples/Makefile 2008-09-22 23:59:53 UTC (rev 611) @@ -2,8 +2,7 @@ # # examples/Makefile # (c)2001 Dan Potter -# -# $Id: Makefile,v 1.1.1.1 2001/09/26 07:05:13 bardtx Exp $ +# all: $(KOS_MAKE) -C $(KOS_ARCH) Modified: kos/examples/dreamcast/2ndmix/2ndmix.c =================================================================== --- kos/examples/dreamcast/2ndmix/2ndmix.c 2008-09-21 18:39:06 UTC (rev 610) +++ kos/examples/dreamcast/2ndmix/2ndmix.c 2008-09-22 23:59:53 UTC (rev 611) @@ -19,9 +19,6 @@ #include <stdlib.h> #include <assert.h> -CVSID("$Id: 2ndmix.c,v 1.7 2002/09/05 07:49:38 bardtx Exp $"); - - /* Floating-point Sin/Cos; 256 angles, -1.0 to 1.0 */ #include "sintab.h" #define msin(angle) sintab[angle] Modified: kos/examples/dreamcast/2ndmix/Makefile =================================================================== --- kos/examples/dreamcast/2ndmix/Makefile 2008-09-21 18:39:06 UTC (rev 610) +++ kos/examples/dreamcast/2ndmix/Makefile 2008-09-22 23:59:53 UTC (rev 611) @@ -2,8 +2,7 @@ # # 2ndmix/Makefile # Copyright (C)2003 Dan Potter -# -# $Id: Makefile,v 1.4 2002/04/20 04:24:19 axlen Exp $ +# all: rm-elf 2ndmix.elf Modified: kos/examples/dreamcast/Makefile =================================================================== --- kos/examples/dreamcast/Makefile 2008-09-21 18:39:06 UTC (rev 610) +++ kos/examples/dreamcast/Makefile 2008-09-22 23:59:53 UTC (rev 611) @@ -2,8 +2,7 @@ # # examples/dreamcast/Makefile # Copyright (C)2003 Dan Potter -# -# $Id: Makefile,v 1.17 2003/05/23 02:05:41 bardtx Exp $ +# DIRS = 2ndmix basic libdream kgl hello sound png network vmu conio pvr video lua parallax modem ifdef KOS_CCPLUS Modified: kos/examples/dreamcast/basic/Makefile =================================================================== --- kos/examples/dreamcast/basic/Makefile 2008-09-21 18:39:06 UTC (rev 610) +++ kos/examples/dreamcast/basic/Makefile 2008-09-22 23:59:53 UTC (rev 611) @@ -2,8 +2,7 @@ # # examples/dreamcast/basic/Makefile # (c)2002 Dan Potter -# -# $Id: Makefile,v 1.4 2002/10/08 07:51:20 bardtx Exp $ +# all: $(KOS_MAKE) -C exec Modified: kos/examples/dreamcast/basic/fpu/Makefile =================================================================== --- kos/examples/dreamcast/basic/fpu/Makefile 2008-09-21 18:39:06 UTC (rev 610) +++ kos/examples/dreamcast/basic/fpu/Makefile 2008-09-22 23:59:53 UTC (rev 611) @@ -2,8 +2,7 @@ # # examples/dreamcast/basic/fpu/Makefile # (c)2002 Dan Potter -# -# $Id: Makefile,v 1.1 2002/05/18 07:08:35 bardtx Exp $ +# all: $(KOS_MAKE) -C exc Modified: kos/examples/dreamcast/basic/mmu/Makefile =================================================================== --- kos/examples/dreamcast/basic/mmu/Makefile 2008-09-21 18:39:06 UTC (rev 610) +++ kos/examples/dreamcast/basic/mmu/Makefile 2008-09-22 23:59:53 UTC (rev 611) @@ -2,8 +2,7 @@ # # examples/dreamcast/basic/mmu/Makefile # (c)2002 Dan Potter -# -# $Id: Makefile,v 1.1 2002/10/08 07:51:21 bardtx Exp $ +# all: $(KOS_MAKE) -C pvrmap Modified: kos/examples/dreamcast/basic/threading/Makefile =================================================================== --- kos/examples/dreamcast/basic/threading/Makefile 2008-09-21 18:39:06 UTC (rev 610) +++ kos/examples/dreamcast/basic/threading/Makefile 2008-09-22 23:59:53 UTC (rev 611) @@ -2,8 +2,7 @@ # # examples/dreamcast/basic/threading/Makefile # (c)2002 Dan Potter -# -# $Id: Makefile,v 1.1 2002/04/19 07:53:52 bardtx Exp $ +# all: $(KOS_MAKE) -C general Modified: kos/examples/dreamcast/basic/threading/general/Makefile =================================================================== --- kos/examples/dreamcast/basic/threading/general/Makefile 2008-09-21 18:39:06 UTC (rev 610) +++ kos/examples/dreamcast/basic/threading/general/Makefile 2008-09-22 23:59:53 UTC (rev 611) @@ -2,8 +2,7 @@ # # basic/threading/Makefile # (c)2001 Dan Potter -# -# $Id: Makefile,v 1.3 2002/04/20 06:25:41 bardtx Exp $ +# all: rm-elf general_threading_test.elf Modified: kos/examples/dreamcast/conio/Makefile =================================================================== --- kos/examples/dreamcast/conio/Makefile 2008-09-21 18:39:06 UTC (rev 610) +++ kos/examples/dreamcast/conio/Makefile 2008-09-22 23:59:53 UTC (rev 611) @@ -2,8 +2,7 @@ # # examples/dreamcast/conio/Makefile # (c)2002 Dan Potter -# -# $Id: Makefile,v 1.4 2002/07/27 01:23:49 bardtx Exp $ +# all: $(KOS_MAKE) -C basic Modified: kos/examples/dreamcast/conio/adventure/Makefile =================================================================== --- kos/examples/dreamcast/conio/adventure/Makefile 2008-09-21 18:39:06 UTC (rev 610) +++ kos/examples/dreamcast/conio/adventure/Makefile 2008-09-22 23:59:53 UTC (rev 611) @@ -2,8 +2,7 @@ # # conio/adventure/Makefile # (c)2002 Dan Potter -# -# $Id: Makefile,v 1.3 2002/06/11 06:55:17 bardtx Exp $ +# all: rm-elf adventure.elf Modified: kos/examples/dreamcast/conio/basic/Makefile =================================================================== --- kos/examples/dreamcast/conio/basic/Makefile 2008-09-21 18:39:06 UTC (rev 610) +++ kos/examples/dreamcast/conio/basic/Makefile 2008-09-22 23:59:53 UTC (rev 611) @@ -2,8 +2,7 @@ # # conio/basic/Makefile # (c)2002 Dan Potter -# -# $Id: Makefile,v 1.1 2002/04/20 19:21:49 bardtx Exp $ +# all: rm-elf basic.elf Modified: kos/examples/dreamcast/conio/wump/Makefile =================================================================== --- kos/examples/dreamcast/conio/wump/Makefile 2008-09-21 18:39:06 UTC (rev 610) +++ kos/examples/dreamcast/conio/wump/Makefile 2008-09-22 23:59:53 UTC (rev 611) @@ -2,8 +2,7 @@ # # conio/wump/Makefile # (c)2002 Dan Potter -# -# $Id: Makefile,v 1.1 2002/04/20 19:49:40 bardtx Exp $ +# all: rm-elf wump.elf Modified: kos/examples/dreamcast/cpp/Makefile =================================================================== --- kos/examples/dreamcast/cpp/Makefile 2008-09-21 18:39:06 UTC (rev 610) +++ kos/examples/dreamcast/cpp/Makefile 2008-09-22 23:59:53 UTC (rev 611) @@ -2,8 +2,7 @@ # # examples/dreamcast/cpp/Makefile # (c)2001-2002 Dan Potter -# -# $Id: Makefile,v 1.3 2002/02/24 02:13:07 bardtx Exp $ +# all: $(KOS_MAKE) -C gltest Modified: kos/examples/dreamcast/kgl/Makefile =================================================================== --- kos/examples/dreamcast/kgl/Makefile 2008-09-21 18:39:06 UTC (rev 610) +++ kos/examples/dreamcast/kgl/Makefile 2008-09-22 23:59:53 UTC (rev 611) @@ -2,8 +2,7 @@ # # examples/dreamcast/kgl/Makefile # (c)2002 Dan Potter -# -# $Id: Makefile,v 1.3 2002/04/20 03:48:55 axlen Exp $ +# all: $(KOS_MAKE) -C basic Modified: kos/examples/dreamcast/kgl/basic/Makefile =================================================================== --- kos/examples/dreamcast/kgl/basic/Makefile 2008-09-21 18:39:06 UTC (rev 610) +++ kos/examples/dreamcast/kgl/basic/Makefile 2008-09-22 23:59:53 UTC (rev 611) @@ -4,8 +4,6 @@ # # (c)2002 Paul Boese # -# $Id: Makefile,v 1.6 2002/12/09 04:52:17 bardtx Exp $ -# # This will make all the examples, leaving only the elf files. # If you want to clean everything, use 'clean'. Modified: kos/examples/dreamcast/kgl/basic/scissor/Makefile =================================================================== --- kos/examples/dreamcast/kgl/basic/scissor/Makefile 2008-09-21 18:39:06 UTC (rev 610) +++ kos/examples/dreamcast/kgl/basic/scissor/Makefile 2008-09-22 23:59:53 UTC (rev 611) @@ -4,7 +4,6 @@ # scissor test # (c)2002 Paul Boese # -# $Id: Makefile,v 1.4 2002/09/05 07:40:47 bardtx Exp $ TARGET = scissor.elf OBJS = scissor.o Modified: kos/examples/dreamcast/kgl/basic/scissor/scissor.c =================================================================== --- kos/examples/dreamcast/kgl/basic/scissor/scissor.c 2008-09-21 18:39:06 UTC (rev 610) +++ kos/examples/dreamcast/kgl/basic/scissor/scissor.c 2008-09-22 23:59:53 UTC (rev 611) @@ -22,8 +22,6 @@ #include <GL/glu.h> #include <pcx/pcx.h> -CVSID("$Id: scissor.c,v 1.4 2002/06/30 16:28:34 axlen Exp $"); - #define NUM_DEMOS 5 enum { USERCLIP_INSIDE = 0, USERCLIP_OUTSIDE, USERCLIP_DISABLED, QUAD_SCREEN_UNCLIPPED, QUAD_SCREEN_CLIPPED }; Modified: kos/examples/dreamcast/kgl/basic/texwrap/Makefile =================================================================== --- kos/examples/dreamcast/kgl/basic/texwrap/Makefile 2008-09-21 18:39:06 UTC (rev 610) +++ kos/examples/dreamcast/kgl/basic/texwrap/Makefile 2008-09-22 23:59:53 UTC (rev 611) @@ -4,7 +4,6 @@ # texwrap test # (c)2002 Paul Boese # -# $Id: Makefile,v 1.4 2002/09/05 07:40:47 bardtx Exp $ TARGET = texwrap.elf OBJS = texwrap.o Modified: kos/examples/dreamcast/kgl/basic/texwrap/texwrap.c =================================================================== --- kos/examples/dreamcast/kgl/basic/texwrap/texwrap.c 2008-09-21 18:39:06 UTC (rev 610) +++ kos/examples/dreamcast/kgl/basic/texwrap/texwrap.c 2008-09-22 23:59:53 UTC (rev 611) @@ -9,8 +9,6 @@ #include <GL/glu.h> #include <pcx/pcx.h> -CVSID("$Id: texwrap.c,v 1.2 2002/04/07 02:54:04 bardtx Exp $"); - /* Really simple KGL example to demonstrate the glTexParameter texture wrapping modes. Modified: kos/examples/dreamcast/kgl/basic/vfzclip/Makefile =================================================================== --- kos/examples/dreamcast/kgl/basic/vfzclip/Makefile 2008-09-21 18:39:06 UTC (rev 610) +++ kos/examples/dreamcast/kgl/basic/vfzclip/Makefile 2008-09-22 23:59:53 UTC (rev 611) @@ -1,8 +1,6 @@ # # KallistiGL View Frustum Z-Clipping Test Program # (c)2002 Paul Boese -# -# $Id # TARGET = vfzclip.elf Modified: kos/examples/dreamcast/kgl/basic/vfzclip/vfzclip.c =================================================================== --- kos/examples/dreamcast/kgl/basic/vfzclip/vfzclip.c 2008-09-21 18:39:06 UTC (rev 610) +++ kos/examples/dreamcast/kgl/basic/vfzclip/vfzclip.c 2008-09-22 23:59:53 UTC (rev 611) @@ -14,8 +14,6 @@ #define true (1 == 1) #define false (1 == 0) -CVSID("$Id"); - /* A demonstration of Trilinear's NEAR-Z-Clipper that has been incorporated into KGL. Use the joystick to rotate the view, the D-Pad Modified: kos/examples/dreamcast/kgl/benchmarks/Makefile =================================================================== --- kos/examples/dreamcast/kgl/benchmarks/Makefile 2008-09-21 18:39:06 UTC (rev 610) +++ kos/examples/dreamcast/kgl/benchmarks/Makefile 2008-09-22 23:59:53 UTC (rev 611) @@ -2,8 +2,7 @@ # # examples/dreamcast/kgl/benchmarks/Makefile # (c)2001-2002 Dan Potter -# -# $Id: Makefile,v 1.1 2002/04/20 03:51:45 axlen Exp $ +# all: $(KOS_MAKE) -C quadmark Modified: kos/examples/dreamcast/kgl/benchmarks/quadmark/quadmark.c =================================================================== --- kos/examples/dreamcast/kgl/benchmarks/quadmark/quadmark.c 2008-09-21 18:39:06 UTC (rev 610) +++ kos/examples/dreamcast/kgl/benchmarks/quadmark/quadmark.c 2008-09-22 23:59:53 UTC (rev 611) @@ -8,8 +8,6 @@ #include <GL/gl.h> #include <time.h> -CVSID("$Id: quadmark.c,v 1.3 2003/03/09 01:20:06 bardtx Exp $"); - pvr_init_params_t pvr_params = { { PVR_BINSIZE_16, PVR_BINSIZE_0, PVR_BINSIZE_0, PVR_BINSIZE_0, PVR_BINSIZE_0 }, 512 * 1024 Modified: kos/examples/dreamcast/kgl/benchmarks/trimark/trimark.c =================================================================== --- kos/examples/dreamcast/kgl/benchmarks/trimark/trimark.c 2008-09-21 18:39:06 UTC (rev 610) +++ kos/examples/dreamcast/kgl/benchmarks/trimark/trimark.c 2008-09-22 23:59:53 UTC (rev 611) @@ -8,8 +8,6 @@ #include <GL/gl.h> #include <time.h> -CVSID("$Id: trimark.c,v 1.3 2003/03/09 01:20:06 bardtx Exp $"); - pvr_init_params_t pvr_params = { { PVR_BINSIZE_16, PVR_BINSIZE_0, PVR_BINSIZE_0, PVR_BINSIZE_0, PVR_BINSIZE_0 }, 512 * 1024 Modified: kos/examples/dreamcast/kgl/demos/Makefile =================================================================== --- kos/examples/dreamcast/kgl/demos/Makefile 2008-09-21 18:39:06 UTC (rev 610) +++ kos/examples/dreamcast/kgl/demos/Makefile 2008-09-22 23:59:53 UTC (rev 611) @@ -2,8 +2,7 @@ # # examples/dreamcast/kgl/demos/Makefile # (c)2001-2002 Dan Potter -# -# $Id: Makefile,v 1.2 2002/03/04 05:00:45 bardtx Exp $ +# all: ifdef KOS_CCPLUS Modified: kos/examples/dreamcast/kgl/demos/tunnel/Makefile =================================================================== --- kos/examples/dreamcast/kgl/demos/tunnel/Makefile 2008-09-21 18:39:06 UTC (rev 610) +++ kos/examples/dreamcast/kgl/demos/tunnel/Makefile 2008-09-22 23:59:53 UTC (rev 611) @@ -1,8 +1,6 @@ # KallistiOS ##version## # # tunnel Makefile -# -# $Id: Makefile,v 1.4 2002/09/05 07:40:48 bardtx Exp $ # TARGET = tunnel.elf Modified: kos/examples/dreamcast/kgl/demos/tunnel/menu.cpp =================================================================== --- kos/examples/dreamcast/kgl/demos/tunnel/menu.cpp 2008-09-21 18:39:06 UTC (rev 610) +++ kos/examples/dreamcast/kgl/demos/tunnel/menu.cpp 2008-09-22 23:59:53 UTC (rev 611) @@ -13,8 +13,6 @@ #include "plprint.h" #include "menu.h" -CVSID("$Id: menu.cpp,v 1.1 2002/03/04 02:57:32 axlen Exp $"); - void Menu::add(int min, int max, int amt, int* pval, char *pformat) { Menuitem_t* madd; if (mlist == NULL) { Modified: kos/examples/dreamcast/kgl/demos/tunnel/menu.h =================================================================== --- kos/examples/dreamcast/kgl/demos/tunnel/menu.h 2008-09-21 18:39:06 UTC (rev 610) +++ kos/examples/dreamcast/kgl/demos/tunnel/menu.h 2008-09-22 23:59:53 UTC (rev 611) @@ -5,7 +5,6 @@ A cheap little menu class - $Id: menu.h,v 1.1 2002/03/04 02:57:32 axlen Exp $ */ #ifndef __MENU_H Modified: kos/examples/dreamcast/kgl/demos/tunnel/plprint.cpp =================================================================== --- kos/examples/dreamcast/kgl/demos/tunnel/plprint.cpp 2008-09-21 18:39:06 UTC (rev 610) +++ kos/examples/dreamcast/kgl/demos/tunnel/plprint.cpp 2008-09-22 23:59:53 UTC (rev 611) @@ -11,8 +11,6 @@ #include <dcplib/fnt.h> #include "plprint.h" -CVSID("$Id: plprint.cpp,v 1.2 2002/04/12 01:05:12 axlen Exp $"); - extern uint8 romdisk[]; static fntRenderer *text; Modified: kos/examples/dreamcast/kgl/demos/tunnel/plprint.h =================================================================== --- kos/examples/dreamcast/kgl/demos/tunnel/plprint.h 2008-09-21 18:39:06 UTC (rev 610) +++ kos/examples/dreamcast/kgl/demos/tunnel/plprint.h 2008-09-22 23:59:53 UTC (rev 611) @@ -3,7 +3,6 @@ plprint.h (c)2002 Paul Boese - $Id: plprint.h,v 1.1 2002/03/04 02:57:32 axlen Exp $ */ #ifndef __PLPRINT_H Modified: kos/examples/dreamcast/kgl/demos/tunnel/tunnel.cpp =================================================================== --- kos/examples/dreamcast/kgl/demos/tunnel/tunnel.cpp 2008-09-21 18:39:06 UTC (rev 610) +++ kos/examples/dreamcast/kgl/demos/tunnel/tunnel.cpp 2008-09-22 23:59:53 UTC (rev 611) @@ -12,8 +12,6 @@ #include "plprint.h" #include "menu.h" -CVSID("$Id: tunnel.cpp,v 1.7 2003/03/09 01:20:06 bardtx Exp $"); - #define DPAD_REPEAT_INTERVAL 7 /* frames */ /* tunnel */ Modified: kos/examples/dreamcast/kgl/nehe/Makefile =================================================================== --- kos/examples/dreamcast/kgl/nehe/Makefile 2008-09-21 18:39:06 UTC (rev 610) +++ kos/examples/dreamcast/kgl/nehe/Makefile 2008-09-22 23:59:53 UTC (rev 611) @@ -3,8 +3,6 @@ # examples/dreamcast/kgl/nehe/Makefile # (c)2002 Paul Boese # -# $Id: Makefile,v 1.1 2002/02/23 05:31:52 axlen Exp $ -# # This will make all the examples, leaving only the elf files. # If you want to clean everything, use 'clean'. Modified: kos/examples/dreamcast/kgl/nehe/nehe26/data/Makefile =================================================================== --- kos/examples/dreamcast/kgl/nehe/nehe26/data/Makefile 2008-09-21 18:39:06 UTC (rev 610) +++ kos/examples/dreamcast/kgl/nehe/nehe26/data/Makefile 2008-09-22 23:59:53 UTC (rev 611) @@ -2,7 +2,6 @@ # # (c)2002, Paul Boese # -# $Id: Makefile,v 1.1 2002/02/23 05:20:36 axlen Exp $ CC = gcc -Wall Modified: kos/examples/dreamcast/lua/Makefile =================================================================== --- kos/examples/dreamcast/lua/Makefile 2008-09-21 18:39:06 UTC (rev 610) +++ kos/examples/dreamcast/lua/Makefile 2008-09-22 23:59:53 UTC (rev 611) @@ -2,8 +2,7 @@ # # examples/dreamcast/lua/Makefile # (c)2002 Dan Potter -# -# $Id: Makefile,v 1.1 2002/06/13 09:51:16 bardtx Exp $ +# all: $(KOS_MAKE) -C basic Modified: kos/examples/dreamcast/lua/basic/Makefile =================================================================== --- kos/examples/dreamcast/lua/basic/Makefile 2008-09-21 18:39:06 UTC (rev 610) +++ kos/examples/dreamcast/lua/basic/Makefile 2008-09-22 23:59:53 UTC (rev 611) @@ -2,8 +2,7 @@ # # lua/basic/Makefile # (c)2002 Dan Potter -# -# $Id: Makefile,v 1.2 2002/06/30 06:33:38 bardtx Exp $ +# all: rm-elf lua.elf Modified: kos/examples/dreamcast/lua/basic/lua.c =================================================================== --- kos/examples/dreamcast/lua/basic/lua.c 2008-09-21 18:39:06 UTC (rev 610) +++ kos/examples/dreamcast/lua/basic/lua.c 2008-09-22 23:59:53 UTC (rev 611) @@ -1,5 +1,4 @@ /* -** $Id: lua.c,v 1.2 2002/06/30 06:33:38 bardtx Exp $ ** Lua stand-alone interpreter ** See Copyright Notice in lua.h */ Modified: kos/examples/dreamcast/modem/Makefile =================================================================== --- kos/examples/dreamcast/modem/Makefile 2008-09-21 18:39:06 UTC (rev 610) +++ kos/examples/dreamcast/modem/Makefile 2008-09-22 23:59:53 UTC (rev 611) @@ -2,8 +2,7 @@ # # examples/dreamcast/modem/Makefile # Copyright (C)2003 Dan Potter -# -# $Id: Makefile,v 1.1 2003/05/23 02:05:41 bardtx Exp $ +# all: $(KOS_MAKE) -C basic Modified: kos/examples/dreamcast/network/Makefile =================================================================== --- kos/examples/dreamcast/network/Makefile 2008-09-21 18:39:06 UTC (rev 610) +++ kos/examples/dreamcast/network/Makefile 2008-09-22 23:59:53 UTC (rev 611) @@ -2,8 +2,7 @@ # # examples/dreamcast/network/Makefile # (c)2002 Dan Potter -# -# $Id: Makefile,v 1.5 2002/06/11 06:14:39 bardtx Exp $ +# all: $(KOS_MAKE) -C basic Modified: kos/examples/dreamcast/network/httpd/httpd.c =================================================================== --- kos/examples/dreamcast/network/httpd/httpd.c 2008-09-21 18:39:06 UTC (rev 610) +++ kos/examples/dreamcast/network/httpd/httpd.c 2008-09-22 23:59:53 UTC (rev 611) @@ -8,8 +8,6 @@ #include <lwip/lwip.h> #include <lwip/sockets.h> #include <sys/queue.h> - -CVSID("$Id: httpd.c,v 1.3 2003/07/22 03:57:57 bardtx Exp $"); struct http_state; typedef TAILQ_HEAD(http_state_list, http_state) http_state_list_t; Modified: kos/examples/dreamcast/parallax/Makefile =================================================================== --- kos/examples/dreamcast/parallax/Makefile 2008-09-21 18:39:06 UTC (rev 610) +++ kos/examples/dreamcast/parallax/Makefile 2008-09-22 23:59:53 UTC (rev 611) @@ -2,8 +2,7 @@ # # examples/dreamcast/parallax/Makefile # (c)2002 Dan Potter -# -# $Id: Makefile,v 1.2 2002/09/10 04:40:10 bardtx Exp $ +# TARGETS = font bubbles raster_melt sinus delay_cube rotocube Modified: kos/examples/dreamcast/pvr/Makefile =================================================================== --- kos/examples/dreamcast/pvr/Makefile 2008-09-21 18:39:06 UTC (rev 610) +++ kos/examples/dreamcast/pvr/Makefile 2008-09-22 23:59:53 UTC (rev 611) @@ -2,8 +2,7 @@ # # examples/dreamcast/pvr/Makefile # (c)2002 Dan Potter -# -# $Id: Makefile,v 1.2 2002/09/28 04:18:55 bardtx Exp $ +# all: $(KOS_MAKE) -C plasma Modified: kos/examples/dreamcast/sound/Makefile =================================================================== --- kos/examples/dreamcast/sound/Makefile 2008-09-21 18:39:06 UTC (rev 610) +++ kos/examples/dreamcast/sound/Makefile 2008-09-22 23:59:53 UTC (rev 611) @@ -2,8 +2,7 @@ # # examples/dreamcast/sound/Makefile # (c)2002 Dan Potter -# -# $Id: Makefile,v 1.2.2.1 2003/06/20 06:31:15 bardtx Exp $ +# all: $(KOS_MAKE) -C ghettoplay-vorbis Modified: kos/examples/dreamcast/sound/cdda/Makefile =================================================================== --- kos/examples/dreamcast/sound/cdda/Makefile 2008-09-21 18:39:06 UTC (rev 610) +++ kos/examples/dreamcast/sound/cdda/Makefile 2008-09-22 23:59:53 UTC (rev 611) @@ -2,8 +2,7 @@ # # examples/dreamcast/sound/cdda/Makefile # (c)2002 Dan Potter -# -# $Id: Makefile,v 1.2 2002/07/17 15:14:16 axlen Exp $ +# all: $(KOS_MAKE) -C basic_cdda Modified: kos/examples/dreamcast/tsunami/Makefile =================================================================== --- kos/examples/dreamcast/tsunami/Makefile 2008-09-21 18:39:06 UTC (rev 610) +++ kos/examples/dreamcast/tsunami/Makefile 2008-09-22 23:59:53 UTC (rev 611) @@ -2,8 +2,7 @@ # # examples/dreamcast/tsunami/Makefile # (c)2002 Dan Potter -# -# $Id: Makefile,v 1.1.2.1 2003/06/20 06:10:25 bardtx Exp $ +# all: $(KOS_MAKE) -C font Modified: kos/examples/dreamcast/video/Makefile =================================================================== --- kos/examples/dreamcast/video/Makefile 2008-09-21 18:39:06 UTC (rev 610) +++ kos/examples/dreamcast/video/Makefile 2008-09-22 23:59:53 UTC (rev 611) @@ -2,8 +2,7 @@ # # examples/dreamcast/video/Makefile # (c)2002 Dan Potter -# -# $Id: Makefile,v 1.1 2002/07/10 16:51:42 bardtx Exp $ +# all: $(KOS_MAKE) -C bfont Modified: kos/examples/dreamcast/video/bfont/Makefile =================================================================== --- kos/examples/dreamcast/video/bfont/Makefile 2008-09-21 18:39:06 UTC (rev 610) +++ kos/examples/dreamcast/video/bfont/Makefile 2008-09-22 23:59:53 UTC (rev 611) @@ -2,8 +2,7 @@ # # basic/bfont/Makefile # (c)2002 Dan Potter -# -# $Id: Makefile,v 1.1 2002/06/27 23:23:09 bardtx Exp $ +# all: rm-elf bfont.elf Modified: kos/examples/dreamcast/vmu/Makefile =================================================================== --- kos/examples/dreamcast/vmu/Makefile 2008-09-21 18:39:06 UTC (rev 610) +++ kos/examples/dreamcast/vmu/Makefile 2008-09-22 23:59:53 UTC (rev 611) @@ -2,8 +2,7 @@ # # examples/dreamcast/vmu/Makefile # (c)2002 Dan Potter -# -# $Id: Makefile,v 1.1 2002/02/24 06:20:12 bardtx Exp $ +# all: $(KOS_MAKE) -C vmu_pkg Modified: kos/examples/gba/Makefile =================================================================== --- kos/examples/gba/Makefile 2008-09-21 18:39:06 UTC (rev 610) +++ kos/examples/gba/Makefile 2008-09-22 23:59:53 UTC (rev 611) @@ -2,8 +2,7 @@ # # examples/gba/Makefile # (c)2001 Dan Potter -# -# $Id: Makefile,v 1.2 2002/09/23 23:35:40 bardtx Exp $ +# all: $(KOS_MAKE) -C pogo-keen Modified: kos/examples/gba/pogo-keen/Makefile =================================================================== --- kos/examples/gba/pogo-keen/Makefile 2008-09-21 18:39:06 UTC (rev 610) +++ kos/examples/gba/pogo-keen/Makefile 2008-09-22 23:59:53 UTC (rev 611) @@ -2,8 +2,7 @@ # # pogo-keen/Makefile # (c)2002 Gil Megidish -# -# $Id: Makefile,v 1.1 2002/09/23 19:30:27 gilm Exp $ +# all: pogo-keen.gba Modified: kos/examples/ps2/Makefile =================================================================== --- kos/examples/ps2/Makefile 2008-09-21 18:39:06 UTC (rev 610) +++ kos/examples/ps2/Makefile 2008-09-22 23:59:53 UTC (rev 611) @@ -2,8 +2,7 @@ # # examples/ps2/Makefile # (c)2002 Dan Potter -# -# $Id: Makefile,v 1.1 2002/10/27 23:41:13 bardtx Exp $ +# all: $(KOS_MAKE) -C basic Modified: kos/examples/ps2/basic/Makefile =================================================================== --- kos/examples/ps2/basic/Makefile 2008-09-21 18:39:06 UTC (rev 610) +++ kos/examples/ps2/basic/Makefile 2008-09-22 23:59:53 UTC (rev 611) @@ -2,8 +2,7 @@ # # examples/ps2/basic/Makefile # (c)2002 Dan Potter -# -# $Id: Makefile,v 1.1 2002/10/27 23:41:13 bardtx Exp $ +# all: $(KOS_MAKE) -C hello Modified: kos/include/assert.h =================================================================== --- kos/include/assert.h 2008-09-21 18:39:06 UTC (rev 610) +++ kos/include/assert.h 2008-09-22 23:59:53 UTC (rev 611) @@ -3,7 +3,6 @@ assert.h Copyright (C)2002,2004 Dan Potter - $Id: assert.h,v 1.2 2002/09/13 04:41:57 bardtx Exp $ */ #ifndef __ASSERT_H Modified: kos/include/endian.h =================================================================== --- kos/include/endian.h 2008-09-21 18:39:06 UTC (rev 610) +++ kos/include/endian.h 2008-09-22 23:59:53 UTC (rev 611) @@ -2,7 +2,6 @@ * This module was ported from the BSD 4.5 libc by Dan Potter. Please * see "README.BSD" in "docs" for more information. * - * $Id: endian.h,v 1.2 2003/04/24 03:18:08 bardtx Exp $ */ /* Modified: kos/include/kos/cdefs.h =================================================================== --- kos/include/kos/cdefs.h 2008-09-21 18:39:06 UTC (rev 610) +++ kos/include/kos/cdefs.h 2008-09-22 23:59:53 UTC (rev 611) @@ -3,8 +3,6 @@ kos/cdefs.h Copyright (C)2002,2004 Dan Potter - $Id: cdefs.h,v 1.2 2002/10/26 08:01:34 bardtx Exp $ - Based loosely around some stuff in BSD's sys/cdefs.h */ @@ -42,20 +40,6 @@ /* GCC macros for special cases */ /* #if __GNUC__ == */ -/* Optional CVS ID tags, without warnings */ -#if defined(__GNUC__) && defined(__ELF__) -# define __IDSTRING(name, string) __asm__(".ident\t\"" string "\"") -#else -# define __IDSTRING(name, string) static const char name[] __unused = string; -#endif - -#ifndef NO_CVS_ID -# define IDSTRING(name, s) __IDSTRING(name, s) -# define CVSID(s) __IDSTRING(cvsid, "KOS " s) -#else -# define IDSTRING(s) -#endif - #endif /* __KOS_CDEFS_H */ Modified: kos/include/kos/cond.h =================================================================== --- kos/include/kos/cond.h 2008-09-21 18:39:06 UTC (rev 610) +++ kos/include/kos/cond.h 2008-09-22 23:59:53 UTC (rev 611) @@ -3,8 +3,6 @@ include/kos/cond.h Copyright (C)2001,2003 Dan Potter - $Id: cond.h,v 1.4 2003/07/31 00:38:00 bardtx Exp $ - */ #ifndef __KOS_COND_H Modified: kos/include/kos/dbgio.h =================================================================== --- kos/include/kos/dbgio.h 2008-09-21 18:39:06 UTC (rev 610) +++ kos/include/kos/dbgio.h 2008-09-22 23:59:53 UTC (rev 611) @@ -2,8 +2,6 @@ kos/include/dbgio.h Copyright (C)2000,2004 Dan Potter - - $Id: dbgio.h,v 1.4 2002/04/06 23:40:32 bardtx Exp $ */ Modified: kos/include/kos/dbglog.h =================================================================== --- kos/include/kos/dbglog.h 2008-09-21 18:39:06 UTC (rev 610) +++ kos/include/kos/dbglog.h 2008-09-22 23:59:53 UTC (rev 611) @@ -3,8 +3,6 @@ kos/dbglog.h Copyright (C)2004 Dan Potter - $Id: stdio.h,v 1.3 2003/06/23 05:21:31 bardtx Exp $ - */ #ifndef __KOS_DBGLOG_H Modified: kos/include/kos/elf.h =================================================================== --- kos/include/kos/elf.h 2008-09-21 18:39:06 UTC (rev 610) +++ kos/include/kos/elf.h 2008-09-22 23:59:53 UTC (rev 611) @@ -3,8 +3,6 @@ kos/elf.h Copyright (C)2000,2001,2003 Dan Potter - $Id: elf.h,v 1.3 2003/08/02 23:08:36 bardtx Exp $ - */ #ifndef __KOS_ELF_H Modified: kos/include/kos/exports.h =================================================================== --- kos/include/kos/exports.h 2008-09-21 18:39:06 UTC (rev 610) +++ kos/include/kos/exports.h 2008-09-22 23:59:53 UTC (rev 611) @@ -3,8 +3,6 @@ kos/exports.h Copyright (C)2003 Dan Potter - $Id: exports.h,v 1.1 2003/06/19 04:30:23 bardtx Exp $ - */ #ifndef __KOS_EXPORTS_H Modified: kos/include/kos/fs.h =================================================================== --- kos/include/kos/fs.h 2008-09-21 18:39:06 UTC (rev 610) +++ kos/include/kos/fs.h 2008-09-22 23:59:53 UTC (rev 611) @@ -3,8 +3,6 @@ kos/fs.h Copyright (C)2000,2001,2002,2003 Dan Potter - $Id: fs.h,v 1.11 2003/07/31 00:38:00 bardtx Exp $ - */ #ifndef __KOS_FS_H Modified: kos/include/kos/fs_builtin.h =================================================================== --- kos/include/kos/fs_builtin.h 2008-09-21 18:39:06 UTC (rev 610) +++ kos/include/kos/fs_builtin.h 2008-09-22 23:59:53 UTC (rev 611) @@ -3,7 +3,6 @@ kos/fs_builtin.h (c)2000-2001 Dan Potter - $Id: fs_builtin.h,v 1.3 2002/08/12 18:43:53 bardtx Exp $ */ #ifndef __KOS_FS_BUILTIN_H Modified: kos/include/kos/fs_pty.h =================================================================== --- kos/include/kos/fs_pty.h 2008-09-21 18:39:06 UTC (rev 610) +++ kos/include/kos/fs_pty.h 2008-09-22 23:59:53 UTC (rev 611) @@ -3,7 +3,6 @@ kos/fs_pty.h Copyright (C)2003 Dan Potter - $Id: fs_pty.h,v 1.1 2003/06/19 04:30:23 bardtx Exp $ */ #ifndef __KOS_FS_PTY_H Modified: kos/include/kos/fs_ramdisk.h =================================================================== --- kos/include/kos/fs_ramdisk.h 2008-09-21 18:39:06 UTC (rev 610) +++ kos/include/kos/fs_ramdisk.h 2008-09-22 23:59:53 UTC (rev 611) @@ -3,7 +3,6 @@ kos/fs_ramdisk.h (c)2002 Dan Potter - $Id: fs_ramdisk.h,v 1.2 2003/04/24 03:00:02 bardtx Exp $ */ #ifndef __KOS_FS_RAMDISK_H Modified: kos/include/kos/fs_romdisk.h =================================================================== --- kos/include/kos/fs_romdisk.h 2008-09-21 18:39:06 UTC (rev 610) +++ kos/include/kos/fs_romdisk.h 2008-09-22 23:59:53 UTC (rev 611) @@ -3,7 +3,6 @@ kos/fs_romdisk.h (c)2001 Dan Potter - $Id: fs_romdisk.h,v 1.4 2002/08/13 04:54:22 bardtx Exp $ */ #ifndef __KOS_FS_ROMDISK_H Modified: kos/include/kos/genwait.h =================================================================== --- kos/include/kos/genwait.h 2008-09-21 18:39:06 UTC (rev 610) +++ kos/include/kos/genwait.h 2008-09-22 23:59:53 UTC (rev 611) @@ -3,8 +3,6 @@ include/kos/genwait.h Copyright (c)2003 Dan Potter - $Id: genwait.h,v 1.2 2003/02/16 04:55:24 bardtx Exp $ - */ #ifndef __KOS_GENWAIT_H Modified: kos/include/kos/iovec.h =================================================================== --- kos/include/kos/iovec.h 2008-09-21 18:39:06 UTC (rev 610) +++ kos/include/kos/iovec.h 2008-09-22 23:59:53 UTC (rev 611) @@ -3,8 +3,6 @@ kos/iovec.h Copyright (C)2001 Dan Potter - $Id: iovec.h,v 1.1 2002/02/09 06:15:42 bardtx Exp $ - */ #ifndef __KOS_IOVEC_H Modified: kos/include/kos/library.h =================================================================== --- kos/include/kos/library.h 2008-09-21 18:39:06 UTC (rev 610) +++ kos/include/kos/library.h 2008-09-22 23:59:53 UTC (rev 611) @@ -3,8 +3,6 @@ include/kos/library.h Copyright (C)2003 Dan Potter - $Id$ - */ #ifndef __KOS_LIBRARY_H Modified: kos/include/kos/limits.h =================================================================== --- kos/include/kos/limits.h 2008-09-21 18:39:06 UTC (rev 610) +++ kos/include/kos/limits.h 2008-09-22 23:59:53 UTC (rev 611) @@ -2,8 +2,6 @@ kos/limits.h (c)2000-2001 Dan Potter - - $Id: limits.h,v 1.1.1.1 2001/09/26 07:05:20 bardtx Exp $ */ Modified: kos/include/kos/mutex.h =================================================================== --- kos/include/kos/mutex.h 2008-09-21 18:39:06 UTC (rev 610) +++ kos/include/kos/mutex.h 2008-09-22 23:59:53 UTC (rev 611) @@ -3,8 +3,6 @@ include/kos/mutex.h Copyright (C)2001,2003 Dan Potter - $Id: mutex.h,v 1.2 2003/07/31 00:38:00 bardtx Exp $ - */ #ifndef __KOS_MUTEX_H Modified: kos/include/kos/net.h =================================================================== --- kos/include/kos/net.h 2008-09-21 18:39:06 UTC (rev 610) +++ kos/include/kos/net.h 2008-09-22 23:59:53 UTC (rev 611) @@ -3,8 +3,6 @@ include/kos/net.h (c)2002 Dan Potter - $Id: net.h,v 1.8 2003/06/19 04:30:23 bardtx Exp $ - */ #ifndef __KOS_NET_H Modified: kos/include/kos/nmmgr.h =================================================================== --- kos/include/kos/nmmgr.h 2008-09-21 18:39:06 UTC (rev 610) +++ kos/include/kos/nmmgr.h 2008-09-22 23:59:53 UTC (rev 611) @@ -3,8 +3,6 @@ kos/nmmgr.h Copyright (C)2003 Dan Potter - $Id: nmmgr.h,v 1.1 2003/06/19 04:30:23 bardtx Exp $ - */ #ifndef __KOS_NMMGR_H Modified: kos/include/kos/sem.h =================================================================== --- kos/include/kos/sem.h 2008-09-21 18:39:06 UTC (rev 610) +++ kos/include/kos/sem.h 2008-09-22 23:59:53 UTC (rev 611) @@ -3,8 +3,6 @@ include/kos/sem.h Copyright (C)2001,2003 Dan Potter - $Id: sem.h,v 1.7 2003/07/31 00:38:00 bardtx Exp $ - */ #ifndef __KOS_SEM_H Modified: kos/include/kos/thread.h =================================================================== --- kos/include/kos/thread.h 2008-09-21 18:39:06 UTC (rev 610) +++ kos/include/kos/thread.h 2008-09-22 23:59:53 UTC (rev 611) @@ -3,8 +3,6 @@ include/kos/thread.h Copyright (C)2000,2001,2002,2003 Dan Potter - $Id: thread.h,v 1.13 2003/06/23 05:19:50 bardtx Exp $ - */ #ifndef __KOS_THREAD_H Modified: kos/include/kos.h =================================================================== --- kos/include/kos.h 2008-09-21 18:39:06 UTC (rev 610) +++ kos/include/kos.h 2008-09-22 23:59:53 UTC (rev 611) @@ -3,7 +3,6 @@ kos.h (c)2001 Dan Potter - $Id: kos.h,v 1.25 2003/05/23 02:18:45 bardtx Exp $ */ #ifndef __KOS_H Modified: kos/include/malloc.h =================================================================== --- kos/include/malloc.h 2008-09-21 18:39:06 UTC (rev 610) +++ kos/include/malloc.h 2008-09-22 23:59:53 UTC (rev 611) @@ -3,8 +3,6 @@ malloc.h Copyright (C)2003 Dan Potter - $Id: malloc.h,v 1.6 2003/06/19 04:31:26 bardtx Exp $ - */ #ifndef __MALLOC_H Modified: kos/include/pthread.h =================================================================== --- kos/include/pthread.h 2008-09-21 18:39:06 UTC (rev 610) +++ kos/include/pthread.h 2008-09-22 23:59:53 UTC (rev 611) @@ -15,7 +15,6 @@ * OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY OF THIS * SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE. * - * $Id: pthread.h,v 1.3 2002/10/08 13:03:07 joel Exp $ */ // Need a local copy of this because the default one is buggy. Modified: kos/kernel/Makefile =================================================================== --- kos/ke... [truncated message content] |
From: <ljs...@us...> - 2009-02-04 22:22:10
|
Revision: 623 http://cadcdev.svn.sourceforge.net/cadcdev/?rev=623&view=rev Author: ljsebald Date: 2009-02-04 21:46:56 +0000 (Wed, 04 Feb 2009) Log Message: ----------- Clean up a whole bunch of warnings. Modified Paths: -------------- kos/include/kos/thread.h kos/kernel/arch/dreamcast/fs/fs_dcload.c kos/kernel/arch/dreamcast/hardware/cdrom.c kos/kernel/arch/dreamcast/include/dc/fs_dcload.h kos/kernel/arch/dreamcast/kernel/entry.s kos/kernel/arch/dreamcast/kernel/irq.c kos/kernel/arch/dreamcast/sound/snd_stream.c kos/kernel/exports/nmmgr.c kos/kernel/fs/fs.c kos/kernel/fs/fs_pty.c kos/kernel/fs/fs_romdisk.c kos/kernel/libc/koslib/realpath.c kos/utils/gba-crcfix/Makefile kos/utils/genromfs/Makefile kos/utils/vqenc/Makefile kos/utils/vqenc/readpng.c kos/utils/vqenc/readpng.h kos/utils/wav2adpcm/Makefile kos/utils/wav2adpcm/wav2adpcm.c Modified: kos/include/kos/thread.h =================================================================== --- kos/include/kos/thread.h 2009-02-03 18:32:27 UTC (rev 622) +++ kos/include/kos/thread.h 2009-02-04 21:46:56 UTC (rev 623) @@ -202,7 +202,13 @@ /* Wait for a thread to exit */ int thd_wait(kthread_t * thd); +/* Print a list of all threads using the given print function. */ +int thd_pslist(int (*pf)(const char *fmt, ...)); +/* Print a list of all queued threads using the given print function. */ +int thd_pslist_queue(int (*pf)(const char *fmt, ...)); + + /* Init */ int thd_init(int mode); Modified: kos/kernel/arch/dreamcast/fs/fs_dcload.c =================================================================== --- kos/kernel/arch/dreamcast/fs/fs_dcload.c 2009-02-03 18:32:27 UTC (rev 622) +++ kos/kernel/arch/dreamcast/fs/fs_dcload.c 2009-02-04 21:46:56 UTC (rev 623) @@ -91,13 +91,13 @@ } static char *dcload_path = NULL; -uint32 dcload_open(vfs_handler_t * vfs, const char *fn, int mode) { +void *dcload_open(vfs_handler_t * vfs, const char *fn, int mode) { int hnd = 0; uint32 h; int dcload_mode = 0; if (lwip_dclsc && irq_inside_int()) - return 0; + return (void *)0; spinlock_lock(&mutex); @@ -136,10 +136,12 @@ h = hnd; spinlock_unlock(&mutex); - return h; + return (void *)h; } -void dcload_close(uint32 hnd) { +void dcload_close(void * h) { + uint32 hnd = (uint32)h; + if (lwip_dclsc && irq_inside_int()) return; @@ -156,8 +158,9 @@ spinlock_unlock(&mutex); } -ssize_t dcload_read(uint32 hnd, void *buf, size_t cnt) { +ssize_t dcload_read(void * h, void *buf, size_t cnt) { ssize_t ret = -1; + uint32 hnd = (uint32)h; if (lwip_dclsc && irq_inside_int()) return 0; @@ -173,8 +176,9 @@ return ret; } -ssize_t dcload_write(uint32 hnd, const void *buf, size_t cnt) { +ssize_t dcload_write(void * h, const void *buf, size_t cnt) { ssize_t ret = -1; + uint32 hnd = (uint32)h; if (lwip_dclsc && irq_inside_int()) return 0; @@ -190,8 +194,9 @@ return ret; } -off_t dcload_seek(uint32 hnd, off_t offset, int whence) { +off_t dcload_seek(void * h, off_t offset, int whence) { off_t ret = -1; + uint32 hnd = (uint32)h; if (lwip_dclsc && irq_inside_int()) return 0; @@ -207,8 +212,9 @@ return ret; } -off_t dcload_tell(uint32 hnd) { +off_t dcload_tell(void * h) { off_t ret = -1; + uint32 hnd = (uint32)h; if (lwip_dclsc && irq_inside_int()) return 0; @@ -224,9 +230,10 @@ return ret; } -size_t dcload_total(uint32 hnd) { +size_t dcload_total(void * h) { size_t ret = -1; size_t cur; + uint32 hnd = (uint32)h; if (lwip_dclsc && irq_inside_int()) return 0; @@ -246,11 +253,12 @@ /* Not thread-safe, but that's ok because neither is the FS */ static dirent_t dirent; -dirent_t *dcload_readdir(uint32 hnd) { +dirent_t *dcload_readdir(void * h) { dirent_t *rv = NULL; dcload_dirent_t *dcld; dcload_stat_t filestat; char *fn; + uint32 hnd = (uint32)h; if (lwip_dclsc && irq_inside_int()) return 0; Modified: kos/kernel/arch/dreamcast/hardware/cdrom.c =================================================================== --- kos/kernel/arch/dreamcast/hardware/cdrom.c 2009-02-03 18:32:27 UTC (rev 622) +++ kos/kernel/arch/dreamcast/hardware/cdrom.c 2009-02-04 21:46:56 UTC (rev 623) @@ -59,11 +59,15 @@ /* Set disc access mode */ static int gdc_change_data_type(void *param) { MAKE_SYSCALL(return, param, 0, 10); } +/* These two functions are never actually used in here. They're only really here + for reference at this point. */ +#if 0 /* Reset the GD-ROM */ static void gdc_reset() { MAKE_SYSCALL(/**/, 0, 0, 9); } /* Abort the current command */ static void gdc_abort_cmd(int cmd) { MAKE_SYSCALL(/**/,cmd, 0, 8); } +#endif /* The CD access mutex */ static mutex_t * mutex = NULL; Modified: kos/kernel/arch/dreamcast/include/dc/fs_dcload.h =================================================================== --- kos/kernel/arch/dreamcast/include/dc/fs_dcload.h 2009-02-03 18:32:27 UTC (rev 622) +++ kos/kernel/arch/dreamcast/include/dc/fs_dcload.h 2009-02-04 21:46:56 UTC (rev 623) @@ -101,13 +101,13 @@ size_t dcload_gdbpacket(const char* in_buf, size_t in_size, char* out_buf, size_t out_size); /* File functions */ -uint32 dcload_open(vfs_handler_t * vfs, const char *fn, int mode); -void dcload_close(uint32 hnd); -ssize_t dcload_read(uint32 hnd, void *buf, size_t cnt); -off_t dcload_seek(uint32 hnd, off_t offset, int whence); -off_t dcload_tell(uint32 hnd); -size_t dcload_total(uint32 hnd); -dirent_t* dcload_readdir(uint32 hnd); +void* dcload_open(vfs_handler_t * vfs, const char *fn, int mode); +void dcload_close(void * hnd); +ssize_t dcload_read(void * hnd, void *buf, size_t cnt); +off_t dcload_seek(void * hnd, off_t offset, int whence); +off_t dcload_tell(void * hnd); +size_t dcload_total(void * hnd); +dirent_t* dcload_readdir(void * hnd); int dcload_rename(vfs_handler_t * vfs, const char *fn1, const char *fn2); int dcload_unlink(vfs_handler_t * vfs, const char *fn); Modified: kos/kernel/arch/dreamcast/kernel/entry.s =================================================================== --- kos/kernel/arch/dreamcast/kernel/entry.s 2009-02-03 18:32:27 UTC (rev 622) +++ kos/kernel/arch/dreamcast/kernel/entry.s 2009-02-04 21:46:56 UTC (rev 623) @@ -272,9 +272,11 @@ mov.l tmh_shortcut_addr,r0 mov.l @r0,r0 cmp/pz r0 - bf/s _irq_save_regs + bt tmh_clear + bra _irq_save_regs mov #2,r4 +tmh_clear: ! Coast is clear -- setup the args and call the C function. Regs R0-R7 ! are volatile on SH-4 anyway, and R8-R14 will be saved if needed ! onto our temp stack. So all we need to worry about here, at least Modified: kos/kernel/arch/dreamcast/kernel/irq.c =================================================================== --- kos/kernel/arch/dreamcast/kernel/irq.c 2009-02-03 18:32:27 UTC (rev 622) +++ kos/kernel/arch/dreamcast/kernel/irq.c 2009-02-04 21:46:56 UTC (rev 623) @@ -12,6 +12,7 @@ #include <arch/types.h> #include <arch/irq.h> #include <arch/timer.h> +#include <arch/stack.h> #include <kos/dbgio.h> #include <kos/thread.h> #include <kos/library.h> Modified: kos/kernel/arch/dreamcast/sound/snd_stream.c =================================================================== --- kos/kernel/arch/dreamcast/sound/snd_stream.c 2009-02-03 18:32:27 UTC (rev 622) +++ kos/kernel/arch/dreamcast/sound/snd_stream.c 2009-02-04 21:46:56 UTC (rev 623) @@ -11,6 +11,7 @@ #include <string.h> #include <stdlib.h> #include <stdio.h> +#include <malloc.h> #include <sys/queue.h> #include <arch/timer.h> Modified: kos/kernel/exports/nmmgr.c =================================================================== --- kos/kernel/exports/nmmgr.c 2009-02-03 18:32:27 UTC (rev 622) +++ kos/kernel/exports/nmmgr.c 2009-02-04 21:46:56 UTC (rev 623) @@ -20,6 +20,7 @@ #include <string.h> #include <kos/nmmgr.h> #include <kos/mutex.h> +#include <kos/exports.h> /* Thread mutex for our name handler list */ static mutex_t * mutex; Modified: kos/kernel/fs/fs.c =================================================================== --- kos/kernel/fs/fs.c 2009-02-03 18:32:27 UTC (rev 622) +++ kos/kernel/fs/fs.c 2009-02-04 21:46:56 UTC (rev 623) @@ -37,6 +37,7 @@ #include <kos/thread.h> #include <kos/mutex.h> #include <kos/nmmgr.h> +#include <kos/dbgio.h> /* File handle structure; this is an entirely internal structure so it does not go in a header file. */ @@ -49,7 +50,10 @@ /* The global file descriptor table */ fs_hnd_t * fd_table[FD_SETSIZE] = { NULL }; +/* For some reason, Newlib doesn't seem to define this function in stdlib.h. */ +extern char *realpath(const char *, const char *); + /* Internal file commands for root dir reading */ static fs_hnd_t * fs_root_opendir() { fs_hnd_t *hnd; Modified: kos/kernel/fs/fs_pty.c =================================================================== --- kos/kernel/fs/fs_pty.c 2009-02-03 18:32:27 UTC (rev 622) +++ kos/kernel/fs/fs_pty.c 2009-02-04 21:46:56 UTC (rev 623) @@ -30,6 +30,7 @@ #include <sys/queue.h> #include <malloc.h> #include <string.h> +#include <stdlib.h> #include <stdio.h> #include <assert.h> #include <errno.h> @@ -553,8 +554,7 @@ } /* Get total size. For this we return the number of bytes available for reading. */ -static ssize_t pty_total(void * h) { - int avail; +static size_t pty_total(void * h) { pipefd_t * fdobj; ptyhalf_t * ph; Modified: kos/kernel/fs/fs_romdisk.c =================================================================== --- kos/kernel/fs/fs_romdisk.c 2009-02-03 18:32:27 UTC (rev 622) +++ kos/kernel/fs/fs_romdisk.c 2009-02-04 21:46:56 UTC (rev 623) @@ -431,7 +431,7 @@ if (c->own_buffer) dbglog(DBG_DEBUG, " (and also freeing its image buffer)\n"); - assert( &c->vfsh->nmmgr == c->vfsh ); + assert( (void *)&c->vfsh->nmmgr == (void *)c->vfsh ); if (c->own_buffer) free((void *)c->image); nmmgr_handler_remove(&c->vfsh->nmmgr); @@ -489,7 +489,7 @@ vfsh->privdata = (void *)mnt; mnt->vfsh = vfsh; - assert( &mnt->vfsh->nmmgr == mnt->vfsh ); + assert( (void *)&mnt->vfsh->nmmgr == (void *)mnt->vfsh ); /* Add it to our mount list */ mutex_lock(fh_mutex); @@ -525,7 +525,7 @@ dbglog(DBG_DEBUG, " (and also freeing its image buffer)\n"); /* Unmount it */ - assert( &n->vfsh->nmmgr == n->vfsh ); + assert( (void *)&n->vfsh->nmmgr == (void *)n->vfsh ); nmmgr_handler_remove(&n->vfsh->nmmgr); /* If we own the buffer, free it */ Modified: kos/kernel/libc/koslib/realpath.c =================================================================== --- kos/kernel/libc/koslib/realpath.c 2009-02-03 18:32:27 UTC (rev 622) +++ kos/kernel/libc/koslib/realpath.c 2009-02-04 21:46:56 UTC (rev 623) @@ -31,6 +31,7 @@ #include <sys/param.h> #include <sys/stat.h> #include <kos/limits.h> +#include <kos/fs.h> #include <errno.h> #include <stdlib.h> Modified: kos/utils/gba-crcfix/Makefile =================================================================== --- kos/utils/gba-crcfix/Makefile 2009-02-03 18:32:27 UTC (rev 622) +++ kos/utils/gba-crcfix/Makefile 2009-02-04 21:46:56 UTC (rev 623) @@ -1,6 +1,6 @@ -CFLAGS = -O2 -g -Wall -DINLINE=inline #-g# -LDFLAGS = -s -g #-g +CFLAGS = -O2 -Wall -DINLINE=inline #-g# +#LDFLAGS = -s -g TARGET=gba-crcfix OBJS=gba-crcfix.o Modified: kos/utils/genromfs/Makefile =================================================================== --- kos/utils/genromfs/Makefile 2009-02-03 18:32:27 UTC (rev 622) +++ kos/utils/genromfs/Makefile 2009-02-04 21:46:56 UTC (rev 623) @@ -2,7 +2,7 @@ # Makefile for the genromfs program. CFLAGS = -O2 -Wall #-g# -LDFLAGS = -s#-g +#LDFLAGS = -s -g all: genromfs Modified: kos/utils/vqenc/Makefile =================================================================== --- kos/utils/vqenc/Makefile 2009-02-03 18:32:27 UTC (rev 622) +++ kos/utils/vqenc/Makefile 2009-02-04 21:46:56 UTC (rev 623) @@ -7,7 +7,7 @@ # Use for other systems CFLAGS = -O2 -Wall -DINLINE=inline #-g# -LDFLAGS = -s -lpng -ljpeg -lz #-g +LDFLAGS = -lpng -ljpeg -lz #-s -g all: vqenc Modified: kos/utils/vqenc/readpng.c =================================================================== --- kos/utils/vqenc/readpng.c 2009-02-03 18:32:27 UTC (rev 622) +++ kos/utils/vqenc/readpng.c 2009-02-04 21:46:56 UTC (rev 623) @@ -60,7 +60,7 @@ return 0; } -uint8 *readpng_get_image(uint32 *pChannels, uint32 *pRowbytes, uint32 *pWidth, uint32 *pHeight) +uint8 *readpng_get_image(uint32 *pChannels, uint32 *pRowbytes, int *pWidth, int *pHeight) { png_uint_32 width, height; int bit_depth, color_type; @@ -76,8 +76,8 @@ png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, NULL, NULL, NULL); - *pWidth = width; - *pHeight = height; + *pWidth = (int)width; + *pHeight = (int)height; /* expand palette images to RGB, low-bit-depth grayscale images to 8 bits, * transparency chunks to full alpha channel; strip 16-bit-per-sample Modified: kos/utils/vqenc/readpng.h =================================================================== --- kos/utils/vqenc/readpng.h 2009-02-03 18:32:27 UTC (rev 622) +++ kos/utils/vqenc/readpng.h 2009-02-04 21:46:56 UTC (rev 623) @@ -33,6 +33,6 @@ * The caller is responsible for freeing the memory */ uint8 *readpng_get_image(uint32 *pNumChannels, - uint32 *pRowBytes, uint32 *pWidth, uint32 *pHeight); + uint32 *pRowBytes, int *pWidth, int *pHeight); void readpng_cleanup(void); Modified: kos/utils/wav2adpcm/Makefile =================================================================== --- kos/utils/wav2adpcm/Makefile 2009-02-03 18:32:27 UTC (rev 622) +++ kos/utils/wav2adpcm/Makefile 2009-02-04 21:46:56 UTC (rev 623) @@ -1,8 +1,8 @@ # Makefile for the wav2adpcm program. -CFLAGS = -O2 -Wall -g -LDFLAGS = -g +CFLAGS = -O2 -Wall #-g# +#LDFLAGS = -g all: wav2adpcm Modified: kos/utils/wav2adpcm/wav2adpcm.c =================================================================== --- kos/utils/wav2adpcm/wav2adpcm.c 2009-02-03 18:32:27 UTC (rev 622) +++ kos/utils/wav2adpcm/wav2adpcm.c 2009-02-04 21:46:56 UTC (rev 623) @@ -17,6 +17,7 @@ #include <stdio.h> #include <stdlib.h> +#include <string.h> static int diff_lookup[16] = { 1,3,5,7,9,11,13,15, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ljs...@us...> - 2009-02-07 23:31:24
|
Revision: 626 http://cadcdev.svn.sourceforge.net/cadcdev/?rev=626&view=rev Author: ljsebald Date: 2009-02-07 23:31:22 +0000 (Sat, 07 Feb 2009) Log Message: ----------- Adding in a new Dreameye driver that can grab saved images off of the Dreameye. Modified Paths: -------------- kos/doc/CHANGELOG kos/examples/dreamcast/Makefile kos/kernel/arch/dreamcast/hardware/maple/dreameye.c kos/kernel/arch/dreamcast/include/dc/maple/dreameye.h kos/kernel/arch/dreamcast/include/dc/maple.h Added Paths: ----------- kos/examples/dreamcast/dreameye/ kos/examples/dreamcast/dreameye/Makefile kos/examples/dreamcast/dreameye/basic/ kos/examples/dreamcast/dreameye/basic/Makefile kos/examples/dreamcast/dreameye/basic/dreameye.c Modified: kos/doc/CHANGELOG =================================================================== --- kos/doc/CHANGELOG 2009-02-07 22:53:58 UTC (rev 625) +++ kos/doc/CHANGELOG 2009-02-07 23:31:22 UTC (rev 626) @@ -177,6 +177,8 @@ - DC Added reading of the ISP settings from PlanetWeb to the flashrom code [LS] - DC Fixed various pieces of code that rely on flashrom_ispcfg_t [LS] - *** Added an implementation of DHCP to the network stack [LS] +- DC Added Dreameye driver that is capable of fetching stored images from the + device. [LS] KallistiOS version 1.2.0 ----------------------------------------------- - DC Fix to use DCARM7_CFLAGS when compiling ARM driver [Christian Groessler == CG] Modified: kos/examples/dreamcast/Makefile =================================================================== --- kos/examples/dreamcast/Makefile 2009-02-07 22:53:58 UTC (rev 625) +++ kos/examples/dreamcast/Makefile 2009-02-07 23:31:22 UTC (rev 626) @@ -4,7 +4,7 @@ # Copyright (C)2003 Dan Potter # -DIRS = 2ndmix basic libdream kgl hello sound png network vmu conio pvr video lua parallax modem +DIRS = 2ndmix basic libdream kgl hello sound png network vmu conio pvr video lua parallax modem dreameye ifdef KOS_CCPLUS DIRS += cpp tsunami endif Added: kos/examples/dreamcast/dreameye/Makefile =================================================================== --- kos/examples/dreamcast/dreameye/Makefile (rev 0) +++ kos/examples/dreamcast/dreameye/Makefile 2009-02-07 23:31:22 UTC (rev 626) @@ -0,0 +1,15 @@ +# KallistiOS ##version## +# +# examples/dreamcast/dreameye/Makefile +# Copyright (C) 2009 Lawrence Sebald +# + +all: + $(KOS_MAKE) -C basic + +clean: + $(KOS_MAKE) -C basic clean + +dist: + $(KOS_MAKE) -C basic dist + Added: kos/examples/dreamcast/dreameye/basic/Makefile =================================================================== --- kos/examples/dreamcast/dreameye/basic/Makefile (rev 0) +++ kos/examples/dreamcast/dreameye/basic/Makefile 2009-02-07 23:31:22 UTC (rev 626) @@ -0,0 +1,29 @@ +# KallistiOS ##version## +# +# examples/dreamcast/dreameye/basic/Makefile +# Copyright (C) 2009 Lawrence Sebald +# + +all: rm-elf dreameye_test.elf + +include $(KOS_BASE)/Makefile.rules + +OBJS = dreameye.o + +clean: rm-elf + -rm -f $(OBJS) + +rm-elf: + -rm -f dreameye_test.elf + +dreameye_test.elf: $(OBJS) + $(KOS_CC) $(KOS_CFLAGS) $(KOS_LDFLAGS) -o dreameye_test.elf $(KOS_START) \ + $(OBJS) $(DATAOBJS) $(OBJEXTRA) $(KOS_LIBS) + + +run: dreameye_test.elf + $(KOS_LOADER) dreameye_test.elf + +dist: + rm -f $(OBJS) + $(KOS_STRIP) dreameye_test.elf Added: kos/examples/dreamcast/dreameye/basic/dreameye.c =================================================================== --- kos/examples/dreamcast/dreameye/basic/dreameye.c (rev 0) +++ kos/examples/dreamcast/dreameye/basic/dreameye.c 2009-02-07 23:31:22 UTC (rev 626) @@ -0,0 +1,61 @@ +/* KallistiOS ##version## + + dreameye.c + Copyright (C) 2009 Lawrence Sebald +*/ + +#include <stdio.h> +#include <stdlib.h> + +#include <dc/maple.h> +#include <dc/maple/dreameye.h> + +int main(int argc, char *argv[]) { + maple_device_t *dreameye; + dreameye_state_t *state; + uint8 *buf; + int size, err; + FILE *fp; + + printf("KallistiOS Dreameye Test program\n"); + printf("Attempting to find a connected Dreameye device...\n"); + + dreameye = maple_enum_type(0, MAPLE_FUNC_CAMERA); + + if(!dreameye) { + printf("Couldn't find any attached devices, bailing out.\n"); + return 0; + } + + state = (dreameye_state_t *)maple_dev_status(dreameye); + + printf("Attempting to grab the number of saved images...\n"); + dreameye_get_image_count(dreameye, 1); + + printf("Image Count is %s -- (%d)\n", + state->image_count_valid ? "valid" : "invalid", state->image_count); + + printf("Attempting to grab the first image.\n"); + err = dreameye_get_image(dreameye, 2, &buf, &size); + + if(err != MAPLE_EOK) { + printf("Error was: %d\n", err); + return 0; + } + + printf("Image received successfully, size %d bytes\n", size); + + fp = fopen("/pc/image.jpg", "wb"); + if(!fp) { + printf("Could not open /pc/image.jpg for writing\n"); + free(buf); + return 0; + } + + fwrite(buf, size, 1, fp); + fclose(fp); + free(buf); + + printf("That's all for now.\n"); + return 0; +} Modified: kos/kernel/arch/dreamcast/hardware/maple/dreameye.c =================================================================== --- kos/kernel/arch/dreamcast/hardware/maple/dreameye.c 2009-02-07 22:53:58 UTC (rev 625) +++ kos/kernel/arch/dreamcast/hardware/maple/dreameye.c 2009-02-07 23:31:22 UTC (rev 626) @@ -1,18 +1,323 @@ /* KallistiOS ##version## dreameye.c - Copyright (C) 2005 Lawrence Sebald + Copyright (C) 2005, 2009 Lawrence Sebald */ +#include <assert.h> +#include <string.h> +#include <stdlib.h> + +#include <kos/dbglog.h> +#include <kos/genwait.h> #include <dc/maple.h> #include <dc/maple/dreameye.h> +static int dreameye_send_get_image(maple_device_t *dev, + dreameye_state_t *state, uint8 req); + +static void dreameye_get_image_count_cb(maple_frame_t *frame) { + dreameye_state_t *de; + maple_response_t *resp; + uint32 *respbuf32; + uint8 *respbuf8; + + /* Unlock the frame */ + maple_frame_unlock(frame); + + /* Make sure we got a valid response */ + resp = (maple_response_t *)frame->recv_buf; + if(resp->response != MAPLE_RESPONSE_DATATRF) + return; + + respbuf32 = (uint32 *)resp->data; + respbuf8 = (uint8 *)resp->data; + if(respbuf32[0] != MAPLE_FUNC_CAMERA) + return; + + /* Update the status that was requested. */ + if(frame->dev) { + assert( (resp->data_len) == 3 ); + assert( respbuf8[4] == 0xD0 ); + assert( respbuf8[5] == 0x00 ); + assert( respbuf8[8] == DREAMEYE_GETCOND_NUM_IMAGES ); + assert( respbuf8[9] == 0x04 ); + + /* Update the data in the status. */ + de = (dreameye_state_t *)frame->dev->status; + de->image_count = (respbuf8[10] << 8) | respbuf8[11]; + de->image_count_valid = 1; + frame->dev->status_valid = 1; + } + + /* Wake up! */ + genwait_wake_all(frame); +} + +int dreameye_get_image_count(maple_device_t *dev, int block) { + dreameye_state_t *de; + uint32 *send_buf; + + assert( dev != NULL); + + de = (dreameye_state_t *)dev->status; + de->image_count_valid = 0; + + /* Lock the frame */ + if(maple_frame_lock(&dev->frame) < 0) + return MAPLE_EAGAIN; + + /* Reset the frame */ + maple_frame_init(&dev->frame); + send_buf = (uint32 *)dev->frame.recv_buf; + send_buf[0] = MAPLE_FUNC_CAMERA; + send_buf[1] = DREAMEYE_GETCOND_NUM_IMAGES | (0x04 << 8); + dev->frame.cmd = MAPLE_COMMAND_GETCOND; + dev->frame.dst_port = dev->port; + dev->frame.dst_unit = dev->unit; + dev->frame.length = 2; + dev->frame.callback = dreameye_get_image_count_cb; + dev->frame.send_buf = send_buf; + maple_queue_frame(&dev->frame); + + if(block) { + /* Wait for the Dreameye to accept it */ + if(genwait_wait(&dev->frame, "dreameye_get_image_count", 500, + NULL) < 0) { + if(dev->frame.state != MAPLE_FRAME_VACANT) { + /* Something went wrong... */ + dev->frame.state = MAPLE_FRAME_VACANT; + dbglog(DBG_ERROR, "dreameye_get_image_count: timeout to unit " + "%c%c\n", dev->port + 'A', dev->unit + '0'); + return MAPLE_ETIMEOUT; + } + } + } + + return MAPLE_EOK; +} + +static void dreameye_get_image_cb(maple_frame_t *frame) { + maple_device_t *dev; + dreameye_state_t *de; + maple_response_t *resp; + uint32 *respbuf32; + uint8 *respbuf8; + int len; + uint8 *tmp; + + /* Unlock the frame */ + maple_frame_unlock(frame); + + if(frame->dev == NULL) + return; + + dev = frame->dev; + de = (dreameye_state_t *)frame->dev->status; + + /* Make sure we got a valid response */ + resp = (maple_response_t *)frame->recv_buf; + if(resp->response != MAPLE_RESPONSE_DATATRF) { + de->img_transferring = -1; + return; + } + + respbuf32 = (uint32 *)resp->data; + respbuf8 = (uint8 *)resp->data; + if(respbuf32[0] != MAPLE_FUNC_CAMERA) { + de->img_transferring = -1; + return; + } + + len = (resp->data_len - 3) * 4; + + /* Allocate space for the data. */ + tmp = (uint8 *)realloc(de->img_buf, de->img_size + len); + + if(tmp == NULL) { + de->img_transferring = -1; + return; + } + + /* Copy the data. */ + memcpy(tmp + de->img_size, respbuf8 + 12, len); + de->img_buf = tmp; + de->img_size += len; + de->img_counter = respbuf8[5] + 1; + + /* Check if we're done. */ + if(respbuf8[4] & 0x40) { + de->img_transferring = 0; + return; + } + + dreameye_send_get_image(dev, de, DREAMEYE_IMAGEREQ_CONTINUE); +} + +static int dreameye_send_get_image(maple_device_t *dev, + dreameye_state_t *state, uint8 req) { + uint32 *send_buf; + + /* Lock the frame */ + if(maple_frame_lock(&dev->frame) < 0) + return MAPLE_EAGAIN; + + /* Reset the frame */ + maple_frame_init(&dev->frame); + send_buf = (uint32 *)dev->frame.recv_buf; + send_buf[0] = MAPLE_FUNC_CAMERA; + send_buf[1] = DREAMEYE_SUBCOMMAND_IMAGEREQ | (state->img_number << 8) | + (req << 16) | (state->img_counter << 24); + dev->frame.cmd = MAPLE_COMMAND_CAMCONTROL; + dev->frame.dst_port = dev->port; + dev->frame.dst_unit = dev->unit; + dev->frame.length = 2; + dev->frame.callback = dreameye_get_image_cb; + dev->frame.send_buf = send_buf; + maple_queue_frame(&dev->frame); + + return MAPLE_EOK; +} + +int dreameye_get_image(maple_device_t *dev, uint8 image, uint8 **data, + int *img_sz) { + dreameye_state_t *de; + int err; + + assert( dev != NULL); + + de = (dreameye_state_t *)dev->status; + + de->img_transferring = 1; + de->img_buf = NULL; + de->img_size = 0; + de->img_number = image; + de->img_counter = 0; + + /* Set up the frame. */ + err = dreameye_send_get_image(dev, de, DREAMEYE_IMAGEREQ_START); + if(err) + return err; + + while(de->img_transferring == 1) { + thd_pass(); + } + + if(de->img_transferring == 0) { + *data = de->img_buf; + *img_sz = de->img_size; + + dbglog(DBG_DEBUG, "dreameye_get_image: Image of size %d received in " + "%d transfers\n", de->img_size, de->img_counter); + + de->img_buf = NULL; + de->img_size = 0; + de->img_counter = 0; + return MAPLE_EOK; + } + + /* If we get here, something went wrong. */ + if(de->img_buf != NULL) { + free(de->img_buf); + } + + de->img_transferring = 0; + de->img_buf = NULL; + de->img_size = 0; + de->img_counter = 0; + + return MAPLE_EFAIL; +} + +static void dreameye_erase_cb(maple_frame_t *frame) { + maple_response_t *resp; + uint8 *respbuf; + + /* Unlock the frame */ + maple_frame_unlock(frame); + + /* Make sure we got a valid response */ + resp = (maple_response_t *)frame->recv_buf; + respbuf = (uint8 *)resp->data; + + if(resp->response == MAPLE_COMMAND_CAMCONTROL && + respbuf[4] == DREAMEYE_SUBCOMMAND_ERROR) { + dbglog(DBG_ERROR, "dreameye_erase_image: Dreameye returned error code " + "0x%02X%02X%02X\n", respbuf[5], respbuf[6], respbuf[7]); + } + else if(resp->response != MAPLE_RESPONSE_OK) + return; + + /* Wake up! */ + genwait_wake_all(frame); +} + +int dreameye_erase_image(maple_device_t *dev, uint8 image, int block) { + uint32 *send_buf; + + assert( dev != NULL ); + + if(image < 0x02 || (image > 0x21 && image != 0xFF)) + return MAPLE_EINVALID; + + /* Lock the frame */ + if(maple_frame_lock(&dev->frame) < 0) + return MAPLE_EAGAIN; + + /* Reset the frame */ + maple_frame_init(&dev->frame); + send_buf = (uint32 *)dev->frame.recv_buf; + send_buf[0] = MAPLE_FUNC_CAMERA; + send_buf[1] = DREAMEYE_SUBCOMMAND_ERASE | (0x80 << 8) | (image << 16); + dev->frame.cmd = MAPLE_COMMAND_CAMCONTROL; + dev->frame.dst_port = dev->port; + dev->frame.dst_unit = dev->unit; + dev->frame.length = 2; + dev->frame.callback = dreameye_erase_cb; + dev->frame.send_buf = send_buf; + maple_queue_frame(&dev->frame); + + if(block) { + /* Wait for the Dreameye to accept it */ + if(genwait_wait(&dev->frame, "dreameye_erase_image", 500, NULL) < 0) { + if(dev->frame.state != MAPLE_FRAME_VACANT) { + /* Something went wrong.... */ + dev->frame.state = MAPLE_FRAME_VACANT; + dbglog(DBG_ERROR, "dreameye_erase_image: timeout to unit " + "%c%c\n", dev->port + 'A', dev->unit + '0'); + return MAPLE_ETIMEOUT; + } + } + } + + return MAPLE_EOK; +} + +static int dreameye_poll(maple_device_t *dev) { + /* For right now, we don't have anything particularly pressing to do here, + so punt. */ + dev->status_valid = 1; + return 0; +} + static void dreameye_periodic(maple_driver_t *drv) { + maple_driver_foreach(drv, dreameye_poll); } static int dreameye_attach(maple_driver_t *drv, maple_device_t *dev) { - dev->status_valid = 1; - return 0; + dreameye_state_t *de; + + de = (dreameye_state_t *)dev->status; + de->image_count = 0; + de->image_count_valid = 0; + de->img_transferring = 0; + de->img_buf = NULL; + de->img_size = 0; + de->img_number = 0; + de->img_counter = 0; + + dev->status_valid = 1; + return 0; } static void dreameye_detach(maple_driver_t *drv, maple_device_t *dev) { @@ -20,18 +325,18 @@ /* Device Driver Struct */ static maple_driver_t dreameye_drv = { - functions: MAPLE_FUNC_CAMERA, - name: "Dreameye (Camera)", - periodic: dreameye_periodic, - attach: dreameye_attach, - detach: dreameye_detach + functions: MAPLE_FUNC_CAMERA, + name: "Dreameye (Camera)", + periodic: dreameye_periodic, + attach: dreameye_attach, + detach: dreameye_detach }; -/* Add the DreamEye to the driver chain */ +/* Add the Dreameye to the driver chain */ int dreameye_init() { - return maple_driver_reg(&dreameye_drv); + return maple_driver_reg(&dreameye_drv); } void dreameye_shutdown() { - maple_driver_unreg(&dreameye_drv); + maple_driver_unreg(&dreameye_drv); } Modified: kos/kernel/arch/dreamcast/include/dc/maple/dreameye.h =================================================================== --- kos/kernel/arch/dreamcast/include/dc/maple/dreameye.h 2009-02-07 22:53:58 UTC (rev 625) +++ kos/kernel/arch/dreamcast/include/dc/maple/dreameye.h 2009-02-07 23:31:22 UTC (rev 626) @@ -1,7 +1,7 @@ /* KallistiOS ##version## dc/maple/dreameye.h - Copyright (C) 2005 Lawrence Sebald + Copyright (C) 2005, 2009 Lawrence Sebald */ @@ -13,9 +13,52 @@ #include <arch/types.h> -/* There's nothing much here to see right now, just stuff - to make the detection work. */ +/* Dreameye Status structure. Everything in here should be considered to be + read-only from user programs. Note that most of this is used for keeping + track of what's going on during an image transfer. */ +typedef struct dreameye_state { + int image_count; + int image_count_valid; + int img_transferring; + uint8 *img_buf; + int img_size; + uint8 img_number; + uint8 img_counter; +} dreameye_state_t; +/* Attributes that can be obtained with the Get Condition command. */ +#define DREAMEYE_GETCOND_NUM_IMAGES 0x81 + +/* Subcommands that are used with Camera Control command. */ +#define DREAMEYE_SUBCOMMAND_IMAGEREQ 0x04 +#define DREAMEYE_SUBCOMMAND_ERASE 0x05 +#define DREAMEYE_SUBCOMMAND_ERROR 0xFF + +/* Used with the image request subcommand. */ +#define DREAMEYE_IMAGEREQ_CONTINUE 0x00 +#define DREAMEYE_IMAGEREQ_START 0x40 + +/* Grab the current number of saved images on the Dreameye. This command can be + sent to any of the sub-devices. Set block to 1 in order to wait for a + response from the Dreameye. When a response arrives, the state image_count + will be set and image_count_valid will be set to 1. The return value from + this function IS NOT the number of images. Returns MAPLE_EOK on success. */ +int dreameye_get_image_count(maple_device_t *dev, int block); + +/* Grab a specified image from the Dreameye. This command can take some time, + and (for the time being, anyway) will block. You can send this command to any + of the sub-devices. You are responsible for freeing the buffer after the + command has completed if you recieve a MAPLE_EOK response. */ +int dreameye_get_image(maple_device_t *dev, uint8 image, uint8 **data, + int *img_sz); + +/* Erase an image from the Dreameye. This command can be sent to any of the + sub-devices. Set block to 1 in order to wait for a response from the + Dreameye. Pass an image of 0xFF to erase all images from the Dreameye. + Returns MAPLE_EOK on success, MAPLE_EINVALID if an invalid image number is + passed in. */ +int dreameye_erase_image(maple_device_t *dev, uint8 image, int block); + /* Init / Shutdown */ int dreameye_init(); void dreameye_shutdown(); Modified: kos/kernel/arch/dreamcast/include/dc/maple.h =================================================================== --- kos/kernel/arch/dreamcast/include/dc/maple.h 2009-02-07 22:53:58 UTC (rev 625) +++ kos/kernel/arch/dreamcast/include/dc/maple.h 2009-02-07 23:31:22 UTC (rev 626) @@ -65,6 +65,7 @@ #define MAPLE_COMMAND_BSYNC 13 #define MAPLE_COMMAND_SETCOND 14 #define MAPLE_COMMAND_MICCONTROL 15 +#define MAPLE_COMMAND_CAMCONTROL 17 /* Function codes; most sources claim that these numbers are little endian, and for all I know, they might be; but since it's a bitmask This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ljs...@us...> - 2009-04-29 18:08:53
|
Revision: 630 http://cadcdev.svn.sourceforge.net/cadcdev/?rev=630&view=rev Author: ljsebald Date: 2009-04-29 18:08:33 +0000 (Wed, 29 Apr 2009) Log Message: ----------- Adding functionality like pthread_once, along with an example for its use. Modified Paths: -------------- kos/examples/dreamcast/basic/threading/Makefile kos/include/kos.h kos/kernel/thread/Makefile Added Paths: ----------- kos/examples/dreamcast/basic/threading/once/ kos/examples/dreamcast/basic/threading/once/Makefile kos/examples/dreamcast/basic/threading/once/once_test.c kos/include/kos/once.h kos/kernel/thread/once.c Modified: kos/examples/dreamcast/basic/threading/Makefile =================================================================== --- kos/examples/dreamcast/basic/threading/Makefile 2009-04-29 03:58:46 UTC (rev 629) +++ kos/examples/dreamcast/basic/threading/Makefile 2009-04-29 18:08:33 UTC (rev 630) @@ -8,14 +8,17 @@ $(KOS_MAKE) -C general $(KOS_MAKE) -C rwsem $(KOS_MAKE) -C recursive_lock + $(KOS_MAKE) -C once clean: $(KOS_MAKE) -C general clean $(KOS_MAKE) -C rwsem clean $(KOS_MAKE) -C recursive_lock clean + $(KOS_MAKE) -C once clean dist: $(KOS_MAKE) -C general dist $(KOS_MAKE) -C rwsem dist $(KOS_MAKE) -C recursive_lock dist + $(KOS_MAKE) -C once dist Added: kos/examples/dreamcast/basic/threading/once/Makefile =================================================================== --- kos/examples/dreamcast/basic/threading/once/Makefile (rev 0) +++ kos/examples/dreamcast/basic/threading/once/Makefile 2009-04-29 18:08:33 UTC (rev 630) @@ -0,0 +1,30 @@ +# KallistiOS ##version## +# +# basic/threading/once/Makefile +# Copyright (C) 2009 Lawrence Sebald +# + +all: rm-elf once_test.elf + +include $(KOS_BASE)/Makefile.rules + +OBJS = once_test.o + +clean: rm-elf + -rm -f $(OBJS) + +rm-elf: + -rm -f once_test.elf + +once_test.elf: $(OBJS) + $(KOS_CC) $(KOS_CFLAGS) $(KOS_LDFLAGS) -o once_test.elf $(KOS_START) \ + $(OBJS) $(DATAOBJS) $(OBJEXTRA) $(KOS_LIBS) + + +run: once_test.elf + $(KOS_LOADER) once_test.elf + +dist: + rm -f $(OBJS) + $(KOS_STRIP) once_test.elf + Added: kos/examples/dreamcast/basic/threading/once/once_test.c =================================================================== --- kos/examples/dreamcast/basic/threading/once/once_test.c (rev 0) +++ kos/examples/dreamcast/basic/threading/once/once_test.c 2009-04-29 18:08:33 UTC (rev 630) @@ -0,0 +1,65 @@ +/* KallistiOS ##version## + + once_test.c + Copyright (C) 2009 Lawrence Sebald + +*/ + +/* This program is a test for the kthread_once_t type added in KOS 1.3.0. A once + object is used with the kthread_once function to ensure that an initializer + function is only run once in a program (meaning multiple threads will not run + the function. */ + +#include <stdio.h> +#include <kos/thread.h> +#include <kos/once.h> + +#include <arch/arch.h> +#include <dc/maple.h> +#include <dc/maple/controller.h> + +#define UNUSED __attribute__((unused)) +#define THD_COUNT 600 + +kthread_once_t once = KTHREAD_ONCE_INIT; +int counter = 0; + +void once_func(void) { + ++counter; +} + +void thd_func(void *param UNUSED) { + kthread_t *cur = thd_get_current(); + + printf("Thd %d: Attempting to call kthread_once\n", cur->tid); + kthread_once(&once, &once_func); + printf("Thd %d: kthread_once returned\n", cur->tid); +} + +KOS_INIT_FLAGS(INIT_DEFAULT); + +int main(int argc, char *argv[]) { + int i; + kthread_t *thds[THD_COUNT]; + + cont_btn_callback(0, CONT_START | CONT_A | CONT_B | CONT_X | CONT_Y, + arch_exit); + + printf("KallistiOS kthread_once test program\n"); + + /* Create the threads. */ + printf("Creating %d threads\n", THD_COUNT); + for(i = 0; i < THD_COUNT; ++i) { + thds[i] = thd_create(&thd_func, NULL); + } + + printf("Waiting for the threads to finish\n"); + for(i = 0; i < THD_COUNT; ++i) { + thd_wait(thds[i]); + } + + printf("Final counter value: %d (expected 1)\n", counter); + printf("Test finished\n"); + + return 0; +} Added: kos/include/kos/once.h =================================================================== --- kos/include/kos/once.h (rev 0) +++ kos/include/kos/once.h 2009-04-29 18:08:33 UTC (rev 630) @@ -0,0 +1,26 @@ +/* KallistiOS ##version## + + include/kos/once.h + Copyright (C) 2009 Lawrence Sebald + +*/ + +#ifndef __KOS_ONCE_H +#define __KOS_ONCE_H + +#include <sys/cdefs.h> +__BEGIN_DECLS + +#include <sys/queue.h> + +typedef int kthread_once_t; + +#define KTHREAD_ONCE_INIT 0 + +/* Run a function once. Returns -1 on failure. + ENOMEM - Out of memory + EPERM - called inside an interrupt + EINTR - was interrupted */ +int kthread_once(kthread_once_t *once_control, void (*init_routine)(void)); + +#endif /* !__KOS_ONCE_H */ Modified: kos/include/kos.h =================================================================== --- kos/include/kos.h 2009-04-29 03:58:46 UTC (rev 629) +++ kos/include/kos.h 2009-04-29 18:08:33 UTC (rev 630) @@ -30,6 +30,7 @@ #include <kos/sem.h> #include <kos/rwsem.h> #include <kos/recursive_lock.h> +#include <kos/once.h> #include <kos/mutex.h> #include <kos/cond.h> #include <kos/genwait.h> Modified: kos/kernel/thread/Makefile =================================================================== --- kos/kernel/thread/Makefile 2009-04-29 03:58:46 UTC (rev 629) +++ kos/kernel/thread/Makefile 2009-04-29 18:08:33 UTC (rev 630) @@ -5,7 +5,7 @@ # OBJS = sem.o cond.o mutex.o genwait.o -OBJS += thread.o rwsem.o recursive_lock.o +OBJS += thread.o rwsem.o recursive_lock.o once.o SUBDIRS = include $(KOS_BASE)/Makefile.prefab Added: kos/kernel/thread/once.c =================================================================== --- kos/kernel/thread/once.c (rev 0) +++ kos/kernel/thread/once.c 2009-04-29 18:08:33 UTC (rev 630) @@ -0,0 +1,48 @@ +/* KallistiOS ##version## + + once.c + Copyright (C) 2009 Lawrence Sebald +*/ + +#include <malloc.h> +#include <stdio.h> +#include <assert.h> +#include <errno.h> + +#include <kos/once.h> +#include <kos/recursive_lock.h> + +/* The lock used to make sure multiple threads don't try to run the same routine + at the same time. */ +static recursive_lock_t *lock = NULL; + +int kthread_once(kthread_once_t *once_control, void (*init_routine)(void)) { + assert(once_control); + + /* Create the lock if needed. */ + if(!lock) { + lock = rlock_create(); + + if(!lock) { + return -1; + } + } + + /* Lock the lock. */ + if(rlock_lock(lock) == -1) { + return -1; + } + + /* If the function has already been run, unlock the lock and return. */ + if(*once_control) { + rlock_unlock(lock); + return 0; + } + + /* Run the function, set the control, and unlock the lock. */ + init_routine(); + *once_control = 1; + rlock_unlock(lock); + + return 0; +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ljs...@us...> - 2009-04-30 14:08:58
|
Revision: 631 http://cadcdev.svn.sourceforge.net/cadcdev/?rev=631&view=rev Author: ljsebald Date: 2009-04-30 14:08:56 +0000 (Thu, 30 Apr 2009) Log Message: ----------- Adding in thread-local storage support. Modified Paths: -------------- kos/doc/CHANGELOG kos/examples/dreamcast/basic/threading/Makefile kos/include/kos/thread.h kos/include/kos.h kos/kernel/thread/Makefile kos/kernel/thread/thread.c Added Paths: ----------- kos/examples/dreamcast/basic/threading/tls/ kos/examples/dreamcast/basic/threading/tls/Makefile kos/examples/dreamcast/basic/threading/tls/tls_test.c kos/include/kos/tls.h kos/kernel/thread/tls.c Modified: kos/doc/CHANGELOG =================================================================== --- kos/doc/CHANGELOG 2009-04-29 18:08:33 UTC (rev 630) +++ kos/doc/CHANGELOG 2009-04-30 14:08:56 UTC (rev 631) @@ -179,6 +179,8 @@ - *** Added an implementation of DHCP to the network stack [LS] - DC Added Dreameye driver that is capable of fetching stored images from the device. [LS] +- *** Added kthread_once function (think pthread_once) [LS] +- *** Added pthreads-like thread-local storage [LS] KallistiOS version 1.2.0 ----------------------------------------------- - DC Fix to use DCARM7_CFLAGS when compiling ARM driver [Christian Groessler == CG] Modified: kos/examples/dreamcast/basic/threading/Makefile =================================================================== --- kos/examples/dreamcast/basic/threading/Makefile 2009-04-29 18:08:33 UTC (rev 630) +++ kos/examples/dreamcast/basic/threading/Makefile 2009-04-30 14:08:56 UTC (rev 631) @@ -9,16 +9,19 @@ $(KOS_MAKE) -C rwsem $(KOS_MAKE) -C recursive_lock $(KOS_MAKE) -C once + $(KOS_MAKE) -C tls clean: $(KOS_MAKE) -C general clean $(KOS_MAKE) -C rwsem clean $(KOS_MAKE) -C recursive_lock clean $(KOS_MAKE) -C once clean + $(KOS_MAKE) -C tls clean dist: $(KOS_MAKE) -C general dist $(KOS_MAKE) -C rwsem dist $(KOS_MAKE) -C recursive_lock dist $(KOS_MAKE) -C once dist + $(KOS_MAKE) -C tls dist Added: kos/examples/dreamcast/basic/threading/tls/Makefile =================================================================== --- kos/examples/dreamcast/basic/threading/tls/Makefile (rev 0) +++ kos/examples/dreamcast/basic/threading/tls/Makefile 2009-04-30 14:08:56 UTC (rev 631) @@ -0,0 +1,30 @@ +# KallistiOS ##version## +# +# basic/threading/tls/Makefile +# Copyright (C) 2009 Lawrence Sebald +# + +all: rm-elf tls_test.elf + +include $(KOS_BASE)/Makefile.rules + +OBJS = tls_test.o + +clean: rm-elf + -rm -f $(OBJS) + +rm-elf: + -rm -f tls_test.elf + +tls_test.elf: $(OBJS) + $(KOS_CC) $(KOS_CFLAGS) $(KOS_LDFLAGS) -o tls_test.elf $(KOS_START) \ + $(OBJS) $(DATAOBJS) $(OBJEXTRA) $(KOS_LIBS) + + +run: tls_test.elf + $(KOS_LOADER) tls_test.elf + +dist: + rm -f $(OBJS) + $(KOS_STRIP) tls_test.elf + Added: kos/examples/dreamcast/basic/threading/tls/tls_test.c =================================================================== --- kos/examples/dreamcast/basic/threading/tls/tls_test.c (rev 0) +++ kos/examples/dreamcast/basic/threading/tls/tls_test.c 2009-04-30 14:08:56 UTC (rev 631) @@ -0,0 +1,105 @@ +/* KallistiOS ##version## + + tls_test.c + Copyright (C) 2009 Lawrence Sebald + +*/ + +/* This program is a test for thread-local storage added in KOS 1.3.0. */ + +#include <stdio.h> +#include <stdlib.h> +#include <kos/thread.h> +#include <kos/once.h> +#include <kos/tls.h> + +#include <arch/arch.h> +#include <dc/maple.h> +#include <dc/maple/controller.h> + +#define UNUSED __attribute__((unused)) + +kthread_once_t once = KTHREAD_ONCE_INIT; +kthread_key_t key1, key2; + +void destructor(void *data) { + printf("Destroying %d\n", (int)data); +} + +void once_func(void) { + if(kthread_key_create(&key2, &destructor)) { + printf("Error in calling kthread_key_create\n"); + } +} + +void thd_func(void *param UNUSED) { + kthread_t *cur = thd_get_current(); + void *data; + + printf("Thd %d: Reading key 1\n", cur->tid); + data = kthread_getspecific(key1); + printf("Thd %d: kthread_getspecific returned %p (should be NULL)\n", + cur->tid, data); + + printf("Thd %d: Will create key 2, if its not created\n", cur->tid); + kthread_once(&once, &once_func); + + printf("Thd %d: Writing to key 2\n", cur->tid); + if(kthread_setspecific(key2, (void *)cur->tid)) { + printf("Error in kthread_setspecific!!!\n"); + thd_exit(); + } + + if(cur->tid & 0x01) { + printf("Thd %d: sleeping...\n", cur->tid); + thd_sleep(200); + } + + printf("Thd %d: Reading key 2\n", cur->tid); + data = kthread_getspecific(key2); + printf("Thd %d: kthread_getspecific returned %d (should be %d)\n", cur->tid, + (int)data, cur->tid); +} + +KOS_INIT_FLAGS(INIT_DEFAULT); + +int main(int argc, char *argv[]) { + kthread_t *thds[2]; + void *data; + + cont_btn_callback(0, CONT_START | CONT_A | CONT_B | CONT_X | CONT_Y, + arch_exit); + + printf("KallistiOS TLS test program\n"); + + printf("Main thread: Creating key 1\n"); + if(kthread_key_create(&key1, NULL)) { + printf("Error in creating key 1\n"); + exit(-1); + } + + printf("Main thread: Setting key 1 to 0xDEADBEEF\n"); + kthread_setspecific(key1, (void *)0xDEADBEEF); + data = kthread_getspecific(key1); + printf("Main thread: Key 1 value: %p\n", data); + + /* Create the threads. */ + printf("Main therad: Creating 2 threads\n"); + thds[0] = thd_create(&thd_func, NULL); + thds[1] = thd_create(&thd_func, NULL); + + printf("Main thread: Waiting for the threads to finish\n"); + thd_wait(thds[0]); + thd_wait(thds[1]); + + data = kthread_getspecific(key1); + printf("Main thread: Key 1 value: %p\n", data); + + printf("Main thread: Removing keys\n"); + kthread_key_delete(key1); + kthread_key_delete(key2); + + printf("Test finished\n"); + + return 0; +} Modified: kos/include/kos/thread.h =================================================================== --- kos/include/kos/thread.h 2009-04-29 18:08:33 UTC (rev 630) +++ kos/include/kos/thread.h 2009-04-30 14:08:56 UTC (rev 631) @@ -2,6 +2,7 @@ include/kos/thread.h Copyright (C)2000,2001,2002,2003 Dan Potter + Copyright (C) 2009 Lawrence Sebald */ @@ -11,6 +12,7 @@ #include <sys/cdefs.h> __BEGIN_DECLS +#include <kos/tls.h> #include <arch/types.h> #include <arch/irq.h> #include <arch/arch.h> @@ -21,6 +23,23 @@ #define PRIO_MAX 4096 #define PRIO_DEFAULT 10 +/* Thread-local storage key-value pair. */ +typedef struct kthread_tls_kv { + /* List handle. */ + LIST_ENTRY(kthread_tls_kv) kv_list; + + /* The key associated with this data. */ + kthread_key_t key; + + /* The value of the data. */ + void *data; + + /* Optional destructor for the key. */ + void (*destructor)(void *); +} kthread_tls_kv_t; + +LIST_HEAD(kthread_tls_kv_list, kthread_tls_kv); + /* Pre-define list/queue types */ struct kthread; TAILQ_HEAD(ktqueue, kthread); @@ -87,6 +106,9 @@ /* Our re-ent struct for newlib */ struct _reent thd_reent; + + /* Thread-local storage */ + struct kthread_tls_kv_list tls_list; } kthread_t; /* Thread flag values */ Added: kos/include/kos/tls.h =================================================================== --- kos/include/kos/tls.h (rev 0) +++ kos/include/kos/tls.h 2009-04-30 14:08:56 UTC (rev 631) @@ -0,0 +1,53 @@ +/* KallistiOS ##version## + + include/kos/tls.h + Copyright (C) 2009 Lawrence Sebald + +*/ + +/* This file defines methods for accessing thread-local storage, added in KOS + 1.3.0. */ + +#ifndef __KOS_TLS_H +#define __KOS_TLS_H + +#include <sys/cdefs.h> +__BEGIN_DECLS + +/* Thread-local storage key type. */ +typedef int kthread_key_t; + +/* Retrieve the next key value (i.e, what key the next kthread_key_create will + use). */ +kthread_key_t kthread_key_next(); + +/* Create a new TLS key. Returns non-zero on failure. + EPERM - called inside an interrupt and another call is in progress + ENOMEM - out of memory */ +int kthread_key_create(kthread_key_t *key, void (*destructor)(void *)); + +/* Get the value stored for a given TLS key. Returns NULL if the key is not + valid or not set in the current thread. */ +void *kthread_getspecific(kthread_key_t key); + +/* Set the value for a given TLS key. Returns non-zero on failure. + EINVAL - the key is not valid + ENOMEM - out of memory + EPERM - called inside an interrupt and another call is in progress */ +int kthread_setspecific(kthread_key_t key, const void *value); + +/* Delete a TLS key, removing all threads' values for the given key. This does + not call any destructors. Returns non-zero on failure. + EINVAL - the key is not valid + EPERM - unsafe to utilize free */ +int kthread_key_delete(kthread_key_t key); + +/* Delete the destructor for a given key. */ +void kthread_key_delete_destructor(kthread_key_t key); + +int kthread_tls_init(); +void kthread_tls_shutdown(); + +__END_DECLS + +#endif /* __KOS_TLS_H */ Modified: kos/include/kos.h =================================================================== --- kos/include/kos.h 2009-04-29 18:08:33 UTC (rev 630) +++ kos/include/kos.h 2009-04-30 14:08:56 UTC (rev 631) @@ -31,6 +31,7 @@ #include <kos/rwsem.h> #include <kos/recursive_lock.h> #include <kos/once.h> +#include <kos/tls.h> #include <kos/mutex.h> #include <kos/cond.h> #include <kos/genwait.h> Modified: kos/kernel/thread/Makefile =================================================================== --- kos/kernel/thread/Makefile 2009-04-29 18:08:33 UTC (rev 630) +++ kos/kernel/thread/Makefile 2009-04-30 14:08:56 UTC (rev 631) @@ -5,7 +5,7 @@ # OBJS = sem.o cond.o mutex.o genwait.o -OBJS += thread.o rwsem.o recursive_lock.o once.o +OBJS += thread.o rwsem.o recursive_lock.o once.o tls.o SUBDIRS = include $(KOS_BASE)/Makefile.prefab Modified: kos/kernel/thread/thread.c =================================================================== --- kos/kernel/thread/thread.c 2009-04-29 18:08:33 UTC (rev 630) +++ kos/kernel/thread/thread.c 2009-04-30 14:08:56 UTC (rev 631) @@ -10,6 +10,7 @@ #include <malloc.h> #include <stdio.h> #include <reent.h> +#include <errno.h> #include <kos/thread.h> #include <kos/sem.h> #include <kos/rwsem.h> @@ -194,6 +195,22 @@ /* Terminate the current thread */ void thd_exit() { + kthread_tls_kv_t *i, *i2; + + /* Clean up any thread-local data. */ + LIST_FOREACH(i, &thd_current->tls_list, kv_list) { + if(i->destructor) { + i->destructor(i->data); + } + } + + i = LIST_FIRST(&thd_current->tls_list); + while(i != NULL) { + i2 = LIST_NEXT(i, kv_list); + free(i); + i = i2; + } + /* Call Dr. Kevorkian; after this executes we could be killed at any time. */ thd_current->state = STATE_ZOMBIE; @@ -306,6 +323,9 @@ _REENT_INIT_PTR((&(nt->thd_reent))); + /* Initialize thread-local storage. */ + LIST_INIT(&nt->tls_list); + /* Insert it into the thread list */ LIST_INSERT_HEAD(&thd_list, nt, t_list); @@ -719,6 +739,47 @@ return old; } +/* Delete a TLS key. Note that currently this doesn't prevent you from reusing + the key after deletion. This seems ok, as the pthreads standard states that + using the key after deletion results in "undefined behavior". + XXXX: This should really be in tls.c, but we need the list of threads to go + through, so it ends up here instead. */ +int kthread_key_delete(kthread_key_t key) { + int old = irq_disable(); + kthread_t *cur; + kthread_tls_kv_t *i; + + /* Make sure the key is valid. */ + if(key >= kthread_key_next() || key < 1) { + irq_restore(old); + errno = EINVAL; + return -1; + } + + /* Make sure we can actually use free below. */ + if(!malloc_irq_safe()) { + irq_restore(old); + errno = EPERM; + return -1; + } + + /* Go through each thread searching for (and removing) the data. */ + LIST_FOREACH(cur, &thd_list, t_list) { + LIST_FOREACH(i, &cur->tls_list, kv_list) { + if(i->key == key) { + LIST_REMOVE(i, kv_list); + free(i); + break; + } + } + } + + kthread_key_delete_destructor(key); + + irq_restore(old); + return 0; +} + /*****************************************************************************/ /* Init/shutdown */ @@ -745,6 +806,9 @@ /* Start off with no "current" thread */ thd_current = NULL; + /* Init thread-local storage. */ + kthread_tls_init(); + /* Setup a kernel task for the currently running "main" thread */ kern = thd_create(NULL, NULL); strcpy(kern->label, "[kernel]"); @@ -817,6 +881,8 @@ cond_shutdown(); genwait_shutdown(); + kthread_tls_shutdown(); + /* Not running */ thd_mode = THD_MODE_NONE; Added: kos/kernel/thread/tls.c =================================================================== --- kos/kernel/thread/tls.c (rev 0) +++ kos/kernel/thread/tls.c 2009-04-30 14:08:56 UTC (rev 631) @@ -0,0 +1,182 @@ +/* KallistiOS ##version## + + kernel/thread/tls.c + Copyright (C) 2009 Lawrence Sebald +*/ + +/* This file defines methods for accessing thread-local storage, added in KOS + 1.3.0. */ + +#include <stdlib.h> +#include <assert.h> +#include <errno.h> +#include <malloc.h> + +#include <kos/tls.h> +#include <kos/thread.h> +#include <arch/irq.h> +#include <arch/spinlock.h> + +static spinlock_t mutex = SPINLOCK_INITIALIZER; +static kthread_key_t next_key = 1; + +typedef struct kthread_tls_dest { + /* List handle */ + LIST_ENTRY(kthread_tls_dest) dest_list; + + /* The key */ + kthread_key_t key; + + /* Destructor for the key */ + void (*destructor)(void *); +} kthread_tls_dest_t; + +LIST_HEAD(kthread_tls_dest_list, kthread_tls_dest); + +static struct kthread_tls_dest_list dest_list; + +/* What is the next key that will be given out? */ +kthread_key_t kthread_key_next() { + return next_key; +} + +typedef void (*destructor)(void *); + +/* Get the destructor for a given key. */ +static destructor kthread_key_get_destructor(kthread_key_t key) { + kthread_tls_dest_t *i; + + LIST_FOREACH(i, &dest_list, dest_list) { + if(i->key == key) { + return i->destructor; + } + } + + return NULL; +} + +/* Delete the destructor for a given key. */ +void kthread_key_delete_destructor(kthread_key_t key) { + kthread_tls_dest_t *i; + + LIST_FOREACH(i, &dest_list, dest_list) { + if(i->key == key) { + LIST_REMOVE(i, dest_list); + free(i); + return; + } + } +} + +/* Create a new TLS key. */ +int kthread_key_create(kthread_key_t *key, void (*destructor)(void *)) { + kthread_tls_dest_t *dest; + + if(irq_inside_int() && + (spinlock_is_locked(&mutex) || !malloc_irq_safe())) { + errno = EPERM; + return -1; + } + + spinlock_lock(&mutex); + + /* Store the destructor if need be. */ + if(destructor) { + dest = (kthread_tls_dest_t *)malloc(sizeof(kthread_tls_dest_t)); + if(!dest) { + errno = ENOMEM; + spinlock_unlock(&mutex); + return -1; + } + + dest->key = next_key; + dest->destructor = destructor; + LIST_INSERT_HEAD(&dest_list, dest, dest_list); + } + + *key = next_key++; + spinlock_unlock(&mutex); + + return 0; +} + +/* Get the value stored for a given TLS key. Returns NULL if the key is invalid + or there is no data there for the current thread. */ +void *kthread_getspecific(kthread_key_t key) { + kthread_t *cur = thd_get_current(); + kthread_tls_kv_t *i; + + LIST_FOREACH(i, &cur->tls_list, kv_list) { + if(i->key == key) { + return i->data; + } + } + + return NULL; +} + +/* Set the value for a given TLS key. Returns -1 on failure. errno will be + EINVAL if the key is not valid, ENOMEM if there is no memory available to + allocate for storage, or EPERM if run inside an interrupt and the a call is + in progress already. */ +int kthread_setspecific(kthread_key_t key, const void *value) { + kthread_t *cur = thd_get_current(); + kthread_tls_kv_t *i; + + if(irq_inside_int() && spinlock_is_locked(&mutex)) { + errno = EPERM; + return -1; + } + + spinlock_lock(&mutex); + + /* Make sure the key is valid. */ + if(key >= next_key || key < 1) { + errno = EINVAL; + return -1; + } + + spinlock_unlock(&mutex); + + /* Check if we already have an entry for this key. */ + LIST_FOREACH(i, &cur->tls_list, kv_list) { + if(i->key == key) { + i->data = (void *)value; + return 0; + } + } + + /* No entry, create a new one. */ + i = (kthread_tls_kv_t *)malloc(sizeof(kthread_tls_kv_t)); + + if(!i) { + errno = ENOMEM; + return -1; + } + + i->key = key; + i->data = (void *)value; + i->destructor = kthread_key_get_destructor(key); + LIST_INSERT_HEAD(&cur->tls_list, i, kv_list); + + return 0; +} + +int kthread_tls_init() { + /* Initialize the destructor list. */ + LIST_INIT(&dest_list); + + return 0; +} + +void kthread_tls_shutdown() { + kthread_tls_dest_t *n1, *n2; + + /* Tear down the destructor list. */ + n1 = LIST_FIRST(&dest_list); + while (n1 != NULL) { + n2 = LIST_NEXT(n1, dest_list); + free(n1); + n1 = n2; + } +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ljs...@us...> - 2009-05-02 18:43:27
|
Revision: 634 http://cadcdev.svn.sourceforge.net/cadcdev/?rev=634&view=rev Author: ljsebald Date: 2009-05-02 18:43:17 +0000 (Sat, 02 May 2009) Log Message: ----------- Initial GCC 4.x support and various warning cleanups Modified Paths: -------------- kos/environ_base.sh kos/kernel/arch/dreamcast/fs/fs_dclsocket.c kos/kernel/arch/dreamcast/fs/fs_iso9660.c kos/kernel/arch/dreamcast/hardware/flashrom.c kos/kernel/arch/dreamcast/hardware/modem/mdata.c kos/kernel/arch/dreamcast/hardware/network/broadband_adapter.c kos/kernel/arch/dreamcast/include/dc/vmufs.h kos/kernel/arch/dreamcast/kernel/gdb_stub.c kos/kernel/arch/dreamcast/kernel/init.c kos/kernel/fs/elf.c kos/kernel/fs/fs_romdisk.c kos/kernel/libc/koslib/crtbegin.c kos/kernel/libc/koslib/crtend.c kos/kernel/net/net_arp.c kos/kernel/net/net_dhcp.c kos/kernel/net/net_icmp.h kos/kernel/net/net_ipv4.h Modified: kos/environ_base.sh =================================================================== --- kos/environ_base.sh 2009-05-01 18:55:59 UTC (rev 633) +++ kos/environ_base.sh 2009-05-02 18:43:17 UTC (rev 634) @@ -11,8 +11,6 @@ export KOS_INC_PATHS="${KOS_INC_PATHS} -I${KOS_BASE}/include \ -I${KOS_BASE}/kernel/arch/${KOS_ARCH}/include -I${KOS_BASE}/addons/include" -#export KOS_INC_PATHS_CPP="${KOS_INC_PATHS_CPP} -I${KOS_BASE}/libk++/stlport" - # "System" libraries export KOS_LIB_PATHS="-L${KOS_BASE}/lib/${KOS_ARCH} -L${KOS_BASE}/addons/lib/${KOS_ARCH}" export KOS_LIBS="-Wl,--start-group -lkallisti -lc -lgcc -Wl,--end-group" @@ -28,9 +26,22 @@ export KOS_STRIP="${KOS_CC_BASE}/bin/${KOS_CC_PREFIX}-strip" export KOS_CFLAGS="${KOS_CFLAGS} ${KOS_INC_PATHS} -D_arch_${KOS_ARCH} -D_arch_sub_${KOS_SUBARCH} -Wall -g -fno-builtin -fno-strict-aliasing" export KOS_CPPFLAGS="${KOS_CPPFLAGS} ${KOS_INC_PATHS_CPP} -fno-operator-names -fno-rtti -fno-exceptions" -#export KOS_AFLAGS="${KOS_AFLAGS}" -export KOS_LDFLAGS="${KOS_LDFLAGS} -nostartfiles -nostdlib ${KOS_LIB_PATHS}" +GCCVER="`kos-cc -v 2>&1 | tail -1 | awk '{print $3}'`" + +case $GCCVER in + 4*) + export KOS_LDFLAGS="${KOS_LDFLAGS} -nodefaultlibs ${KOS_LIB_PATHS}" ;; + *) + export KOS_LDFLAGS="${KOS_LDFLAGS} -nostartfiles -nostdlib ${KOS_LIB_PATHS}" ;; +esac + # Some extra vars based on architecture export KOS_ARCH_DIR="${KOS_BASE}/kernel/arch/${KOS_ARCH}" -export KOS_START="${KOS_ARCH_DIR}/kernel/startup.o" + +case $GCCVER in + 4*) + export KOS_START="" ;; + *) + export KOS_START="${KOS_ARCH_DIR}/kernel/startup.o" ;; +esac Modified: kos/kernel/arch/dreamcast/fs/fs_dclsocket.c =================================================================== --- kos/kernel/arch/dreamcast/fs/fs_dclsocket.c 2009-05-01 18:55:59 UTC (rev 633) +++ kos/kernel/arch/dreamcast/fs/fs_dclsocket.c 2009-05-02 18:43:17 UTC (rev 634) @@ -41,23 +41,23 @@ #define PACKED __attribute__((packed)) typedef struct { - unsigned char id[4] PACKED; - unsigned int address PACKED; - unsigned int size PACKED; - unsigned char data[0] PACKED; -} command_t; + unsigned char id[4]; + unsigned int address; + unsigned int size; + unsigned char data[0]; +} PACKED command_t; typedef struct { - unsigned char id[4] PACKED; - unsigned int value0 PACKED; -} command_int_t; + unsigned char id[4]; + unsigned int value0; +} PACKED command_int_t; typedef struct { - unsigned char id[4] PACKED; - unsigned int value0 PACKED; - unsigned int value1 PACKED; - unsigned int value2 PACKED; -} command_3int_t; + unsigned char id[4]; + unsigned int value0; + unsigned int value1; + unsigned int value2; +} PACKED command_3int_t; #undef PACKED static struct { @@ -158,7 +158,7 @@ int size = strlen(NAME) + 1 + sizeof(command_t); memcpy(resp, cmd, sizeof(command_t)); - strcpy(resp->data, NAME); + strcpy((char *)resp->data, NAME); send(dcls_socket, pktbuf, size, 0); } @@ -230,7 +230,7 @@ } memcpy(pktbuf, "DC16", 4); - strcpy(pktbuf + 4, fn); + strcpy((char *)(pktbuf + 4), fn); send(dcls_socket, pktbuf, 5 + strlen(realfn), 0); @@ -268,7 +268,7 @@ memcpy(cmd->id, "DC04", 4); cmd->address = htonl(dcload_mode); /* Open flags */ cmd->size = htonl(0644); /* umask */ - strcpy(cmd->data, fn); + strcpy((char *)cmd->data, fn); send(dcls_socket, pktbuf, sizeof(command_t) + strlen(fn) + 1, 0); dcls_recv_loop(); @@ -472,7 +472,7 @@ memcpy(cmd2->id, "DC13", 4); cmd2->address = htonl((uint32) &filestat); cmd2->size = htonl(sizeof(dcload_stat_t)); - strcpy(cmd2->data, fn); + strcpy((char *)cmd2->data, fn); send(dcls_socket, cmd2, sizeof(command_t) + strlen(fn) + 1, 0); @@ -511,8 +511,8 @@ } memcpy(pktbuf, "DC07", 4); - strcpy(pktbuf + 4, fn1); - strcpy(pktbuf + 5 + len1, fn2); + strcpy((char *)(pktbuf + 4), fn1); + strcpy((char *)(pktbuf + 5 + len1), fn2); send(dcls_socket, pktbuf, 6 + len1 + len2, 0); @@ -520,7 +520,7 @@ if(retval == 0) { memcpy(pktbuf, "DC08", 4); - strcpy(pktbuf + 4, fn1); + strcpy((char *)(pktbuf + 4), fn1); send(dcls_socket, pktbuf, len1 + 5, 0); @@ -546,7 +546,7 @@ } memcpy(pktbuf, "DC08", 4); - strcpy(pktbuf + 4, fn); + strcpy((char *)(pktbuf + 4), fn); send(dcls_socket, pktbuf, len, 0); @@ -579,7 +579,7 @@ memcpy(cmd->id, "DC13", 4); cmd->address = htonl((uint32) &filestat); cmd->size = htonl(sizeof(struct stat)); - strcpy(cmd->data, fn); + strcpy((char *)(cmd->data), fn); send(dcls_socket, cmd, sizeof(command_t) + strlen(fn) + 1, 0); Modified: kos/kernel/arch/dreamcast/fs/fs_iso9660.c =================================================================== --- kos/kernel/arch/dreamcast/fs/fs_iso9660.c 2009-05-01 18:55:59 UTC (rev 633) +++ kos/kernel/arch/dreamcast/fs/fs_iso9660.c 2009-05-02 18:43:17 UTC (rev 634) @@ -404,7 +404,7 @@ /* If this is a Joliet CD, then UCSify the name */ if (joliet) - utf2ucs(ucsname, fn); + utf2ucs(ucsname, (uint8 *)fn); while (size_left > 0) { c = biread(dir_extent); @@ -417,7 +417,7 @@ /* Try the Joliet filename if the CD is a Joliet disc */ if (joliet) { - if (!ucscompare(de->name, ucsname, de->name_len)) { + if (!ucscompare((uint8 *)de->name, ucsname, de->name_len)) { if (!((dir << 1) ^ de->flags)) return de; } @@ -434,9 +434,9 @@ pnt++; len--; } while ((len >= 4) && ((pnt[3] == 1) || (pnt[3] == 2))) { - if (strncmp(pnt, "NM", 2) == 0) { + if (strncmp((char *)pnt, "NM", 2) == 0) { rrnamelen = pnt[2] - 5; - strncpy(rrname, pnt+5, rrnamelen); + strncpy(rrname, (char *)(pnt+5), rrnamelen); rrname[rrnamelen] = 0; } len -= pnt[2]; @@ -768,7 +768,7 @@ } if (joliet) { - ucs2utfn(fh[fd].dirent.name, de->name, de->name_len); + ucs2utfn((uint8 *)fh[fd].dirent.name, (uint8 *)de->name, de->name_len); } else { /* Fill out the VFS dirent */ strncpy(fh[fd].dirent.name, de->name, de->name_len); @@ -782,8 +782,8 @@ pnt++; len--; } while ((len >= 4) && ((pnt[3] == 1) || (pnt[3] == 2))) { - if (strncmp(pnt, "NM", 2) == 0) { - strncpy(fh[fd].dirent.name, pnt+5, pnt[2] - 5); + if (strncmp((char *)pnt, "NM", 2) == 0) { + strncpy(fh[fd].dirent.name, (char *)(pnt+5), pnt[2] - 5); fh[fd].dirent.name[pnt[2] - 5] = 0; } len -= pnt[2]; Modified: kos/kernel/arch/dreamcast/hardware/flashrom.c =================================================================== --- kos/kernel/arch/dreamcast/hardware/flashrom.c 2009-05-01 18:55:59 UTC (rev 633) +++ kos/kernel/arch/dreamcast/hardware/flashrom.c 2009-05-02 18:43:17 UTC (rev 634) @@ -644,7 +644,7 @@ /* Grab block 0x83 */ if(flashrom_get_block(FLASHROM_PT_BLOCK_1, FLASHROM_B1_PW_SETTINGS_4, buffer) >= 0) { /* The modem init string continues at the start of this block. */ - strncpy(out->modem_init + 30, isp->b83.modem_str2, 2); + strncpy(out->modem_init + 30, (char *)isp->b83.modem_str2, 2); out->modem_init[32] = '\0'; /* Copy out the area code next. */ Modified: kos/kernel/arch/dreamcast/hardware/modem/mdata.c =================================================================== --- kos/kernel/arch/dreamcast/hardware/modem/mdata.c 2009-05-01 18:55:59 UTC (rev 633) +++ kos/kernel/arch/dreamcast/hardware/modem/mdata.c 2009-05-02 18:43:17 UTC (rev 634) @@ -381,7 +381,7 @@ if (w < 0) dbglog(DBG_ERROR, "modem_dial: unknown DTMF symbol '%c'\n", digits[i]); else - writeToChainBuffer(txBuffer, &w, 1); + writeToChainBuffer(txBuffer, (unsigned char *)&w, 1); } primeBuffer = 1; Modified: kos/kernel/arch/dreamcast/hardware/network/broadband_adapter.c =================================================================== --- kos/kernel/arch/dreamcast/hardware/network/broadband_adapter.c 2009-05-01 18:55:59 UTC (rev 633) +++ kos/kernel/arch/dreamcast/hardware/network/broadband_adapter.c 2009-05-02 18:43:17 UTC (rev 634) @@ -86,7 +86,7 @@ static int gaps_detect() { char str[16]; - g2_read_block_8(str, 0xa1001400, 16); + g2_read_block_8((uint8 *)str, 0xa1001400, 16); if (!strncmp(str, "GAPSPCI_BRIDGE_2", 16)) return 0; else Modified: kos/kernel/arch/dreamcast/include/dc/vmufs.h =================================================================== --- kos/kernel/arch/dreamcast/include/dc/vmufs.h 2009-05-01 18:55:59 UTC (rev 633) +++ kos/kernel/arch/dreamcast/include/dc/vmufs.h 2009-05-02 18:43:17 UTC (rev 634) @@ -16,46 +16,46 @@ #define __packed__ __attribute__((packed)) /** BCD timestamp, used several places below */ typedef struct { - uint8 cent __packed__; - uint8 year __packed__; - uint8 month __packed__; - uint8 day __packed__; - uint8 hour __packed__; - uint8 min __packed__; - uint8 sec __packed__; - uint8 dow __packed__; /* Day of week (0 = monday, etc) */ -} vmu_timestamp_t; + uint8 cent; + uint8 year; + uint8 month; + uint8 day; + uint8 hour; + uint8 min; + uint8 sec; + uint8 dow; /* Day of week (0 = monday, etc) */ +} __packed__ vmu_timestamp_t; /** Root block layout */ typedef struct { - uint8 magic[16] __packed__; /*< All should contain 0x55 */ - uint8 use_custom __packed__; /*< 0 = standard, 1 = custom */ - uint8 custom_color[4] __packed__; /*< blue, green, red, alpha */ - uint8 pad1[27] __packed__; /*< All zeros */ - vmu_timestamp_t timestamp __packed__; /*< BCD timestamp */ - uint8 pad2[8] __packed__; /*< All zeros */ - uint8 unk1[6] __packed__; /*< ??? */ - uint16 fat_loc __packed__; /*< FAT location */ - uint16 fat_size __packed__; /*< FAT size in blocks */ - uint16 dir_loc __packed__; /*< Directory location */ - uint16 dir_size __packed__; /*< Directory size in blocks */ - uint16 icon_shape __packed__; /*< Icon shape for this VMS */ - uint16 blk_cnt __packed__; /*< Number of user blocks */ - uint8 unk2[430] __packed__; /*< ??? */ -} vmu_root_t; + uint8 magic[16]; /*< All should contain 0x55 */ + uint8 use_custom; /*< 0 = standard, 1 = custom */ + uint8 custom_color[4]; /*< blue, green, red, alpha */ + uint8 pad1[27]; /*< All zeros */ + vmu_timestamp_t timestamp; /*< BCD timestamp */ + uint8 pad2[8]; /*< All zeros */ + uint8 unk1[6]; /*< ??? */ + uint16 fat_loc ; /*< FAT location */ + uint16 fat_size; /*< FAT size in blocks */ + uint16 dir_loc; /*< Directory location */ + uint16 dir_size; /*< Directory size in blocks */ + uint16 icon_shape; /*< Icon shape for this VMS */ + uint16 blk_cnt; /*< Number of user blocks */ + uint8 unk2[430]; /*< ??? */ +} __packed__ vmu_root_t; /** Directory entries, 32 bytes each */ typedef struct { - uint8 filetype __packed__; /*< 0x00 = no file; 0x33 = data; 0xcc = a game */ - uint8 copyprotect __packed__; /*< 0x00 = copyable; 0xff = copy protected */ - uint16 firstblk __packed__; /*< Location of the first block in the file */ - char filename[12] __packed__; /*< Note: there is no null terminator */ - vmu_timestamp_t timestamp __packed__; /*< File time */ - uint16 filesize __packed__; /*< Size of the file in blocks */ - uint16 hdroff __packed__; /*< Offset of header, in blocks from start of file */ - uint8 dirty __packed__; /*< See header notes */ - uint8 pad1[3] __packed__; /*< All zeros */ -} vmu_dir_t; + uint8 filetype; /*< 0x00 = no file; 0x33 = data; 0xcc = a game */ + uint8 copyprotect; /*< 0x00 = copyable; 0xff = copy protected */ + uint16 firstblk; /*< Location of the first block in the file */ + char filename[12]; /*< Note: there is no null terminator */ + vmu_timestamp_t timestamp; /*< File time */ + uint16 filesize; /*< Size of the file in blocks */ + uint16 hdroff; /*< Offset of header, in blocks from start of file */ + uint8 dirty; /*< See header notes */ + uint8 pad1[3]; /*< All zeros */ +} __packed__ vmu_dir_t; #undef __packed__ /* Notes about the "dirty" field on vmu_dir_t :) Modified: kos/kernel/arch/dreamcast/kernel/gdb_stub.c =================================================================== --- kos/kernel/arch/dreamcast/kernel/gdb_stub.c 2009-05-01 18:55:59 UTC (rev 633) +++ kos/kernel/arch/dreamcast/kernel/gdb_stub.c 2009-05-02 18:43:17 UTC (rev 634) @@ -389,7 +389,7 @@ static unsigned char * getpacket (void) { - unsigned char *buffer = &remcomInBuffer[0]; + unsigned char *buffer = (unsigned char *)(&remcomInBuffer[0]); unsigned char checksum; unsigned char xmitcsum; int count; @@ -766,7 +766,7 @@ while (1) { remcomOutBuffer[0] = 0; - ptr = getpacket (); + ptr = (char *)getpacket (); switch (*ptr++) { Modified: kos/kernel/arch/dreamcast/kernel/init.c =================================================================== --- kos/kernel/arch/dreamcast/kernel/init.c 2009-05-01 18:55:59 UTC (rev 633) +++ kos/kernel/arch/dreamcast/kernel/init.c 2009-05-02 18:43:17 UTC (rev 634) @@ -23,6 +23,12 @@ void _atexit_call_all(); +#if __GNUC__ >= 4 +void init(void); +void fini(void); +void __verify_newlib_patch(); +#endif + /* Ditto */ int main(int argc, char **argv); @@ -173,7 +179,9 @@ int rv; /* Ensure that we pull in crtend.c in the linking process */ +#if __GNUC__ < 4 __crtend_pullin(); +#endif /* Ensure that UBC is not enabled from a previous session */ ubc_disable_all(); @@ -185,7 +193,12 @@ arch_auto_init(); /* Run ctors */ +#if __GNUC__ < 4 arch_ctors(); +#else + __verify_newlib_patch(); + init(); +#endif /* Call the user's main function */ rv = main(0, NULL); @@ -207,7 +220,12 @@ void arch_shutdown() { /* Run dtors */ _atexit_call_all(); + +#if __GNUC__ < 4 arch_dtors(); +#else + fini(); +#endif dbglog(DBG_CRITICAL, "arch: shutting down kernel\n"); Modified: kos/kernel/fs/elf.c =================================================================== --- kos/kernel/fs/elf.c 2009-05-01 18:55:59 UTC (rev 633) +++ kos/kernel/fs/elf.c 2009-05-02 18:43:17 UTC (rev 634) @@ -83,7 +83,7 @@ /* Header is at the front */ hdr = (struct elf_hdr_t *)(img+0); - if (hdr->ident[0] != 0x7f || strncmp(hdr->ident+1, "ELF", 3)) { + if (hdr->ident[0] != 0x7f || strncmp((char *)hdr->ident+1, "ELF", 3)) { dbglog(DBG_ERROR, "elf_load: file is not a valid ELF file\n"); hdr->ident[4] = 0; dbglog(DBG_ERROR, " hdr->ident is %d/%s\n", hdr->ident[0], hdr->ident+1); Modified: kos/kernel/fs/fs_romdisk.c =================================================================== --- kos/kernel/fs/fs_romdisk.c 2009-05-01 18:55:59 UTC (rev 633) +++ kos/kernel/fs/fs_romdisk.c 2009-05-02 18:43:17 UTC (rev 634) @@ -467,7 +467,7 @@ /* Check the image and print some info about it */ hdr = (const romdisk_hdr_t *)img; - if (strncmp(img, "-rom1fs-", 8)) { + if (strncmp((char *)img, "-rom1fs-", 8)) { dbglog(DBG_ERROR, "Rom disk image at %p is not a ROMFS image\n", img); return -1; } else { Modified: kos/kernel/libc/koslib/crtbegin.c =================================================================== --- kos/kernel/libc/koslib/crtbegin.c 2009-05-01 18:55:59 UTC (rev 633) +++ kos/kernel/libc/koslib/crtbegin.c 2009-05-02 18:43:17 UTC (rev 634) @@ -8,6 +8,8 @@ FreeBSD crtbegin.c code. Note that the default linker scripts for GCC will automatically put our ctors at the front of the list. */ +#if __GNUC__ < 4 + #include <arch/types.h> /* Here we gain access to the ctor and dtor sections of the program by @@ -43,3 +45,5 @@ (**fpp)(); } +#endif /* __GNUC__ < 4 */ + Modified: kos/kernel/libc/koslib/crtend.c =================================================================== --- kos/kernel/libc/koslib/crtend.c 2009-05-01 18:55:59 UTC (rev 633) +++ kos/kernel/libc/koslib/crtend.c 2009-05-02 18:43:17 UTC (rev 634) @@ -8,6 +8,8 @@ FreeBSD crtend.c code. Note that the default linker scripts for GCC will automatically put our ctors at the end of the list. */ +#if __GNUC__ < 4 + #include <sys/cdefs.h> /* Here we gain access to the ctor and dtor sections of the program by @@ -23,3 +25,4 @@ (void)dtor_list; } +#endif /* __GNUC__ < 4 */ Modified: kos/kernel/net/net_arp.c =================================================================== --- kos/kernel/net/net_arp.c 2009-05-01 18:55:59 UTC (rev 633) +++ kos/kernel/net/net_arp.c 2009-05-02 18:43:17 UTC (rev 634) @@ -22,16 +22,16 @@ /* ARP Packet Structre */ #define packed __attribute__((packed)) typedef struct { - uint8 hw_type[2] packed; - uint8 pr_type[2] packed; - uint8 hw_size packed; - uint8 pr_size packed; - uint8 opcode[2] packed; - uint8 hw_send[6] packed; - uint8 pr_send[4] packed; - uint8 hw_recv[6] packed; - uint8 pr_recv[6] packed; -} arp_pkt_t; + uint8 hw_type[2]; + uint8 pr_type[2]; + uint8 hw_size; + uint8 pr_size; + uint8 opcode[2]; + uint8 hw_send[6]; + uint8 pr_send[4]; + uint8 hw_recv[6]; + uint8 pr_recv[6]; +} packed arp_pkt_t; #undef packed /**************************************************************************/ Modified: kos/kernel/net/net_dhcp.c =================================================================== --- kos/kernel/net/net_dhcp.c 2009-05-01 18:55:59 UTC (rev 633) +++ kos/kernel/net/net_dhcp.c 2009-05-02 18:43:17 UTC (rev 634) @@ -77,7 +77,7 @@ /* Host Name: Dreamcast */ req->options[pos++] = DHCP_OPTION_HOST_NAME; req->options[pos++] = 10; /* Length = 10 */ - strcpy(req->options + pos, "KallistiOS"); + strcpy((char *)req->options + pos, "KallistiOS"); pos += 10; /* Client Identifier: The network adapter's MAC address */ Modified: kos/kernel/net/net_icmp.h =================================================================== --- kos/kernel/net/net_icmp.h 2009-05-01 18:55:59 UTC (rev 633) +++ kos/kernel/net/net_icmp.h 2009-05-02 18:43:17 UTC (rev 634) @@ -17,11 +17,11 @@ #define packed __attribute__((packed)) typedef struct { - uint8 type packed; - uint8 code packed; - uint16 checksum packed; - uint8 misc[4] packed; -} icmp_hdr_t; + uint8 type; + uint8 code; + uint16 checksum; + uint8 misc[4]; +} packed icmp_hdr_t; #undef packed int net_icmp_input(netif_t *src, ip_hdr_t *ih, const uint8 *data, int size); Modified: kos/kernel/net/net_ipv4.h =================================================================== --- kos/kernel/net/net_ipv4.h 2009-05-01 18:55:59 UTC (rev 633) +++ kos/kernel/net/net_ipv4.h 2009-05-02 18:43:17 UTC (rev 634) @@ -11,36 +11,36 @@ /* These structs are from AndrewK's dcload-ip. */ #define packed __attribute__((packed)) typedef struct { - uint8 dest[6] packed; - uint8 src[6] packed; - uint8 type[2] packed; -} eth_hdr_t; + uint8 dest[6]; + uint8 src[6]; + uint8 type[2]; +} packed eth_hdr_t; typedef struct { - uint8 version_ihl packed; - uint8 tos packed; - uint16 length packed; - uint16 packet_id packed; - uint16 flags_frag_offs packed; - uint8 ttl packed; - uint8 protocol packed; - uint16 checksum packed; - uint32 src packed; - uint32 dest packed; -} ip_hdr_t; + uint8 version_ihl; + uint8 tos; + uint16 length; + uint16 packet_id; + uint16 flags_frag_offs; + uint8 ttl; + uint8 protocol; + uint16 checksum; + uint32 src; + uint32 dest; +} packed ip_hdr_t; typedef struct { - uint32 src_addr packed; - uint32 dst_addr packed; - uint8 zero packed; - uint8 proto packed; - uint16 length packed; - uint16 src_port packed; - uint16 dst_port packed; - uint16 hdrlength packed; - uint16 checksum packed; - uint8 data[1] packed; -} ip_pseudo_hdr_t; + uint32 src_addr; + uint32 dst_addr; + uint8 zero; + uint8 proto; + uint16 length; + uint16 src_port; + uint16 dst_port; + uint16 hdrlength; + uint16 checksum; + uint8 data[1]; +} packed ip_pseudo_hdr_t; #undef packed uint16 net_ipv4_checksum(const uint8 *data, int bytes); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ljs...@us...> - 2009-05-03 19:05:05
|
Revision: 635 http://cadcdev.svn.sourceforge.net/cadcdev/?rev=635&view=rev Author: ljsebald Date: 2009-05-03 19:05:00 +0000 (Sun, 03 May 2009) Log Message: ----------- Adding in a linker script to be used with GCC 4.x... The default one puts the .init segment in a rather stupid place (0x1000, I think), which of course won't work all that well. Also, this one prunes away the useless .stack segment. Modified Paths: -------------- kos/environ_base.sh Added Paths: ----------- kos/utils/ldscripts/ kos/utils/ldscripts/shlelf.xc Modified: kos/environ_base.sh =================================================================== --- kos/environ_base.sh 2009-05-02 18:43:17 UTC (rev 634) +++ kos/environ_base.sh 2009-05-03 19:05:00 UTC (rev 635) @@ -31,7 +31,7 @@ case $GCCVER in 4*) - export KOS_LDFLAGS="${KOS_LDFLAGS} -nodefaultlibs ${KOS_LIB_PATHS}" ;; + export KOS_LDFLAGS="${KOS_LDFLAGS} -T${KOS_BASE}/utils/ldscripts/shlelf.xc -nodefaultlibs ${KOS_LIB_PATHS}" ;; *) export KOS_LDFLAGS="${KOS_LDFLAGS} -nostartfiles -nostdlib ${KOS_LIB_PATHS}" ;; esac Added: kos/utils/ldscripts/shlelf.xc =================================================================== --- kos/utils/ldscripts/shlelf.xc (rev 0) +++ kos/utils/ldscripts/shlelf.xc 2009-05-03 19:05:00 UTC (rev 635) @@ -0,0 +1,227 @@ +/* Script for -z combreloc: combine and sort reloc sections */ +OUTPUT_FORMAT("elf32-shl", "elf32-shl", + "elf32-shl") +OUTPUT_ARCH(sh) +ENTRY(start) +SEARCH_DIR("/usr/local/dc-new/sh-elf/sh-elf/lib"); +SECTIONS +{ + /* Read-only sections, merged into text segment: */ + PROVIDE (__executable_start = 0x8c010000); . = 0x8c010000; + .text : + { + *(.text .stub .text.* .gnu.linkonce.t.*) + /* .gnu.warning sections are handled specially by elf32.em. */ + *(.gnu.warning) + } =0 + .init : + { + KEEP (*(.init)) + } =0 + .fini : + { + KEEP (*(.fini)) + } =0 + .interp : { *(.interp) } + .note.gnu.build-id : { *(.note.gnu.build-id) } + .hash : { *(.hash) } + .gnu.hash : { *(.gnu.hash) } + .dynsym : { *(.dynsym) } + .dynstr : { *(.dynstr) } + .gnu.version : { *(.gnu.version) } + .gnu.version_d : { *(.gnu.version_d) } + .gnu.version_r : { *(.gnu.version_r) } + .rel.dyn : + { + *(.rel.init) + *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) + *(.rel.fini) + *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) + *(.rel.data.rel.ro* .rel.gnu.linkonce.d.rel.ro.*) + *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) + *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) + *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) + *(.rel.ctors) + *(.rel.dtors) + *(.rel.got) + *(.rel.sdata .rel.sdata.* .rel.gnu.linkonce.s.*) + *(.rel.sbss .rel.sbss.* .rel.gnu.linkonce.sb.*) + *(.rel.sdata2 .rel.sdata2.* .rel.gnu.linkonce.s2.*) + *(.rel.sbss2 .rel.sbss2.* .rel.gnu.linkonce.sb2.*) + *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) + } + .rela.dyn : + { + *(.rela.init) + *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) + *(.rela.fini) + *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) + *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) + *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) + *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) + *(.rela.ctors) + *(.rela.dtors) + *(.rela.got) + *(.rela.sdata .rela.sdata.* .rela.gnu.linkonce.s.*) + *(.rela.sbss .rela.sbss.* .rela.gnu.linkonce.sb.*) + *(.rela.sdata2 .rela.sdata2.* .rela.gnu.linkonce.s2.*) + *(.rela.sbss2 .rela.sbss2.* .rela.gnu.linkonce.sb2.*) + *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) + } + .rel.plt : { *(.rel.plt) } + .rela.plt : { *(.rela.plt) } + .plt : { *(.plt) } + PROVIDE (__etext = .); + PROVIDE (_etext = .); + PROVIDE (etext = .); + .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) } + .rodata1 : { *(.rodata1) } + .sdata2 : + { + *(.sdata2 .sdata2.* .gnu.linkonce.s2.*) + } + .sbss2 : { *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*) } + .eh_frame_hdr : { *(.eh_frame_hdr) } + .eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) } + .gcc_except_table : ONLY_IF_RO { *(.gcc_except_table .gcc_except_table.*) } + /* Adjust the address for the data segment. We want to adjust up to + the same address within the page on the next page up. */ + . = ALIGN(128) + (. & (128 - 1)); + /* Exception handling */ + .eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) } + .gcc_except_table : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) } + /* Thread Local Storage sections */ + .tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) } + .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) } + .preinit_array : + { + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP (*(.preinit_array)) + PROVIDE_HIDDEN (__preinit_array_end = .); + } + .init_array : + { + PROVIDE_HIDDEN (__init_array_start = .); + KEEP (*(SORT(.init_array.*))) + KEEP (*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); + } + .fini_array : + { + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP (*(.fini_array)) + KEEP (*(SORT(.fini_array.*))) + PROVIDE_HIDDEN (__fini_array_end = .); + } + .ctors : + { + ___ctors = .; + /* gcc uses crtbegin.o to find the start of + the constructors, so we make sure it is + first. Because this is a wildcard, it + doesn't matter if the user does not + actually link against crtbegin.o; the + linker won't look for a file to match a + wildcard. The wildcard also means that it + doesn't matter which directory crtbegin.o + is in. */ + KEEP (*crtbegin.o(.ctors)) + KEEP (*crtbegin?.o(.ctors)) + /* We don't want to include the .ctor section from + the crtend.o file until after the sorted ctors. + The .ctor section from the crtend file contains the + end of ctors marker and it must be last */ + KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors)) + KEEP (*(SORT(.ctors.*))) + KEEP (*(.ctors)) + ___ctors_end = .; + } + .dtors : + { + ___dtors = .; + KEEP (*crtbegin.o(.dtors)) + KEEP (*crtbegin?.o(.dtors)) + KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors)) + KEEP (*(SORT(.dtors.*))) + KEEP (*(.dtors)) + ___dtors_end = .; + } + .jcr : { KEEP (*(.jcr)) } + .data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro* .gnu.linkonce.d.rel.ro.*) } + .dynamic : { *(.dynamic) } + .data : + { + *(.data .data.* .gnu.linkonce.d.*) + SORT(CONSTRUCTORS) + } + .data1 : { *(.data1) } + .got : { *(.got.plt) *(.got) } + /* We want the small data sections together, so single-instruction offsets + can access them all, and initialized data all before uninitialized, so + we can shorten the on-disk segment size. */ + .sdata : + { + *(.sdata .sdata.* .gnu.linkonce.s.*) + } + _edata = .; PROVIDE (edata = .); + __bss_start = .; + .sbss : + { + *(.dynsbss) + *(.sbss .sbss.* .gnu.linkonce.sb.*) + *(.scommon) + } + .bss : + { + *(.dynbss) + *(.bss .bss.* .gnu.linkonce.b.*) + *(COMMON) + /* Align here to ensure that the .bss section occupies space up to + _end. Align after .bss to ensure correct alignment even if the + .bss section disappears because there are no input sections. + FIXME: Why do we need it? When there is no .bss section, we don't + pad the .data section. */ + . = ALIGN(. != 0 ? 32 / 8 : 1); + } + . = ALIGN(32 / 8); + . = ALIGN(32 / 8); + _end = .; PROVIDE (end = .); + /* Stabs debugging sections. */ + .stab 0 : { *(.stab) } + .stabstr 0 : { *(.stabstr) } + .stab.excl 0 : { *(.stab.excl) } + .stab.exclstr 0 : { *(.stab.exclstr) } + .stab.index 0 : { *(.stab.index) } + .stab.indexstr 0 : { *(.stab.indexstr) } + .comment 0 : { *(.comment) } + /* DWARF debug sections. + Symbols in the DWARF debugging sections are relative to the beginning + of the section so we begin them at 0. */ + /* DWARF 1 */ + .debug 0 : { *(.debug) } + .line 0 : { *(.line) } + /* GNU DWARF 1 extensions */ + .debug_srcinfo 0 : { *(.debug_srcinfo) } + .debug_sfnames 0 : { *(.debug_sfnames) } + /* DWARF 1.1 and DWARF 2 */ + .debug_aranges 0 : { *(.debug_aranges) } + .debug_pubnames 0 : { *(.debug_pubnames) } + /* DWARF 2 */ + .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } + .debug_abbrev 0 : { *(.debug_abbrev) } + .debug_line 0 : { *(.debug_line) } + .debug_frame 0 : { *(.debug_frame) } + .debug_str 0 : { *(.debug_str) } + .debug_loc 0 : { *(.debug_loc) } + .debug_macinfo 0 : { *(.debug_macinfo) } + /* SGI/MIPS DWARF 2 extensions */ + .debug_weaknames 0 : { *(.debug_weaknames) } + .debug_funcnames 0 : { *(.debug_funcnames) } + .debug_typenames 0 : { *(.debug_typenames) } + .debug_varnames 0 : { *(.debug_varnames) } + /* DWARF 3 */ + .debug_pubtypes 0 : { *(.debug_pubtypes) } + .debug_ranges 0 : { *(.debug_ranges) } + .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) } + /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) } +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ljs...@us...> - 2009-05-09 00:14:48
|
Revision: 636 http://cadcdev.svn.sourceforge.net/cadcdev/?rev=636&view=rev Author: ljsebald Date: 2009-05-09 00:13:03 +0000 (Sat, 09 May 2009) Log Message: ----------- Adding in timed wait on a recursive lock. Modified Paths: -------------- kos/include/kos/recursive_lock.h kos/kernel/thread/recursive_lock.c Modified: kos/include/kos/recursive_lock.h =================================================================== --- kos/include/kos/recursive_lock.h 2009-05-03 19:05:00 UTC (rev 635) +++ kos/include/kos/recursive_lock.h 2009-05-09 00:13:03 UTC (rev 636) @@ -38,6 +38,12 @@ EINTR - was interrupted */ int rlock_lock(recursive_lock_t *l); +/* Lock a recursive lock, with timeout (in milliseconds). Returns -1 on error. + EPERM - called inside an interrupt + EINTR - was interrupted + EAGIN - timed out*/ +int rlock_lock_timed(recursive_lock_t *l, int timeout); + /* Unlock a recursive lock. Returns -1 on error. EPERM - the lock is not held by the current thread */ int rlock_unlock(recursive_lock_t *l); Modified: kos/kernel/thread/recursive_lock.c =================================================================== --- kos/kernel/thread/recursive_lock.c 2009-05-03 19:05:00 UTC (rev 635) +++ kos/kernel/thread/recursive_lock.c 2009-05-09 00:13:03 UTC (rev 636) @@ -1,7 +1,7 @@ /* KallistiOS ##version## recursive_lock.c - Copyright (C) 2008 Lawrence Sebald + Copyright (C) 2008, 2009 Lawrence Sebald */ /* This file defines recursive locks. */ @@ -42,10 +42,15 @@ /* Lock a recursive lock */ int rlock_lock(recursive_lock_t *l) { + return rlock_lock_timed(l, 0); +} + +/* Lock a recursive lock, with timeout (in milliseconds) */ +int rlock_lock_timed(recursive_lock_t *l, int timeout) { int old, rv = 0; if(irq_inside_int()) { - dbglog(DBG_WARNING, "rlock_lock: called inside interrupt\n"); + dbglog(DBG_WARNING, "rlock_lock_timed: called inside interrupt\n"); errno = EPERM; return -1; } @@ -64,7 +69,7 @@ } else { /* Block until the lock isn't held any more */ - rv = genwait_wait(l, "rlock_lock", 0, NULL); + rv = genwait_wait(l, "rlock_lock_timed", timeout, NULL); if(rv < 0) { assert(errno == EINTR); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ljs...@us...> - 2009-06-02 02:54:26
|
Revision: 637 http://cadcdev.svn.sourceforge.net/cadcdev/?rev=637&view=rev Author: ljsebald Date: 2009-06-02 02:54:25 +0000 (Tue, 02 Jun 2009) Log Message: ----------- Adding support for untextured PVR sprites. Modified Paths: -------------- kos/doc/CHANGELOG kos/kernel/arch/dreamcast/hardware/pvr/pvr_prim.c kos/kernel/arch/dreamcast/include/dc/pvr.h Modified: kos/doc/CHANGELOG =================================================================== --- kos/doc/CHANGELOG 2009-05-09 00:13:03 UTC (rev 636) +++ kos/doc/CHANGELOG 2009-06-02 02:54:25 UTC (rev 637) @@ -181,6 +181,8 @@ device. [LS] - *** Added kthread_once function (think pthread_once) [LS] - *** Added pthreads-like thread-local storage [LS] +- DC Added in support for untextured PVR sprites and added support for the more + correct polygon header to be sent for sprites [LS] KallistiOS version 1.2.0 ----------------------------------------------- - DC Fix to use DCARM7_CFLAGS when compiling ARM driver [Christian Groessler == CG] Modified: kos/kernel/arch/dreamcast/hardware/pvr/pvr_prim.c =================================================================== --- kos/kernel/arch/dreamcast/hardware/pvr/pvr_prim.c 2009-05-09 00:13:03 UTC (rev 636) +++ kos/kernel/arch/dreamcast/hardware/pvr/pvr_prim.c 2009-06-02 02:54:25 UTC (rev 637) @@ -187,8 +187,36 @@ dst->txr.format = textureformat; } -/* Create a textured sprite context with parameters similar to - the old "ta" function `ta_poly_hdr_txr' */ +/* Create an untextured sprite context. */ +void pvr_sprite_cxt_col(pvr_sprite_cxt_t *dst, pvr_list_t list) { + int alpha; + + /* Start off blank */ + memset(dst, 0, sizeof(pvr_poly_cxt_t)); + + /* Fill in a few values */ + dst->list_type = list; + alpha = list > PVR_LIST_OP_MOD; + dst->depth.comparison = PVR_DEPTHCMP_GREATER; + dst->depth.write = PVR_DEPTHWRITE_ENABLE; + dst->gen.culling = PVR_CULLING_CCW; + dst->txr.enable = PVR_TEXTURE_DISABLE; + if (!alpha) { + dst->gen.alpha = PVR_ALPHA_DISABLE; + dst->blend.src = PVR_BLEND_ONE; + dst->blend.dst = PVR_BLEND_ZERO; + } else { + dst->gen.alpha = PVR_ALPHA_ENABLE; + dst->blend.src = PVR_BLEND_SRCALPHA; + dst->blend.dst = PVR_BLEND_INVSRCALPHA; + } + dst->blend.src_enable = PVR_BLEND_DISABLE; + dst->blend.dst_enable = PVR_BLEND_DISABLE; + dst->gen.fog_type = PVR_FOG_DISABLE; + dst->gen.color_clamp = PVR_CLRCLAMP_DISABLE; +} + +/* Create a textured sprite context. */ void pvr_sprite_cxt_txr(pvr_sprite_cxt_t *dst, pvr_list_t list, int textureformat, int tw, int th, pvr_ptr_t textureaddr, int filtering) { @@ -218,6 +246,7 @@ dst->blend.dst_enable = PVR_BLEND_DISABLE; dst->gen.fog_type = PVR_FOG_DISABLE; dst->gen.color_clamp = PVR_CLRCLAMP_DISABLE; + dst->txr.enable = PVR_TEXTURE_ENABLE; dst->txr.uv_flip = PVR_UVFLIP_NONE; dst->txr.uv_clamp = PVR_UVCLAMP_NONE; dst->txr.filter = filtering; @@ -228,8 +257,7 @@ dst->txr.format = textureformat; } -void pvr_sprite_compile(pvr_poly_ic_hdr_t *dst, - pvr_sprite_cxt_t *src) { +void pvr_sprite_compile(pvr_sprite_hdr_t *dst, pvr_sprite_cxt_t *src) { int u, v; uint32 txr_base; @@ -237,8 +265,11 @@ into place, and OR it into the final result. */ /* The base values for CMD */ - dst->cmd = PVR_CMD_SPRITE | 8; + dst->cmd = PVR_CMD_SPRITE; + if (src->txr.enable == PVR_TEXTURE_ENABLE) + dst->cmd |= 8; + /* Or in the list type, clipping mode, and UV formats */ dst->cmd |= (src->list_type << PVR_TA_CMD_TYPE_SHIFT) & PVR_TA_CMD_TYPE_MASK; dst->cmd |= (PVR_UVFMT_16BIT << PVR_TA_CMD_UVFMT_SHIFT) & PVR_TA_CMD_UVFMT_MASK; @@ -248,7 +279,7 @@ dst->mode1 = (src->depth.comparison << PVR_TA_PM1_DEPTHCMP_SHIFT) & PVR_TA_PM1_DEPTHCMP_MASK; dst->mode1 |= (src->gen.culling << PVR_TA_PM1_CULLING_SHIFT) & PVR_TA_PM1_CULLING_MASK; dst->mode1 |= (src->depth.write << PVR_TA_PM1_DEPTHWRITE_SHIFT) & PVR_TA_PM1_DEPTHWRITE_MASK; - dst->mode1 |= (1 << PVR_TA_PM1_TXRENABLE_SHIFT) & PVR_TA_PM1_TXRENABLE_MASK; + dst->mode1 |= (src->txr.enable << PVR_TA_PM1_TXRENABLE_SHIFT) & PVR_TA_PM1_TXRENABLE_MASK; /* Polygon mode 2 */ dst->mode2 = (src->blend.src << PVR_TA_PM2_SRCBLEND_SHIFT) & PVR_TA_PM2_SRCBLEND_MASK; @@ -259,51 +290,52 @@ dst->mode2 |= (src->gen.color_clamp << PVR_TA_PM2_CLAMP_SHIFT) & PVR_TA_PM2_CLAMP_MASK; dst->mode2 |= (src->gen.alpha << PVR_TA_PM2_ALPHA_SHIFT) & PVR_TA_PM2_ALPHA_MASK; - assert_msg(src->txr.base != NULL, "Sprites must be textured"); + if(src->txr.enable == PVR_TEXTURE_DISABLE) { + dst->mode3 = 0; + } + else { + dst->mode2 |= (src->txr.alpha << PVR_TA_PM2_TXRALPHA_SHIFT) & PVR_TA_PM2_TXRALPHA_MASK; + dst->mode2 |= (src->txr.uv_flip << PVR_TA_PM2_UVFLIP_SHIFT) & PVR_TA_PM2_UVFLIP_MASK; + dst->mode2 |= (src->txr.uv_clamp << PVR_TA_PM2_UVCLAMP_SHIFT) & PVR_TA_PM2_UVCLAMP_MASK; + dst->mode2 |= (src->txr.filter << PVR_TA_PM2_FILTER_SHIFT) & PVR_TA_PM2_FILTER_MASK; + dst->mode2 |= (src->txr.mipmap_bias << PVR_TA_PM2_MIPBIAS_SHIFT) & PVR_TA_PM2_MIPBIAS_MASK; - dst->mode2 |= (src->txr.alpha << PVR_TA_PM2_TXRALPHA_SHIFT) & PVR_TA_PM2_TXRALPHA_MASK; - dst->mode2 |= (src->txr.uv_flip << PVR_TA_PM2_UVFLIP_SHIFT) & PVR_TA_PM2_UVFLIP_MASK; - dst->mode2 |= (src->txr.uv_clamp << PVR_TA_PM2_UVCLAMP_SHIFT) & PVR_TA_PM2_UVCLAMP_MASK; - dst->mode2 |= (src->txr.filter << PVR_TA_PM2_FILTER_SHIFT) & PVR_TA_PM2_FILTER_MASK; - dst->mode2 |= (src->txr.mipmap_bias << PVR_TA_PM2_MIPBIAS_SHIFT) & PVR_TA_PM2_MIPBIAS_MASK; + switch (src->txr.width) { + case 8: u = 0; break; + case 16: u = 1; break; + case 32: u = 2; break; + case 64: u = 3; break; + case 128: u = 4; break; + case 256: u = 5; break; + case 512: u = 6; break; + case 1024: u = 7; break; + default: assert_msg(0, "Invalid texture U size"); u = 0; break; + } - switch (src->txr.width) { - case 8: u = 0; break; - case 16: u = 1; break; - case 32: u = 2; break; - case 64: u = 3; break; - case 128: u = 4; break; - case 256: u = 5; break; - case 512: u = 6; break; - case 1024: u = 7; break; - default: assert_msg(0, "Invalid texture U size"); u = 0; break; - } + switch (src->txr.height) { + case 8: v = 0; break; + case 16: v = 1; break; + case 32: v = 2; break; + case 64: v = 3; break; + case 128: v = 4; break; + case 256: v = 5; break; + case 512: v = 6; break; + case 1024: v = 7; break; + default: assert_msg(0, "Invalid texture V size"); v = 0; break; + } - switch (src->txr.height) { - case 8: v = 0; break; - case 16: v = 1; break; - case 32: v = 2; break; - case 64: v = 3; break; - case 128: v = 4; break; - case 256: v = 5; break; - case 512: v = 6; break; - case 1024: v = 7; break; - default: assert_msg(0, "Invalid texture V size"); v = 0; break; + dst->mode2 |= (u << PVR_TA_PM2_USIZE_SHIFT) & PVR_TA_PM2_USIZE_MASK; + dst->mode2 |= (v << PVR_TA_PM2_VSIZE_SHIFT) & PVR_TA_PM2_VSIZE_MASK; + + /* Polygon mode 3 */ + dst->mode3 = (src->txr.mipmap << PVR_TA_PM3_MIPMAP_SHIFT) & PVR_TA_PM3_MIPMAP_MASK; + dst->mode3 |= (src->txr.format << PVR_TA_PM3_TXRFMT_SHIFT) & PVR_TA_PM3_TXRFMT_MASK; + + txr_base = (uint32)src->txr.base; + txr_base = (txr_base & 0x00fffff8) >> 3; + dst->mode3 |= txr_base; } - dst->mode2 |= (u << PVR_TA_PM2_USIZE_SHIFT) & PVR_TA_PM2_USIZE_MASK; - dst->mode2 |= (v << PVR_TA_PM2_VSIZE_SHIFT) & PVR_TA_PM2_VSIZE_MASK; - - /* Polygon mode 3 */ - dst->mode3 = (src->txr.mipmap << PVR_TA_PM3_MIPMAP_SHIFT) & PVR_TA_PM3_MIPMAP_MASK; - dst->mode3 |= (src->txr.format << PVR_TA_PM3_TXRFMT_SHIFT) & PVR_TA_PM3_TXRFMT_MASK; - - txr_base = (uint32)src->txr.base; - txr_base = (txr_base & 0x00fffff8) >> 3; - dst->mode3 |= txr_base; - - dst->a = 1.0f; - dst->r = 1.0f; - dst->g = 1.0f; - dst->b = 1.0f; + dst->argb = 0xFFFFFFFF; + dst->oargb = 0x00000000; } Modified: kos/kernel/arch/dreamcast/include/dc/pvr.h =================================================================== --- kos/kernel/arch/dreamcast/include/dc/pvr.h 2009-05-09 00:13:03 UTC (rev 636) +++ kos/kernel/arch/dreamcast/include/dc/pvr.h 2009-06-02 02:54:25 UTC (rev 637) @@ -99,6 +99,7 @@ int write; } depth; struct { + int enable; int filter; int mipmap; int mipmap_bias; @@ -265,13 +266,22 @@ } pvr_poly_hdr_t; /* Polygon header with intensity color. This is the equivalent of - pvr_poly_hdr_t, but for use with intensity color (sprites). */ + pvr_poly_hdr_t, but for use with intensity color. */ typedef struct { uint32 cmd; /* TA command */ uint32 mode1, mode2, mode3; /* mode parameters */ float a, r, g, b; /* color */ } pvr_poly_ic_hdr_t; +/* Polygon header specifically for sprites. */ +typedef struct { + uint32 cmd; /* TA command */ + uint32 mode1, mode2, mode3; /* mode parameters */ + uint32 argb; /* sprite color */ + uint32 oargb; /* offset color */ + uint32 d1, d2; /* dummies */ +} pvr_sprite_hdr_t; + /* Generic vertex type; the PVR chip itself supports many more vertex types, but this is the main one that can be used with both textured and non-textured polygons, and is fairly fast. You can find other @@ -315,6 +325,18 @@ uint32 cuv; } pvr_sprite_txr_t; +/* Untextured sprite. This vertex type is to be used with the sprite + polygon header and the sprite related commands to draw untextured + sprites (aka, quads). */ +typedef struct { + uint32 flags; + float ax, ay, az; + float bx, by, bz; + float cx, cy, cz; + float dx, dy; + uint32 d1, d2, d3, d4; +} pvr_sprite_col_t; + /* This vertex is only for modifer volumes */ typedef struct { uint32 flags; /* vertex flags */ @@ -866,9 +888,12 @@ int filtering); /* Compile a sprite context into a colored polygon header */ -void pvr_sprite_compile(pvr_poly_ic_hdr_t *dst, +void pvr_sprite_compile(pvr_sprite_hdr_t *dst, pvr_sprite_cxt_t *src); +/* Create an untextured sprite context */ +void pvr_sprite_cxt_col(pvr_sprite_cxt_t *dst, pvr_list_t list); + /* Create a textured sprite context */ void pvr_sprite_cxt_txr(pvr_sprite_cxt_t *dst, pvr_list_t list, int textureformat, int tw, int th, pvr_ptr_t textureaddr, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ljs...@us...> - 2009-06-03 19:53:40
|
Revision: 638 http://cadcdev.svn.sourceforge.net/cadcdev/?rev=638&view=rev Author: ljsebald Date: 2009-06-03 19:53:33 +0000 (Wed, 03 Jun 2009) Log Message: ----------- Adding in support functions for modifier volumes and a simple example. Modified Paths: -------------- kos/doc/CHANGELOG kos/examples/dreamcast/pvr/Makefile kos/kernel/arch/dreamcast/hardware/pvr/pvr_prim.c kos/kernel/arch/dreamcast/include/dc/pvr.h Added Paths: ----------- kos/examples/dreamcast/pvr/modifier_volume/ kos/examples/dreamcast/pvr/modifier_volume/Makefile kos/examples/dreamcast/pvr/modifier_volume/modifier.c Modified: kos/doc/CHANGELOG =================================================================== --- kos/doc/CHANGELOG 2009-06-02 02:54:25 UTC (rev 637) +++ kos/doc/CHANGELOG 2009-06-03 19:53:33 UTC (rev 638) @@ -182,7 +182,9 @@ - *** Added kthread_once function (think pthread_once) [LS] - *** Added pthreads-like thread-local storage [LS] - DC Added in support for untextured PVR sprites and added support for the more - correct polygon header to be sent for sprites [LS] + correct polygon header to be sent for sprites [LS] +- DC Added in some support functions for PVR modifier volumes (and an example + program that uses them) [LS] KallistiOS version 1.2.0 ----------------------------------------------- - DC Fix to use DCARM7_CFLAGS when compiling ARM driver [Christian Groessler == CG] Modified: kos/examples/dreamcast/pvr/Makefile =================================================================== --- kos/examples/dreamcast/pvr/Makefile 2009-06-02 02:54:25 UTC (rev 637) +++ kos/examples/dreamcast/pvr/Makefile 2009-06-03 19:53:33 UTC (rev 638) @@ -10,6 +10,7 @@ $(KOS_MAKE) -C pvrmark_strips $(KOS_MAKE) -C pvrmark_strips_direct $(KOS_MAKE) -C texture_render + $(KOS_MAKE) -C modifier_volume clean: $(KOS_MAKE) -C plasma clean @@ -17,6 +18,7 @@ $(KOS_MAKE) -C pvrmark_strips clean $(KOS_MAKE) -C pvrmark_strips_direct clean $(KOS_MAKE) -C texture_render clean + $(KOS_MAKE) -C modifier_volume clean dist: $(KOS_MAKE) -C plasma dist @@ -24,5 +26,6 @@ $(KOS_MAKE) -C pvrmark_strips dist $(KOS_MAKE) -C pvrmark_strips_direct dist $(KOS_MAKE) -C texture_render dist + $(KOS_MAKE) -C modifier_volume dist Added: kos/examples/dreamcast/pvr/modifier_volume/Makefile =================================================================== --- kos/examples/dreamcast/pvr/modifier_volume/Makefile (rev 0) +++ kos/examples/dreamcast/pvr/modifier_volume/Makefile 2009-06-03 19:53:33 UTC (rev 638) @@ -0,0 +1,32 @@ +# +# Basic KallistiOS skeleton / test program +# (c)2001 Dan Potter +# + +# Put the filename of the output binary here +TARGET = modifier.elf + +# List all of your C files here, but change the extension to ".o" +OBJS = modifier.o + +all: rm-elf $(TARGET) + +include $(KOS_BASE)/Makefile.rules + +clean: + -rm -f $(TARGET) $(OBJS) + +rm-elf: + -rm -f $(TARGET) + +$(TARGET): $(OBJS) + $(KOS_CC) $(KOS_CFLAGS) $(KOS_LDFLAGS) -o $(TARGET) $(KOS_START) \ + $(OBJS) $(OBJEXTRA) $(KOS_LIBS) + +run: $(TARGET) + $(KOS_LOADER) $(TARGET) -n + +dist: + rm -f $(OBJS) + $(KOS_STRIP) $(TARGET) + Added: kos/examples/dreamcast/pvr/modifier_volume/modifier.c =================================================================== --- kos/examples/dreamcast/pvr/modifier_volume/modifier.c (rev 0) +++ kos/examples/dreamcast/pvr/modifier_volume/modifier.c 2009-06-03 19:53:33 UTC (rev 638) @@ -0,0 +1,200 @@ +/* KallistiOS ##version## + + examples/dreamcast/pvr/modifier_volume/modifier.c + Copyright (C) 2009 Lawrence Sebald + + This example shows off how to do a basic modifier volume. +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <time.h> + +#include <dc/pvr.h> +#include <dc/maple.h> +#include <dc/maple/controller.h> + +#define NUM_POLYS 10 + +static pvr_vertex_pcm_t verts[NUM_POLYS * 4]; + +static pvr_poly_hdr_t phdr; +static pvr_mod_hdr_t mhdr, mhdr2; +static float mx = 320.0f, my = 240.0f; +static pvr_list_t list = PVR_LIST_OP_POLY; + +void setup() { + pvr_poly_cxt_t cxt; + int i; + float x, y, z; + uint32 argb = list == PVR_LIST_OP_POLY ? 0xFF0000FF : 0x80FF00FF; + + pvr_poly_cxt_col(&cxt, list); + cxt.fmt.modifier = PVR_MODIFIER_ENABLE; + cxt.gen.modifier_mode = PVR_MODIFIER_NORMAL; + pvr_poly_compile(&phdr, &cxt); + + pvr_mod_compile(&mhdr, list + 1, PVR_MODIFIER_OTHER_POLY, PVR_CULLING_NONE); + pvr_mod_compile(&mhdr2, list + 1, PVR_MODIFIER_INCLUDE_LAST_POLY, + PVR_CULLING_NONE); + + for(i = 0; i < NUM_POLYS; ++i) { + x = rand() % 640; + y = rand() % 480; + z = rand() % 100 + 1; + + verts[i * 4].flags = PVR_CMD_VERTEX; + verts[i * 4].x = x - 50; + verts[i * 4].y = y + 50; + verts[i * 4].z = z; + verts[i * 4].argb0 = argb; + verts[i * 4].argb1 = 0xFF00FF00; + verts[i * 4].d1 = verts[i * 4].d2 = 0; + + verts[i * 4 + 1].flags = PVR_CMD_VERTEX; + verts[i * 4 + 1].x = x - 50; + verts[i * 4 + 1].y = y - 50; + verts[i * 4 + 1].z = z; + verts[i * 4 + 1].argb0 = argb; + verts[i * 4 + 1].argb1 = 0xFF00FF00; + verts[i * 4 + 1].d1 = verts[i * 4 + 1].d2 = 0; + + verts[i * 4 + 2].flags = PVR_CMD_VERTEX; + verts[i * 4 + 2].x = x + 50; + verts[i * 4 + 2].y = y + 50; + verts[i * 4 + 2].z = z; + verts[i * 4 + 2].argb0 = argb; + verts[i * 4 + 2].argb1 = 0xFF00FF00; + verts[i * 4 + 2].d1 = verts[i * 4 + 2].d2 = 0; + + verts[i * 4 + 3].flags = PVR_CMD_VERTEX_EOL; + verts[i * 4 + 3].x = x + 50; + verts[i * 4 + 3].y = y - 50; + verts[i * 4 + 3].z = z; + verts[i * 4 + 3].argb0 = argb; + verts[i * 4 + 3].argb1 = 0xFF00FF00; + verts[i * 4 + 3].d1 = verts[i * 4 + 3].d2 = 0; + } +} + +int check_start() { + maple_device_t *cont; + cont_state_t *state; + static int taken = 0; + + cont = maple_enum_type(0, MAPLE_FUNC_CONTROLLER); + + if (cont) { + state = (cont_state_t *)maple_dev_status(cont); + if (!state) + return 0; + + if(state->buttons & CONT_START) + return 1; + + if(state->buttons & CONT_DPAD_UP) + my -= 1.0f; + if(state->buttons & CONT_DPAD_DOWN) + my += 1.0f; + if(state->buttons & CONT_DPAD_LEFT) + mx -= 1.0f; + if(state->buttons & CONT_DPAD_RIGHT) + mx += 1.0f; + + if((state->buttons & CONT_A) && !taken) { + list = list == PVR_LIST_OP_POLY ? PVR_LIST_TR_POLY : + PVR_LIST_OP_POLY; + setup(); + taken = 1; + } + else if(!(state->buttons & CONT_A)) { + taken = 0; + } + } + + return 0; +} + +void do_frame() { + pvr_modifier_vol_t mod; + int i; + + pvr_wait_ready(); + pvr_scene_begin(); + pvr_list_begin(list); + + pvr_prim(&phdr, sizeof(phdr)); + + for(i = 0; i < NUM_POLYS; ++i) { + pvr_prim(&verts[i * 4], sizeof(verts[i * 4])); + pvr_prim(&verts[i * 4 + 1], sizeof(verts[i * 4 + 1])); + pvr_prim(&verts[i * 4 + 2], sizeof(verts[i * 4 + 2])); + pvr_prim(&verts[i * 4 + 3], sizeof(verts[i * 4 + 3])); + } + + pvr_list_finish(); + + pvr_list_begin(list + 1); + + pvr_prim(&mhdr, sizeof(mhdr)); + + mod.flags = PVR_CMD_VERTEX_EOL; + mod.ax = mx; + mod.ay = my + 50.0f; + mod.az = 150.0f; + mod.bx = mx; + mod.by = my; + mod.bz = 150.0f; + mod.cx = mx + 50.0f; + mod.cy = my + 50.0f; + mod.cz = 150.0f; + mod.d1 = mod.d2 = mod.d3 = mod.d4 = mod.d5 = mod.d6 = 0; + pvr_prim(&mod, sizeof(mod)); + + pvr_prim(&mhdr2, sizeof(mhdr2)); + + mod.flags = PVR_CMD_VERTEX_EOL; + mod.ax = mx; + mod.ay = my; + mod.az = 150.0f; + mod.bx = mx + 50.0f; + mod.by = my + 50.0f; + mod.bz = 150.0f; + mod.cx = mx + 50.0f; + mod.cy = my; + mod.cz = 150.0f; + mod.d1 = mod.d2 = mod.d3 = mod.d4 = mod.d5 = mod.d6 = 0; + pvr_prim(&mod, sizeof(mod)); + + pvr_list_finish(); + pvr_scene_finish(); +} + +static pvr_init_params_t pvr_params = { + /* Enable Opaque, Opaque modifiers, Translucent, and Translucent + modifiers. */ + { PVR_BINSIZE_16, PVR_BINSIZE_16, PVR_BINSIZE_16, PVR_BINSIZE_16, + PVR_BINSIZE_0 }, + 512 * 1024 +}; + +int main(int argc, char *argv[]) { + printf("---KallistiOS PVR Modifier Example---\n"); + printf("Press A to toggle between translucent and opaque polygons.\n"); + printf("Use the DPAD to move the modifier square around (it starts at "); + printf("(320, 240))\n"); + printf("Press Start to exit.\n"); + + srand(time(NULL)); + + pvr_init(&pvr_params); + + setup(); + + /* Go as long as the user hasn't pressed start on controller 1. */ + while(!check_start()) { + do_frame(); + } + + return 0; +} Modified: kos/kernel/arch/dreamcast/hardware/pvr/pvr_prim.c =================================================================== --- kos/kernel/arch/dreamcast/hardware/pvr/pvr_prim.c 2009-06-02 02:54:25 UTC (rev 637) +++ kos/kernel/arch/dreamcast/hardware/pvr/pvr_prim.c 2009-06-03 19:53:33 UTC (rev 638) @@ -103,8 +103,17 @@ dst->mode3 |= txr_base; } - /* Dummy values */ - dst->d1 = dst->d2 = dst->d3 = dst->d4 = 0xffffffff; + if(src->fmt.modifier) { + /* If we're affected by a modifier volume, silently promote the header + to the one that is affected by a modifier volume. */ + dst->d1 = dst->mode2; + dst->d2 = dst->mode3; + } + else { + dst->d1 = dst->d2 = 0xffffffff; + } + + dst->d3 = dst->d4 = 0xffffffff; } /* Create a colored polygon context with parameters similar to @@ -339,3 +348,14 @@ dst->argb = 0xFFFFFFFF; dst->oargb = 0x00000000; } + +void pvr_mod_compile(pvr_mod_hdr_t *dst, pvr_list_t list, uint32 mode, + uint32 cull) { + dst->cmd = PVR_CMD_MODIFIER; + dst->cmd |= (list << PVR_TA_CMD_TYPE_SHIFT) & PVR_TA_CMD_TYPE_MASK; + + dst->mode1 = (mode << PVR_TA_PM1_MODIFIERINST_SHIFT) & PVR_TA_PM1_MODIFIERINST_MASK; + dst->mode1 |= (cull << PVR_TA_PM1_CULLING_SHIFT) & PVR_TA_PM1_CULLING_MASK; + + dst->d1 = dst->d2 = dst->d3 = dst->d4 = dst->d5 = dst->d6 = 0; +} Modified: kos/kernel/arch/dreamcast/include/dc/pvr.h =================================================================== --- kos/kernel/arch/dreamcast/include/dc/pvr.h 2009-06-02 02:54:25 UTC (rev 637) +++ kos/kernel/arch/dreamcast/include/dc/pvr.h 2009-06-03 19:53:33 UTC (rev 638) @@ -252,8 +252,8 @@ #define PVR_MODIFIER_NORMAL 1 #define PVR_MODIFIER_OTHER_POLY 0 /* PM1 modifer instruction */ -#define PVR_MODIFIER_FIRST_POLY 1 /* ...in inclusion vol */ -#define PVR_MODIFIER_LAST_POLY 2 /* ...in exclusion vol */ +#define PVR_MODIFIER_INCLUDE_LAST_POLY 1 /* ...in inclusion vol */ +#define PVR_MODIFIER_EXCLUDE_LAST_POLY 2 /* ...in exclusion vol */ /* "Polygon header" -- this is the hardware equivalent of a rendering @@ -273,6 +273,17 @@ float a, r, g, b; /* color */ } pvr_poly_ic_hdr_t; +/* Polygon header to be used with modifier volumes. This is the + equivalent of a pvr_poly_hdr_t for use when a polygon is to + be used with modifier volumes. */ +typedef struct { + uint32 cmd; /* TA command */ + uint32 mode1; /* mode parameters */ + uint32 mode2_1, mode3_1; + uint32 mode2_2, mode3_2; + uint32 d1, d2; /* dummies */ +} pvr_poly_mod_hdr_t; + /* Polygon header specifically for sprites. */ typedef struct { uint32 cmd; /* TA command */ @@ -282,6 +293,13 @@ uint32 d1, d2; /* dummies */ } pvr_sprite_hdr_t; +/* Modifier volume header. */ +typedef struct { + uint32 cmd; /* TA command */ + uint32 mode1; /* mode parameter */ + uint32 d1, d2, d3, d4, d5, d6; /* dummies */ +} pvr_mod_hdr_t; + /* Generic vertex type; the PVR chip itself supports many more vertex types, but this is the main one that can be used with both textured and non-textured polygons, and is fairly fast. You can find other @@ -294,6 +312,17 @@ uint32 oargb; /* offset color */ } pvr_vertex_t; +/* Non-textured, packed color, affected by modifier volume. This + vertex type has two copies of colors. The second color is used when + enclosed within a modifier volume. */ +typedef struct { + uint32 flags; + float x, y, z; + uint32 argb0; + uint32 argb1; + uint32 d1, d2; +} pvr_vertex_pcm_t; + /* Textured, packed color, affected by modifer volume. Note that this vertex type has two copies of colors, offset colors and texture coords. The second set of texture coords, colors, and offset colors @@ -310,9 +339,9 @@ uint32 d1, d2, d3, d4; /* dummies */ } pvr_vertex_tpcm_t; -/* Textured sprite. This vertex type is to be used with the intensity - colored polygon header and the sprite related commands to draw - hardware accelerated, textured sprites. */ +/* Textured sprite. This vertex type is to be used with the sprite + polygon header and the sprite related commands to draw textured + sprites. */ typedef struct { uint32 flags; float ax, ay, az; @@ -367,7 +396,7 @@ #define PVR_CMD_VERTEX 0xe0000000 #define PVR_CMD_VERTEX_EOL 0xf0000000 #define PVR_CMD_USERCLIP 0x20000000 -#define PVR_CMD_MODIFIER 0x80040000 +#define PVR_CMD_MODIFIER 0x80000000 #define PVR_CMD_SPRITE 0xA0000000 /* Constants and bitmasks for handling polygon headers; note that thanks @@ -407,7 +436,7 @@ #define PVR_TA_PM1_TXRENABLE_MASK (1 << PVR_TA_PM1_TXRENABLE_SHIFT) #define PVR_TA_PM1_MODIFIERINST_SHIFT 29 -#define PVR_TA_PM1_MODIFIERINST_MASK (2 << PVR_TA_PM1_MODIFIERINST_SHIFT) +#define PVR_TA_PM1_MODIFIERINST_MASK (3 << PVR_TA_PM1_MODIFIERINST_SHIFT) #define PVR_TA_PM2_SRCBLEND_SHIFT 29 #define PVR_TA_PM2_SRCBLEND_MASK (7 << PVR_TA_PM2_SRCBLEND_SHIFT) @@ -899,6 +928,10 @@ int textureformat, int tw, int th, pvr_ptr_t textureaddr, int filtering); +/* Create a modifier volume context */ +void pvr_mod_compile(pvr_mod_hdr_t *dst, pvr_list_t list, uint32 mode, + uint32 cull); + /* Texture handling **************************************************/ /* Helper functions for handling texture tasks of various kinds. */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ljs...@us...> - 2009-06-05 01:12:59
|
Revision: 639 http://cadcdev.svn.sourceforge.net/cadcdev/?rev=639&view=rev Author: ljsebald Date: 2009-06-05 00:32:53 +0000 (Fri, 05 Jun 2009) Log Message: ----------- Better support for modifier volumes (really for the polygons affected by them), and an example of how to use modifiers with textures. Modified Paths: -------------- kos/examples/dreamcast/pvr/Makefile kos/examples/dreamcast/pvr/modifier_volume/modifier.c kos/kernel/arch/dreamcast/hardware/pvr/pvr_prim.c kos/kernel/arch/dreamcast/include/dc/pvr.h Added Paths: ----------- kos/examples/dreamcast/pvr/modifier_volume_tex/ kos/examples/dreamcast/pvr/modifier_volume_tex/Makefile kos/examples/dreamcast/pvr/modifier_volume_tex/fruit.jpg kos/examples/dreamcast/pvr/modifier_volume_tex/modifier.c kos/examples/dreamcast/pvr/modifier_volume_tex/romdisk/ kos/examples/dreamcast/pvr/modifier_volume_tex/romdisk/crate.pcx Modified: kos/examples/dreamcast/pvr/Makefile =================================================================== --- kos/examples/dreamcast/pvr/Makefile 2009-06-03 19:53:33 UTC (rev 638) +++ kos/examples/dreamcast/pvr/Makefile 2009-06-05 00:32:53 UTC (rev 639) @@ -11,6 +11,7 @@ $(KOS_MAKE) -C pvrmark_strips_direct $(KOS_MAKE) -C texture_render $(KOS_MAKE) -C modifier_volume + $(KOS_MAKE) -C modifier_volume_tex clean: $(KOS_MAKE) -C plasma clean @@ -19,6 +20,7 @@ $(KOS_MAKE) -C pvrmark_strips_direct clean $(KOS_MAKE) -C texture_render clean $(KOS_MAKE) -C modifier_volume clean + $(KOS_MAKE) -C modifier_volume_tex clean dist: $(KOS_MAKE) -C plasma dist @@ -27,5 +29,6 @@ $(KOS_MAKE) -C pvrmark_strips_direct dist $(KOS_MAKE) -C texture_render dist $(KOS_MAKE) -C modifier_volume dist + $(KOS_MAKE) -C modifier_volume_tex dist Modified: kos/examples/dreamcast/pvr/modifier_volume/modifier.c =================================================================== --- kos/examples/dreamcast/pvr/modifier_volume/modifier.c 2009-06-03 19:53:33 UTC (rev 638) +++ kos/examples/dreamcast/pvr/modifier_volume/modifier.c 2009-06-05 00:32:53 UTC (rev 639) @@ -18,7 +18,7 @@ static pvr_vertex_pcm_t verts[NUM_POLYS * 4]; -static pvr_poly_hdr_t phdr; +static pvr_poly_mod_hdr_t phdr; static pvr_mod_hdr_t mhdr, mhdr2; static float mx = 320.0f, my = 240.0f; static pvr_list_t list = PVR_LIST_OP_POLY; @@ -29,10 +29,8 @@ float x, y, z; uint32 argb = list == PVR_LIST_OP_POLY ? 0xFF0000FF : 0x80FF00FF; - pvr_poly_cxt_col(&cxt, list); - cxt.fmt.modifier = PVR_MODIFIER_ENABLE; - cxt.gen.modifier_mode = PVR_MODIFIER_NORMAL; - pvr_poly_compile(&phdr, &cxt); + pvr_poly_cxt_col_mod(&cxt, list); + pvr_poly_mod_compile(&phdr, &cxt); pvr_mod_compile(&mhdr, list + 1, PVR_MODIFIER_OTHER_POLY, PVR_CULLING_NONE); pvr_mod_compile(&mhdr2, list + 1, PVR_MODIFIER_INCLUDE_LAST_POLY, Added: kos/examples/dreamcast/pvr/modifier_volume_tex/Makefile =================================================================== --- kos/examples/dreamcast/pvr/modifier_volume_tex/Makefile (rev 0) +++ kos/examples/dreamcast/pvr/modifier_volume_tex/Makefile 2009-06-05 00:32:53 UTC (rev 639) @@ -0,0 +1,42 @@ +# +# Basic KallistiOS skeleton / test program +# (c)2001 Dan Potter +# + +# Put the filename of the output binary here +TARGET = modifier.elf + +# List all of your C files here, but change the extension to ".o" +OBJS = modifier.o romdisk.o + +all: rm-elf $(TARGET) + +include $(KOS_BASE)/Makefile.rules + +clean: + -rm -f $(TARGET) $(OBJS) romdisk.* romdisk/fruit.kmg + +rm-elf: + -rm -f $(TARGET) + +$(TARGET): $(OBJS) + $(KOS_CC) $(KOS_CFLAGS) $(KOS_LDFLAGS) -o $(TARGET) $(KOS_START) \ + $(OBJS) $(OBJEXTRA) -lkmg -lpcx -lkosutils $(KOS_LIBS) + +romdisk.img: romdisk/fruit.kmg romdisk/crate.pcx + $(KOS_GENROMFS) -f romdisk.img -d romdisk -v + +romdisk.o: romdisk.img + $(KOS_BASE)/utils/bin2o/bin2o romdisk.img romdisk romdisk.o + +romdisk/fruit.kmg: fruit.jpg + $(KOS_BASE)/utils/vqenc/vqenc -t -v -q -k fruit.jpg + mv fruit.kmg romdisk/ + +run: $(TARGET) + $(KOS_LOADER) $(TARGET) -n + +dist: + rm -f $(OBJS) romdisk.* romdisk/fruit.kmg + $(KOS_STRIP) $(TARGET) + Added: kos/examples/dreamcast/pvr/modifier_volume_tex/fruit.jpg =================================================================== (Binary files differ) Property changes on: kos/examples/dreamcast/pvr/modifier_volume_tex/fruit.jpg ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: kos/examples/dreamcast/pvr/modifier_volume_tex/modifier.c =================================================================== --- kos/examples/dreamcast/pvr/modifier_volume_tex/modifier.c (rev 0) +++ kos/examples/dreamcast/pvr/modifier_volume_tex/modifier.c 2009-06-05 00:32:53 UTC (rev 639) @@ -0,0 +1,252 @@ +/* KallistiOS ##version## + + examples/dreamcast/pvr/modifier_volume/modifier.c + Copyright (C) 2009 Lawrence Sebald + + This example shows off how to do a basic modifier volume (with textures). +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <time.h> + +#include <dc/pvr.h> +#include <dc/maple.h> +#include <dc/maple/controller.h> + +#include <pcx/pcx.h> +#include <kmg/kmg.h> + +#define NUM_POLYS 10 + +static pvr_vertex_tpcm_t verts[NUM_POLYS * 4]; + +static pvr_poly_mod_hdr_t phdr; +static pvr_mod_hdr_t mhdr, mhdr2; +static float mx = 320.0f, my = 240.0f; +static pvr_list_t list = PVR_LIST_OP_POLY; +static pvr_ptr_t txr1, txr2; + +void setup() { + pvr_poly_cxt_t cxt; + int i; + float x, y, z; + int w1, h1, w2, h2; + uint32 fmt1, fmt2; + kos_img_t img; + + if(pcx_to_img("/rd/crate.pcx", &img)) { + printf("Failed to load /rd/crate.pcx\n"); + exit(1); + } + + w1 = img.w; + h1 = img.h; + fmt1 = PVR_TXRFMT_RGB565 | PVR_TXRFMT_TWIDDLED; + txr1 = pvr_mem_malloc(img.byte_count); + pvr_txr_load_kimg(&img, txr1, 0); + kos_img_free(&img, 0); + + if(kmg_to_img("/rd/fruit.kmg", &img)) { + printf("Failed to load /rd/fruit.kmg\n"); + exit(1); + } + + w2 = img.w; + h2 = img.h; + fmt2 = PVR_TXRFMT_RGB565 | PVR_TXRFMT_VQ_ENABLE | PVR_TXRFMT_TWIDDLED; + txr2 = pvr_mem_malloc(img.byte_count); + pvr_txr_load_kimg(&img, txr2, 0); + kos_img_free(&img, 0); + + printf("Loaded textures\n"); + + pvr_poly_cxt_txr_mod(&cxt, list, fmt1, w1, h1, txr1, PVR_FILTER_BILINEAR, + fmt2, w2, h2, txr2, PVR_FILTER_NONE); + pvr_poly_mod_compile(&phdr, &cxt); + + pvr_mod_compile(&mhdr, list + 1, PVR_MODIFIER_OTHER_POLY, PVR_CULLING_NONE); + pvr_mod_compile(&mhdr2, list + 1, PVR_MODIFIER_INCLUDE_LAST_POLY, + PVR_CULLING_NONE); + + for(i = 0; i < NUM_POLYS; ++i) { + x = rand() % 640; + y = rand() % 480; + z = rand() % 100 + 1; + + verts[i * 4].flags = PVR_CMD_VERTEX; + verts[i * 4].x = x - 50; + verts[i * 4].y = y + 50; + verts[i * 4].z = z; + verts[i * 4].u0 = 0.0f; + verts[i * 4].v0 = 1.0f; + verts[i * 4].argb0 = 0xFFFFFFFF; + verts[i * 4].oargb0 = 0xFF000000; + verts[i * 4].u1 = 0.0f; + verts[i * 4].v1 = 1.0f; + verts[i * 4].argb1 = 0xFFFFFFFF; + verts[i * 4].oargb1 = 0xFF000000; + verts[i * 4].d1 = verts[i * 4].d2 = verts[i * 4].d3 = + verts[i * 4].d4 = 0; + + verts[i * 4 + 1].flags = PVR_CMD_VERTEX; + verts[i * 4 + 1].x = x - 50; + verts[i * 4 + 1].y = y - 50; + verts[i * 4 + 1].z = z; + verts[i * 4 + 1].u0 = 0.0f; + verts[i * 4 + 1].v0 = 0.0f; + verts[i * 4 + 1].argb0 = 0xFFFFFFFF; + verts[i * 4 + 1].oargb0 = 0xFF000000; + verts[i * 4 + 1].u1 = 0.0f; + verts[i * 4 + 1].v1 = 0.0f; + verts[i * 4 + 1].argb1 = 0xFFFFFFFF; + verts[i * 4 + 1].oargb1 = 0xFF000000; + verts[i * 4 + 1].d1 = verts[i * 4 + 1].d2 = verts[i * 4 + 1].d3 = + verts[i * 4 + 1].d4 = 0; + + verts[i * 4 + 2].flags = PVR_CMD_VERTEX; + verts[i * 4 + 2].x = x + 50; + verts[i * 4 + 2].y = y + 50; + verts[i * 4 + 2].z = z; + verts[i * 4 + 2].u0 = 1.0f; + verts[i * 4 + 2].v0 = 1.0f; + verts[i * 4 + 2].argb0 = 0xFFFFFFFF; + verts[i * 4 + 2].oargb0 = 0xFF000000; + verts[i * 4 + 2].u1 = 1.0f; + verts[i * 4 + 2].v1 = 1.0f; + verts[i * 4 + 2].argb1 = 0xFFFFFFFF; + verts[i * 4 + 2].oargb1 = 0xFF000000; + verts[i * 4 + 2].d1 = verts[i * 4 + 2].d2 = verts[i * 4 + 2].d3 = + verts[i * 4 + 2].d4 = 0; + + verts[i * 4 + 3].flags = PVR_CMD_VERTEX_EOL; + verts[i * 4 + 3].x = x + 50; + verts[i * 4 + 3].y = y - 50; + verts[i * 4 + 3].z = z; + verts[i * 4 + 3].u0 = 1.0f; + verts[i * 4 + 3].v0 = 0.0f; + verts[i * 4 + 3].argb0 = 0xFFFFFFFF; + verts[i * 4 + 3].oargb0 = 0xFF000000; + verts[i * 4 + 3].u1 = 1.0f; + verts[i * 4 + 3].v1 = 0.0f; + verts[i * 4 + 3].argb1 = 0xFFFFFFFF; + verts[i * 4 + 3].oargb1 = 0xFF000000; + verts[i * 4 + 3].d1 = verts[i * 4 + 3].d2 = verts[i * 4 + 3].d3 = + verts[i * 4 + 3].d4 = 0; + } +} + +int check_start() { + maple_device_t *cont; + cont_state_t *state; + + cont = maple_enum_type(0, MAPLE_FUNC_CONTROLLER); + + if (cont) { + state = (cont_state_t *)maple_dev_status(cont); + if (!state) + return 0; + + if(state->buttons & CONT_START) + return 1; + + if(state->buttons & CONT_DPAD_UP) + my -= 1.0f; + if(state->buttons & CONT_DPAD_DOWN) + my += 1.0f; + if(state->buttons & CONT_DPAD_LEFT) + mx -= 1.0f; + if(state->buttons & CONT_DPAD_RIGHT) + mx += 1.0f; + } + + return 0; +} + +void do_frame() { + pvr_modifier_vol_t mod; + int i; + + pvr_wait_ready(); + pvr_scene_begin(); + pvr_list_begin(list); + + pvr_prim(&phdr, sizeof(phdr)); + + for(i = 0; i < NUM_POLYS; ++i) { + pvr_prim(&verts[i * 4], sizeof(verts[i * 4])); + pvr_prim(&verts[i * 4 + 1], sizeof(verts[i * 4 + 1])); + pvr_prim(&verts[i * 4 + 2], sizeof(verts[i * 4 + 2])); + pvr_prim(&verts[i * 4 + 3], sizeof(verts[i * 4 + 3])); + } + + pvr_list_finish(); + + pvr_list_begin(list + 1); + + pvr_prim(&mhdr, sizeof(mhdr)); + + mod.flags = PVR_CMD_VERTEX_EOL; + mod.ax = mx; + mod.ay = my + 50.0f; + mod.az = 150.0f; + mod.bx = mx; + mod.by = my; + mod.bz = 150.0f; + mod.cx = mx + 50.0f; + mod.cy = my + 50.0f; + mod.cz = 150.0f; + mod.d1 = mod.d2 = mod.d3 = mod.d4 = mod.d5 = mod.d6 = 0; + pvr_prim(&mod, sizeof(mod)); + + pvr_prim(&mhdr2, sizeof(mhdr2)); + + mod.flags = PVR_CMD_VERTEX_EOL; + mod.ax = mx; + mod.ay = my; + mod.az = 150.0f; + mod.bx = mx + 50.0f; + mod.by = my + 50.0f; + mod.bz = 150.0f; + mod.cx = mx + 50.0f; + mod.cy = my; + mod.cz = 150.0f; + mod.d1 = mod.d2 = mod.d3 = mod.d4 = mod.d5 = mod.d6 = 0; + pvr_prim(&mod, sizeof(mod)); + + pvr_list_finish(); + pvr_scene_finish(); +} + +static pvr_init_params_t pvr_params = { + /* Enable Opaque and Opaque modifiers. */ + { PVR_BINSIZE_16, PVR_BINSIZE_16, PVR_BINSIZE_0, PVR_BINSIZE_0, + PVR_BINSIZE_0 }, + 512 * 1024 +}; + +extern uint8 romdisk[]; +KOS_INIT_ROMDISK(romdisk); + +int main(int argc, char *argv[]) { + printf("---KallistiOS PVR Modifier Example (with textures)---\n"); + printf("Use the DPAD to move the modifier square around (it starts at "); + printf("(320, 240))\n"); + printf("Press Start to exit.\n"); + + srand(time(NULL)); + + pvr_init(&pvr_params); + + setup(); + + /* Go as long as the user hasn't pressed start on controller 1. */ + while(!check_start()) { + do_frame(); + } + + pvr_mem_free(txr1); + pvr_mem_free(txr2); + + return 0; +} Added: kos/examples/dreamcast/pvr/modifier_volume_tex/romdisk/crate.pcx =================================================================== (Binary files differ) Property changes on: kos/examples/dreamcast/pvr/modifier_volume_tex/romdisk/crate.pcx ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Modified: kos/kernel/arch/dreamcast/hardware/pvr/pvr_prim.c =================================================================== --- kos/kernel/arch/dreamcast/hardware/pvr/pvr_prim.c 2009-06-03 19:53:33 UTC (rev 638) +++ kos/kernel/arch/dreamcast/hardware/pvr/pvr_prim.c 2009-06-05 00:32:53 UTC (rev 639) @@ -359,3 +359,266 @@ dst->d1 = dst->d2 = dst->d3 = dst->d4 = dst->d5 = dst->d6 = 0; } + +/* Compile a polygon context into a polygon header that is affected by + modifier volumes */ +void pvr_poly_mod_compile(pvr_poly_mod_hdr_t *dst, pvr_poly_cxt_t *src) { + int u, v; + uint32 txr_base; + + /* Basically we just take each parameter, clip it, shift it + into place, and OR it into the final result. */ + + /* The base values for CMD */ + dst->cmd = PVR_CMD_POLYHDR; + if (src->txr.enable == PVR_TEXTURE_ENABLE) + dst->cmd |= 8; + + /* Or in the list type, shading type, color and UV formats */ + dst->cmd |= (src->list_type << PVR_TA_CMD_TYPE_SHIFT) & PVR_TA_CMD_TYPE_MASK; + dst->cmd |= (src->fmt.color << PVR_TA_CMD_CLRFMT_SHIFT) & PVR_TA_CMD_CLRFMT_MASK; + dst->cmd |= (src->gen.shading << PVR_TA_CMD_SHADE_SHIFT) & PVR_TA_CMD_SHADE_MASK; + dst->cmd |= (src->fmt.uv << PVR_TA_CMD_UVFMT_SHIFT) & PVR_TA_CMD_UVFMT_MASK; + dst->cmd |= (src->gen.clip_mode << PVR_TA_CMD_USERCLIP_SHIFT) & PVR_TA_CMD_USERCLIP_MASK; + dst->cmd |= (src->fmt.modifier << PVR_TA_CMD_MODIFIER_SHIFT) & PVR_TA_CMD_MODIFIER_MASK; + dst->cmd |= (src->gen.modifier_mode << PVR_TA_CMD_MODIFIERMODE_SHIFT) & PVR_TA_CMD_MODIFIERMODE_MASK; + + /* Polygon mode 1 */ + dst->mode1 = (src->depth.comparison << PVR_TA_PM1_DEPTHCMP_SHIFT) & PVR_TA_PM1_DEPTHCMP_MASK; + dst->mode1 |= (src->gen.culling << PVR_TA_PM1_CULLING_SHIFT) & PVR_TA_PM1_CULLING_MASK; + dst->mode1 |= (src->depth.write << PVR_TA_PM1_DEPTHWRITE_SHIFT) & PVR_TA_PM1_DEPTHWRITE_MASK; + dst->mode1 |= (src->txr.enable << PVR_TA_PM1_TXRENABLE_SHIFT) & PVR_TA_PM1_TXRENABLE_MASK; + + /* Polygon mode 2 (outside volume) */ + dst->mode2_0 = (src->blend.src << PVR_TA_PM2_SRCBLEND_SHIFT) & PVR_TA_PM2_SRCBLEND_MASK; + dst->mode2_0 |= (src->blend.dst << PVR_TA_PM2_DSTBLEND_SHIFT) & PVR_TA_PM2_DSTBLEND_MASK; + dst->mode2_0 |= (src->blend.src_enable << PVR_TA_PM2_SRCENABLE_SHIFT) & PVR_TA_PM2_SRCENABLE_MASK; + dst->mode2_0 |= (src->blend.dst_enable << PVR_TA_PM2_DSTENABLE_SHIFT) & PVR_TA_PM2_DSTENABLE_MASK; + dst->mode2_0 |= (src->gen.fog_type << PVR_TA_PM2_FOG_SHIFT) & PVR_TA_PM2_FOG_MASK; + dst->mode2_0 |= (src->gen.color_clamp << PVR_TA_PM2_CLAMP_SHIFT) & PVR_TA_PM2_CLAMP_MASK; + dst->mode2_0 |= (src->gen.alpha << PVR_TA_PM2_ALPHA_SHIFT) & PVR_TA_PM2_ALPHA_MASK; + + if (src->txr.enable == PVR_TEXTURE_DISABLE) { + dst->mode3_0 = 0; + } else { + dst->mode2_0 |= (src->txr.alpha << PVR_TA_PM2_TXRALPHA_SHIFT) & PVR_TA_PM2_TXRALPHA_MASK; + dst->mode2_0 |= (src->txr.uv_flip << PVR_TA_PM2_UVFLIP_SHIFT) & PVR_TA_PM2_UVFLIP_MASK; + dst->mode2_0 |= (src->txr.uv_clamp << PVR_TA_PM2_UVCLAMP_SHIFT) & PVR_TA_PM2_UVCLAMP_MASK; + dst->mode2_0 |= (src->txr.filter << PVR_TA_PM2_FILTER_SHIFT) & PVR_TA_PM2_FILTER_MASK; + dst->mode2_0 |= (src->txr.mipmap_bias << PVR_TA_PM2_MIPBIAS_SHIFT) & PVR_TA_PM2_MIPBIAS_MASK; + dst->mode2_0 |= (src->txr.env << PVR_TA_PM2_TXRENV_SHIFT) & PVR_TA_PM2_TXRENV_MASK; + + switch (src->txr.width) { + case 8: u = 0; break; + case 16: u = 1; break; + case 32: u = 2; break; + case 64: u = 3; break; + case 128: u = 4; break; + case 256: u = 5; break; + case 512: u = 6; break; + case 1024: u = 7; break; + default: assert_msg(0, "Invalid texture U size"); u = 0; break; + } + + switch (src->txr.height) { + case 8: v = 0; break; + case 16: v = 1; break; + case 32: v = 2; break; + case 64: v = 3; break; + case 128: v = 4; break; + case 256: v = 5; break; + case 512: v = 6; break; + case 1024: v = 7; break; + default: assert_msg(0, "Invalid texture V size"); v = 0; break; + } + + dst->mode2_0 |= (u << PVR_TA_PM2_USIZE_SHIFT) & PVR_TA_PM2_USIZE_MASK; + dst->mode2_0 |= (v << PVR_TA_PM2_VSIZE_SHIFT) & PVR_TA_PM2_VSIZE_MASK; + + /* Polygon mode 3 (outside volume) */ + dst->mode3_0 = (src->txr.mipmap << PVR_TA_PM3_MIPMAP_SHIFT) & PVR_TA_PM3_MIPMAP_MASK; + dst->mode3_0 |= (src->txr.format << PVR_TA_PM3_TXRFMT_SHIFT) & PVR_TA_PM3_TXRFMT_MASK; + + /* Convert the texture address */ + txr_base = (uint32)src->txr.base; + txr_base = (txr_base & 0x00fffff8) >> 3; + dst->mode3_0 |= txr_base; + } + + /* Polygon mode 2 (within volume) */ + dst->mode2_1 = (src->blend.src2 << PVR_TA_PM2_SRCBLEND_SHIFT) & PVR_TA_PM2_SRCBLEND_MASK; + dst->mode2_1 |= (src->blend.dst2 << PVR_TA_PM2_DSTBLEND_SHIFT) & PVR_TA_PM2_DSTBLEND_MASK; + dst->mode2_1 |= (src->blend.src_enable2 << PVR_TA_PM2_SRCENABLE_SHIFT) & PVR_TA_PM2_SRCENABLE_MASK; + dst->mode2_1 |= (src->blend.dst_enable2 << PVR_TA_PM2_DSTENABLE_SHIFT) & PVR_TA_PM2_DSTENABLE_MASK; + dst->mode2_1 |= (src->gen.fog_type2 << PVR_TA_PM2_FOG_SHIFT) & PVR_TA_PM2_FOG_MASK; + dst->mode2_1 |= (src->gen.color_clamp2 << PVR_TA_PM2_CLAMP_SHIFT) & PVR_TA_PM2_CLAMP_MASK; + dst->mode2_1 |= (src->gen.alpha2 << PVR_TA_PM2_ALPHA_SHIFT) & PVR_TA_PM2_ALPHA_MASK; + + if (src->txr2.enable == PVR_TEXTURE_DISABLE) { + dst->mode3_1 = 0; + } else { + dst->mode2_1 |= (src->txr2.alpha << PVR_TA_PM2_TXRALPHA_SHIFT) & PVR_TA_PM2_TXRALPHA_MASK; + dst->mode2_1 |= (src->txr2.uv_flip << PVR_TA_PM2_UVFLIP_SHIFT) & PVR_TA_PM2_UVFLIP_MASK; + dst->mode2_1 |= (src->txr2.uv_clamp << PVR_TA_PM2_UVCLAMP_SHIFT) & PVR_TA_PM2_UVCLAMP_MASK; + dst->mode2_1 |= (src->txr2.filter << PVR_TA_PM2_FILTER_SHIFT) & PVR_TA_PM2_FILTER_MASK; + dst->mode2_1 |= (src->txr2.mipmap_bias << PVR_TA_PM2_MIPBIAS_SHIFT) & PVR_TA_PM2_MIPBIAS_MASK; + dst->mode2_1 |= (src->txr2.env << PVR_TA_PM2_TXRENV_SHIFT) & PVR_TA_PM2_TXRENV_MASK; + + switch (src->txr2.width) { + case 8: u = 0; break; + case 16: u = 1; break; + case 32: u = 2; break; + case 64: u = 3; break; + case 128: u = 4; break; + case 256: u = 5; break; + case 512: u = 6; break; + case 1024: u = 7; break; + default: assert_msg(0, "Invalid texture U size"); u = 0; break; + } + + switch (src->txr2.height) { + case 8: v = 0; break; + case 16: v = 1; break; + case 32: v = 2; break; + case 64: v = 3; break; + case 128: v = 4; break; + case 256: v = 5; break; + case 512: v = 6; break; + case 1024: v = 7; break; + default: assert_msg(0, "Invalid texture V size"); v = 0; break; + } + + dst->mode2_1 |= (u << PVR_TA_PM2_USIZE_SHIFT) & PVR_TA_PM2_USIZE_MASK; + dst->mode2_1 |= (v << PVR_TA_PM2_VSIZE_SHIFT) & PVR_TA_PM2_VSIZE_MASK; + + /* Polygon mode 3 (within volume) */ + dst->mode3_1 = (src->txr2.mipmap << PVR_TA_PM3_MIPMAP_SHIFT) & PVR_TA_PM3_MIPMAP_MASK; + dst->mode3_1 |= (src->txr2.format << PVR_TA_PM3_TXRFMT_SHIFT) & PVR_TA_PM3_TXRFMT_MASK; + + /* Convert the texture address */ + txr_base = (uint32)src->txr2.base; + txr_base = (txr_base & 0x00fffff8) >> 3; + dst->mode3_1 |= txr_base; + } + + dst->d1 = dst->d2 = 0xffffffff; +} + +/* Create a colored polygon context for polygons affected by modifier volumes */ +void pvr_poly_cxt_col_mod(pvr_poly_cxt_t *dst, pvr_list_t list) { + int alpha; + + /* Start off blank */ + memset(dst, 0, sizeof(pvr_poly_cxt_t)); + + /* Fill in a few values */ + dst->list_type = list; + alpha = list > PVR_LIST_OP_MOD; + dst->fmt.color = PVR_CLRFMT_ARGBPACKED; + dst->fmt.uv = PVR_UVFMT_32BIT; + dst->gen.shading = PVR_SHADE_GOURAUD; + dst->depth.comparison = PVR_DEPTHCMP_GREATER; + dst->depth.write = PVR_DEPTHWRITE_ENABLE; + dst->gen.culling = PVR_CULLING_CCW; + dst->fmt.modifier = PVR_MODIFIER_ENABLE; + dst->gen.modifier_mode = PVR_MODIFIER_NORMAL; + dst->txr.enable = PVR_TEXTURE_DISABLE; + dst->txr2.enable = PVR_TEXTURE_DISABLE; + if (!alpha) { + dst->gen.alpha = PVR_ALPHA_DISABLE; + dst->blend.src = PVR_BLEND_ONE; + dst->blend.dst = PVR_BLEND_ZERO; + dst->gen.alpha2 = PVR_ALPHA_DISABLE; + dst->blend.src2 = PVR_BLEND_ONE; + dst->blend.dst2 = PVR_BLEND_ZERO; + } else { + dst->gen.alpha = PVR_ALPHA_ENABLE; + dst->blend.src = PVR_BLEND_SRCALPHA; + dst->blend.dst = PVR_BLEND_INVSRCALPHA; + dst->gen.alpha2 = PVR_ALPHA_ENABLE; + dst->blend.src2 = PVR_BLEND_SRCALPHA; + dst->blend.dst2 = PVR_BLEND_INVSRCALPHA; + } + dst->blend.src_enable = PVR_BLEND_DISABLE; + dst->blend.dst_enable = PVR_BLEND_DISABLE; + dst->gen.fog_type = PVR_FOG_DISABLE; + dst->gen.color_clamp = PVR_CLRCLAMP_DISABLE; + dst->blend.src_enable2 = PVR_BLEND_DISABLE; + dst->blend.dst_enable2 = PVR_BLEND_DISABLE; + dst->gen.fog_type2 = PVR_FOG_DISABLE; + dst->gen.color_clamp2 = PVR_CLRCLAMP_DISABLE; +} + +/* Create a textured polygon context for polygons affected by modifier + volumes */ +void pvr_poly_cxt_txr_mod(pvr_poly_cxt_t *dst, pvr_list_t list, + int textureformat, int tw, int th, + pvr_ptr_t textureaddr, int filtering, + int textureformat2, int tw2, int th2, + pvr_ptr_t textureaddr2, int filtering2) { + int alpha; + + /* Start off blank */ + memset(dst, 0, sizeof(pvr_poly_cxt_t)); + + /* Fill in a few values */ + dst->list_type = list; + alpha = list > PVR_LIST_OP_MOD; + dst->fmt.color = PVR_CLRFMT_ARGBPACKED; + dst->fmt.uv = PVR_UVFMT_32BIT; + dst->gen.shading = PVR_SHADE_GOURAUD; + dst->depth.comparison = PVR_DEPTHCMP_GREATER; + dst->depth.write = PVR_DEPTHWRITE_ENABLE; + dst->gen.culling = PVR_CULLING_CCW; + dst->fmt.modifier = PVR_MODIFIER_ENABLE; + dst->gen.modifier_mode = PVR_MODIFIER_NORMAL; + dst->txr.enable = PVR_TEXTURE_ENABLE; + dst->txr2.enable = PVR_TEXTURE_ENABLE; + if (!alpha) { + dst->gen.alpha = PVR_ALPHA_DISABLE; + dst->txr.alpha = PVR_TXRALPHA_ENABLE; + dst->blend.src = PVR_BLEND_ONE; + dst->blend.dst = PVR_BLEND_ZERO; + dst->txr.env = PVR_TXRENV_MODULATE; + dst->gen.alpha2 = PVR_ALPHA_DISABLE; + dst->txr2.alpha = PVR_TXRALPHA_ENABLE; + dst->blend.src2 = PVR_BLEND_ONE; + dst->blend.dst2 = PVR_BLEND_ZERO; + dst->txr2.env = PVR_TXRENV_MODULATE; + } else { + dst->gen.alpha = PVR_ALPHA_ENABLE; + dst->txr.alpha = PVR_TXRALPHA_ENABLE; + dst->blend.src = PVR_BLEND_SRCALPHA; + dst->blend.dst = PVR_BLEND_INVSRCALPHA; + dst->txr.env = PVR_TXRENV_MODULATEALPHA; + dst->gen.alpha2 = PVR_ALPHA_ENABLE; + dst->txr2.alpha = PVR_TXRALPHA_ENABLE; + dst->blend.src2 = PVR_BLEND_SRCALPHA; + dst->blend.dst2 = PVR_BLEND_INVSRCALPHA; + dst->txr2.env = PVR_TXRENV_MODULATEALPHA; + } + dst->blend.src_enable = PVR_BLEND_DISABLE; + dst->blend.dst_enable = PVR_BLEND_DISABLE; + dst->gen.fog_type = PVR_FOG_DISABLE; + dst->gen.color_clamp = PVR_CLRCLAMP_DISABLE; + dst->txr.uv_flip = PVR_UVFLIP_NONE; + dst->txr.uv_clamp = PVR_UVCLAMP_NONE; + dst->txr.filter = filtering; + dst->txr.mipmap_bias = PVR_MIPBIAS_NORMAL; + dst->txr.width = tw; + dst->txr.height = th; + dst->txr.base = textureaddr; + dst->txr.format = textureformat; + dst->blend.src_enable2 = PVR_BLEND_DISABLE; + dst->blend.dst_enable2 = PVR_BLEND_DISABLE; + dst->gen.fog_type2 = PVR_FOG_DISABLE; + dst->gen.color_clamp2 = PVR_CLRCLAMP_DISABLE; + dst->txr2.uv_flip = PVR_UVFLIP_NONE; + dst->txr2.uv_clamp = PVR_UVCLAMP_NONE; + dst->txr2.filter = filtering2; + dst->txr2.mipmap_bias = PVR_MIPBIAS_NORMAL; + dst->txr2.width = tw2; + dst->txr2.height = th2; + dst->txr2.base = textureaddr2; + dst->txr2.format = textureformat2; +} Modified: kos/kernel/arch/dreamcast/include/dc/pvr.h =================================================================== --- kos/kernel/arch/dreamcast/include/dc/pvr.h 2009-06-03 19:53:33 UTC (rev 638) +++ kos/kernel/arch/dreamcast/include/dc/pvr.h 2009-06-05 00:32:53 UTC (rev 639) @@ -48,10 +48,15 @@ int color_clamp; int clip_mode; int modifier_mode; + int alpha2; + int fog_type2; + int color_clamp2; } gen; struct { int src, dst; int src_enable, dst_enable; + int src2, dst2; + int src_enable2, dst_enable2; } blend; struct { int color; @@ -76,6 +81,20 @@ int format; /* bit format, vq, twiddle, stride */ pvr_ptr_t base; /* texture location */ } txr; + struct { + int enable; + int filter; /* none, bi-linear, tri-linear, etc */ + int mipmap; + int mipmap_bias; + int uv_flip; + int uv_clamp; + int alpha; + int env; + int width; + int height; + int format; /* bit format, vq, twiddle, stride */ + pvr_ptr_t base; /* texture location */ + } txr2; } pvr_poly_cxt_t; /* Sprite context; use this somewhat readable format to specify your @@ -279,8 +298,8 @@ typedef struct { uint32 cmd; /* TA command */ uint32 mode1; /* mode parameters */ + uint32 mode2_0, mode3_0; uint32 mode2_1, mode3_1; - uint32 mode2_2, mode3_2; uint32 d1, d2; /* dummies */ } pvr_poly_mod_hdr_t; @@ -932,6 +951,22 @@ void pvr_mod_compile(pvr_mod_hdr_t *dst, pvr_list_t list, uint32 mode, uint32 cull); +/* Compile a polygon context into a polygon header that is affected by + modifier volumes */ +void pvr_poly_mod_compile(pvr_poly_mod_hdr_t *dst, pvr_poly_cxt_t *src); + +/* Create a colored polygon context for polygons affected by + modifier volumes */ +void pvr_poly_cxt_col_mod(pvr_poly_cxt_t *dst, pvr_list_t list); + +/* Create a textured polygon context for polygons affected by + modifier volumes */ +void pvr_poly_cxt_txr_mod(pvr_poly_cxt_t *dst, pvr_list_t list, + int textureformat, int tw, int th, + pvr_ptr_t textureaddr, int filtering, + int textureformat2, int tw2, int th2, + pvr_ptr_t textureaddr2, int filtering2); + /* Texture handling **************************************************/ /* Helper functions for handling texture tasks of various kinds. */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ljs...@us...> - 2009-06-05 02:53:14
|
Revision: 640 http://cadcdev.svn.sourceforge.net/cadcdev/?rev=640&view=rev Author: ljsebald Date: 2009-06-05 02:02:22 +0000 (Fri, 05 Jun 2009) Log Message: ----------- Adding in simple statistics system for IPv4 and UDP (and fixing comment at the top of the second modifier volume example). Modified Paths: -------------- kos/doc/CHANGELOG kos/examples/dreamcast/network/basic/basic.c kos/examples/dreamcast/pvr/modifier_volume_tex/modifier.c kos/include/kos/net.h kos/kernel/net/net_ipv4.c kos/kernel/net/net_udp.c Modified: kos/doc/CHANGELOG =================================================================== --- kos/doc/CHANGELOG 2009-06-05 00:32:53 UTC (rev 639) +++ kos/doc/CHANGELOG 2009-06-05 02:02:22 UTC (rev 640) @@ -185,6 +185,9 @@ correct polygon header to be sent for sprites [LS] - DC Added in some support functions for PVR modifier volumes (and an example program that uses them) [LS] +- DC Added a modifier volume example using textures [LS] +- DC Added a simple statistics system to the IPv4 and UDP layers of the + network stack [LS] KallistiOS version 1.2.0 ----------------------------------------------- - DC Fix to use DCARM7_CFLAGS when compiling ARM driver [Christian Groessler == CG] Modified: kos/examples/dreamcast/network/basic/basic.c =================================================================== --- kos/examples/dreamcast/network/basic/basic.c 2009-06-05 00:32:53 UTC (rev 639) +++ kos/examples/dreamcast/network/basic/basic.c 2009-06-05 02:02:22 UTC (rev 640) @@ -1,7 +1,8 @@ /* KallistiOS ##version## - network.c - (c)2002 Dan Potter + basic.c + Copyright (C) 2002 Dan Potter + Copyright (C) 2009 Lawrence Sebald */ #include <kos.h> @@ -13,15 +14,45 @@ ping it, etc. Note that this program is totally portable as long as your KOS platform has networking capabilities, but I'm leaving it in "dreamcast" for now. - + +Now with statistics printing! + */ KOS_INIT_FLAGS(INIT_DEFAULT | INIT_NET); int main(int argc, char **argv) { + net_ipv4_stats_t ip; + net_udp_stats_t udp; + /* Wait for a bit so the user can ping, etc */ - usleep(10 * 1000 * 1000); + thd_sleep(10 * 1000); + /* Print out some statistics about the connection. */ + ip = net_ipv4_get_stats(); + udp = net_udp_get_stats(); + + printf("IPv4 Stats:\n" + "Packets sent successfully: %6d\n" + "Packets that failed to send: %6d\n" + "Packets received successfully: %6d\n" + "Packets rejected (bad size): %6d\n" + " (bad checksum): %6d\n" + " (bad protocol): %6d\n\n", + ip.pkt_sent, ip.pkt_send_failed, ip.pkt_recv, ip.pkt_recv_bad_size, + ip.pkt_recv_bad_chksum, ip.pkt_recv_bad_proto); + + printf("UDP Stats:\n" + "Packets sent successfully: %6d\n" + "Packets that failed to send: %6d\n" + "Packets received successfully: %6d\n" + "Packets rejected (bad size): %6d\n" + " (bad checksum): %6d\n" + " (no socket): %6d\n\n", + udp.pkt_sent, udp.pkt_send_failed, udp.pkt_recv, + udp.pkt_recv_bad_size, udp.pkt_recv_bad_chksum, + udp.pkt_recv_no_sock); + return 0; } Modified: kos/examples/dreamcast/pvr/modifier_volume_tex/modifier.c =================================================================== --- kos/examples/dreamcast/pvr/modifier_volume_tex/modifier.c 2009-06-05 00:32:53 UTC (rev 639) +++ kos/examples/dreamcast/pvr/modifier_volume_tex/modifier.c 2009-06-05 02:02:22 UTC (rev 640) @@ -1,6 +1,6 @@ /* KallistiOS ##version## - examples/dreamcast/pvr/modifier_volume/modifier.c + examples/dreamcast/pvr/modifier_volume_tex/modifier.c Copyright (C) 2009 Lawrence Sebald This example shows off how to do a basic modifier volume (with textures). Modified: kos/include/kos/net.h =================================================================== --- kos/include/kos/net.h 2009-06-05 00:32:53 UTC (rev 639) +++ kos/include/kos/net.h 2009-06-05 02:02:22 UTC (rev 640) @@ -1,7 +1,8 @@ /* KallistiOS ##version## include/kos/net.h - (c)2002 Dan Potter + Copyright (C) 2002 Dan Potter + Copyright (C) 2005, 2006, 2007, 2008, 2009 Lawrence Sebald */ @@ -195,6 +196,20 @@ /***** net_ipv4.c *********************************************************/ +/* IPv4 statistics structure. This structure holds some basic statistics about + the IPv4 layer of the stack, and can be retrieved with the function below. */ +typedef struct net_ipv4_stats { + uint32 pkt_sent; /* Packets sent out successfully */ + uint32 pkt_send_failed; /* Packets that failed to send */ + uint32 pkt_recv; /* Packets received successfully */ + uint32 pkt_recv_bad_size; /* Packets of a bad size */ + uint32 pkt_recv_bad_chksum; /* Packets with a bad checksum */ + uint32 pkt_recv_bad_proto; /* Packets with an unknown protocol */ +} net_ipv4_stats_t; + +/* Retrieve statistics from the IPv4 layer. */ +net_ipv4_stats_t net_ipv4_get_stats(); + /* Create a 32-bit IP address, based on the individual numbers contained within the ip. */ uint32 net_ipv4_address(const uint8 addr[4]); @@ -205,6 +220,20 @@ /***** net_udp.c **********************************************************/ +/* UDP statistics structure. This structure holds some basic statistics about + the UDP layer of the stack, and can be retrieved with the function below. */ +typedef struct net_udp_stats { + uint32 pkt_sent; /* Packets sent out successfully */ + uint32 pkt_send_failed; /* Packets that failed to send */ + uint32 pkt_recv; /* Packets received successfully */ + uint32 pkt_recv_bad_size; /* Packets of a bad size */ + uint32 pkt_recv_bad_chksum; /* Packets with a bad checksum */ + uint32 pkt_recv_no_sock; /* Packets with to an unopened socket */ +} net_udp_stats_t; + +/* Retrieve statistics from the UDP layer. */ +net_udp_stats_t net_udp_get_stats(); + /* Init */ int net_udp_init(); Modified: kos/kernel/net/net_ipv4.c =================================================================== --- kos/kernel/net/net_ipv4.c 2009-06-05 00:32:53 UTC (rev 639) +++ kos/kernel/net/net_ipv4.c 2009-06-05 02:02:22 UTC (rev 640) @@ -2,7 +2,7 @@ kernel/net/net_ipv4.c - Copyright (C) 2005, 2006, 2007, 2008 Lawrence Sebald + Copyright (C) 2005, 2006, 2007, 2008, 2009 Lawrence Sebald Portions adapted from KOS' old net_icmp.c file: Copyright (c) 2002 Dan Potter @@ -18,6 +18,8 @@ #include "net_icmp.h" #include "net_udp.h" +static net_ipv4_stats_t ipv4_stats = { 0 }; + /* Perform an IP-style checksum on a block of data */ uint16 net_ipv4_checksum(const uint8 *data, int bytes) { uint32 sum = 0; @@ -105,6 +107,8 @@ /* Put the IP header / data into our packet */ memcpy(pkt, hdr, 4 * (hdr->version_ihl & 0x0f)); memcpy(pkt + 4 * (hdr->version_ihl & 0x0f), data, size); + + ++ipv4_stats.pkt_sent; /* Send it "away" */ net_ipv4_input(NULL, pkt, 4 * (hdr->version_ihl & 0x0f) + size); @@ -129,9 +133,11 @@ err = net_arp_lookup(net, dest_ip, dest_mac); if(err == -1) { errno = ENETUNREACH; + ++ipv4_stats.pkt_send_failed; return -1; } else if(err == -2) { + ++ipv4_stats.pkt_send_failed; return -2; } } @@ -148,6 +154,8 @@ memcpy(pkt + sizeof(eth_hdr_t) + 4 * (hdr->version_ihl & 0x0f), data, size); + ++ipv4_stats.pkt_sent; + /* Send it away */ net->if_tx(net, pkt, sizeof(ip_hdr_t) + size + sizeof(eth_hdr_t), NETIF_BLOCK); @@ -182,16 +190,20 @@ uint8 *data; int hdrlen; - if(pktsize < sizeof(ip_hdr_t)) + if(pktsize < sizeof(ip_hdr_t)) { /* This is obviously a bad packet, drop it */ + ++ipv4_stats.pkt_recv_bad_size; return -1; + } ip = (ip_hdr_t*) pkt; hdrlen = (ip->version_ihl & 0x0F) << 2; - if(pktsize < hdrlen) + if(pktsize < hdrlen) { /* The packet is smaller than the listed header length, bail */ + ++ipv4_stats.pkt_recv_bad_size; return -1; + } data = (uint8 *) (pkt + hdrlen); @@ -202,18 +214,22 @@ if(i != ip->checksum) { /* The checksums don't match, bail */ + ++ipv4_stats.pkt_recv_bad_chksum; return -1; } switch(ip->protocol) { case IPPROTO_ICMP: + ++ipv4_stats.pkt_recv; return net_icmp_input(src, ip, data, ntohs(ip->length) - hdrlen); case IPPROTO_UDP: + ++ipv4_stats.pkt_recv; return net_udp_input(src, ip, data, ntohs(ip->length) - hdrlen); } /* There's no handler for this packet type, bail out */ + ++ipv4_stats.pkt_recv_bad_proto; return -1; } @@ -227,3 +243,7 @@ out[2] = (uint8) ((addr >> 8) & 0xFF); out[3] = (uint8) (addr & 0xFF); } + +net_ipv4_stats_t net_ipv4_get_stats() { + return ipv4_stats; +} Modified: kos/kernel/net/net_udp.c =================================================================== --- kos/kernel/net/net_udp.c 2009-06-05 00:32:53 UTC (rev 639) +++ kos/kernel/net/net_udp.c 2009-06-05 02:02:22 UTC (rev 640) @@ -1,7 +1,7 @@ /* KallistiOS ##version## kernel/net/net_udp.c - Copyright (C) 2005, 2006, 2007, 2008 Lawrence Sebald + Copyright (C) 2005, 2006, 2007, 2008, 2009 Lawrence Sebald */ @@ -44,6 +44,7 @@ static struct udp_sock_list net_udp_sockets = LIST_HEAD_INITIALIZER(0); static mutex_t *udp_mutex = NULL; +static net_udp_stats_t udp_stats = { 0 }; int net_udp_accept(net_socket_t *hnd, struct sockaddr *addr, socklen_t *addr_len) { @@ -616,6 +617,7 @@ if(size <= sizeof(udp_hdr_t)) { /* Discard the packet, since it is too short to be of any interest. */ + ++udp_stats.pkt_recv_bad_size; return -1; } @@ -632,6 +634,7 @@ if(checksum != ps->checksum) { /* The checksums don't match, bail out */ + ++udp_stats.pkt_recv_bad_chksum; return -1; } @@ -665,12 +668,16 @@ mutex_unlock(udp_mutex); + ++udp_stats.pkt_recv; + return 0; } } mutex_unlock(udp_mutex); + ++udp_stats.pkt_recv_no_sock; + return -1; } @@ -683,6 +690,7 @@ if(net == NULL && net_default_dev == NULL) { errno = ENETDOWN; + ++udp_stats.pkt_send_failed; return -1; } @@ -725,16 +733,23 @@ } else if(err == -2) { errno = ENETUNREACH; + ++udp_stats.pkt_send_failed; return -1; } else if(err < 0) { + ++udp_stats.pkt_send_failed; return -1; } else { + ++udp_stats.pkt_sent; return size - sizeof(udp_hdr_t); } } +net_udp_stats_t net_udp_get_stats() { + return udp_stats; +} + int net_udp_init() { udp_mutex = mutex_create(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ljs...@us...> - 2009-06-06 04:41:24
|
Revision: 641 http://cadcdev.svn.sourceforge.net/cadcdev/?rev=641&view=rev Author: ljsebald Date: 2009-06-06 04:41:23 +0000 (Sat, 06 Jun 2009) Log Message: ----------- Add the MTU of the interface to the netif structure and some fixups for DHCP. Modified Paths: -------------- kos/include/kos/net.h kos/kernel/arch/dreamcast/hardware/network/broadband_adapter.c kos/kernel/arch/dreamcast/hardware/network/lan_adapter.c kos/kernel/net/net_dhcp.c Modified: kos/include/kos/net.h =================================================================== --- kos/include/kos/net.h 2009-06-05 02:02:22 UTC (rev 640) +++ kos/include/kos/net.h 2009-06-06 04:41:23 UTC (rev 641) @@ -48,15 +48,21 @@ /* The device's IP address (if any) */ uint8 ip_addr[4]; - /* The device's netmask */ - uint8 netmask[4]; + /* The device's netmask */ + uint8 netmask[4]; - /* The device's gateway's IP address */ - uint8 gateway[4]; + /* The device's gateway's IP address */ + uint8 gateway[4]; - /* The device's broadcast address */ - uint8 broadcast[4]; + /* The device's broadcast address */ + uint8 broadcast[4]; + /* The device's DNS server address */ + uint8 dns[4]; + + /* The interface's MTU */ + int mtu; + /* All of the following callback functions should return a negative value on failure, and a zero or positive value on success. Some functions have special values, as noted. */ Modified: kos/kernel/arch/dreamcast/hardware/network/broadband_adapter.c =================================================================== --- kos/kernel/arch/dreamcast/hardware/network/broadband_adapter.c 2009-06-05 02:02:22 UTC (rev 640) +++ kos/kernel/arch/dreamcast/hardware/network/broadband_adapter.c 2009-06-06 04:41:23 UTC (rev 641) @@ -1047,6 +1047,8 @@ memset(bba_if.netmask, 0, sizeof(bba_if.netmask)); memset(bba_if.gateway, 0, sizeof(bba_if.gateway)); memset(bba_if.broadcast, 0, sizeof(bba_if.broadcast)); + memset(bba_if.dns, 0, sizeof(bba_if.dns)); + bba_if.mtu = 1500; /* The Ethernet v2 MTU */ bba_if.if_detect = bba_if_detect; bba_if.if_init = bba_if_init; bba_if.if_shutdown = bba_if_shutdown; Modified: kos/kernel/arch/dreamcast/hardware/network/lan_adapter.c =================================================================== --- kos/kernel/arch/dreamcast/hardware/network/lan_adapter.c 2009-06-05 02:02:22 UTC (rev 640) +++ kos/kernel/arch/dreamcast/hardware/network/lan_adapter.c 2009-06-06 04:41:23 UTC (rev 641) @@ -661,12 +661,14 @@ la_if.name = "la"; la_if.descr = "Lan Adapter (HIT-0300)"; la_if.index = 0; - la_if.dev_id =0 ; + la_if.dev_id = 0 ; la_if.flags = NETIF_NO_FLAGS; memset(la_if.ip_addr, 0, sizeof(la_if.ip_addr)); memset(la_if.netmask, 0, sizeof(la_if.netmask)); memset(la_if.gateway, 0, sizeof(la_if.gateway)); memset(la_if.broadcast, 0, sizeof(la_if.broadcast)); + memset(la_if.dns, 0, sizeof(la_if.dns)); + la_if.mtu = 1500; /* The Ethernet v2 MTU */ la_if.if_detect = la_if_detect; la_if.if_init = la_if_init; la_if.if_shutdown = la_if_shutdown; Modified: kos/kernel/net/net_dhcp.c =================================================================== --- kos/kernel/net/net_dhcp.c 2009-06-05 02:02:22 UTC (rev 640) +++ kos/kernel/net/net_dhcp.c 2009-06-06 04:41:23 UTC (rev 641) @@ -1,7 +1,7 @@ /* KallistiOS ##version## kernel/net/net_dhcp.c - Copyright (C) 2008 Lawrence Sebald + Copyright (C) 2008, 2009 Lawrence Sebald */ @@ -60,44 +60,39 @@ req->options[pos++] = 0x82; req->options[pos++] = 0x53; req->options[pos++] = 0x63; - + /* Message Type: DHCPDISCOVER */ req->options[pos++] = DHCP_OPTION_MESSAGE_TYPE; req->options[pos++] = 1; /* Length = 1 */ req->options[pos++] = msgtype; - - req->options[pos++] = DHCP_OPTION_PAD; /* Pad for alignment */ - - /* Max Message Length: 1024 octets */ + + /* Max Message Length: 1500 octets */ req->options[pos++] = DHCP_OPTION_MAX_MESSAGE; req->options[pos++] = 2; /* Length = 2 */ - *((uint16 *)(req->options + pos)) = htons(1024); - pos += 2; - + req->options[pos++] = (net->mtu >> 8) & 0xFF; + req->options[pos++] = (net->mtu >> 0) & 0xFF; + /* Host Name: Dreamcast */ req->options[pos++] = DHCP_OPTION_HOST_NAME; req->options[pos++] = 10; /* Length = 10 */ strcpy((char *)req->options + pos, "KallistiOS"); pos += 10; - + /* Client Identifier: The network adapter's MAC address */ req->options[pos++] = DHCP_OPTION_CLIENT_ID; req->options[pos++] = 1 + DHCP_HLEN_ETHERNET; /* Length = 7 */ req->options[pos++] = DHCP_HTYPE_10MB_ETHERNET; memcpy(req->options + pos, net->mac_addr, DHCP_HLEN_ETHERNET); pos += DHCP_HLEN_ETHERNET; - - req->options[pos++] = DHCP_OPTION_PAD; /* Pad for alignment */ - req->options[pos++] = DHCP_OPTION_PAD; - req->options[pos++] = DHCP_OPTION_PAD; - - /* Parameters requested: Subnet, Router, DNS, Broadcast */ + + /* Parameters requested: Subnet, Router, DNS, Broadcast, MTU */ req->options[pos++] = DHCP_OPTION_PARAMETER_REQUEST; - req->options[pos++] = 4; /* Length = 4 */ + req->options[pos++] = 5; /* Length = 5 */ req->options[pos++] = DHCP_OPTION_SUBNET_MASK; req->options[pos++] = DHCP_OPTION_ROUTER; req->options[pos++] = DHCP_OPTION_DOMAIN_NAME_SERVER; req->options[pos++] = DHCP_OPTION_BROADCAST_ADDR; + req->options[pos++] = DHCP_OPTION_INTERFACE_MTU; if(serverid) { /* Add the Server identifier option */ @@ -119,9 +114,6 @@ req->options[pos++] = (reqip >> 0) & 0xFF; } - /* Pad so that we have an even number of octets */ - req->options[pos++] = DHCP_OPTION_PAD; - /* The End */ req->options[pos++] = DHCP_OPTION_END; @@ -144,7 +136,7 @@ ++i; } else { - i += pkt->options[i + 1]; + i += pkt->options[i + 1] + 2; } } @@ -163,24 +155,50 @@ return (pkt->options[i + 2] << 24) | (pkt->options[i + 3] << 16) | (pkt->options[i + 4] << 8) | (pkt->options[i + 5]); } - else if(pkt->options[i] == DHCP_OPTION_PAD || - pkt->options[i] == DHCP_OPTION_END) { + else if(pkt->options[i] == DHCP_OPTION_PAD) { ++i; } + else if(pkt->options[i] == DHCP_OPTION_END) { + break; + } else { - i += pkt->options[i + 1]; + i += pkt->options[i + 1] + 2; } } return 0; } +static uint16 net_dhcp_get_16bit(dhcp_pkt_t *pkt, uint8 opt, int len) { + int i; + + len -= sizeof(dhcp_pkt_t); + + /* Read each byte of the options field looking for the specified option, + return it when found. */ + for(i = 4; i < len;) { + if(pkt->options[i] == opt) { + return (pkt->options[i + 2] << 8) | (pkt->options[i + 3]); + } + else if(pkt->options[i] == DHCP_OPTION_PAD) { + ++i; + } + else if(pkt->options[i] == DHCP_OPTION_END) { + break; + } + else { + i += pkt->options[i + 1] + 2; + } + } + + return 0; +} + int net_dhcp_request() { - uint8 pkt[1024]; + uint8 pkt[1500]; dhcp_pkt_t *req = (dhcp_pkt_t *)pkt; int optlen; struct dhcp_pkt_out *qpkt; - uint32 old; int rv = 0; if(dhcp_sock == -1) { @@ -243,25 +261,20 @@ STAILQ_INSERT_TAIL(&dhcp_pkts, qpkt, pkt_queue); state = DHCP_STATE_SELECTING; - - old = irq_disable(); rlock_unlock(dhcp_lock); /* We need to wait til we're either bound to an IP address, or until we give up all hope of doing so (give us 60 seconds). */ - if(thd_current != dhcp_thd) { rv = genwait_wait(qpkt, "net_dhcp_request", 60 * 1000, NULL); } - irq_restore(old); - return rv; } static void net_dhcp_send_request(dhcp_pkt_t *pkt, int pktlen, dhcp_pkt_t *pkt2, int pkt2len) { - uint8 buf[1024]; + uint8 buf[1500]; dhcp_pkt_t *req = (dhcp_pkt_t *)buf; int optlen; struct dhcp_pkt_out *qpkt; @@ -318,7 +331,7 @@ } static void net_dhcp_renew() { - uint8 buf[1024]; + uint8 buf[1500]; dhcp_pkt_t *req = (dhcp_pkt_t *)buf; int optlen; struct dhcp_pkt_out *qpkt; @@ -399,13 +412,13 @@ } /* Grab the DNS address if it was returned to us */ - tmp = net_dhcp_get_32bit(pkt, DHCP_OPTION_NAME_SERVER, len); + tmp = net_dhcp_get_32bit(pkt, DHCP_OPTION_DOMAIN_NAME_SERVER, len); if(tmp != 0) { - net_default_dev->gateway[0] = (tmp >> 24) & 0xFF; - net_default_dev->gateway[1] = (tmp >> 16) & 0xFF; - net_default_dev->gateway[2] = (tmp >> 8) & 0xFF; - net_default_dev->gateway[3] = (tmp >> 0) & 0xFF; + net_default_dev->dns[0] = (tmp >> 24) & 0xFF; + net_default_dev->dns[1] = (tmp >> 16) & 0xFF; + net_default_dev->dns[2] = (tmp >> 8) & 0xFF; + net_default_dev->dns[3] = (tmp >> 0) & 0xFF; } /* Grab the broadcast address if it was sent to us, otherwise infer it from @@ -446,6 +459,13 @@ renew_time = rebind_time = lease_expires = 0xFFFFFFFFFFFFFFFFULL; } + /* Grab the interface MTU, if we got it */ + tmp = net_dhcp_get_16bit(pkt, DHCP_OPTION_INTERFACE_MTU, len); + + if(tmp != 0) { + net_default_dev->mtu = (int)((uint16)tmp); + } + state = DHCP_STATE_BOUND; irq_restore(old); @@ -455,7 +475,7 @@ struct dhcp_pkt_out *qpkt; uint64 now; struct sockaddr_in addr; - uint8 buf[1024]; + uint8 buf[1500]; ssize_t len = 0; socklen_t addr_len = sizeof(struct sockaddr_in); dhcp_pkt_t *pkt = (dhcp_pkt_t *)buf, *pkt2; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ljs...@us...> - 2009-06-06 22:06:03
|
Revision: 643 http://cadcdev.svn.sourceforge.net/cadcdev/?rev=643&view=rev Author: ljsebald Date: 2009-06-06 22:05:36 +0000 (Sat, 06 Jun 2009) Log Message: ----------- Added IP fragmenting support. Modified Paths: -------------- kos/doc/CHANGELOG kos/kernel/net/Makefile kos/kernel/net/net_ipv4.c kos/kernel/net/net_ipv4.h Added Paths: ----------- kos/kernel/net/net_ipv4_frag.c Modified: kos/doc/CHANGELOG =================================================================== --- kos/doc/CHANGELOG 2009-06-06 14:15:37 UTC (rev 642) +++ kos/doc/CHANGELOG 2009-06-06 22:05:36 UTC (rev 643) @@ -188,6 +188,10 @@ - DC Added a modifier volume example using textures [LS] - DC Added a simple statistics system to the IPv4 and UDP layers of the network stack [LS] +- DC Added a MTU value to the netif structure for maintaining the maximum + transfer size of the adapter [LS] +- DC Added the ability to fragment IP packets, and made fragmenting respect + the MTU [LS] KallistiOS version 1.2.0 ----------------------------------------------- - DC Fix to use DCARM7_CFLAGS when compiling ARM driver [Christian Groessler == CG] Modified: kos/kernel/net/Makefile =================================================================== --- kos/kernel/net/Makefile 2009-06-06 14:15:37 UTC (rev 642) +++ kos/kernel/net/Makefile 2009-06-06 22:05:36 UTC (rev 643) @@ -4,7 +4,8 @@ # (c)2002 Dan Potter # -OBJS = net_core.o net_arp.o net_input.o net_icmp.o net_ipv4.o net_udp.o net_dhcp.o +OBJS = net_core.o net_arp.o net_input.o net_icmp.o net_ipv4.o net_udp.o +OBJS += net_dhcp.o net_ipv4_frag.o SUBDIRS = include $(KOS_BASE)/Makefile.prefab Modified: kos/kernel/net/net_ipv4.c =================================================================== --- kos/kernel/net/net_ipv4.c 2009-06-06 14:15:37 UTC (rev 642) +++ kos/kernel/net/net_ipv4.c 2009-06-06 22:05:36 UTC (rev 643) @@ -164,7 +164,7 @@ } int net_ipv4_send(netif_t *net, const uint8 *data, int size, int id, int ttl, - int proto, uint32 src, uint32 dst) { + int proto, uint32 src, uint32 dst) { ip_hdr_t hdr; /* Fill in the IPv4 Header */ @@ -172,7 +172,7 @@ hdr.tos = 0; hdr.length = htons(size + 20); hdr.packet_id = id; - hdr.flags_frag_offs = htons(0x4000); + hdr.flags_frag_offs = 0; hdr.ttl = ttl; hdr.protocol = proto; hdr.checksum = 0; @@ -181,7 +181,7 @@ hdr.checksum = net_ipv4_checksum((uint8 *)&hdr, sizeof(ip_hdr_t)); - return net_ipv4_send_packet(net, &hdr, data, size); + return net_ipv4_frag_send(net, &hdr, data, size); } int net_ipv4_input(netif_t *src, const uint8 *pkt, int pktsize) { Modified: kos/kernel/net/net_ipv4.h =================================================================== --- kos/kernel/net/net_ipv4.h 2009-06-06 14:15:37 UTC (rev 642) +++ kos/kernel/net/net_ipv4.h 2009-06-06 22:05:36 UTC (rev 643) @@ -50,4 +50,8 @@ int proto, uint32 src, uint32 dst); int net_ipv4_input(netif_t *src, const uint8 *pkt, int pktsize); +/* In net_ipv4_frag.c */ +int net_ipv4_frag_send(netif_t *net, ip_hdr_t *hdr, const uint8 *data, + int size); + #endif /* __LOCAL_NET_IPV4_H */ Added: kos/kernel/net/net_ipv4_frag.c =================================================================== --- kos/kernel/net/net_ipv4_frag.c (rev 0) +++ kos/kernel/net/net_ipv4_frag.c 2009-06-06 22:05:36 UTC (rev 643) @@ -0,0 +1,61 @@ +/* KallistiOS ##version## + + kernel/net/net_ipv4_frag.c + Copyright (C) 2009 Lawrence Sebald + +*/ + +#include <string.h> +#include <errno.h> +#include <arpa/inet.h> + +#include <kos/net.h> + +#include "net_ipv4.h" + +int net_ipv4_frag_send(netif_t *net, ip_hdr_t *hdr, const uint8 *data, + int size) { + int ihl = (hdr->version_ihl & 0x0f) << 2; + int total = size + ihl; + uint16 flags = ntohs(hdr->flags_frag_offs); + ip_hdr_t newhdr; + int nfb, ds; + + if(net == NULL) + net = net_default_dev; + + /* If the packet doesn't need to be fragmented, send it away as is. */ + if(total < net->mtu) { + return net_ipv4_send_packet(net, hdr, data, size); + } + /* If it needs to be fragmented and the DF flag is set, return error. */ + else if(flags & 0x4000) { + errno = EMSGSIZE; + return -1; + } + + /* Copy over the old header, and set up things for fragment processing. */ + memcpy(&newhdr, hdr, ihl); + nfb = ((net->mtu - ihl) >> 3); + ds = nfb << 3; + newhdr.flags_frag_offs = htons(flags | 0x2000); + newhdr.length = htons(ihl + (nfb << 3)); + + /* Recompute the checksum. */ + newhdr.checksum = 0; + newhdr.checksum = net_ipv4_checksum((uint8 *)&newhdr, sizeof(ip_hdr_t)); + + if(net_ipv4_send_packet(net, &newhdr, data, ds)) { + return -1; + } + + /* We don't deal with options right now, so dealing with the rest of the + fragments is pretty easy. Fix the header, and recursively call this + function to finish things off. */ + hdr->length = htons(ihl + size); + hdr->flags_frag_offs = htons((flags & 0xE000) | ((flags & 0x1FFF) + nfb)); + hdr->checksum = 0; + hdr->checksum = net_ipv4_checksum((uint8 *)hdr, sizeof(ip_hdr_t)); + + return net_ipv4_frag_send(net, hdr, data + ds, size - ds); +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ljs...@us...> - 2009-06-07 23:08:22
|
Revision: 644 http://cadcdev.svn.sourceforge.net/cadcdev/?rev=644&view=rev Author: ljsebald Date: 2009-06-07 23:08:14 +0000 (Sun, 07 Jun 2009) Log Message: ----------- Adding in new network thread code. Various bits and pieces of the network stack are likely to need to use threads for some part of their operation now, so devote one thread to that purpose. Also, add the beginnings of IP reassembly (just reject fragments for now). Modified Paths: -------------- kos/doc/CHANGELOG kos/kernel/net/Makefile kos/kernel/net/net_core.c kos/kernel/net/net_dhcp.c kos/kernel/net/net_ipv4.c kos/kernel/net/net_ipv4.h kos/kernel/net/net_ipv4_frag.c Added Paths: ----------- kos/kernel/net/net_thd.c kos/kernel/net/net_thd.h Modified: kos/doc/CHANGELOG =================================================================== --- kos/doc/CHANGELOG 2009-06-06 22:05:36 UTC (rev 643) +++ kos/doc/CHANGELOG 2009-06-07 23:08:14 UTC (rev 644) @@ -186,12 +186,15 @@ - DC Added in some support functions for PVR modifier volumes (and an example program that uses them) [LS] - DC Added a modifier volume example using textures [LS] -- DC Added a simple statistics system to the IPv4 and UDP layers of the +- *** Added a simple statistics system to the IPv4 and UDP layers of the network stack [LS] -- DC Added a MTU value to the netif structure for maintaining the maximum +- *** Added a MTU value to the netif structure for maintaining the maximum transfer size of the adapter [LS] -- DC Added the ability to fragment IP packets, and made fragmenting respect +- *** Added the ability to fragment IP packets, and made fragmenting respect the MTU [LS] +- *** Added a primary network thread that can be used for timer-based, + repetitive network tasks (like DHCP renewals), and made the DHCP code + utilize it [LS] KallistiOS version 1.2.0 ----------------------------------------------- - DC Fix to use DCARM7_CFLAGS when compiling ARM driver [Christian Groessler == CG] Modified: kos/kernel/net/Makefile =================================================================== --- kos/kernel/net/Makefile 2009-06-06 22:05:36 UTC (rev 643) +++ kos/kernel/net/Makefile 2009-06-07 23:08:14 UTC (rev 644) @@ -5,7 +5,7 @@ # OBJS = net_core.o net_arp.o net_input.o net_icmp.o net_ipv4.o net_udp.o -OBJS += net_dhcp.o net_ipv4_frag.o +OBJS += net_dhcp.o net_ipv4_frag.o net_thd.o SUBDIRS = include $(KOS_BASE)/Makefile.prefab Modified: kos/kernel/net/net_core.c =================================================================== --- kos/kernel/net/net_core.c 2009-06-06 22:05:36 UTC (rev 643) +++ kos/kernel/net/net_core.c 2009-06-07 23:08:14 UTC (rev 644) @@ -13,6 +13,7 @@ #include <kos/fs_socket.h> #include "net_dhcp.h" +#include "net_thd.h" /* @@ -141,7 +142,10 @@ /* Detect and potentially initialize devices */ if (net_dev_init() < 0) return -1; - + + /* Initialize the network thread. */ + net_thd_init(); + /* Initialize the ARP cache */ net_arp_init(); @@ -177,6 +181,9 @@ /* Shut down the ARP cache */ net_arp_shutdown(); + /* Shut down the network thread */ + net_thd_shutdown(); + /* Shut down all activated network devices */ LIST_FOREACH(cur, &net_if_list, if_list) { if (cur->flags & NETIF_RUNNING && cur->if_stop) Modified: kos/kernel/net/net_dhcp.c =================================================================== --- kos/kernel/net/net_dhcp.c 2009-06-06 22:05:36 UTC (rev 643) +++ kos/kernel/net/net_dhcp.c 2009-06-07 23:08:14 UTC (rev 644) @@ -17,7 +17,6 @@ #include <time.h> #include <kos/net.h> -#include <kos/thread.h> #include <kos/genwait.h> #include <kos/recursive_lock.h> #include <kos/fs_socket.h> @@ -25,6 +24,7 @@ #include <arch/timer.h> #include "net_dhcp.h" +#include "net_thd.h" #define DHCP_SERVER_PORT 67 #define DHCP_CLIENT_PORT 68 @@ -45,7 +45,7 @@ static struct dhcp_pkt_queue dhcp_pkts = STAILQ_HEAD_INITIALIZER(dhcp_pkts); static recursive_lock_t *dhcp_lock = NULL; -static kthread_t *dhcp_thd = NULL; +static int dhcp_cbid = -1; static uint64 renew_time = 0xFFFFFFFFFFFFFFFFULL; static uint64 rebind_time = 0xFFFFFFFFFFFFFFFFULL; static uint64 lease_expires = 0xFFFFFFFFFFFFFFFFULL; @@ -265,7 +265,7 @@ /* We need to wait til we're either bound to an IP address, or until we give up all hope of doing so (give us 60 seconds). */ - if(thd_current != dhcp_thd) { + if(!net_thd_is_current()) { rv = genwait_wait(&dhcp_sock, "net_dhcp_request", 60 * 1000, NULL); } @@ -481,137 +481,132 @@ dhcp_pkt_t *pkt = (dhcp_pkt_t *)buf, *pkt2; int found; - for(;;) { - now = timer_ms_gettime64(); - len = 0; + now = timer_ms_gettime64(); + len = 0; - rlock_lock(dhcp_lock); + rlock_lock(dhcp_lock); - /* Make sure we don't need to renew our lease */ - if(lease_expires <= now && (state == DHCP_STATE_BOUND || - state == DHCP_STATE_RENEWING || state == DHCP_STATE_REBINDING)) { - STAILQ_FOREACH(qpkt, &dhcp_pkts, pkt_queue) { - STAILQ_REMOVE(&dhcp_pkts, qpkt, dhcp_pkt_out, pkt_queue); - free(qpkt->buf); - free(qpkt); - } + /* Make sure we don't need to renew our lease */ + if(lease_expires <= now && (state == DHCP_STATE_BOUND || + state == DHCP_STATE_RENEWING || state == DHCP_STATE_REBINDING)) { + STAILQ_FOREACH(qpkt, &dhcp_pkts, pkt_queue) { + STAILQ_REMOVE(&dhcp_pkts, qpkt, dhcp_pkt_out, pkt_queue); + free(qpkt->buf); + free(qpkt); + } - state = DHCP_STATE_INIT; - srv_addr.sin_addr.s_addr = INADDR_BROADCAST; - memset(net_default_dev->ip_addr, 0, 4); - net_dhcp_request(); + state = DHCP_STATE_INIT; + srv_addr.sin_addr.s_addr = INADDR_BROADCAST; + memset(net_default_dev->ip_addr, 0, 4); + net_dhcp_request(); + } + else if(rebind_time <= now && + (state == DHCP_STATE_BOUND || state == DHCP_STATE_RENEWING)) { + /* Clear out any existing packets. */ + STAILQ_FOREACH(qpkt, &dhcp_pkts, pkt_queue) { + STAILQ_REMOVE(&dhcp_pkts, qpkt, dhcp_pkt_out, pkt_queue); + free(qpkt->buf); + free(qpkt); } - else if(rebind_time <= now && - (state == DHCP_STATE_BOUND || state == DHCP_STATE_RENEWING)) { - /* Clear out any existing packets. */ - STAILQ_FOREACH(qpkt, &dhcp_pkts, pkt_queue) { - STAILQ_REMOVE(&dhcp_pkts, qpkt, dhcp_pkt_out, pkt_queue); - free(qpkt->buf); - free(qpkt); - } - state = DHCP_STATE_REBINDING; - srv_addr.sin_addr.s_addr = INADDR_BROADCAST; - net_dhcp_renew(); + state = DHCP_STATE_REBINDING; + srv_addr.sin_addr.s_addr = INADDR_BROADCAST; + net_dhcp_renew(); + } + else if(renew_time <= now && state == DHCP_STATE_BOUND) { + state = DHCP_STATE_RENEWING; + net_dhcp_renew(); + } + + /* Check if we have any packets waiting to come in. */ + while((len = recvfrom(dhcp_sock, buf, 1024, 0, + (struct sockaddr *)&addr, &addr_len)) != -1) { + /* Ignore any boot request packets -- they shouldn't be sent to + the port we're monitoring anyway. */ + if(pkt->op != DHCP_OP_BOOTREPLY) { + continue; } - else if(renew_time <= now && state == DHCP_STATE_BOUND) { - state = DHCP_STATE_RENEWING; - net_dhcp_renew(); + + /* Check the magic cookie to make sure we've actually got a DHCP + packet coming in. */ + if(pkt->options[0] != 0x63 || pkt->options[1] != 0x82 || + pkt->options[2] != 0x53 || pkt->options[3] != 0x63) { + continue; } - /* Check if we have any packets waiting to come in. */ - while((len = recvfrom(dhcp_sock, buf, 1024, 0, - (struct sockaddr *)&addr, &addr_len)) != -1) { - /* Ignore any boot request packets -- they shouldn't be sent to - the port we're monitoring anyway. */ - if(pkt->op != DHCP_OP_BOOTREPLY) { - continue; - } + found = 0; - /* Check the magic cookie to make sure we've actually got a DHCP - packet coming in. */ - if(pkt->options[0] != 0x63 || pkt->options[1] != 0x82 || - pkt->options[2] != 0x53 || pkt->options[3] != 0x63) { - continue; + /* Check the xid field of the new packet versus what we're still + waiting on responses for. */ + STAILQ_FOREACH(qpkt, &dhcp_pkts, pkt_queue) { + pkt2 = (dhcp_pkt_t *)qpkt->buf; + + if(pkt2->xid == pkt->xid) { + found = 1; + break; } + } - found = 0; + /* If we've found a pending request, act on the message received. */ + if(found) { + switch(net_dhcp_get_message_type(pkt2, qpkt->size)) { + case DHCP_MSG_DHCPDISCOVER: + if(net_dhcp_get_message_type(pkt, len) != + DHCP_MSG_DHCPOFFER) { + break; + } - /* Check the xid field of the new packet versus what we're still - waiting on responses for. */ - STAILQ_FOREACH(qpkt, &dhcp_pkts, pkt_queue) { - pkt2 = (dhcp_pkt_t *)qpkt->buf; + /* Send our DHCPREQUEST packet */ + net_dhcp_send_request(pkt, len, pkt2, qpkt->size); - if(pkt2->xid == pkt->xid) { - found = 1; + /* Remove the old packet from our queue */ + STAILQ_REMOVE(&dhcp_pkts, qpkt, dhcp_pkt_out, + pkt_queue); + free(qpkt->buf); + free(qpkt); break; - } - } - /* If we've found a pending request, act on the message received. */ - if(found) { - switch(net_dhcp_get_message_type(pkt2, qpkt->size)) { - case DHCP_MSG_DHCPDISCOVER: - if(net_dhcp_get_message_type(pkt, len) != - DHCP_MSG_DHCPOFFER) { - break; - } + case DHCP_MSG_DHCPREQUEST: + found = net_dhcp_get_message_type(pkt, len); - /* Send our DHCPREQUEST packet */ - net_dhcp_send_request(pkt, len, pkt2, qpkt->size); + if(found == DHCP_MSG_DHCPACK) { + srv_addr.sin_addr.s_addr = addr.sin_addr.s_addr; - /* Remove the old packet from our queue */ - STAILQ_REMOVE(&dhcp_pkts, qpkt, dhcp_pkt_out, - pkt_queue); - free(qpkt->buf); - free(qpkt); - break; + /* Bind to the specified IP address */ + net_dhcp_bind(pkt, len); + genwait_wake_all(&dhcp_sock); + } + else if(found == DHCP_MSG_DHCPNAK) { + /* We got a NAK, try to discover again. */ + state = DHCP_STATE_INIT; + net_dhcp_request(); + } - case DHCP_MSG_DHCPREQUEST: - found = net_dhcp_get_message_type(pkt, len); + /* Remove the old packet from our queue */ + STAILQ_REMOVE(&dhcp_pkts, qpkt, dhcp_pkt_out, + pkt_queue); + free(qpkt->buf); + free(qpkt); + break; - if(found == DHCP_MSG_DHCPACK) { - srv_addr.sin_addr.s_addr = addr.sin_addr.s_addr; - - /* Bind to the specified IP address */ - net_dhcp_bind(pkt, len); - genwait_wake_all(&dhcp_sock); - } - else if(found == DHCP_MSG_DHCPNAK) { - /* We got a NAK, try to discover again. */ - state = DHCP_STATE_INIT; - net_dhcp_request(); - } - - /* Remove the old packet from our queue */ - STAILQ_REMOVE(&dhcp_pkts, qpkt, dhcp_pkt_out, - pkt_queue); - free(qpkt->buf); - free(qpkt); - break; - - /* Currently, these are the only two DHCP packets the code - here sends out, so other packet types are omitted for - the time being. */ - } + /* Currently, these are the only two DHCP packets the code + here sends out, so other packet types are omitted for + the time being. */ } } - - /* Send any packets that need to be sent. */ - STAILQ_FOREACH(qpkt, &dhcp_pkts, pkt_queue) { - if(qpkt->next_send <= now) { - sendto(dhcp_sock, qpkt->buf, qpkt->size, 0, - (struct sockaddr *)&srv_addr, sizeof(srv_addr)); - qpkt->next_send = now + qpkt->next_delay; - qpkt->next_delay <<= 1; - } + } + + /* Send any packets that need to be sent. */ + STAILQ_FOREACH(qpkt, &dhcp_pkts, pkt_queue) { + if(qpkt->next_send <= now) { + sendto(dhcp_sock, qpkt->buf, qpkt->size, 0, + (struct sockaddr *)&srv_addr, sizeof(srv_addr)); + qpkt->next_send = now + qpkt->next_delay; + qpkt->next_delay <<= 1; } - - rlock_unlock(dhcp_lock); - - /* Sleep for a while. */ - thd_sleep(25); } + + rlock_unlock(dhcp_lock); } int net_dhcp_init() { @@ -650,8 +645,8 @@ /* Make the socket non-blocking */ fs_socket_setflags(dhcp_sock, O_NONBLOCK); - /* Create the thread for processing DHCP packets */ - dhcp_thd = thd_create(&net_dhcp_thd, NULL); + /* Create the callback for processing DHCP packets */ + dhcp_cbid = net_thd_add_callback(&net_dhcp_thd, NULL, 50); return 0; } @@ -669,4 +664,8 @@ if(dhcp_sock != -1) { close(dhcp_sock); } + + if(dhcp_cbid != -1) { + net_thd_del_callback(dhcp_cbid); + } } Modified: kos/kernel/net/net_ipv4.c =================================================================== --- kos/kernel/net/net_ipv4.c 2009-06-06 22:05:36 UTC (rev 643) +++ kos/kernel/net/net_ipv4.c 2009-06-07 23:08:14 UTC (rev 644) @@ -185,8 +185,8 @@ } int net_ipv4_input(netif_t *src, const uint8 *pkt, int pktsize) { - ip_hdr_t *ip; - int i; + ip_hdr_t *ip; + int i; uint8 *data; int hdrlen; @@ -205,8 +205,6 @@ return -1; } - data = (uint8 *) (pkt + hdrlen); - /* Check ip header checksum */ i = ip->checksum; ip->checksum = 0; @@ -218,6 +216,16 @@ return -1; } + data = (uint8 *)(pkt + hdrlen); + + /* Submit the packet for possible reassembly. */ + return net_ipv4_reassemble(src, ip, data, ntohs(ip->length) - hdrlen); +} + +int net_ipv4_input_proto(netif_t *src, ip_hdr_t *ip, const uint8 *data) { + int hdrlen = (ip->version_ihl & 0x0F) << 2; + + /* Send the packet along to the appropriate protocol. */ switch(ip->protocol) { case IPPROTO_ICMP: ++ipv4_stats.pkt_recv; Modified: kos/kernel/net/net_ipv4.h =================================================================== --- kos/kernel/net/net_ipv4.h 2009-06-06 22:05:36 UTC (rev 643) +++ kos/kernel/net/net_ipv4.h 2009-06-07 23:08:14 UTC (rev 644) @@ -49,9 +49,11 @@ int net_ipv4_send(netif_t *net, const uint8 *data, int size, int id, int ttl, int proto, uint32 src, uint32 dst); int net_ipv4_input(netif_t *src, const uint8 *pkt, int pktsize); +int net_ipv4_input_proto(netif_t *net, ip_hdr_t *ip, const uint8 *data); /* In net_ipv4_frag.c */ int net_ipv4_frag_send(netif_t *net, ip_hdr_t *hdr, const uint8 *data, int size); - +int net_ipv4_reassemble(netif_t *net, ip_hdr_t *hdr, const uint8 *data, + int size); #endif /* __LOCAL_NET_IPV4_H */ Modified: kos/kernel/net/net_ipv4_frag.c =================================================================== --- kos/kernel/net/net_ipv4_frag.c 2009-06-06 22:05:36 UTC (rev 643) +++ kos/kernel/net/net_ipv4_frag.c 2009-06-07 23:08:14 UTC (rev 644) @@ -59,3 +59,16 @@ return net_ipv4_frag_send(net, hdr, data + ds, size - ds); } + +int net_ipv4_reassemble(netif_t *src, ip_hdr_t *hdr, const uint8 *data, + int size) { + uint16 flags = ntohs(hdr->flags_frag_offs); + + /* If the fragment offset is zero and the MF flag is 0, this is the whole + packet. Treat it as such. */ + if(!(flags & 0x2000) && (flags & 0x1FFF) == 0) { + return net_ipv4_input_proto(src, hdr, data); + } + + return -1; +} Added: kos/kernel/net/net_thd.c =================================================================== --- kos/kernel/net/net_thd.c (rev 0) +++ kos/kernel/net/net_thd.c 2009-06-07 23:08:14 UTC (rev 644) @@ -0,0 +1,131 @@ +/* KallistiOS ##version## + + kernel/net/net_thd.c + Copyright (C) 2009 Lawrence Sebald + +*/ + +#include <sys/queue.h> +#include <errno.h> +#include <stdlib.h> + +#include <kos/thread.h> +#include <arch/timer.h> +#include "net_thd.h" + +struct thd_cb { + TAILQ_ENTRY(thd_cb) thds; + + int cbid; + void (*cb)(void *); + void *data; + uint64 timeout; + uint64 nextrun; +}; + +TAILQ_HEAD(thd_cb_queue, thd_cb); + +static struct thd_cb_queue cbs; +static kthread_t *thd; +static int done = 0; +static int cbid_top; + +static void net_thd_thd(void *data __attribute__((unused))) { + struct thd_cb *cb; + uint64 now; + + while(!done) { + now = timer_ms_gettime64(); + + /* Run any callbacks that need to be run now. */ + TAILQ_FOREACH(cb, &cbs, thds) { + if(now >= cb->nextrun) { + cb->cb(cb->data); + cb->nextrun = now + cb->timeout; + } + } + + /* Go to sleep til we need to be run again. */ + thd_sleep(50); + } +} + +int net_thd_add_callback(void (*cb)(void *), void *data, uint64 timeout) { + int old; + struct thd_cb *newcb; + + /* Allocate space for the new callback and set it up. */ + newcb = (struct thd_cb *)malloc(sizeof(struct thd_cb)); + if(!newcb) { + errno = ENOMEM; + return -1; + } + + newcb->cbid = cbid_top++; + newcb->cb = cb; + newcb->data = data; + newcb->timeout = timeout; + newcb->nextrun = timer_ms_gettime64() + timeout; + + /* Disable interrupts, insert, and reenable interrupts */ + old = irq_disable(); + TAILQ_INSERT_TAIL(&cbs, newcb, thds); + irq_restore(old); + + return newcb->cbid; +} + +int net_thd_del_callback(int cbid) { + int old; + struct thd_cb *cb; + + /* Disable interrupts so we can search without fear of anything changing + underneath us. */ + old = irq_disable(); + + /* See if we can find the callback requested. */ + TAILQ_FOREACH(cb, &cbs, thds) { + if(cb->cbid == cbid) { + TAILQ_REMOVE(&cbs, cb, thds); + free(cb); + irq_restore(old); + return 0; + } + } + + /* We didn't find it, punt. */ + irq_restore(old); + return -1; +} + +int net_thd_is_current() { + return thd_current == thd; +} + +int net_thd_init() { + TAILQ_INIT(&cbs); + done = 0; + cbid_top = 1; + + thd = thd_create(&net_thd_thd, NULL); + + return 0; +} + +void net_thd_shutdown() { + struct thd_cb *c, *n; + + /* Kill the thread. */ + done = 1; + thd_wait(thd); + + /* Free any handlers that we have laying around */ + c = TAILQ_FIRST(&cbs); + while(c) { + n = TAILQ_NEXT(c, thds); + free(c); + c = n; + } + + TAILQ_INIT(&cbs); +} Added: kos/kernel/net/net_thd.h =================================================================== --- kos/kernel/net/net_thd.h (rev 0) +++ kos/kernel/net/net_thd.h 2009-06-07 23:08:14 UTC (rev 644) @@ -0,0 +1,27 @@ +/* KallistiOS ##version## + + kernel/net/net_thd.h + Copyright (C) 2009 Lawrence Sebald + +*/ + +#ifndef __LOCAL_NET_THD_H +#define __LOCAL_NET_THD_H + +#include <sys/cdefs.h> + +__BEGIN_DECLS + +#include <arch/types.h> + +int net_thd_add_callback(void (*cb)(void *), void *data, uint64 timeout); +int net_thd_del_callback(int cbid); + +int net_thd_is_current(); + +int net_thd_init(); +void net_thd_shutdown(); + +__END_DECLS + +#endif /* !__LOCAL_NET_THD_H */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ljs...@us...> - 2009-06-11 19:51:01
|
Revision: 645 http://cadcdev.svn.sourceforge.net/cadcdev/?rev=645&view=rev Author: ljsebald Date: 2009-06-11 19:50:58 +0000 (Thu, 11 Jun 2009) Log Message: ----------- Adding in IP reassembly support and some fixes to ICMP. Modified Paths: -------------- kos/doc/CHANGELOG kos/include/kos/net.h kos/kernel/net/net_core.c kos/kernel/net/net_icmp.c kos/kernel/net/net_ipv4.h kos/kernel/net/net_ipv4_frag.c Modified: kos/doc/CHANGELOG =================================================================== --- kos/doc/CHANGELOG 2009-06-07 23:08:14 UTC (rev 644) +++ kos/doc/CHANGELOG 2009-06-11 19:50:58 UTC (rev 645) @@ -195,6 +195,7 @@ - *** Added a primary network thread that can be used for timer-based, repetitive network tasks (like DHCP renewals), and made the DHCP code utilize it [LS] +- *** Added rudimentary IP reassembly support [LS] KallistiOS version 1.2.0 ----------------------------------------------- - DC Fix to use DCARM7_CFLAGS when compiling ARM driver [Christian Groessler == CG] Modified: kos/include/kos/net.h =================================================================== --- kos/include/kos/net.h 2009-06-07 23:08:14 UTC (rev 644) +++ kos/include/kos/net.h 2009-06-11 19:50:58 UTC (rev 645) @@ -200,6 +200,10 @@ /* Where will we handle possibly notifying the user of ping replies? */ extern net_echo_cb net_icmp_echo_cb; +/* Send an ICMP Echo packet to the specified IP. */ +int net_icmp_send_echo(netif_t *net, const uint8 ipaddr[4], const uint8 *data, + int size); + /***** net_ipv4.c *********************************************************/ /* IPv4 statistics structure. This structure holds some basic statistics about Modified: kos/kernel/net/net_core.c =================================================================== --- kos/kernel/net/net_core.c 2009-06-07 23:08:14 UTC (rev 644) +++ kos/kernel/net/net_core.c 2009-06-11 19:50:58 UTC (rev 645) @@ -14,6 +14,7 @@ #include "net_dhcp.h" #include "net_thd.h" +#include "net_ipv4.h" /* @@ -149,6 +150,9 @@ /* Initialize the ARP cache */ net_arp_init(); + /* Initialize IP fragmentation support */ + net_ipv4_frag_init(); + /* Initialize the UDP system */ net_udp_init(); @@ -178,6 +182,9 @@ /* Shut down the UDP system */ net_udp_shutdown(); + /* Shut down IP fragmentation support */ + net_ipv4_frag_shutdown(); + /* Shut down the ARP cache */ net_arp_shutdown(); Modified: kos/kernel/net/net_icmp.c =================================================================== --- kos/kernel/net/net_icmp.c 2009-06-07 23:08:14 UTC (rev 644) +++ kos/kernel/net/net_icmp.c 2009-06-11 19:50:58 UTC (rev 645) @@ -3,7 +3,7 @@ kernel/net/net_icmp.c Copyright (C) 2002 Dan Potter - Copyright (C) 2005, 2006, 2007 Lawrence Sebald + Copyright (C) 2005, 2006, 2007, 2009 Lawrence Sebald */ @@ -37,25 +37,24 @@ */ struct __ping_pkt { - LIST_ENTRY(__ping_pkt) pkt_list; - uint8 ip[4]; - uint8 *data; - int data_sz; - uint16 icmp_seq; - uint64 usec; + LIST_ENTRY(__ping_pkt) pkt_list; + uint8 ip[4]; + uint8 *data; + int data_sz; + uint16 icmp_seq; + uint64 usec; }; LIST_HEAD(__ping_pkt_list, __ping_pkt); static struct __ping_pkt_list pings = LIST_HEAD_INITIALIZER(0); -static uint8 pktbuf[1514]; static uint16 icmp_echo_seq = 1; static void icmp_default_echo_cb(const uint8 *ip, uint16 seq, uint64 delta_us, uint8 ttl, const uint8* data, int data_sz) { - printf("%d bytes from %d.%d.%d.%d: icmp_seq=%d ttl=%d time=%.2f ms\n", - data_sz, ip[0], ip[1], ip[2], ip[3], seq, ttl, - delta_us / 1000.0f); + printf("%d bytes from %d.%d.%d.%d: icmp_seq=%d ttl=%d time=%.3f ms\n", + data_sz, ip[0], ip[1], ip[2], ip[3], seq, ttl, + delta_us / 1000.0f); } /* The default echo (ping) callback */ @@ -64,157 +63,126 @@ /* Handle Echo Reply (ICMP type 0) packets */ static void net_icmp_input_0(netif_t *src, ip_hdr_t *ip, icmp_hdr_t *icmp, const uint8 *d, int s) { - uint64 tmr; - struct __ping_pkt *ping; - uint16 seq; + uint64 tmr; + struct __ping_pkt *ping; + uint16 seq; - tmr = timer_us_gettime64(); + tmr = timer_us_gettime64(); + seq = (d[7] | (d[6] << 8)); - LIST_FOREACH(ping, &pings, pkt_list) { - seq = (d[7] | (d[6] << 8)); - if(ping->icmp_seq == seq) { - net_icmp_echo_cb((uint8 *)&ip->src, seq, - tmr - ping->usec, ip->ttl, d, s); + LIST_FOREACH(ping, &pings, pkt_list) { + if(ping->icmp_seq == seq) { + net_icmp_echo_cb((uint8 *)&ip->src, seq, + tmr - ping->usec, ip->ttl, d, s); - LIST_REMOVE(ping, pkt_list); - free(ping->data); - free(ping); + LIST_REMOVE(ping, pkt_list); + free(ping->data); + free(ping); - return; - } - } + return; + } + } } /* Handle Echo (ICMP type 8) packets */ static void net_icmp_input_8(netif_t *src, ip_hdr_t *ip, icmp_hdr_t *icmp, const uint8 *d, int s) { - /* Set type to echo reply */ - icmp->type = 0; + /* Set type to echo reply */ + icmp->type = 0; - /* Set the destination to the original source, and substitute in our IP - for the src (done this way so that pings that are broadcasted get an - appropriate reply). */ - ip->dest = ip->src; - ip->src = htonl(net_ipv4_address(src->ip_addr)); + /* Recompute the ICMP header checksum */ + icmp->checksum = 0; + icmp->checksum = net_ipv4_checksum((uint8 *)icmp, ntohs(ip->length) - + 4 * (ip->version_ihl & 0x0f)); - /* Recompute the IP header checksum */ - ip->checksum = 0; - ip->checksum = net_ipv4_checksum((uint8 *)ip, - 4 * (ip->version_ihl & 0x0f)); - - /* Recompute the ICMP header checksum */ - icmp->checksum = 0; - icmp->checksum = net_ipv4_checksum((uint8 *)icmp, ntohs(ip->length) - - 4 * (ip->version_ihl & 0x0f)); - - /* Send it */ - memcpy(pktbuf, ip, 20); - memcpy(pktbuf + 20, d, ntohs(ip->length) - 4 * (ip->version_ihl & 0x0F)); - net_ipv4_send_packet(src, ip, pktbuf + 20, ntohs(ip->length) - - 4 * (ip->version_ihl & 0x0F)); + /* Set the destination to the original source, and substitute in our IP + for the src (done this way so that pings that are broadcasted get an + appropriate reply), and send it away. */ + net_ipv4_send(src, d, s, ip->packet_id, ip->ttl, 1, ip->dest, ip->src); } int net_icmp_input(netif_t *src, ip_hdr_t *ip, const uint8 *d, int s) { - icmp_hdr_t *icmp; - int i; + icmp_hdr_t *icmp; + int i; - /* Find ICMP header */ - icmp = (icmp_hdr_t*) d; + /* Find ICMP header */ + icmp = (icmp_hdr_t*)d; - /* Check icmp checksum */ - memset(pktbuf, 0, 1514); - i = icmp->checksum; - icmp->checksum = 0; - memcpy(pktbuf, icmp, ntohs(ip->length) - 4 * (ip->version_ihl & 0x0f)); - icmp->checksum = net_ipv4_checksum(pktbuf, (ntohs(ip->length) + 1) - - 4 * (ip->version_ihl & 0x0f)); + /* Check the ICMP checksum */ + i = net_ipv4_checksum(d, s); - if (i != icmp->checksum) { - dbglog(DBG_KDEBUG, "net_icmp: icmp with invalid checksum\n"); - return -1; - } + if (i) { + dbglog(DBG_KDEBUG, "net_icmp: icmp with invalid checksum\n"); + return -1; + } - switch(icmp->type) { - case 0: /* Echo reply */ - net_icmp_input_0(src, ip, icmp, d, s); - break; - case 3: /* Destination unreachable */ - dbglog(DBG_KDEBUG, "net_icmp: Destination unreachable," - " code %d\n", icmp->code); - break; + switch(icmp->type) { + case 0: /* Echo reply */ + net_icmp_input_0(src, ip, icmp, d, s); + break; - case 8: /* Echo */ - net_icmp_input_8(src, ip, icmp, d, s); - break; + case 3: /* Destination unreachable */ + dbglog(DBG_KDEBUG, "net_icmp: Destination unreachable," + " code %d\n", icmp->code); + break; - default: - dbglog(DBG_KDEBUG, "net_icmp: unknown icmp type: %d\n", - icmp->type); - } + case 8: /* Echo */ + net_icmp_input_8(src, ip, icmp, d, s); + break; - return 0; + default: + dbglog(DBG_KDEBUG, "net_icmp: unknown icmp type: %d\n", + icmp->type); + } + + return 0; } /* Send an ICMP Echo (PING) packet to the specified device */ int net_icmp_send_echo(netif_t *net, const uint8 ipaddr[4], const uint8 *data, int size) { - icmp_hdr_t *icmp; - ip_hdr_t ip; - struct __ping_pkt *newping; - int r = -1; - uint8 databuf[sizeof(icmp_hdr_t) + size]; + icmp_hdr_t *icmp; + struct __ping_pkt *newping; + int r = -1; + uint8 databuf[sizeof(icmp_hdr_t) + size]; + uint16 seq = icmp_echo_seq++; + uint32 src; - icmp = (icmp_hdr_t *)databuf; + icmp = (icmp_hdr_t *)databuf; - /* Fill in the ICMP Header */ - icmp->type = 8; /* Echo */ - icmp->code = 0; - icmp->checksum = 0; - icmp->misc[0] = (uint8) 'D'; - icmp->misc[1] = (uint8) 'C'; - icmp->misc[2] = (uint8) (icmp_echo_seq >> 8); - icmp->misc[3] = (uint8) (icmp_echo_seq & 0xFF); - memcpy(databuf + sizeof(icmp_hdr_t), data, size); + /* Fill in the ICMP Header */ + icmp->type = 8; /* Echo */ + icmp->code = 0; + icmp->checksum = 0; + icmp->misc[0] = (uint8) 'D'; + icmp->misc[1] = (uint8) 'C'; + icmp->misc[2] = (uint8) (seq >> 8); + icmp->misc[3] = (uint8) (seq & 0xFF); + memcpy(databuf + sizeof(icmp_hdr_t), data, size); - /* Fill in the IP Header */ - ip.version_ihl = 0x45; /* 20 byte header, ipv4 */ - ip.tos = 0; - ip.length = htons(sizeof(icmp_hdr_t) + size + 20); - ip.packet_id = 0; - ip.flags_frag_offs = 0x0040; - ip.ttl = 64; - ip.protocol = 1; /* ICMP */ - ip.checksum = 0; + /* Compute the ICMP Checksum */ + icmp->checksum = net_ipv4_checksum(databuf, sizeof(icmp_hdr_t) + size); - if(net_ipv4_address(ipaddr) == 0x7F000001) - ip.src = htonl(net_ipv4_address(ipaddr)); - else - ip.src = htonl(net_ipv4_address(net->ip_addr)); + /* If we're sending to the loopback, set that as our source too. */ + if(ipaddr[0] == 127) { + src = net_ipv4_address(ipaddr); + } + else { + src = net_ipv4_address(net->ip_addr); + } - ip.dest = htonl(net_ipv4_address(ipaddr)); + newping = (struct __ping_pkt*) malloc(sizeof(struct __ping_pkt)); + newping->data = (uint8 *)malloc(size); + newping->data_sz = size; + newping->icmp_seq = seq; + memcpy(newping->data, data, size); + memcpy(newping->ip, ipaddr, 4); + LIST_INSERT_HEAD(&pings, newping, pkt_list); - /* Compute the ICMP Checksum */ - icmp->checksum = net_ipv4_checksum(databuf, sizeof(icmp_hdr_t) + size); + newping->usec = timer_us_gettime64(); + r = net_ipv4_send(net, databuf, sizeof(icmp_hdr_t) + size, seq, 64, 1, + htonl(src), + htonl(net_ipv4_address(ipaddr))); - /* Compute the IP Checksum */ - ip.checksum = net_ipv4_checksum((uint8 *)&ip, sizeof(ip_hdr_t)); - - newping = (struct __ping_pkt*) malloc(sizeof(struct __ping_pkt)); - newping->data = (uint8 *)malloc(size); - newping->data_sz = size; - newping->icmp_seq = icmp_echo_seq; - memcpy(newping->data, data, size); - memcpy(newping->ip, ipaddr, 4); - LIST_INSERT_HEAD(&pings, newping, pkt_list); - - ++icmp_echo_seq; - - while(r == -1) { - newping->usec = timer_us_gettime64(); - r = net_ipv4_send_packet(net, &ip, databuf, - sizeof(icmp_hdr_t) + size); - thd_sleep(10); - } - - return 0; + return r; } Modified: kos/kernel/net/net_ipv4.h =================================================================== --- kos/kernel/net/net_ipv4.h 2009-06-07 23:08:14 UTC (rev 644) +++ kos/kernel/net/net_ipv4.h 2009-06-11 19:50:58 UTC (rev 645) @@ -56,4 +56,7 @@ int size); int net_ipv4_reassemble(netif_t *net, ip_hdr_t *hdr, const uint8 *data, int size); +int net_ipv4_frag_init(); +void net_ipv4_frag_shutdown(); + #endif /* __LOCAL_NET_IPV4_H */ Modified: kos/kernel/net/net_ipv4_frag.c =================================================================== --- kos/kernel/net/net_ipv4_frag.c 2009-06-07 23:08:14 UTC (rev 644) +++ kos/kernel/net/net_ipv4_frag.c 2009-06-11 19:50:58 UTC (rev 645) @@ -6,13 +6,138 @@ */ #include <string.h> +#include <stdlib.h> #include <errno.h> #include <arpa/inet.h> #include <kos/net.h> +#include <kos/mutex.h> +#include <arch/timer.h> #include "net_ipv4.h" +#include "net_thd.h" +#define MAX(a, b) a > b ? a : b; + +struct ip_frag { + TAILQ_ENTRY(ip_frag) listhnd; + + uint32 src; + uint32 dst; + uint16 ident; + uint8 proto; + + ip_hdr_t hdr; + uint8 *data; + uint8 bitfield[8192]; + int cur_length; + int total_length; + uint64 death_time; +}; + +TAILQ_HEAD(ip_frag_list, ip_frag); + +static struct ip_frag_list frags; +static mutex_t *frag_mutex = NULL; +static int cbid = -1; + +/* Set the bits in the bitfield for the given set of fragment blocks. + XXXX: This is horribly inefficient. */ +static inline void set_bits(uint8 *bitfield, int start, int end) { + --end; + while(end >= start) { + bitfield[end >> 3] |= (1 << (end & 0x07)); + --end; + } +} + +/* Check if all bits in the bitfield that should be set are set. */ +static inline int all_bits_set(const uint8 *bitfield, int end) { + int i; + + /* Make sure each of the beginning bytes are fully set. */ + for(i = 0; i < (end >> 3); ++i) { + if(bitfield[i] != 0xFF) { + return 0; + } + } + + /* Check the last byte to make sure it has the right number of bits set. */ + if(bitfield[(end >> 3)] != ((1 << (end & 0x07)) - 1)) { + return 0; + } + + return 1; +} + +/* Import the data for a fragment, potentially passing it onward in processing, + if the whole datagram has arrived. */ +static int frag_import(netif_t *src, ip_hdr_t *hdr, const uint8 *data, + int size, uint16 flags, struct ip_frag *frag) { + void *tmp; + int fo = flags & 0x1FFF; + int tl = ntohs(hdr->length); + int start = (fo << 3); + int ihl = (hdr->version_ihl & 0x0F) << 2; + int end = start + tl - ihl; + int rv = 0; + uint64 now = timer_ms_gettime64(); + + /* Reallocate space for the data buffer, if needed. */ + if(end > frag->cur_length) { + tmp = realloc(frag->data, end); + + if(!tmp) { + errno = ENOMEM; + rv = -1; + goto out; + } + + frag->data = tmp; + } + + memcpy(frag->data + start, data, end - start); + set_bits(frag->bitfield, fo, fo + (((tl - ihl) + 7) >> 3)); + + /* If the MF flag is not set, set the data length. */ + if(!(flags & 0x2000)) { + frag->total_length = end; + } + + /* If the fragment offset is zero, store the header. */ + if(!fo) { + frag->hdr = *hdr; + } + + /* If the total length is not zero, and all the bits in the bitfield are + set, we continue on. */ + if(frag->total_length && + all_bits_set(frag->bitfield, frag->total_length >> 3)) { + /* Set the right length. Don't worry about updating the checksum, since + net_ipv4_input_proto doesn't check it anyway. */ + frag->hdr.length = htons(frag->total_length + + ((frag->hdr.version_ihl & 0x0F) << 2)); + + rv = net_ipv4_input_proto(src, &frag->hdr, frag->data); + + /* Remove the fragment from our buffer. */ + TAILQ_REMOVE(&frags, frag, listhnd); + free(frag->data); + free(frag); + + goto out; + } + + /* Update the timer. */ + frag->death_time = MAX(frag->death_time, (now + hdr->ttl * 1000)); + +out: + mutex_unlock(frag_mutex); + return rv; +} + +/* IPv4 fragmentation procedure. This is basically a direct implementation of + the example IP fragmentation procedure on pages 26-27 of RFC 791. */ int net_ipv4_frag_send(netif_t *net, ip_hdr_t *hdr, const uint8 *data, int size) { int ihl = (hdr->version_ihl & 0x0f) << 2; @@ -39,7 +164,7 @@ nfb = ((net->mtu - ihl) >> 3); ds = nfb << 3; newhdr.flags_frag_offs = htons(flags | 0x2000); - newhdr.length = htons(ihl + (nfb << 3)); + newhdr.length = htons(ihl + ds); /* Recompute the checksum. */ newhdr.checksum = 0; @@ -52,7 +177,7 @@ /* We don't deal with options right now, so dealing with the rest of the fragments is pretty easy. Fix the header, and recursively call this function to finish things off. */ - hdr->length = htons(ihl + size); + hdr->length = htons(ihl + size - ds); hdr->flags_frag_offs = htons((flags & 0xE000) | ((flags & 0x1FFF) + nfb)); hdr->checksum = 0; hdr->checksum = net_ipv4_checksum((uint8 *)hdr, sizeof(ip_hdr_t)); @@ -60,9 +185,13 @@ return net_ipv4_frag_send(net, hdr, data + ds, size - ds); } +/* IPv4 fragment reassembly procedure. This (along with the frag_import function + above are basically a direct implementation of the example IP reassembly + routine on pages 27-29 of RFC 791. */ int net_ipv4_reassemble(netif_t *src, ip_hdr_t *hdr, const uint8 *data, int size) { uint16 flags = ntohs(hdr->flags_frag_offs); + struct ip_frag *f; /* If the fragment offset is zero and the MF flag is 0, this is the whole packet. Treat it as such. */ @@ -70,5 +199,72 @@ return net_ipv4_input_proto(src, hdr, data); } - return -1; + /* Find the packet if we already have this one in our data buffer. */ + mutex_lock(frag_mutex); + + TAILQ_FOREACH(f, &frags, listhnd) { + if(f->src == hdr->src && f->dst == hdr->dest && + f->ident == hdr->packet_id && f->proto == hdr->protocol) { + /* We've got it, import the data (this function handles unlocking + the mutex when its done). */ + return frag_import(src, hdr, data, size, flags, f); + } + } + + /* We don't have a fragment with that identifier, so make one. */ + f = (struct ip_frag *)malloc(sizeof(struct ip_frag)); + + if(!f) { + errno = ENOMEM; + return -1; + } + + f->src = hdr->src; + f->dst = hdr->dest; + f->ident = hdr->packet_id; + f->proto = hdr->protocol; + f->data = NULL; + f->cur_length = 0; + f->total_length = 0; + memset(f->bitfield, 0, sizeof(f->bitfield)); + + TAILQ_INSERT_TAIL(&frags, f, listhnd); + + return frag_import(src, hdr, data, size, flags, f); } + +int net_ipv4_frag_init() { + if(!frag_mutex) { + frag_mutex = mutex_create(); + TAILQ_INIT(&frags); + } + + return frag_mutex != NULL; +} + +void net_ipv4_frag_shutdown() { + struct ip_frag *c, *n; + + if(frag_mutex) { + mutex_lock(frag_mutex); + + c = TAILQ_FIRST(&frags); + while(c) { + n = TAILQ_NEXT(c, listhnd); + free(c->data); + free(c->bitfield); + c = n; + } + + if(cbid != -1) { + net_thd_del_callback(cbid); + } + + mutex_unlock(frag_mutex); + mutex_destroy(frag_mutex); + } + + cbid = -1; + frag_mutex = NULL; + TAILQ_INIT(&frags); +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ljs...@us...> - 2010-04-14 21:43:02
|
Revision: 657 http://cadcdev.svn.sourceforge.net/cadcdev/?rev=657&view=rev Author: ljsebald Date: 2010-04-14 21:42:55 +0000 (Wed, 14 Apr 2010) Log Message: ----------- Ok... I didn't really mean for this commit to be so large, but apparently I haven't committed anything in a long while... - Fix the Doxyfile a bit more. - Add Doxygen comments to a bunch of headers (stuff I've added over time). - Modularize the socket protocol handlers a bit (to make adding new protocols much easier later). - Fix the prototypes of the htonl/htons/ntohl/ntohs functions to align with IEEE 1003.1-2008. - Fix some of the network related stuff for alignment with IEEE 1003.1-2008. Modified Paths: -------------- kos/doc/Doxyfile kos/include/arpa/inet.h kos/include/kos/fs_socket.h kos/include/kos/once.h kos/include/kos/recursive_lock.h kos/include/kos/rwsem.h kos/include/kos/tls.h kos/include/netinet/in.h kos/include/sys/socket.h kos/kernel/fs/fs_socket.c kos/kernel/libc/koslib/byteorder.c kos/kernel/net/net_udp.c kos/kernel/net/net_udp.h kos/kernel/thread/once.c Modified: kos/doc/Doxyfile =================================================================== --- kos/doc/Doxyfile 2010-02-20 04:34:13 UTC (rev 656) +++ kos/doc/Doxyfile 2010-04-14 21:42:55 UTC (rev 657) @@ -1,4 +1,4 @@ -# Doxyfile 1.5.6 +# Doxyfile 1.6.2 # This file describes the settings to be used by the documentation system # doxygen (www.doxygen.org) for a project @@ -14,211 +14,215 @@ # Project related configuration options #--------------------------------------------------------------------------- -# This tag specifies the encoding used for all characters in the config file -# that follow. The default is UTF-8 which is also the encoding used for all -# text before the first occurrence of this tag. Doxygen uses libiconv (or the -# iconv built into libc) for the transcoding. See +# This tag specifies the encoding used for all characters in the config file +# that follow. The default is UTF-8 which is also the encoding used for all +# text before the first occurrence of this tag. Doxygen uses libiconv (or the +# iconv built into libc) for the transcoding. See # http://www.gnu.org/software/libiconv for the list of possible encodings. DOXYFILE_ENCODING = UTF-8 -# The PROJECT_NAME tag is a single word (or a sequence of words surrounded +# The PROJECT_NAME tag is a single word (or a sequence of words surrounded # by quotes) that should identify the project. PROJECT_NAME = "KallistiOS" -# The PROJECT_NUMBER tag can be used to enter a project or revision number. -# This could be handy for archiving the generated documentation or +# The PROJECT_NUMBER tag can be used to enter a project or revision number. +# This could be handy for archiving the generated documentation or # if some version control system is used. PROJECT_NUMBER = "##version##" -# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) -# base path where the generated documentation will be put. -# If a relative path is entered, it will be relative to the location +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) +# base path where the generated documentation will be put. +# If a relative path is entered, it will be relative to the location # where doxygen was started. If left blank the current directory will be used. OUTPUT_DIRECTORY = $(KOS_BASE)/doc/reference -# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create -# 4096 sub-directories (in 2 levels) under the output directory of each output -# format and will distribute the generated files over these directories. -# Enabling this option can be useful when feeding doxygen a huge amount of -# source files, where putting all generated files in the same directory would +# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create +# 4096 sub-directories (in 2 levels) under the output directory of each output +# format and will distribute the generated files over these directories. +# Enabling this option can be useful when feeding doxygen a huge amount of +# source files, where putting all generated files in the same directory would # otherwise cause performance problems for the file system. CREATE_SUBDIRS = NO -# The OUTPUT_LANGUAGE tag is used to specify the language in which all -# documentation generated by doxygen is written. Doxygen will use this -# information to generate all constant output in the proper language. -# The default language is English, other supported languages are: -# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, -# Croatian, Czech, Danish, Dutch, Farsi, Finnish, French, German, Greek, -# Hungarian, Italian, Japanese, Japanese-en (Japanese with English messages), -# Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, Polish, -# Portuguese, Romanian, Russian, Serbian, Slovak, Slovene, Spanish, Swedish, -# and Ukrainian. +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# The default language is English, other supported languages are: +# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, +# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German, +# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English +# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, +# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak, +# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese. OUTPUT_LANGUAGE = English -# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will -# include brief member descriptions after the members that are listed in -# the file and class documentation (similar to JavaDoc). +# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will +# include brief member descriptions after the members that are listed in +# the file and class documentation (similar to JavaDoc). # Set to NO to disable this. BRIEF_MEMBER_DESC = YES -# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend -# the brief description of a member or function before the detailed description. -# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend +# the brief description of a member or function before the detailed description. +# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the # brief descriptions will be completely suppressed. REPEAT_BRIEF = YES -# This tag implements a quasi-intelligent brief description abbreviator -# that is used to form the text in various listings. Each string -# in this list, if found as the leading text of the brief description, will be -# stripped from the text and the result after processing the whole list, is -# used as the annotated text. Otherwise, the brief description is used as-is. -# If left blank, the following values are used ("$name" is automatically -# replaced with the name of the entity): "The $name class" "The $name widget" -# "The $name file" "is" "provides" "specifies" "contains" +# This tag implements a quasi-intelligent brief description abbreviator +# that is used to form the text in various listings. Each string +# in this list, if found as the leading text of the brief description, will be +# stripped from the text and the result after processing the whole list, is +# used as the annotated text. Otherwise, the brief description is used as-is. +# If left blank, the following values are used ("$name" is automatically +# replaced with the name of the entity): "The $name class" "The $name widget" +# "The $name file" "is" "provides" "specifies" "contains" # "represents" "a" "an" "the" -ABBREVIATE_BRIEF = +ABBREVIATE_BRIEF = -# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then -# Doxygen will generate a detailed section even if there is only a brief +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# Doxygen will generate a detailed section even if there is only a brief # description. ALWAYS_DETAILED_SEC = NO -# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all -# inherited members of a class in the documentation of that class as if those -# members were ordinary class members. Constructors, destructors and assignment +# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all +# inherited members of a class in the documentation of that class as if those +# members were ordinary class members. Constructors, destructors and assignment # operators of the base classes will not be shown. INLINE_INHERITED_MEMB = NO -# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full -# path before files name in the file list and in the header files. If set +# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full +# path before files name in the file list and in the header files. If set # to NO the shortest path that makes the file name unique will be used. FULL_PATH_NAMES = YES -# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag -# can be used to strip a user-defined part of the path. Stripping is -# only done if one of the specified strings matches the left-hand part of -# the path. The tag can be used to show relative paths in the file list. -# If left blank the directory from which doxygen is run is used as the +# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag +# can be used to strip a user-defined part of the path. Stripping is +# only done if one of the specified strings matches the left-hand part of +# the path. The tag can be used to show relative paths in the file list. +# If left blank the directory from which doxygen is run is used as the # path to strip. STRIP_FROM_PATH = $(KOS_BASE)/ -# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of -# the path mentioned in the documentation of a class, which tells -# the reader which header file to include in order to use a class. -# If left blank only the name of the header file containing the class -# definition is used. Otherwise one should specify the include paths that +# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of +# the path mentioned in the documentation of a class, which tells +# the reader which header file to include in order to use a class. +# If left blank only the name of the header file containing the class +# definition is used. Otherwise one should specify the include paths that # are normally passed to the compiler using the -I flag. -STRIP_FROM_INC_PATH = +STRIP_FROM_INC_PATH = -# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter -# (but less readable) file names. This can be useful is your file systems +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter +# (but less readable) file names. This can be useful is your file systems # doesn't support long names like on DOS, Mac, or CD-ROM. SHORT_NAMES = NO -# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen -# will interpret the first line (until the first dot) of a JavaDoc-style -# comment as the brief description. If set to NO, the JavaDoc -# comments will behave just like regular Qt-style comments +# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen +# will interpret the first line (until the first dot) of a JavaDoc-style +# comment as the brief description. If set to NO, the JavaDoc +# comments will behave just like regular Qt-style comments # (thus requiring an explicit @brief command for a brief description.) JAVADOC_AUTOBRIEF = NO -# If the QT_AUTOBRIEF tag is set to YES then Doxygen will -# interpret the first line (until the first dot) of a Qt-style -# comment as the brief description. If set to NO, the comments -# will behave just like regular Qt-style comments (thus requiring +# If the QT_AUTOBRIEF tag is set to YES then Doxygen will +# interpret the first line (until the first dot) of a Qt-style +# comment as the brief description. If set to NO, the comments +# will behave just like regular Qt-style comments (thus requiring # an explicit \brief command for a brief description.) QT_AUTOBRIEF = NO -# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen -# treat a multi-line C++ special comment block (i.e. a block of //! or /// -# comments) as a brief description. This used to be the default behaviour. -# The new default is to treat a multi-line C++ comment block as a detailed +# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen +# treat a multi-line C++ special comment block (i.e. a block of //! or /// +# comments) as a brief description. This used to be the default behaviour. +# The new default is to treat a multi-line C++ comment block as a detailed # description. Set this tag to YES if you prefer the old behaviour instead. MULTILINE_CPP_IS_BRIEF = NO -# If the DETAILS_AT_TOP tag is set to YES then Doxygen -# will output the detailed description near the top, like JavaDoc. -# If set to NO, the detailed description appears after the member -# documentation. - -DETAILS_AT_TOP = YES - -# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented -# member inherits the documentation from any documented member that it +# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented +# member inherits the documentation from any documented member that it # re-implements. INHERIT_DOCS = YES -# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce -# a new page for each member. If set to NO, the documentation of a member will +# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce +# a new page for each member. If set to NO, the documentation of a member will # be part of the file/class/namespace that contains it. SEPARATE_MEMBER_PAGES = NO -# The TAB_SIZE tag can be used to set the number of spaces in a tab. +# The TAB_SIZE tag can be used to set the number of spaces in a tab. # Doxygen uses this value to replace tabs by spaces in code fragments. TAB_SIZE = 8 -# This tag can be used to specify a number of aliases that acts -# as commands in the documentation. An alias has the form "name=value". -# For example adding "sideeffect=\par Side Effects:\n" will allow you to -# put the command \sideeffect (or @sideeffect) in the documentation, which -# will result in a user-defined paragraph with heading "Side Effects:". +# This tag can be used to specify a number of aliases that acts +# as commands in the documentation. An alias has the form "name=value". +# For example adding "sideeffect=\par Side Effects:\n" will allow you to +# put the command \sideeffect (or @sideeffect) in the documentation, which +# will result in a user-defined paragraph with heading "Side Effects:". # You can put \n's in the value part of an alias to insert newlines. -ALIASES = +ALIASES = -# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C -# sources only. Doxygen will then generate output that is more tailored for C. -# For instance, some of the names that are used will be different. The list +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C +# sources only. Doxygen will then generate output that is more tailored for C. +# For instance, some of the names that are used will be different. The list # of all members will be omitted, etc. OPTIMIZE_OUTPUT_FOR_C = YES -# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java -# sources only. Doxygen will then generate output that is more tailored for -# Java. For instance, namespaces will be presented as packages, qualified +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java +# sources only. Doxygen will then generate output that is more tailored for +# Java. For instance, namespaces will be presented as packages, qualified # scopes will look different, etc. OPTIMIZE_OUTPUT_JAVA = NO -# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran -# sources only. Doxygen will then generate output that is more tailored for +# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran +# sources only. Doxygen will then generate output that is more tailored for # Fortran. OPTIMIZE_FOR_FORTRAN = NO -# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL -# sources. Doxygen will then generate output that is tailored for +# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL +# sources. Doxygen will then generate output that is tailored for # VHDL. OPTIMIZE_OUTPUT_VHDL = NO -# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want -# to include (a tag file for) the STL sources as input, then you should -# set this tag to YES in order to let doxygen match functions declarations and -# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. -# func(std::string) {}). This also make the inheritance and collaboration +# Doxygen selects the parser to use depending on the extension of the files it parses. +# With this tag you can assign which parser to use for a given extension. +# Doxygen has a built-in mapping, but you can override or extend it using this tag. +# The format is ext=language, where ext is a file extension, and language is one of +# the parsers supported by doxygen: IDL, Java, Javascript, C#, C, C++, D, PHP, +# Objective-C, Python, Fortran, VHDL, C, C++. For instance to make doxygen treat +# .inc files as Fortran files (default is PHP), and .f files as C (default is Fortran), +# use: inc=Fortran f=C. Note that for custom extensions you also need to set FILE_PATTERNS otherwise the files are not read by doxygen. + +EXTENSION_MAPPING = + +# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want +# to include (a tag file for) the STL sources as input, then you should +# set this tag to YES in order to let doxygen match functions declarations and +# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. +# func(std::string) {}). This also make the inheritance and collaboration # diagrams that involve STL classes more complete and accurate. BUILTIN_STL_SUPPORT = NO @@ -228,413 +232,452 @@ CPP_CLI_SUPPORT = NO -# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. -# Doxygen will parse them like normal C++ but will assume all classes use public +# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. +# Doxygen will parse them like normal C++ but will assume all classes use public # instead of private inheritance when no explicit protection keyword is present. SIP_SUPPORT = NO -# For Microsoft's IDL there are propget and propput attributes to indicate getter -# and setter methods for a property. Setting this option to YES (the default) -# will make doxygen to replace the get and set methods by a property in the -# documentation. This will only work if the methods are indeed getting or -# setting a simple type. If this is not the case, or you want to show the +# For Microsoft's IDL there are propget and propput attributes to indicate getter +# and setter methods for a property. Setting this option to YES (the default) +# will make doxygen to replace the get and set methods by a property in the +# documentation. This will only work if the methods are indeed getting or +# setting a simple type. If this is not the case, or you want to show the # methods anyway, you should set this option to NO. IDL_PROPERTY_SUPPORT = YES -# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC -# tag is set to YES, then doxygen will reuse the documentation of the first -# member in the group (if any) for the other members of the group. By default +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES, then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default # all members of a group must be documented explicitly. DISTRIBUTE_GROUP_DOC = NO -# Set the SUBGROUPING tag to YES (the default) to allow class member groups of -# the same type (for instance a group of public functions) to be put as a -# subgroup of that type (e.g. under the Public Functions section). Set it to -# NO to prevent subgrouping. Alternatively, this can be done per class using +# Set the SUBGROUPING tag to YES (the default) to allow class member groups of +# the same type (for instance a group of public functions) to be put as a +# subgroup of that type (e.g. under the Public Functions section). Set it to +# NO to prevent subgrouping. Alternatively, this can be done per class using # the \nosubgrouping command. SUBGROUPING = YES -# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum -# is documented as struct, union, or enum with the name of the typedef. So -# typedef struct TypeS {} TypeT, will appear in the documentation as a struct -# with name TypeT. When disabled the typedef will appear as a member of a file, -# namespace, or class. And the struct will be named TypeS. This can typically -# be useful for C code in case the coding convention dictates that all compound +# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum +# is documented as struct, union, or enum with the name of the typedef. So +# typedef struct TypeS {} TypeT, will appear in the documentation as a struct +# with name TypeT. When disabled the typedef will appear as a member of a file, +# namespace, or class. And the struct will be named TypeS. This can typically +# be useful for C code in case the coding convention dictates that all compound # types are typedef'ed and only the typedef is referenced, never the tag name. TYPEDEF_HIDES_STRUCT = NO +# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to +# determine which symbols to keep in memory and which to flush to disk. +# When the cache is full, less often used symbols will be written to disk. +# For small to medium size projects (<1000 input files) the default value is +# probably good enough. For larger projects a too small cache size can cause +# doxygen to be busy swapping symbols to and from disk most of the time +# causing a significant performance penality. +# If the system has enough physical memory increasing the cache will improve the +# performance by keeping more symbols in memory. Note that the value works on +# a logarithmic scale so increasing the size by one will rougly double the +# memory usage. The cache size is given by this formula: +# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, +# corresponding to a cache size of 2^16 = 65536 symbols + +SYMBOL_CACHE_SIZE = 0 + #--------------------------------------------------------------------------- # Build related configuration options #--------------------------------------------------------------------------- -# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in -# documentation are documented, even if no documentation was available. -# Private class members and static file members will be hidden unless +# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in +# documentation are documented, even if no documentation was available. +# Private class members and static file members will be hidden unless # the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES EXTRACT_ALL = YES -# If the EXTRACT_PRIVATE tag is set to YES all private members of a class +# If the EXTRACT_PRIVATE tag is set to YES all private members of a class # will be included in the documentation. EXTRACT_PRIVATE = NO -# If the EXTRACT_STATIC tag is set to YES all static members of a file +# If the EXTRACT_STATIC tag is set to YES all static members of a file # will be included in the documentation. EXTRACT_STATIC = NO -# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) -# defined locally in source files will be included in the documentation. +# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) +# defined locally in source files will be included in the documentation. # If set to NO only classes defined in header files are included. EXTRACT_LOCAL_CLASSES = NO -# This flag is only useful for Objective-C code. When set to YES local -# methods, which are defined in the implementation section but not in -# the interface are included in the documentation. +# This flag is only useful for Objective-C code. When set to YES local +# methods, which are defined in the implementation section but not in +# the interface are included in the documentation. # If set to NO (the default) only methods in the interface are included. EXTRACT_LOCAL_METHODS = NO -# If this flag is set to YES, the members of anonymous namespaces will be -# extracted and appear in the documentation as a namespace called -# 'anonymous_namespace{file}', where file will be replaced with the base -# name of the file that contains the anonymous namespace. By default +# If this flag is set to YES, the members of anonymous namespaces will be +# extracted and appear in the documentation as a namespace called +# 'anonymous_namespace{file}', where file will be replaced with the base +# name of the file that contains the anonymous namespace. By default # anonymous namespace are hidden. EXTRACT_ANON_NSPACES = NO -# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all -# undocumented members of documented classes, files or namespaces. -# If set to NO (the default) these members will be included in the -# various overviews, but no documentation section is generated. +# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all +# undocumented members of documented classes, files or namespaces. +# If set to NO (the default) these members will be included in the +# various overviews, but no documentation section is generated. # This option has no effect if EXTRACT_ALL is enabled. HIDE_UNDOC_MEMBERS = NO -# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all -# undocumented classes that are normally visible in the class hierarchy. -# If set to NO (the default) these classes will be included in the various +# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. +# If set to NO (the default) these classes will be included in the various # overviews. This option has no effect if EXTRACT_ALL is enabled. HIDE_UNDOC_CLASSES = NO -# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all -# friend (class|struct|union) declarations. -# If set to NO (the default) these declarations will be included in the +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all +# friend (class|struct|union) declarations. +# If set to NO (the default) these declarations will be included in the # documentation. HIDE_FRIEND_COMPOUNDS = NO -# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any -# documentation blocks found inside the body of a function. -# If set to NO (the default) these blocks will be appended to the +# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any +# documentation blocks found inside the body of a function. +# If set to NO (the default) these blocks will be appended to the # function's detailed documentation block. HIDE_IN_BODY_DOCS = NO -# The INTERNAL_DOCS tag determines if documentation -# that is typed after a \internal command is included. If the tag is set -# to NO (the default) then the documentation will be excluded. +# The INTERNAL_DOCS tag determines if documentation +# that is typed after a \internal command is included. If the tag is set +# to NO (the default) then the documentation will be excluded. # Set it to YES to include the internal documentation. INTERNAL_DOCS = YES -# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate -# file names in lower-case letters. If set to YES upper-case letters are also -# allowed. This is useful if you have classes or files whose names only differ -# in case and if your file system supports case sensitive file names. Windows +# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate +# file names in lower-case letters. If set to YES upper-case letters are also +# allowed. This is useful if you have classes or files whose names only differ +# in case and if your file system supports case sensitive file names. Windows # and Mac users are advised to set this option to NO. CASE_SENSE_NAMES = YES -# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen -# will show members with their full class and namespace scopes in the +# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen +# will show members with their full class and namespace scopes in the # documentation. If set to YES the scope will be hidden. HIDE_SCOPE_NAMES = NO -# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen -# will put a list of the files that are included by a file in the documentation +# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen +# will put a list of the files that are included by a file in the documentation # of that file. SHOW_INCLUDE_FILES = YES -# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] +# If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen +# will list include files with double quotes in the documentation +# rather than with sharp brackets. + +FORCE_LOCAL_INCLUDES = NO + +# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] # is inserted in the documentation for inline members. INLINE_INFO = YES -# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen -# will sort the (detailed) documentation of file and class members -# alphabetically by member name. If set to NO the members will appear in +# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen +# will sort the (detailed) documentation of file and class members +# alphabetically by member name. If set to NO the members will appear in # declaration order. SORT_MEMBER_DOCS = YES -# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the -# brief documentation of file, namespace and class members alphabetically -# by member name. If set to NO (the default) the members will appear in +# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the +# brief documentation of file, namespace and class members alphabetically +# by member name. If set to NO (the default) the members will appear in # declaration order. SORT_BRIEF_DOCS = NO -# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the -# hierarchy of group names into alphabetical order. If set to NO (the default) +# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the (brief and detailed) documentation of class members so that constructors and destructors are listed first. If set to NO (the default) the constructors will appear in the respective orders defined by SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO. + +SORT_MEMBERS_CTORS_1ST = NO + +# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the +# hierarchy of group names into alphabetical order. If set to NO (the default) # the group names will appear in their defined order. SORT_GROUP_NAMES = NO -# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be -# sorted by fully-qualified names, including namespaces. If set to -# NO (the default), the class list will be sorted only by class name, -# not including the namespace part. +# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be +# sorted by fully-qualified names, including namespaces. If set to +# NO (the default), the class list will be sorted only by class name, +# not including the namespace part. # Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. -# Note: This option applies only to the class list, not to the +# Note: This option applies only to the class list, not to the # alphabetical list. SORT_BY_SCOPE_NAME = NO -# The GENERATE_TODOLIST tag can be used to enable (YES) or -# disable (NO) the todo list. This list is created by putting \todo +# The GENERATE_TODOLIST tag can be used to enable (YES) or +# disable (NO) the todo list. This list is created by putting \todo # commands in the documentation. GENERATE_TODOLIST = YES -# The GENERATE_TESTLIST tag can be used to enable (YES) or -# disable (NO) the test list. This list is created by putting \test +# The GENERATE_TESTLIST tag can be used to enable (YES) or +# disable (NO) the test list. This list is created by putting \test # commands in the documentation. GENERATE_TESTLIST = YES -# The GENERATE_BUGLIST tag can be used to enable (YES) or -# disable (NO) the bug list. This list is created by putting \bug +# The GENERATE_BUGLIST tag can be used to enable (YES) or +# disable (NO) the bug list. This list is created by putting \bug # commands in the documentation. GENERATE_BUGLIST = YES -# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or -# disable (NO) the deprecated list. This list is created by putting +# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or +# disable (NO) the deprecated list. This list is created by putting # \deprecated commands in the documentation. GENERATE_DEPRECATEDLIST= YES -# The ENABLED_SECTIONS tag can be used to enable conditional +# The ENABLED_SECTIONS tag can be used to enable conditional # documentation sections, marked by \if sectionname ... \endif. -ENABLED_SECTIONS = +ENABLED_SECTIONS = -# The MAX_INITIALIZER_LINES tag determines the maximum number of lines -# the initial value of a variable or define consists of for it to appear in -# the documentation. If the initializer consists of more lines than specified -# here it will be hidden. Use a value of 0 to hide initializers completely. -# The appearance of the initializer of individual variables and defines in the -# documentation can be controlled using \showinitializer or \hideinitializer +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines +# the initial value of a variable or define consists of for it to appear in +# the documentation. If the initializer consists of more lines than specified +# here it will be hidden. Use a value of 0 to hide initializers completely. +# The appearance of the initializer of individual variables and defines in the +# documentation can be controlled using \showinitializer or \hideinitializer # command in the documentation regardless of this setting. MAX_INITIALIZER_LINES = 30 -# Set the SHOW_USED_FILES tag to NO to disable the list of files generated -# at the bottom of the documentation of classes and structs. If set to YES the +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated +# at the bottom of the documentation of classes and structs. If set to YES the # list will mention the files that were used to generate the documentation. SHOW_USED_FILES = YES -# If the sources in your project are distributed over multiple directories -# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy +# If the sources in your project are distributed over multiple directories +# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy # in the documentation. The default is NO. SHOW_DIRECTORIES = NO # Set the SHOW_FILES tag to NO to disable the generation of the Files page. -# This will remove the Files entry from the Quick Index and from the +# This will remove the Files entry from the Quick Index and from the # Folder Tree View (if specified). The default is YES. SHOW_FILES = YES -# Set the SHOW_NAMESPACES tag to NO to disable the generation of the -# Namespaces page. This will remove the Namespaces entry from the Quick Index +# Set the SHOW_NAMESPACES tag to NO to disable the generation of the +# Namespaces page. +# This will remove the Namespaces entry from the Quick Index # and from the Folder Tree View (if specified). The default is YES. SHOW_NAMESPACES = YES -# The FILE_VERSION_FILTER tag can be used to specify a program or script that -# doxygen should invoke to get the current version for each file (typically from -# the version control system). Doxygen will invoke the program by executing (via -# popen()) the command <command> <input-file>, where <command> is the value of -# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file -# provided by doxygen. Whatever the program writes to standard output +# The FILE_VERSION_FILTER tag can be used to specify a program or script that +# doxygen should invoke to get the current version for each file (typically from +# the version control system). Doxygen will invoke the program by executing (via +# popen()) the command <command> <input-file>, where <command> is the value of +# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file +# provided by doxygen. Whatever the program writes to standard output # is used as the file version. See the manual for examples. -FILE_VERSION_FILTER = +FILE_VERSION_FILTER = +# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed by +# doxygen. The layout file controls the global structure of the generated output files +# in an output format independent way. The create the layout file that represents +# doxygen's defaults, run doxygen with the -l option. You can optionally specify a +# file name after the option, if omitted DoxygenLayout.xml will be used as the name +# of the layout file. + +LAYOUT_FILE = + #--------------------------------------------------------------------------- # configuration options related to warning and progress messages #--------------------------------------------------------------------------- -# The QUIET tag can be used to turn on/off the messages that are generated +# The QUIET tag can be used to turn on/off the messages that are generated # by doxygen. Possible values are YES and NO. If left blank NO is used. QUIET = NO -# The WARNINGS tag can be used to turn on/off the warning messages that are -# generated by doxygen. Possible values are YES and NO. If left blank +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated by doxygen. Possible values are YES and NO. If left blank # NO is used. WARNINGS = YES -# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings -# for undocumented members. If EXTRACT_ALL is set to YES then this flag will +# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings +# for undocumented members. If EXTRACT_ALL is set to YES then this flag will # automatically be disabled. WARN_IF_UNDOCUMENTED = YES -# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for -# potential errors in the documentation, such as not documenting some -# parameters in a documented function, or documenting parameters that +# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for +# potential errors in the documentation, such as not documenting some +# parameters in a documented function, or documenting parameters that # don't exist or using markup commands wrongly. WARN_IF_DOC_ERROR = YES -# This WARN_NO_PARAMDOC option can be abled to get warnings for -# functions that are documented, but have no documentation for their parameters -# or return value. If set to NO (the default) doxygen will only warn about -# wrong or incomplete parameter documentation, but not about the absence of +# This WARN_NO_PARAMDOC option can be abled to get warnings for +# functions that are documented, but have no documentation for their parameters +# or return value. If set to NO (the default) doxygen will only warn about +# wrong or incomplete parameter documentation, but not about the absence of # documentation. WARN_NO_PARAMDOC = NO -# The WARN_FORMAT tag determines the format of the warning messages that -# doxygen can produce. The string should contain the $file, $line, and $text -# tags, which will be replaced by the file and line number from which the -# warning originated and the warning text. Optionally the format may contain -# $version, which will be replaced by the version of the file (if it could +# The WARN_FORMAT tag determines the format of the warning messages that +# doxygen can produce. The string should contain the $file, $line, and $text +# tags, which will be replaced by the file and line number from which the +# warning originated and the warning text. Optionally the format may contain +# $version, which will be replaced by the version of the file (if it could # be obtained via FILE_VERSION_FILTER) WARN_FORMAT = "$file:$line: $text" -# The WARN_LOGFILE tag can be used to specify a file to which warning -# and error messages should be written. If left blank the output is written +# The WARN_LOGFILE tag can be used to specify a file to which warning +# and error messages should be written. If left blank the output is written # to stderr. -WARN_LOGFILE = +WARN_LOGFILE = #--------------------------------------------------------------------------- # configuration options related to the input files #--------------------------------------------------------------------------- -# The INPUT tag can be used to specify the files and/or directories that contain -# documented source files. You may enter file names like "myfile.cpp" or -# directories like "/usr/src/myproject". Separate the files or directories +# The INPUT tag can be used to specify the files and/or directories that contain +# documented source files. You may enter file names like "myfile.cpp" or +# directories like "/usr/src/myproject". Separate the files or directories # with spaces. INPUT = $(KOS_BASE)/include \ $(KOS_BASE)/kernel/arch/$(KOS_ARCH)/include -# This tag can be used to specify the character encoding of the source files -# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is -# also the default input encoding. Doxygen uses libiconv (or the iconv built -# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for +# This tag can be used to specify the character encoding of the source files +# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is +# also the default input encoding. Doxygen uses libiconv (or the iconv built +# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for # the list of possible encodings. INPUT_ENCODING = UTF-8 -# If the value of the INPUT tag contains directories, you can use the -# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp -# and *.h) to filter out the source-files in the directories. If left -# blank the following patterns are tested: -# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank the following patterns are tested: +# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx # *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90 -FILE_PATTERNS = +FILE_PATTERNS = -# The RECURSIVE tag can be used to turn specify whether or not subdirectories -# should be searched for input files as well. Possible values are YES and NO. +# The RECURSIVE tag can be used to turn specify whether or not subdirectories +# should be searched for input files as well. Possible values are YES and NO. # If left blank NO is used. RECURSIVE = YES -# The EXCLUDE tag can be used to specify files and/or directories that should -# excluded from the INPUT source files. This way you can easily exclude a +# The EXCLUDE tag can be used to specify files and/or directories that should +# excluded from the INPUT source files. This way you can easily exclude a # subdirectory from a directory tree whose root is specified with the INPUT tag. -EXCLUDE = +EXCLUDE = -# The EXCLUDE_SYMLINKS tag can be used select whether or not files or -# directories that are symbolic links (a Unix filesystem feature) are excluded +# The EXCLUDE_SYMLINKS tag can be used select whether or not files or +# directories that are symbolic links (a Unix filesystem feature) are excluded # from the input. EXCLUDE_SYMLINKS = YES -# If the value of the INPUT tag contains directories, you can use the -# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude -# certain files from those directories. Note that the wildcards are matched -# against the file with absolute path, so to exclude all test directories +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. Note that the wildcards are matched +# against the file with absolute path, so to exclude all test directories # for example use the pattern */test/* -EXCLUDE_PATTERNS = +EXCLUDE_PATTERNS = -# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names -# (namespaces, classes, functions, etc.) that should be excluded from the -# output. The symbol name can be a fully qualified name, a word, or if the -# wildcard * is used, a substring. Examples: ANamespace, AClass, +# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names +# (namespaces, classes, functions, etc.) that should be excluded from the +# output. The symbol name can be a fully qualified name, a word, or if the +# wildcard * is used, a substring. Examples: ANamespace, AClass, # AClass::ANamespace, ANamespace::*Test -EXCLUDE_SYMBOLS = +EXCLUDE_SYMBOLS = -# The EXAMPLE_PATH tag can be used to specify one or more files or -# directories that contain example code fragments that are included (see +# The EXAMPLE_PATH tag can be used to specify one or more files or +# directories that contain example code fragments that are included (see # the \include command). -EXAMPLE_PATH = +EXAMPLE_PATH = -# If the value of the EXAMPLE_PATH tag contains directories, you can use the -# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp -# and *.h) to filter out the source-files in the directories. If left +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left # blank all files are included. -EXAMPLE_PATTERNS = +EXAMPLE_PATTERNS = -# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be -# searched for input files to be used with the \include or \dontinclude -# commands irrespective of the value of the RECURSIVE tag. +# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be +# searched for input files to be used with the \include or \dontinclude +# commands irrespective of the value of the RECURSIVE tag. # Possible values are YES and NO. If left blank NO is used. EXAMPLE_RECURSIVE = NO -# The IMAGE_PATH tag can be used to specify one or more files or -# directories that contain image that are included in the documentation (see +# The IMAGE_PATH tag can be used to specify one or more files or +# directories that contain image that are included in the documentation (see # the \image command). -IMAGE_PATH = +IMAGE_PATH = -# The INPUT_FILTER tag can be used to specify a program that doxygen should -# invoke to filter for each input file. Doxygen will invoke the filter program -# by executing (via popen()) the command <filter> <input-file>, where <filter> -# is the value of the INPUT_FILTER tag, and <input-file> is the name of an -# input file. Doxygen will then use the output that the filter program writes -# to standard output. If FILTER_PATTERNS is specified, this tag will be +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command <filter> <input-file>, where <filter> +# is the value of the INPUT_FILTER tag, and <input-file> is the name of an +# input file. Doxygen will then use the output that the filter program writes +# to standard output. +# If FILTER_PATTERNS is specified, this tag will be # ignored. -INPUT_FILTER = +INPUT_FILTER = -# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern -# basis. Doxygen will compare the file name with each pattern and apply the -# filter if there is a match. The filters are a list of the form: -# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further -# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER +# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern +# basis. +# Doxygen will compare the file name with each pattern and apply the +# filter if there is a match. +# The filters are a list of the form: +# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further +# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER # is applied to all files. -FILTER_PATTERNS = +FILTER_PATTERNS = -# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using -# INPUT_FILTER) will be used to filter the input files when producing source +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER) will be used to filter the input files when producing source # files to browse (i.e. when SOURCE_BROWSER is set to YES). FILTER_SOURCE_FILES = NO @@ -643,32 +686,32 @@ # configuration options related to source browsing #--------------------------------------------------------------------------- -# If the SOURCE_BROWSER tag is set to YES then a list of source files will -# be generated. Documented entities will be cross-referenced with these sources. -# Note: To get rid of all source code in the generated output, make sure also +# If the SOURCE_BROWSER tag is set to YES then a list of source files will +# be generated. Documented entities will be cross-referenced with these sources. +# Note: To get rid of all source code in the generated output, make sure also # VERBATIM_HEADERS is set to NO. SOURCE_BROWSER = NO -# Setting the INLINE_SOURCES tag to YES will include the body +# Setting the INLINE_SOURCES tag to YES will include the body # of functions and classes directly in the documentation. INLINE_SOURCES = NO -# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct -# doxygen to hide any special comment blocks from generated source code +# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct +# doxygen to hide any special comment blocks from generated source code # fragments. Normal C and C++ comments will always remain visible. STRIP_CODE_COMMENTS = NO -# If the REFERENCED_BY_RELATION tag is set to YES -# then for each documented function all documented +# If the REFERENCED_BY_RELATION tag is set to YES +# then for each documented function all documented # functions referencing it will be listed. REFERENCED_BY_RELATION = YES -# If the REFERENCES_RELATION tag is set to YES -# then for each documented function all documented entities +# If the REFERENCES_RELATION tag is set to YES +# then for each documented function all documented entities # called/used by that function will be listed. REFERENCES_RELATION = YES @@ -676,20 +719,21 @@ # If the REFERENCES_LINK_SOURCE tag is set to YES (the default) # and SOURCE_BROWSER tag is set to YES, then the hyperlinks from # functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will -# link to the source code. Otherwise they will link to the documentstion. +# link to the source code. +# Otherwise they will link to the documentation. REFERENCES_LINK_SOURCE = YES -# If the USE_HTAGS tag is set to YES then the references to source code -# will point to the HTML generated by the htags(1) tool instead of doxygen -# built-in source browser. The htags tool is part of GNU's global source -# tagging system (see http://www.gnu.org/software/global/global.html). You +# If the USE_HTAGS tag is set to YES then the references to source code +# will point to the HTML generated by the htags(1) tool instead of doxygen +# built-in source browser. The htags tool is part of GNU's global source +# tagging system (see http://www.gnu.org/software/global/global.html). You # will need version 4.8.6 or higher. USE_HTAGS = NO -# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen -# will generate a verbatim copy of the header file for each class for +# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen +# will generate a verbatim copy of the header file for each class for # which an include is specified. Set to NO to disable this. VERBATIM_HEADERS = YES @@ -698,129 +742,136 @@ # configuration options related to the alphabetical class index #--------------------------------------------------------------------------- -# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index -# of all compounds will be generated. Enable this if the project +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index +# of all compounds will be generated. Enable this if the project # contains a lot of classes, structs, unions or interfaces. ALPHABETICAL_INDEX = YES -# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then -# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns +# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then +# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns # in which this list will be split (can be a number in the range [1..20]) COLS_IN_ALPHA_INDEX = 5 -# In case all classes in a project start with a common prefix, all -# classes will be put under the same header in the alphabetical index. -# The IGNORE_PREFIX tag can be used to specify one or more prefixes that +# In case all classes in a project start with a common prefix, all +# classes will be put under the same header in the alphabetical index. +# The IGNORE_PREFIX tag can be used to specify one or more prefixes that # should be ignored while generating the index headers. -IGNORE_PREFIX = +IGNORE_PREFIX = #--------------------------------------------------------------------------- # configuration options related to the HTML output #--------------------------------------------------------------------------- -# If the GENERATE_HTML tag is set to YES (the default) Doxygen will +# If the GENERATE_HTML tag is set to YES (the default) Doxygen will # generate HTML output. GENERATE_HTML = YES -# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `html' will be used as the default path. HTML_OUTPUT = html -# The HTML_FILE_EXTENSION tag can be used to specify the file extension for -# each generated HTML page (for example: .htm,.php,.asp). If it is left blank +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for +# each generated HTML page (for example: .htm,.php,.asp). If it is left blank # doxygen will generate files with .html extension. HTML_FILE_EXTENSION = .html -# The HTML_HEADER tag can be used to specify a personal HTML header for -# each generated HTML page. If it is left blank doxygen will generate a +# The HTML_HEADER tag can be used to specify a personal HTML header for +# each generated HTML page. If it is left blank doxygen will generate a # standard header. -HTML_HEADER = +HTML_HEADER = -# The HTML_FOOTER tag can be used to specify a personal HTML footer for -# each generated HTML page. If it is left blank doxygen will generate a +# The HTML_FOOTER tag can be used to specify a personal HTML footer for +# each generated HTML page. If it is left blank doxygen will generate a # standard footer. -HTML_FOOTER = +HTML_FOOTER = -# The HTML_STYLESHEET tag can be used to specify a user-defined cascading -# style sheet that is used by each HTML page. It can be used to -# fine-tune the look of the HTML output. If the tag is left blank doxygen -# will generate a default style sheet. Note that doxygen will try to copy -# the style sheet file to the HTML output directory, so don't put your own +# The HTML_STYLESHEET tag can be used to specify a user-defined cascading +# style sheet that is used by each HTML page. It can be used to +# fine-tune the look of the HTML output. If the tag is left blank doxygen +# will generate a default style sheet. Note that doxygen will try to copy +# the style sheet file to the HTML output directory, so don't put your own # stylesheet in the HTML output directory as well, or it will be erased! -HTML_STYLESHEET = +HTML_STYLESHEET = -# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, -# files or namespaces will be aligned in HTML using tables. If set to +# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML +# page will contain the date and time when the page was generated. Setting +# this to NO can help when comparing the output of multiple runs. + +HTML_TIMESTAMP = NO + +# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, +# files or namespaces will be aligned in HTML using tables. If set to # NO a bullet list will be used. HTML_ALIGN_MEMBERS = YES -# If the GENERATE_HTMLHELP tag is set to YES, additional index files -# will be generated that can be used as input for tools like the -# Microsoft HTML help workshop to generate a compiled HTML help file (.chm) -# of the generated HTML documentation. +# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML +# documentation will contain sections that can be hidden and shown after the +# page has loaded. For this to work a browser that supports +# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox +# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari). -GENERATE_HTMLHELP = NO +HTML_DYNAMIC_SECTIONS = NO -# If the GENERATE_DOCSET tag is set to YES, additional index files -# will be generated that can be used as input for Apple's Xcode 3 -# integrated development environment, introduced with OSX... [truncated message content] |