From a3d3d9aeda34fd9c4535b6d59cf90f42528d273a Mon Sep 17 00:00:00 2001 From: Ralf Corsepius Date: Tue, 20 Apr 2004 10:43:39 +0000 Subject: Remove stray white spaces. --- c/src/libchip/ide/ata.c | 614 ++++++++++++++++++------------------ c/src/libchip/ide/ata.h | 14 +- c/src/libchip/ide/ata_internal.h | 26 +- c/src/libchip/ide/ide_controller.c | 28 +- c/src/libchip/ide/ide_ctrl.h | 4 +- c/src/libchip/ide/ide_ctrl_cfg.h | 32 +- c/src/libchip/ide/ide_ctrl_io.h | 12 +- c/src/libchip/network/cs8900.c | 2 +- c/src/libchip/network/cs8900.h | 48 +-- c/src/libchip/network/dec21140.c | 106 +++---- c/src/libchip/network/elnk.c | 196 ++++++------ c/src/libchip/network/i82586.c | 106 +++---- c/src/libchip/network/i82586reg.h | 2 +- c/src/libchip/network/i82586var.h | 8 +- c/src/libchip/network/if_fxp.c | 38 +-- c/src/libchip/network/if_fxpreg.h | 6 +- c/src/libchip/network/if_fxpvar.h | 12 +- c/src/libchip/network/mii.h | 2 +- c/src/libchip/network/open_eth.c | 4 +- c/src/libchip/network/open_eth.h | 26 +- c/src/libchip/network/sonic.c | 50 +-- c/src/libchip/network/sonic.h | 6 +- c/src/libchip/rtc/icm7170.c | 8 +- c/src/libchip/rtc/icm7170_reg.c | 4 +- c/src/libchip/rtc/icm7170_reg2.c | 2 +- c/src/libchip/rtc/icm7170_reg4.c | 2 +- c/src/libchip/rtc/icm7170_reg8.c | 2 +- c/src/libchip/rtc/m48t08.c | 10 +- c/src/libchip/rtc/m48t08.h | 4 +- c/src/libchip/rtc/m48t08_reg.c | 4 +- c/src/libchip/rtc/m48t08_reg2.c | 2 +- c/src/libchip/rtc/m48t08_reg4.c | 2 +- c/src/libchip/rtc/m48t08_reg8.c | 2 +- c/src/libchip/rtc/rtc.h | 4 +- c/src/libchip/serial/mc68681.c | 64 ++-- c/src/libchip/serial/mc68681.h | 2 +- c/src/libchip/serial/mc68681_p.h | 4 +- c/src/libchip/serial/mc68681_reg.c | 4 +- c/src/libchip/serial/mc68681_reg2.c | 2 +- c/src/libchip/serial/mc68681_reg4.c | 2 +- c/src/libchip/serial/mc68681_reg8.c | 2 +- c/src/libchip/serial/ns16550.c | 40 +-- c/src/libchip/serial/ns16550_p.h | 2 +- c/src/libchip/serial/serial.h | 8 +- c/src/libchip/serial/z85c30.c | 38 +-- c/src/libchip/serial/z85c30.h | 2 +- c/src/libchip/serial/z85c30_p.h | 2 +- c/src/libchip/serial/z85c30_reg.c | 2 +- c/src/libchip/shmdr/init.c | 8 +- c/src/libchip/shmdr/poll.c | 2 +- c/src/libchip/shmdr/shm_driver.h | 4 +- 51 files changed, 788 insertions(+), 788 deletions(-) (limited to 'c/src/libchip') diff --git a/c/src/libchip/ide/ata.c b/c/src/libchip/ide/ata.c index 7f88809a3c..d0161f4cb2 100644 --- a/c/src/libchip/ide/ata.c +++ b/c/src/libchip/ide/ata.c @@ -1,8 +1,8 @@ /* * ata.c * - * ATA RTEMS driver. ATA driver is hardware independant implementation of - * ATA-2 standart, working draft X3T10/0948D, revision 4c. ATA driver bases + * ATA RTEMS driver. ATA driver is hardware independant implementation of + * ATA-2 standart, working draft X3T10/0948D, revision 4c. ATA driver bases * on RTEMS IDE controller driver. * * Copyright (C) 2001 OKTET Ltd., St.-Petersburg, Russia @@ -11,9 +11,9 @@ * The license and distribution terms for this file may be * found in the file LICENSE in this distribution or at * http://www.rtems.com/license/LICENSE. - * + * * $Id$ - * + * */ #include #include @@ -49,7 +49,7 @@ typedef rtems_mode preemption_key; } while (0) #else - + typedef boolean preemption_key; #define DISABLE_PREEMPTION(key) \ @@ -57,7 +57,7 @@ typedef boolean preemption_key; (key) = _Thread_Executing->is_preemptible; \ _Thread_Executing->is_preemptible = 0; \ } while (0) - + #define ENABLE_PREEMPTION(key) \ do { \ _Thread_Executing->is_preemptible = (key); \ @@ -81,7 +81,7 @@ typedef struct blkdev_request1 { static ata_ide_ctrl_t ata_ide_ctrls[IDE_CTRL_MAX_MINOR_NUMBER]; /* - * Mapping from ATA-minor numbers to + * Mapping from ATA-minor numbers to * controller-minor and device on this controller. */ static ata_ide_dev_t ata_devs[2 * IDE_CTRL_MAX_MINOR_NUMBER]; @@ -96,7 +96,7 @@ static rtems_id ata_task_id; static rtems_id ata_queue_id; /* Mapping of interrupt vectors to devices */ -static Chain_Control ata_int_vec[ATA_MAX_RTEMS_INT_VEC_NUMBER + 1]; +static Chain_Control ata_int_vec[ATA_MAX_RTEMS_INT_VEC_NUMBER + 1]; static void ata_process_request(rtems_device_minor_number ctrl_minor); @@ -105,40 +105,40 @@ static void ata_process_request_on_init_phase(rtems_device_minor_number ctrl_minor, ata_req_t *areq); -static void -ata_add_to_controller_queue(rtems_device_minor_number ctrl_minor, +static void +ata_add_to_controller_queue(rtems_device_minor_number ctrl_minor, ata_req_t *areq); /* - * read/write, open/close and ioctl are provided by general block device + * read/write, open/close and ioctl are provided by general block device * driver. Only initialization and ata-specific ioctl are here. */ -/* ata_io_data_request -- - * Form read/write request for an ATA device and enqueue it to - * IDE controller. - * +/* ata_io_data_request -- + * Form read/write request for an ATA device and enqueue it to + * IDE controller. + * * PARAMETERS: * device - device identifier * req - read/write request from block device driver * * RETURNS: * RTEMS_SUCCESSFUL on success, or error code if - * error occured + * error occured */ static rtems_status_code ata_io_data_request(dev_t device, blkdev_request *req) { ata_req_t *areq; /* ATA request */ - rtems_device_minor_number rel_minor; /* relative minor which indexes + rtems_device_minor_number rel_minor; /* relative minor which indexes * ata_devs array */ rtems_device_minor_number ctrl_minor; uint8_t dev; - - rel_minor = (rtems_filesystem_dev_minor_t(device)) / + + rel_minor = (rtems_filesystem_dev_minor_t(device)) / ATA_MINOR_NUM_RESERVED_PER_ATA_DEVICE; - + /* get controller which serves the ATA device */ ctrl_minor = ata_devs[rel_minor].ctrl_minor; @@ -150,18 +150,18 @@ ata_io_data_request(dev_t device, blkdev_request *req) { return RTEMS_NO_MEMORY; } - + areq->breq = req; areq->cnt = req->count; areq->cbuf = 0; areq->pos = 0; - - /* set up registers masks */ + + /* set up registers masks */ areq->regs.to_write = ATA_REGISTERS_POSITION; areq->regs.to_read = ATA_REGISTERS_VALUE(IDE_REGISTER_STATUS); - + /* choose device on the controller for which the command will be issued */ - areq->regs.regs[IDE_REGISTER_DEVICE_HEAD] = + areq->regs.regs[IDE_REGISTER_DEVICE_HEAD] = (dev << IDE_REGISTER_DEVICE_HEAD_DEV_POS); /* Find ATA command and its type */ @@ -171,43 +171,43 @@ ata_io_data_request(dev_t device, blkdev_request *req) areq->type = ATA_COMMAND_TYPE_DMA; if (req->req == BLKDEV_REQ_READ) areq->regs.regs[IDE_REGISTER_COMMAND] = ATA_COMMAND_READ_DMA; - else + else areq->regs.regs[IDE_REGISTER_COMMAND] = ATA_COMMAND_WRITE_DMA; } - else + else { if (req->req == BLKDEV_REQ_READ) { areq->type = ATA_COMMAND_TYPE_PIO_IN; - - /* - * choose command to issue: if the number of blocks to be + + /* + * choose command to issue: if the number of blocks to be * exchanged is greater then 1 and for ATA command READ MULTIPLE * data block consists of more then 1 sector choose READ MULTIPLE * otherwise READ SECTORS */ - areq->regs.regs[IDE_REGISTER_COMMAND] = - ((ATA_DEV_INFO(ctrl_minor, dev).max_multiple) && - (req->count > 1) && - (ATA_DEV_INFO(ctrl_minor, dev).current_multiple > 1)) ? - ATA_COMMAND_READ_MULTIPLE : + areq->regs.regs[IDE_REGISTER_COMMAND] = + ((ATA_DEV_INFO(ctrl_minor, dev).max_multiple) && + (req->count > 1) && + (ATA_DEV_INFO(ctrl_minor, dev).current_multiple > 1)) ? + ATA_COMMAND_READ_MULTIPLE : ATA_COMMAND_READ_SECTORS; } else { areq->type = ATA_COMMAND_TYPE_PIO_OUT; - /* - * choose command to issue: if the number of blocks to be + /* + * choose command to issue: if the number of blocks to be * exchanged is greater then 1 and for ATA command WRITE MULTIPLE * data block consists of more then 1 sector choose WRITE MULTIPLE * otherwise WRITE SECTORS */ - areq->regs.regs[IDE_REGISTER_COMMAND] = + areq->regs.regs[IDE_REGISTER_COMMAND] = ((ATA_DEV_INFO(ctrl_minor, dev).max_multiple) && (req->count > 1) && - (ATA_DEV_INFO(ctrl_minor, dev).current_multiple > 1)) ? - ATA_COMMAND_WRITE_MULTIPLE : + (ATA_DEV_INFO(ctrl_minor, dev).current_multiple > 1)) ? + ATA_COMMAND_WRITE_MULTIPLE : ATA_COMMAND_WRITE_SECTORS; } } @@ -232,30 +232,30 @@ ata_io_data_request(dev_t device, blkdev_request *req) /* now count = number of tracks: */ count /= ATA_DEV_INFO(ctrl_minor, dev).sectors; - areq->regs.regs[IDE_REGISTER_DEVICE_HEAD] |= + areq->regs.regs[IDE_REGISTER_DEVICE_HEAD] |= (count / ATA_DEV_INFO(ctrl_minor, dev).cylinders); /* now count = number of cylinders */ count %= ATA_DEV_INFO(ctrl_minor, dev).cylinders; areq->regs.regs[IDE_REGISTER_CYLINDER_LOW] = (uint8_t)count; areq->regs.regs[IDE_REGISTER_CYLINDER_HIGH] = (uint8_t)(count >> 8); - areq->regs.regs[IDE_REGISTER_DEVICE_HEAD] &= + areq->regs.regs[IDE_REGISTER_DEVICE_HEAD] &= ~IDE_REGISTER_DEVICE_HEAD_L; } /* fill sector count register */ areq->regs.regs[IDE_REGISTER_SECTOR_COUNT] = areq->breq->count; - + /* add request to the queue of awaiting requests to the controller */ ata_add_to_controller_queue(ctrl_minor, areq); - + return RTEMS_SUCCESSFUL; } -/* ata_non_data_request -- - * Form and serve request of NON DATA type for an ATA device. +/* ata_non_data_request -- + * Form and serve request of NON DATA type for an ATA device. * Processing of NON DATA request is SYNChronous operation. - * + * * PARAMETERS: * device - device identifier * cmd - command @@ -263,7 +263,7 @@ ata_io_data_request(dev_t device, blkdev_request *req) * * RETURNS: * RTEMS_SUCCESSFUL on success, or error code if - * error occured + * error occured */ static rtems_status_code ata_non_data_request(dev_t device, int cmd, void *argp) @@ -275,10 +275,10 @@ ata_non_data_request(dev_t device, int cmd, void *argp) */ rtems_device_minor_number ctrl_minor; uint8_t dev; - ata_queue_msg_t msg; - + ata_queue_msg_t msg; + rel_minor = (rtems_filesystem_dev_minor_t(device)) / - ATA_MINOR_NUM_RESERVED_PER_ATA_DEVICE; + ATA_MINOR_NUM_RESERVED_PER_ATA_DEVICE; /* get controller which serves the ATA device */ ctrl_minor = ata_devs[rel_minor].ctrl_minor; @@ -292,38 +292,38 @@ ata_non_data_request(dev_t device, int cmd, void *argp) { return RTEMS_NO_MEMORY; } - memset(areq, 0, sizeof(ata_req_t)); + memset(areq, 0, sizeof(ata_req_t)); areq->type = ATA_COMMAND_TYPE_NON_DATA; areq->regs.to_write = ATA_REGISTERS_VALUE(IDE_REGISTER_COMMAND); - areq->regs.regs[IDE_REGISTER_DEVICE_HEAD] |= + areq->regs.regs[IDE_REGISTER_DEVICE_HEAD] |= (dev << IDE_REGISTER_DEVICE_HEAD_DEV_POS); areq->breq = NULL; areq->regs.to_read = ATA_REGISTERS_VALUE(IDE_REGISTER_ERROR); - - /* - * depending on command fill command register and additional registers + + /* + * depending on command fill command register and additional registers * which are needed for command execution */ switch(cmd) - { + { case ATAIO_SET_MULTIPLE_MODE: - areq->regs.regs[IDE_REGISTER_COMMAND] = + areq->regs.regs[IDE_REGISTER_COMMAND] = ATA_COMMAND_SET_MULTIPLE_MODE; - areq->regs.to_write |= + areq->regs.to_write |= ATA_REGISTERS_VALUE(IDE_REGISTER_SECTOR_COUNT); areq->regs.regs[IDE_REGISTER_SECTOR_COUNT] = *(uint8_t*)argp; break; - + default: free(areq); return RTEMS_INVALID_NUMBER; - break; - } + break; + } - rc = rtems_semaphore_create(rtems_build_name('I', 'D', 'E', 'S'), - 0, - RTEMS_FIFO | RTEMS_COUNTING_SEMAPHORE | + rc = rtems_semaphore_create(rtems_build_name('I', 'D', 'E', 'S'), + 0, + RTEMS_FIFO | RTEMS_COUNTING_SEMAPHORE | RTEMS_NO_INHERIT_PRIORITY | RTEMS_NO_PRIORITY_CEILING | RTEMS_LOCAL, 0, @@ -332,60 +332,60 @@ ata_non_data_request(dev_t device, int cmd, void *argp) { free(areq); return rc; - } - + } + ata_add_to_controller_queue(ctrl_minor, areq); - + /* wait for request processing... */ rc = rtems_semaphore_obtain(areq->sema, RTEMS_WAIT, RTEMS_NO_TIMEOUT); if (rc != RTEMS_SUCCESSFUL) { free(areq); return rc; - } + } rtems_semaphore_delete(areq->sema); - - /* - * if no error occurred and if necessary, update internal ata driver data + + /* + * if no error occurred and if necessary, update internal ata driver data * structures to reflect changes (in device configuration, for example) - */ + */ if (areq->status == RTEMS_SUCCESSFUL) { switch(cmd) - { + { case ATAIO_SET_MULTIPLE_MODE: - ATA_DEV_INFO(ctrl_minor, dev).current_multiple = + ATA_DEV_INFO(ctrl_minor, dev).current_multiple = *(uint8_t*)argp; break; - + default: rc = RTEMS_INVALID_NUMBER; - break; - } - } - else - { - /* XXX: should be correct error processing: for ex, may be + break; + } + } + else + { + /* XXX: should be correct error processing: for ex, may be * ABRT and then we should return RTEMS_NOT_IMPLEMENTED */ rc = RTEMS_IO_ERROR; - } - + } + /* tell ata driver that controller ready to serve next request */ ATA_SEND_EVT(msg, ATA_MSG_SUCCESS_EVT, ctrl_minor, 0); - + return rc; } -/* ata_process_request -- - * Get first request from controller's queue and process it. - * +/* ata_process_request -- + * Get first request from controller's queue and process it. + * * PARAMETERS: * ctrl_minor - controller identifier * * RETURNS: - * NONE + * NONE */ static void ata_process_request(rtems_device_minor_number ctrl_minor) @@ -395,11 +395,11 @@ ata_process_request(rtems_device_minor_number ctrl_minor) ata_queue_msg_t msg; uint8_t i, dev; uint16_t val; - uint16_t data_bs; /* the number of 512-bytes sectors in one - * data block + uint16_t data_bs; /* the number of 512-bytes sectors in one + * data block */ - ISR_Level level; - + ISR_Level level; + /* if no requests to controller then do nothing */ if (Chain_Is_empty(&ata_ide_ctrls[ctrl_minor].reqs)) return; @@ -408,22 +408,22 @@ ata_process_request(rtems_device_minor_number ctrl_minor) _ISR_Disable(level); areq = (ata_req_t *)(ata_ide_ctrls[ctrl_minor].reqs.first); _ISR_Enable(level); - + /* get ATA device identifier (0 or 1) */ - dev = areq->regs.regs[IDE_REGISTER_DEVICE_HEAD] & + dev = areq->regs.regs[IDE_REGISTER_DEVICE_HEAD] & IDE_REGISTER_DEVICE_HEAD_DEV; /* get data block size */ - data_bs = ATA_DEV_INFO(ctrl_minor, dev).current_multiple ? - ATA_DEV_INFO(ctrl_minor, dev).current_multiple : 1; - + data_bs = ATA_DEV_INFO(ctrl_minor, dev).current_multiple ? + ATA_DEV_INFO(ctrl_minor, dev).current_multiple : 1; + /* execute device select protocol */ - ide_controller_write_register(ctrl_minor, IDE_REGISTER_DEVICE_HEAD, + ide_controller_write_register(ctrl_minor, IDE_REGISTER_DEVICE_HEAD, areq->regs.regs[IDE_REGISTER_DEVICE_HEAD]); - + do { ide_controller_read_register(ctrl_minor, IDE_REGISTER_STATUS, &byte); - } while ((byte & IDE_REGISTER_STATUS_BSY) || + } while ((byte & IDE_REGISTER_STATUS_BSY) || (!(byte & IDE_REGISTER_STATUS_DRDY))); /* fill in all necessary registers on the controller */ @@ -438,53 +438,53 @@ ata_process_request(rtems_device_minor_number ctrl_minor) if (areq->type == ATA_COMMAND_TYPE_PIO_OUT) { do { - ide_controller_read_register(ctrl_minor, IDE_REGISTER_STATUS, + ide_controller_read_register(ctrl_minor, IDE_REGISTER_STATUS, &byte); } while (byte & IDE_REGISTER_STATUS_BSY); if (byte & IDE_REGISTER_STATUS_DRQ) { ide_controller_write_data_block( - ctrl_minor, + ctrl_minor, MIN(data_bs, areq->cnt) * ATA_SECTOR_SIZE, areq->breq->bufs, &areq->cbuf, &areq->pos); areq->cnt -= MIN(data_bs, areq->cnt); - } + } else - { + { if (IDE_Controller_Table[ctrl_minor].int_driven == 0) { ide_controller_read_register( - ctrl_minor, + ctrl_minor, IDE_REGISTER_ALTERNATE_STATUS_OFFSET, &val); ide_controller_read_register(ctrl_minor, IDE_REGISTER_STATUS, &val); - ATA_SEND_EVT(msg, ATA_MSG_ERROR_EVT, ctrl_minor, + ATA_SEND_EVT(msg, ATA_MSG_ERROR_EVT, ctrl_minor, RTEMS_IO_ERROR); } - } + } } if (IDE_Controller_Table[ctrl_minor].int_driven == 0) { do { - ide_controller_read_register(ctrl_minor, IDE_REGISTER_STATUS, + ide_controller_read_register(ctrl_minor, IDE_REGISTER_STATUS, &byte); } while (byte & IDE_REGISTER_STATUS_BSY); - + ATA_SEND_EVT(msg, ATA_MSG_GEN_EVT, ctrl_minor, 0); - } + } } -/* ata_request_done -- +/* ata_request_done -- * Extract request from controller queue, execute callback if necessary * and process next request for the controller. - * + * * PARAMETERS: - * areq - ATA request + * areq - ATA request * ctrl_minor - controller identifier * status - status with which request has been done * error - error, if status != RTEMS_SUCCESSFUL @@ -511,14 +511,14 @@ ata_request_done(ata_req_t *areq, rtems_device_minor_number ctrl_minor, ata_process_request(ctrl_minor); return; } - ENABLE_PREEMPTION(key); + ENABLE_PREEMPTION(key); } -/* ata_non_data_request_done -- +/* ata_non_data_request_done -- * Set up request status and release request's semaphore. - * + * * PARAMETERS: - * areq - ATA request + * areq - ATA request * ctrl_minor - controller identifier * status - status with which request has been done * error - error, if status != RTEMS_SUCCESSFUL @@ -527,7 +527,7 @@ ata_request_done(ata_req_t *areq, rtems_device_minor_number ctrl_minor, * NONE */ static inline void -ata_non_data_request_done(ata_req_t *areq, +ata_non_data_request_done(ata_req_t *areq, rtems_device_minor_number ctrl_minor, rtems_status_code status, int error) { @@ -537,18 +537,18 @@ ata_non_data_request_done(ata_req_t *areq, } -/* ata_add_to_controller_queue -- +/* ata_add_to_controller_queue -- * Add request to the controller's queue. - * + * * PARAMETERS: * ctrl_minor - controller identifier - * areq - ATA request + * areq - ATA request * * RETURNS: * NONE */ static void -ata_add_to_controller_queue(rtems_device_minor_number ctrl_minor, +ata_add_to_controller_queue(rtems_device_minor_number ctrl_minor, ata_req_t *areq) { Chain_Append(&ata_ide_ctrls[ctrl_minor].reqs, &areq->link); @@ -558,28 +558,28 @@ ata_add_to_controller_queue(rtems_device_minor_number ctrl_minor, ata_queue_msg_t msg; #ifdef DEBUG - /* + /* * read IDE_REGISTER_ALTERNATE_STATUS instead IDE_REGISTER_STATUS * to prevent clearing of pending interrupt */ - ide_controller_read_register(ctrl_minor, - IDE_REGISTER_ALTERNATE_STATUS, + ide_controller_read_register(ctrl_minor, + IDE_REGISTER_ALTERNATE_STATUS, &val); if (val & IDE_REGISTER_STATUS_BSY) return; #endif ATA_SEND_EVT(msg, ATA_MSG_PROCESS_NEXT_EVT, ctrl_minor, 0); - } -} + } +} -/* ata_interrupt_handler -- +/* ata_interrupt_handler -- * ATA driver interrrupt handler. If interrrupt happend it mapped it to * controller (controllerS, if a number of controllers share one int line) * and generates ATA event(s). - * + * * PARAMETERS: - * vec - interrupt vector + * vec - interrupt vector * * RETURNS: * NONE @@ -590,7 +590,7 @@ ata_interrupt_handler(rtems_vector_number vec) Chain_Node *the_node = ((Chain_Control *)(&ata_int_vec[vec]))->first; ata_queue_msg_t msg; uint16_t byte; /* emphasize that only 8 low bits is meaningful */ - + for ( ; !Chain_Is_tail(&ata_int_vec[vec], the_node) ; ) { /* if (1) - is temporary hack - currently I don't know how to identify @@ -600,20 +600,20 @@ ata_interrupt_handler(rtems_vector_number vec) if (1) { msg.ctrl_minor = ((ata_int_st_t *)the_node)->ctrl_minor; - ide_controller_read_register(msg.ctrl_minor, IDE_REGISTER_STATUS, + ide_controller_read_register(msg.ctrl_minor, IDE_REGISTER_STATUS, &byte); - ATA_SEND_EVT(msg, ATA_MSG_GEN_EVT, msg.ctrl_minor, 0); + ATA_SEND_EVT(msg, ATA_MSG_GEN_EVT, msg.ctrl_minor, 0); } the_node = the_node->next; - } + } } -/* ata_pio_in_protocol -- +/* ata_pio_in_protocol -- * ATA PIO_IN protocol implementation, see specification - * + * * PARAMETERS: * ctrl_minor - controller identifier - * areq - ATA request + * areq - ATA request * * RETURNS: * NONE @@ -625,17 +625,17 @@ ata_pio_in_protocol(rtems_device_minor_number ctrl_minor, ata_req_t *areq) uint8_t dev; uint32_t min_val; ata_queue_msg_t msg; - - dev = areq->regs.regs[IDE_REGISTER_DEVICE_HEAD] & + + dev = areq->regs.regs[IDE_REGISTER_DEVICE_HEAD] & IDE_REGISTER_DEVICE_HEAD_DEV; - bs = ATA_DEV_INFO(ctrl_minor, dev).current_multiple ? - ATA_DEV_INFO(ctrl_minor, dev).current_multiple : 1; + bs = ATA_DEV_INFO(ctrl_minor, dev).current_multiple ? + ATA_DEV_INFO(ctrl_minor, dev).current_multiple : 1; min_val = MIN(bs, areq->cnt); - - ide_controller_read_data_block(ctrl_minor, min_val * ATA_SECTOR_SIZE, + + ide_controller_read_data_block(ctrl_minor, min_val * ATA_SECTOR_SIZE, areq->breq->bufs, &areq->cbuf, &areq->pos); - + areq->cnt -= min_val; if (areq->cnt == 0) { @@ -646,17 +646,17 @@ ata_pio_in_protocol(rtems_device_minor_number ctrl_minor, ata_req_t *areq) do { ide_controller_read_register(ctrl_minor, IDE_REGISTER_STATUS, &val); } while (val & IDE_REGISTER_STATUS_BSY); - + ATA_SEND_EVT(msg, ATA_MSG_GEN_EVT, ctrl_minor, 0); } } -/* ata_pio_out_protocol -- +/* ata_pio_out_protocol -- * ATA PIO_OUT protocol implementation, see specification - * + * * PARAMETERS: * ctrl_minor - controller identifier - * areq - ATA request + * areq - ATA request * * RETURNS: * NONE @@ -668,29 +668,29 @@ ata_pio_out_protocol(rtems_device_minor_number ctrl_minor, ata_req_t *areq) uint8_t dev; uint32_t min_val; ata_queue_msg_t msg; - - dev = areq->regs.regs[IDE_REGISTER_DEVICE_HEAD] & + + dev = areq->regs.regs[IDE_REGISTER_DEVICE_HEAD] & IDE_REGISTER_DEVICE_HEAD_DEV; - bs = ATA_DEV_INFO(ctrl_minor, dev).current_multiple ? - ATA_DEV_INFO(ctrl_minor, dev).current_multiple : 1; + bs = ATA_DEV_INFO(ctrl_minor, dev).current_multiple ? + ATA_DEV_INFO(ctrl_minor, dev).current_multiple : 1; - min_val = MIN(bs, areq->cnt); + min_val = MIN(bs, areq->cnt); if (areq->cnt == 0) { ata_request_done(areq, ctrl_minor, RTEMS_SUCCESSFUL, RTEMS_SUCCESSFUL); } - else + else { ide_controller_write_data_block(ctrl_minor, min_val * ATA_SECTOR_SIZE, - areq->breq->bufs, &areq->cbuf, + areq->breq->bufs, &areq->cbuf, &areq->pos); areq->cnt -= min_val; if (IDE_Controller_Table[ctrl_minor].int_driven == 0) { do { - ide_controller_read_register(ctrl_minor, IDE_REGISTER_STATUS, + ide_controller_read_register(ctrl_minor, IDE_REGISTER_STATUS, &val); } while (val & IDE_REGISTER_STATUS_BSY); @@ -699,9 +699,9 @@ ata_pio_out_protocol(rtems_device_minor_number ctrl_minor, ata_req_t *areq) } } -/* ata_queue_task -- +/* ata_queue_task -- * Task which manages ATA driver events queue. - * + * * PARAMETERS: * arg - ignored * @@ -709,7 +709,7 @@ ata_pio_out_protocol(rtems_device_minor_number ctrl_minor, ata_req_t *areq) * NONE * * NOTES: - * should be non-preemptive + * should be non-preemptive */ static rtems_task ata_queue_task(rtems_task_argument arg) @@ -726,19 +726,19 @@ ata_queue_task(rtems_task_argument arg) while (1) { /* get event which has happend */ - rc = rtems_message_queue_receive(ata_queue_id, &msg, &size, RTEMS_WAIT, + rc = rtems_message_queue_receive(ata_queue_id, &msg, &size, RTEMS_WAIT, RTEMS_NO_TIMEOUT); if (rc != RTEMS_SUCCESSFUL) rtems_fatal_error_occurred(RTEMS_INTERNAL_ERROR); - + /* get controller on which event has happend */ ctrl_minor = msg.ctrl_minor; - + /* get current request to the controller */ - _ISR_Disable(level); + _ISR_Disable(level); areq = (ata_req_t *)(ata_ide_ctrls[ctrl_minor].reqs.first); _ISR_Enable(level); - + switch(msg.type) { case ATA_MSG_PROCESS_NEXT_EVT: @@ -747,47 +747,47 @@ ata_queue_task(rtems_task_argument arg) break; case ATA_MSG_SUCCESS_EVT: - /* - * finish processing of current request with successful - * status and start processing of the next request in the + /* + * finish processing of current request with successful + * status and start processing of the next request in the * controller queue */ - ata_request_done(areq, ctrl_minor, RTEMS_SUCCESSFUL, + ata_request_done(areq, ctrl_minor, RTEMS_SUCCESSFUL, msg.error); break; - + case ATA_MSG_ERROR_EVT: - /* - * finish processing of current request with error - * status and start processing of the next request in the + /* + * finish processing of current request with error + * status and start processing of the next request in the * controller queue */ - ata_request_done(areq, ctrl_minor, RTEMS_UNSATISFIED, + ata_request_done(areq, ctrl_minor, RTEMS_UNSATISFIED, msg.error); break; - + case ATA_MSG_GEN_EVT: - /* - * continue processing of the current request to the - * controller according to current request state and + /* + * continue processing of the current request to the + * controller according to current request state and * ATA protocol */ - ide_controller_read_register(ctrl_minor, IDE_REGISTER_STATUS, + ide_controller_read_register(ctrl_minor, IDE_REGISTER_STATUS, &val); /* process error case */ if (val & IDE_REGISTER_STATUS_ERR) - { - ide_controller_read_register(ctrl_minor, - IDE_REGISTER_ERROR, + { + ide_controller_read_register(ctrl_minor, + IDE_REGISTER_ERROR, &val); if (areq->type == ATA_COMMAND_TYPE_NON_DATA) - ata_non_data_request_done(areq, ctrl_minor, - RTEMS_UNSATISFIED, + ata_non_data_request_done(areq, ctrl_minor, + RTEMS_UNSATISFIED, RTEMS_IO_ERROR); - else - ata_request_done(areq, ctrl_minor, RTEMS_UNSATISFIED, + else + ata_request_done(areq, ctrl_minor, RTEMS_UNSATISFIED, RTEMS_IO_ERROR); - break; + break; } switch(areq->type) @@ -795,28 +795,28 @@ ata_queue_task(rtems_task_argument arg) case ATA_COMMAND_TYPE_PIO_IN: ata_pio_in_protocol(ctrl_minor, areq); break; - + case ATA_COMMAND_TYPE_PIO_OUT: ata_pio_out_protocol(ctrl_minor, areq); break; - + case ATA_COMMAND_TYPE_NON_DATA: - ide_controller_read_register(ctrl_minor, - IDE_REGISTER_ERROR, + ide_controller_read_register(ctrl_minor, + IDE_REGISTER_ERROR, &val1); ata_non_data_request_done(areq, ctrl_minor, RTEMS_SUCCESSFUL, val1); break; - + default: printf("ata_queue_task: non-supported command type\n"); ata_request_done(areq, ctrl_minor, RTEMS_UNSATISFIED, RTEMS_NOT_IMPLEMENTED); - break; + break; } - break; + break; default: rtems_fatal_error_occurred(RTEMS_INTERNAL_ERROR); @@ -825,9 +825,9 @@ ata_queue_task(rtems_task_argument arg) } } -/* ata_ioctl -- +/* ata_ioctl -- * ATA driver ioctl interface. - * + * * PARAMETERS: * device - device identifier * cmd - command @@ -836,35 +836,35 @@ ata_queue_task(rtems_task_argument arg) * RETURNS: * depend on 'cmd' */ -int +int ata_ioctl(dev_t device, int cmd, void *argp) { rtems_status_code status; rtems_device_minor_number rel_minor; - + rel_minor = (rtems_filesystem_dev_minor_t(device)) / ATA_MINOR_NUM_RESERVED_PER_ATA_DEVICE; - /* + /* * in most cases this means that device 'device' is not an registred ATA * device - */ + */ if (ata_devs[rel_minor].device == ATA_UNDEFINED_VALUE) { errno = ENODEV; return -1; - } + } - switch (cmd) + switch (cmd) { case BLKIO_REQUEST: status = ata_io_data_request(device, (blkdev_request *)argp); break; - + case ATAIO_SET_MULTIPLE_MODE: status = ata_non_data_request(device, cmd, argp); break; - + default: errno = EBADRQC; return -1; @@ -874,7 +874,7 @@ ata_ioctl(dev_t device, int cmd, void *argp) if (status != RTEMS_SUCCESSFUL) { errno = EIO; - return -1; + return -1; } return 0; } @@ -882,7 +882,7 @@ ata_ioctl(dev_t device, int cmd, void *argp) /* * ata_initialize -- * Initializes all ATA devices found on initialized IDE controllers. - * + * * PARAMETERS: * major - device major number * minor - device minor number @@ -890,17 +890,17 @@ ata_ioctl(dev_t device, int cmd, void *argp) * * RETURNS: * RTEMS_SUCCESSFUL on success, or error code if - * error occured + * error occured */ -rtems_device_driver -ata_initialize(rtems_device_major_number major, - rtems_device_minor_number minor_arg, +rtems_device_driver +ata_initialize(rtems_device_major_number major, + rtems_device_minor_number minor_arg, void *args) { uint32_t ctrl_minor; rtems_status_code status; ata_req_t areq; - blkdev_request1 breq; + blkdev_request1 breq; uint8_t i, dev = 0; uint16_t *buffer; uint16_t ec; @@ -911,12 +911,12 @@ ata_initialize(rtems_device_major_number major, if (ata_initialized) return RTEMS_SUCCESSFUL; - + /* initialization of disk devices library */ status = rtems_disk_io_initialize(); if (status != RTEMS_SUCCESSFUL) return status; - + /* create queue for asynchronous requests handling */ status = rtems_message_queue_create( rtems_build_name('A', 'T', 'A', 'Q'), @@ -928,17 +928,17 @@ ata_initialize(rtems_device_major_number major, { rtems_disk_io_done(); return status; - } + } - /* - * create ATA driver task, see comments for task implementation for - * details + /* + * create ATA driver task, see comments for task implementation for + * details */ status = rtems_task_create( rtems_build_name ('A', 'T', 'A', 'T'), ATA_DRIVER_TASK_PRIORITY, ATA_DRIVER_TASK_STACK_SIZE, - RTEMS_PREEMPT | RTEMS_NO_TIMESLICE | RTEMS_ASR | + RTEMS_PREEMPT | RTEMS_NO_TIMESLICE | RTEMS_ASR | RTEMS_INTERRUPT_LEVEL(0), RTEMS_NO_FLOATING_POINT | RTEMS_LOCAL, &ata_task_id); @@ -947,21 +947,21 @@ ata_initialize(rtems_device_major_number major, rtems_message_queue_delete(ata_queue_id); rtems_disk_io_done(); return status; - } - - /* - * start ATA driver task. Actually the task will not start immediately - + } + + /* + * start ATA driver task. Actually the task will not start immediately - * it will start only after multitasking support will be started - */ - status = rtems_task_start(ata_task_id, ata_queue_task, 0); + */ + status = rtems_task_start(ata_task_id, ata_queue_task, 0); if (status != RTEMS_SUCCESSFUL) { rtems_task_delete(ata_task_id); rtems_message_queue_delete(ata_queue_id); rtems_disk_io_done(); return status; - } - + } + buffer = (uint16_t*)malloc(ATA_SECTOR_SIZE); if (buffer == NULL) { @@ -969,8 +969,8 @@ ata_initialize(rtems_device_major_number major, rtems_message_queue_delete(ata_queue_id); rtems_disk_io_done(); return RTEMS_NO_MEMORY; - } - + } + ata_devs_number = 0; for (i = 0; i < (2 * IDE_CTRL_MAX_MINOR_NUMBER); i++) @@ -980,10 +980,10 @@ ata_initialize(rtems_device_major_number major, for (i = 0; i < ATA_MAX_RTEMS_INT_VEC_NUMBER; i++) Chain_Initialize_empty(&ata_int_vec[i]); - /* - * during ATA driver initialization EXECUTE DEVICE DIAGNOSTIC and - * IDENTIFY DEVICE ATA command should be issued; for these purposes ATA - * requests should be formed; ATA requests contain block device request, + /* + * during ATA driver initialization EXECUTE DEVICE DIAGNOSTIC and + * IDENTIFY DEVICE ATA command should be issued; for these purposes ATA + * requests should be formed; ATA requests contain block device request, * so form block device request first */ memset(&breq, 0, sizeof(blkdev_request1)); @@ -994,16 +994,16 @@ ata_initialize(rtems_device_major_number major, breq.req.bufs[0].length = ATA_SECTOR_SIZE; breq.req.bufs[0].buffer = buffer; - /* + /* * for each presented IDE controller execute EXECUTE DEVICE DIAGNOSTIC - * ATA command; for each found device execute IDENTIFY DEVICE ATA - * command + * ATA command; for each found device execute IDENTIFY DEVICE ATA + * command */ for (ctrl_minor = 0; ctrl_minor < IDE_Controller_Count; ctrl_minor++) if (IDE_Controller_Table[ctrl_minor].status == IDE_CTRL_INITIALIZED) { Chain_Initialize_empty(&ata_ide_ctrls[ctrl_minor].reqs); - + if (IDE_Controller_Table[ctrl_minor].int_driven == TRUE) { int_st = malloc(sizeof(ata_int_st_t)); @@ -1014,13 +1014,13 @@ ata_initialize(rtems_device_major_number major, rtems_message_queue_delete(ata_queue_id); rtems_disk_io_done(); return RTEMS_NO_MEMORY; - } + } int_st->ctrl_minor = ctrl_minor; status = rtems_interrupt_catch( - ata_interrupt_handler, - IDE_Controller_Table[ctrl_minor].int_vec, + ata_interrupt_handler, + IDE_Controller_Table[ctrl_minor].int_vec, &old_isr); if (status != RTEMS_SUCCESSFUL) { @@ -1030,14 +1030,14 @@ ata_initialize(rtems_device_major_number major, rtems_message_queue_delete(ata_queue_id); rtems_disk_io_done(); return status; - } + } Chain_Append( &ata_int_vec[IDE_Controller_Table[ctrl_minor].int_vec], &int_st->link); /* disable interrupts */ - ide_controller_write_register(ctrl_minor, - IDE_REGISTER_DEVICE_CONTROL_OFFSET, + ide_controller_write_register(ctrl_minor, + IDE_REGISTER_DEVICE_CONTROL_OFFSET, IDE_REGISTER_DEVICE_CONTROL_nIEN); } @@ -1048,15 +1048,15 @@ ata_initialize(rtems_device_major_number major, memset(&areq, 0, sizeof(ata_req_t)); areq.type = ATA_COMMAND_TYPE_NON_DATA; areq.regs.to_write = ATA_REGISTERS_VALUE(IDE_REGISTER_COMMAND); - areq.regs.regs[IDE_REGISTER_COMMAND] = + areq.regs.regs[IDE_REGISTER_COMMAND] = ATA_COMMAND_EXECUTE_DEVICE_DIAGNOSTIC; areq.regs.to_read = ATA_REGISTERS_VALUE(IDE_REGISTER_ERROR); areq.breq = (blkdev_request *)&breq; - /* - * Process the request. Special processing of requests on - * initialization phase is needed because at this moment there + /* + * Process the request. Special processing of requests on + * initialization phase is needed because at this moment there * is no multitasking enviroment */ ata_process_request_on_init_phase(ctrl_minor, &areq); @@ -1066,12 +1066,12 @@ ata_initialize(rtems_device_major_number major, */ if (breq.req.status != RTEMS_SUCCESSFUL) continue; - - /* disassemble returned diagnostic codes */ + + /* disassemble returned diagnostic codes */ if (breq.req.error == ATA_DEV0_PASSED_DEV1_PASSED_OR_NOT_PRSNT) { ATA_DEV_INFO(ctrl_minor, 0).present = 1; - ATA_DEV_INFO(ctrl_minor,1).present = 1; + ATA_DEV_INFO(ctrl_minor,1).present = 1; } else if (breq.req.error == ATA_DEV0_PASSED_DEV1_FAILED) { @@ -1104,25 +1104,25 @@ ata_initialize(rtems_device_major_number major, if (ATA_DEV_INFO(ctrl_minor, dev).present) { /* - * Issue DEVICE IDENTIFY ATA command and get device - * configuration + * Issue DEVICE IDENTIFY ATA command and get device + * configuration */ memset(&areq, 0, sizeof(ata_req_t)); areq.type = ATA_COMMAND_TYPE_PIO_IN; areq.regs.to_write = ATA_REGISTERS_VALUE(IDE_REGISTER_COMMAND); - areq.regs.regs[IDE_REGISTER_COMMAND] = + areq.regs.regs[IDE_REGISTER_COMMAND] = ATA_COMMAND_IDENTIFY_DEVICE; areq.regs.to_read = ATA_REGISTERS_VALUE(IDE_REGISTER_STATUS); areq.breq = (blkdev_request *)&breq; - + areq.cnt = breq.req.count; areq.regs.regs[IDE_REGISTER_DEVICE_HEAD] |= (dev << IDE_REGISTER_DEVICE_HEAD_DEV_POS); - /* - * Process the request. Special processing of requests on - * initialization phase is needed because at this moment there + /* + * Process the request. Special processing of requests on + * initialization phase is needed because at this moment there * is no multitasking enviroment */ ata_process_request_on_init_phase(ctrl_minor, &areq); @@ -1132,28 +1132,28 @@ ata_initialize(rtems_device_major_number major, continue; /* - * Parse returned device configuration and fill in ATA internal + * Parse returned device configuration and fill in ATA internal * device info structure */ - ATA_DEV_INFO(ctrl_minor, dev).cylinders = + ATA_DEV_INFO(ctrl_minor, dev).cylinders = CF_LE_W(buffer[ATA_IDENT_WORD_NUM_OF_CURR_LOG_CLNDS]); - ATA_DEV_INFO(ctrl_minor, dev).heads = + ATA_DEV_INFO(ctrl_minor, dev).heads = CF_LE_W(buffer[ATA_IDENT_WORD_NUM_OF_CURR_LOG_HEADS]); - ATA_DEV_INFO(ctrl_minor, dev).sectors = + ATA_DEV_INFO(ctrl_minor, dev).sectors = CF_LE_W(buffer[ATA_IDENT_WORD_NUM_OF_CURR_LOG_SECS]); - ATA_DEV_INFO(ctrl_minor, dev).lba_sectors = - (CF_LE_W(buffer[ATA_IDENT_WORD_NUM_OF_USR_SECS0]) << 16) + + ATA_DEV_INFO(ctrl_minor, dev).lba_sectors = + (CF_LE_W(buffer[ATA_IDENT_WORD_NUM_OF_USR_SECS0]) << 16) + CF_LE_W(buffer[ATA_IDENT_WORD_NUM_OF_USR_SECS1]); - ATA_DEV_INFO(ctrl_minor, dev).lba_avaible = + ATA_DEV_INFO(ctrl_minor, dev).lba_avaible = (CF_LE_W(buffer[ATA_IDENT_WORD_CAPABILITIES]) >> 9) & 0x1; - ATA_DEV_INFO(ctrl_minor, dev).max_multiple = + ATA_DEV_INFO(ctrl_minor, dev).max_multiple = (uint8_t) (CF_LE_W(buffer[ATA_IDENT_WORD_RW_MULT])); - ATA_DEV_INFO(ctrl_minor, dev).current_multiple = - (CF_LE_W(buffer[ATA_IDENT_WORD_MULT_SECS]) & 0x100) ? + ATA_DEV_INFO(ctrl_minor, dev).current_multiple = + (CF_LE_W(buffer[ATA_IDENT_WORD_MULT_SECS]) & 0x100) ? (uint8_t)(CF_LE_W(buffer[ATA_IDENT_WORD_MULT_SECS])) : 0; - if ((CF_LE_W(buffer[ATA_IDENT_WORD_FIELD_VALIDITY]) & + if ((CF_LE_W(buffer[ATA_IDENT_WORD_FIELD_VALIDITY]) & ATA_IDENT_BIT_VALID) == 0) { /* no "supported modes" info -> use default */ ATA_DEV_INFO(ctrl_minor, dev).mode_active = ATA_MODES_PIO3; @@ -1163,22 +1163,22 @@ ata_initialize(rtems_device_major_number major, ((CF_LE_W(buffer[64]) & 0x1) ? ATA_MODES_PIO3 : 0) | ((CF_LE_W(buffer[64]) & 0x2) ? ATA_MODES_PIO4 : 0) | ((CF_LE_W(buffer[63]) & 0x1) ? ATA_MODES_DMA0 : 0) | - ((CF_LE_W(buffer[63]) & 0x2) ? + ((CF_LE_W(buffer[63]) & 0x2) ? ATA_MODES_DMA0 | ATA_MODES_DMA1 : 0) | - ((CF_LE_W(buffer[63]) & 0x4) ? + ((CF_LE_W(buffer[63]) & 0x4) ? ATA_MODES_DMA0 | ATA_MODES_DMA1 | ATA_MODES_DMA2 : 0); if (ATA_DEV_INFO(ctrl_minor, dev).modes_avaible == 0) continue; - /* + /* * choose most appropriate ATA device data I/O speed supported * by the controller */ status = ide_controller_config_io_speed( - ctrl_minor, + ctrl_minor, ATA_DEV_INFO(ctrl_minor, dev).modes_avaible); if (status != RTEMS_SUCCESSFUL) continue; - } + } /* * Ok, let register new ATA device in the system */ @@ -1190,13 +1190,13 @@ ata_initialize(rtems_device_major_number major, name[7] = 'a' + 2 * ctrl_minor + dev; device = rtems_filesystem_make_dev_t( - major, - (ata_devs_number * + major, + (ata_devs_number * ATA_MINOR_NUM_RESERVED_PER_ATA_DEVICE)); - status = rtems_disk_create_phys(device, ATA_SECTOR_SIZE, - ATA_DEV_INFO(ctrl_minor, dev).lba_avaible ? - ATA_DEV_INFO(ctrl_minor, dev).lba_sectors : + status = rtems_disk_create_phys(device, ATA_SECTOR_SIZE, + ATA_DEV_INFO(ctrl_minor, dev).lba_avaible ? + ATA_DEV_INFO(ctrl_minor, dev).lba_sectors : (ATA_DEV_INFO(ctrl_minor, dev).heads * ATA_DEV_INFO(ctrl_minor, dev).cylinders * ATA_DEV_INFO(ctrl_minor, dev).sectors), @@ -1205,13 +1205,13 @@ ata_initialize(rtems_device_major_number major, { ata_devs[ata_devs_number].device = ATA_UNDEFINED_VALUE; continue; - } + } ata_devs_number++; } if (IDE_Controller_Table[ctrl_minor].int_driven == TRUE) - { - ide_controller_write_register(ctrl_minor, - IDE_REGISTER_DEVICE_CONTROL_OFFSET, + { + ide_controller_write_register(ctrl_minor, + IDE_REGISTER_DEVICE_CONTROL_OFFSET, 0x00); } } @@ -1221,16 +1221,16 @@ ata_initialize(rtems_device_major_number major, return RTEMS_SUCCESSFUL; } -/* ata_process_request_on_init_phase -- - * Process the ATA request during system initialization. Request +/* ata_process_request_on_init_phase -- + * Process the ATA request during system initialization. Request * processing is syncronous and doesn't use multiprocessing enviroment. - * + * * PARAMETERS: * ctrl_minor - controller identifier * areq - ATA request * * RETURNS: - * NONE + * NONE */ static void ata_process_request_on_init_phase(rtems_device_minor_number ctrl_minor, @@ -1239,30 +1239,30 @@ ata_process_request_on_init_phase(rtems_device_minor_number ctrl_minor, uint16_t byte;/* emphasize that only 8 low bits is meaningful */ uint8_t i, dev; uint16_t val, val1; - uint16_t data_bs; /* the number of 512 bytes sectors into one - * data block + uint16_t data_bs; /* the number of 512 bytes sectors into one + * data block */ assert(areq); - - dev = areq->regs.regs[IDE_REGISTER_DEVICE_HEAD] & + + dev = areq->regs.regs[IDE_REGISTER_DEVICE_HEAD] & IDE_REGISTER_DEVICE_HEAD_DEV; - data_bs = ATA_DEV_INFO(ctrl_minor, dev).current_multiple ? - ATA_DEV_INFO(ctrl_minor, dev).current_multiple : 1; - - ide_controller_write_register(ctrl_minor, IDE_REGISTER_DEVICE_HEAD, + data_bs = ATA_DEV_INFO(ctrl_minor, dev).current_multiple ? + ATA_DEV_INFO(ctrl_minor, dev).current_multiple : 1; + + ide_controller_write_register(ctrl_minor, IDE_REGISTER_DEVICE_HEAD, areq->regs.regs[IDE_REGISTER_DEVICE_HEAD]); - + do { ide_controller_read_register(ctrl_minor, IDE_REGISTER_STATUS, &byte); - } while ((byte & IDE_REGISTER_STATUS_BSY) || + } while ((byte & IDE_REGISTER_STATUS_BSY) || (!(byte & IDE_REGISTER_STATUS_DRDY))); for (i=0; i< ATA_MAX_CMD_REG_OFFSET; i++) { uint32_t reg = (1 << i); if (areq->regs.to_write & reg) - ide_controller_write_register(ctrl_minor, i, + ide_controller_write_register(ctrl_minor, i, areq->regs.regs[i]); } @@ -1279,40 +1279,40 @@ ata_process_request_on_init_phase(rtems_device_minor_number ctrl_minor, areq->breq->error = RTEMS_IO_ERROR; return; } - + switch(areq->type) { case ATA_COMMAND_TYPE_PIO_IN: ide_controller_read_data_block( - ctrl_minor, + ctrl_minor, MIN(data_bs, areq->cnt) * ATA_SECTOR_SIZE, areq->breq->bufs, &areq->cbuf, &areq->pos); - + areq->cnt -= MIN(data_bs, areq->cnt); if (areq->cnt == 0) { areq->breq->status = RTEMS_SUCCESSFUL; } - else + else { - /* - * this shouldn't happend on the initialization - * phase! + /* + * this shouldn't happend on the initialization + * phase! */ - rtems_fatal_error_occurred(RTEMS_INTERNAL_ERROR); + rtems_fatal_error_occurred(RTEMS_INTERNAL_ERROR); } break; - + case ATA_COMMAND_TYPE_NON_DATA: areq->breq->status = RTEMS_SUCCESSFUL; areq->breq->error = val1; break; - + default: printf("ata_queue_task: non-supported command type\n"); areq->breq->status = RTEMS_UNSATISFIED; areq->breq->error = RTEMS_NOT_IMPLEMENTED; - break; + break; } } diff --git a/c/src/libchip/ide/ata.h b/c/src/libchip/ide/ata.h index e46accf6bb..0a79b48ccd 100644 --- a/c/src/libchip/ide/ata.h +++ b/c/src/libchip/ide/ata.h @@ -1,7 +1,7 @@ /* * ata.h * - * ATA RTEMS driver header file. This file should be included from an + * ATA RTEMS driver header file. This file should be included from an * application. * * Copyright (C) 2002 OKTET Ltd., St.-Petersburg, Russia @@ -10,7 +10,7 @@ * The license and distribution terms for this file may be * found in the file LICENSE in this distribution or at * http://www.rtems.com/license/LICENSE. - * + * * $Id$ */ #ifndef __ATA_H__ @@ -29,20 +29,20 @@ rtems_device_driver ata_initialize( rtems_device_major_number major, rtems_device_minor_number minor, void *args); - + #define ATA_DRIVER_TABLE_ENTRY \ {ata_initialize, GENERIC_BLOCK_DEVICE_DRIVER_ENTRIES} - + /* ATA IOCTL request codes */ #define ATAIO_SET_MULTIPLE_MODE _IO('A', 1) -/* - * ATA driver configuration parameters +/* + * ATA driver configuration parameters * FIXME: should be configured more easy... */ #define ATA_DRIVER_MESSAGE_QUEUE_SIZE 50 #define ATA_DRIVER_TASK_PRIORITY 140 -#define ATA_DRIVER_TASK_STACK_SIZE 16*1024 +#define ATA_DRIVER_TASK_STACK_SIZE 16*1024 #ifdef __cplusplus } diff --git a/c/src/libchip/ide/ata_internal.h b/c/src/libchip/ide/ata_internal.h index 030820fa55..051ea49db6 100644 --- a/c/src/libchip/ide/ata_internal.h +++ b/c/src/libchip/ide/ata_internal.h @@ -1,7 +1,7 @@ /* * ata_internal.h * - * ATA RTEMS driver internal header file + * ATA RTEMS driver internal header file * * Copyright (C) 2001 OKTET Ltd., St.-Petersburg, Russia * Authors: Eugeny S. Mints @@ -10,7 +10,7 @@ * The license and distribution terms for this file may be * found in the file LICENSE in this distribution or at * http://www.rtems.com/license/LICENSE. - * + * * $Id$ * */ @@ -82,9 +82,9 @@ #define ATA_COMMAND_TYPE_DMA 3 /* ATA commands opcodes */ -/* - * Commands present in both ATA-2 and ATA-4 specs. - * Some commands have two values in ATA-2, +/* + * Commands present in both ATA-2 and ATA-4 specs. + * Some commands have two values in ATA-2, * in such case value from ATA-4 used. * Some commands have slightly different names in these specifications, * so names from ATA-4 are used. @@ -223,11 +223,11 @@ typedef struct ata_req_s { uint32_t cnt; /* Number of sectors to be exchanged */ uint32_t cbuf; /* number of current buffer from breq in use */ uint32_t pos; /* current position in 'cbuf' */ - blkdev_request *breq; /* blkdev_request which corresponds to the + blkdev_request *breq; /* blkdev_request which corresponds to the * ata request */ - rtems_id sema; /* semaphore which is used if synchronous - * processing of the ata request is required + rtems_id sema; /* semaphore which is used if synchronous + * processing of the ata request is required */ rtems_status_code status; /* status of ata request processing */ int error; /* device error code */ @@ -274,8 +274,8 @@ typedef struct ata_queue_msg_s { } while (0) /* - * Array of such structures is indexed by interrupt vecotrs and used for - * mapping of IDE controllers and interrupt vectors + * Array of such structures is indexed by interrupt vecotrs and used for + * mapping of IDE controllers and interrupt vectors */ typedef struct ata_int_st_s { Chain_Node link; @@ -313,9 +313,9 @@ typedef struct ata_dev_s { } ata_dev_t; /* - * This structure describes controller state, devices configuration on the - * controller and chain of ATA requests to the controller. Array of such - * structures is indexed by controller minor number + * This structure describes controller state, devices configuration on the + * controller and chain of ATA requests to the controller. Array of such + * structures is indexed by controller minor number */ typedef struct ata_ide_ctrl_s { rtems_boolean present; /* controller state */ diff --git a/c/src/libchip/ide/ide_controller.c b/c/src/libchip/ide/ide_controller.c index bf64b4bb4e..af4d56fe4c 100644 --- a/c/src/libchip/ide/ide_controller.c +++ b/c/src/libchip/ide/ide_controller.c @@ -1,6 +1,6 @@ /* * ide_controller.c - * + * * This is generic rtems driver for IDE controllers. * * Copyright (C) 2001 OKTET Ltd., St.-Petersburg, Russia @@ -10,7 +10,7 @@ * The license and distribution terms for this file may be * found in the file LICENSE in this distribution or at * http://www.rtems.com/license/LICENSE. - * + * * $Id$ * */ @@ -23,7 +23,7 @@ /* * ide_controller_initialize -- - * Initializes all configured IDE controllers. Controllers configuration + * Initializes all configured IDE controllers. Controllers configuration * table is provided by BSP * * PARAMETERS: @@ -35,7 +35,7 @@ * RTEMS_SUCCESSFUL on success, or error code if * error occured */ -rtems_device_driver +rtems_device_driver ide_controller_initialize(rtems_device_major_number major, rtems_device_minor_number minor_arg, void *args) @@ -46,22 +46,22 @@ ide_controller_initialize(rtems_device_major_number major, /* FIXME: may be it should be done on compilation phase */ if (IDE_Controller_Count > IDE_CTRL_MAX_MINOR_NUMBER) rtems_fatal_error_occurred(RTEMS_TOO_MANY); - + for (minor=0; minor < IDE_Controller_Count; minor++) { IDE_Controller_Table[minor].status = IDE_CTRL_NON_INITIALIZED; - - if ((IDE_Controller_Table[minor].probe != NULL && + + if ((IDE_Controller_Table[minor].probe != NULL && IDE_Controller_Table[minor].probe(minor)) || IDE_Controller_Table[minor].fns->ctrl_probe(minor)) { - status = rtems_io_register_name(IDE_Controller_Table[minor].name, + status = rtems_io_register_name(IDE_Controller_Table[minor].name, major, minor); - if (status != RTEMS_SUCCESSFUL) + if (status != RTEMS_SUCCESSFUL) rtems_fatal_error_occurred(status); IDE_Controller_Table[minor].fns->ctrl_initialize(minor); - + IDE_Controller_Table[minor].status = IDE_CTRL_INITIALIZED; } } @@ -133,7 +133,7 @@ ide_controller_write_data_block(rtems_device_minor_number minor, */ void ide_controller_read_register(rtems_device_minor_number minor, - int reg, + int reg, uint16_t *value) { IDE_Controller_Table[minor].fns->ctrl_reg_read(minor, reg, value); @@ -152,7 +152,7 @@ ide_controller_read_register(rtems_device_minor_number minor, * NONE */ void -ide_controller_write_register(rtems_device_minor_number minor, int reg, +ide_controller_write_register(rtems_device_minor_number minor, int reg, uint16_t value) { IDE_Controller_Table[minor].fns->ctrl_reg_write(minor, reg, value); @@ -170,10 +170,10 @@ ide_controller_write_register(rtems_device_minor_number minor, int reg, * RTEMS_SUCCESSFUL on success, or error code if * error occured */ -rtems_status_code +rtems_status_code ide_controller_config_io_speed(int minor, uint8_t modes_avaible) { return IDE_Controller_Table[minor].fns->ctrl_config_io_speed( - minor, + minor, modes_avaible); } diff --git a/c/src/libchip/ide/ide_ctrl.h b/c/src/libchip/ide/ide_ctrl.h index f28cc5c9a7..fc010f8536 100644 --- a/c/src/libchip/ide/ide_ctrl.h +++ b/c/src/libchip/ide/ide_ctrl.h @@ -23,11 +23,11 @@ rtems_device_driver ide_controller_initialize( rtems_device_major_number major, rtems_device_minor_number minor, void *args); - + #define IDE_CONTROLLER_DRIVER_TABLE_ENTRY \ {ide_controller_initialize, NULL, NULL, NULL, NULL, NULL} - + #ifdef __cplusplus } diff --git a/c/src/libchip/ide/ide_ctrl_cfg.h b/c/src/libchip/ide/ide_ctrl_cfg.h index 9a888f75c1..61ab426309 100644 --- a/c/src/libchip/ide/ide_ctrl_cfg.h +++ b/c/src/libchip/ide/ide_ctrl_cfg.h @@ -1,7 +1,7 @@ /* * ide_ctrl_cfg.h * - * LibChip library IDE controller header file - structuers used for + * LibChip library IDE controller header file - structuers used for * configuration and plugin interface definition. * * Copyright (C) 2002 OKTET Ltd., St.-Petersburg, Russia @@ -33,38 +33,38 @@ typedef enum { /* * Each driver for a particular controller have to provide following * functions in such a structure. The only field which should not be NULL - * is contInit. + * is contInit. */ typedef struct ide_ctrl_fns_s { boolean (*ctrl_probe)(int minor); /* probe routine */ void (*ctrl_initialize)(int minor); - int (*ctrl_control)(int minor, uint32_t command, + int (*ctrl_control)(int minor, uint32_t command, void *arg); /* * Functions which allow read/write registers of a particular controller. - * (these functions may be used from ide_controller_read_register, + * (these functions may be used from ide_controller_read_register, * ide_controller_write_register) */ void (*ctrl_reg_read)(int minor, int regist, uint16_t *value); void (*ctrl_reg_write)(int minor, int regist, uint16_t value); - - /* - * The function allows to escape overhead for read/write register + + /* + * The function allows to escape overhead for read/write register * functions calls */ - void (*ctrl_read_block)(int minor, uint16_t block_size, + void (*ctrl_read_block)(int minor, uint16_t block_size, blkdev_sg_buffer *bufs, uint32_t *cbuf, uint32_t *pos); void (*ctrl_write_block)(int minor, uint16_t block_size, blkdev_sg_buffer *bufs, uint32_t *cbuf, uint32_t *pos); - - rtems_status_code (*ctrl_config_io_speed)(int minor, + + rtems_status_code (*ctrl_config_io_speed)(int minor, uint8_t modes_available); } ide_ctrl_fns_t; -/* - * IDE Controller configuration. Table of such configurations is provided +/* + * IDE Controller configuration. Table of such configurations is provided * by BSP */ typedef struct ide_controller_bsp_table_s { @@ -72,14 +72,14 @@ typedef struct ide_controller_bsp_table_s { ide_ctrl_devs_t type; /* chip type */ ide_ctrl_fns_t *fns; /* pointer to the set of driver routines */ boolean (*probe)(int minor); /* general probe routine */ - uint8_t status; /* initialized/non initialized. Should be set - * to zero by static initialization + uint8_t status; /* initialized/non initialized. Should be set + * to zero by static initialization */ uint32_t port1; /* port number for the port of the device */ rtems_boolean int_driven; /* interrupt/poll driven */ rtems_vector_number int_vec; /* the interrupt vector of the device */ - void *params; /* contains either device specific data or a - * pointer to s device specific information + void *params; /* contains either device specific data or a + * pointer to s device specific information * table */ } ide_controller_bsp_table_t; diff --git a/c/src/libchip/ide/ide_ctrl_io.h b/c/src/libchip/ide/ide_ctrl_io.h index cf582b05d1..e69c02f0c3 100644 --- a/c/src/libchip/ide/ide_ctrl_io.h +++ b/c/src/libchip/ide/ide_ctrl_io.h @@ -1,8 +1,8 @@ /* * ide_ctrl_io.h * - * LibChip library IDE controller header file - IO operations defined for - * IDE controllers. + * LibChip library IDE controller header file - IO operations defined for + * IDE controllers. * * Copyright (C) 2002 OKTET Ltd., St.-Petersburg, Russia * Author: Eugeny S. Mints @@ -28,7 +28,7 @@ extern "C" { #define IDE_REGISTER_FEATURES IDE_REGISTER_ERROR #define IDE_REGISTER_SECTOR_COUNT 2 #define IDE_REGISTER_SECTOR_NUMBER 3 -#define IDE_REGISTER_LBA0 IDE_REGISTER_SECTOR_NUMBER +#define IDE_REGISTER_LBA0 IDE_REGISTER_SECTOR_NUMBER #define IDE_REGISTER_CYLINDER_LOW 4 #define IDE_REGISTER_LBA1 IDE_REGISTER_CYLINDER_LOW #define IDE_REGISTER_CYLINDER_HIGH 5 @@ -42,7 +42,7 @@ extern "C" { #define IDE_REGISTER_ALTERNATE_STATUS 6 #define IDE_REGISTER_DEVICE_CONTROL IDE_REGISTER_ALTERNATE_STATUS -/* offsets used to access registers */ +/* offsets used to access registers */ #define IDE_REGISTER_DEVICE_CONTROL_OFFSET 8 #define IDE_REGISTER_ALTERNATE_STATUS_OFFSET IDE_REGISTER_DEVICE_CONTROL_OFFSET #define IDE_REGISTER_DATA_BYTE 9 @@ -143,7 +143,7 @@ ide_controller_write_data_block(rtems_device_minor_number minor, */ void ide_controller_read_register(rtems_device_minor_number minor, - int reg, + int reg, uint16_t *value); /* @@ -174,7 +174,7 @@ ide_controller_write_register(rtems_device_minor_number minor, * RTEMS_SUCCESSFUL on success, or error code if * error occured */ -rtems_status_code +rtems_status_code ide_controller_config_io_speed(int minor, uint8_t modes_avaible); #ifdef __cplusplus diff --git a/c/src/libchip/network/cs8900.c b/c/src/libchip/network/cs8900.c index 3dbce70a8e..bf580c93fe 100644 --- a/c/src/libchip/network/cs8900.c +++ b/c/src/libchip/network/cs8900.c @@ -23,7 +23,7 @@ CS8900 RTEMS driver. See the header file for details. - + */ #include diff --git a/c/src/libchip/network/cs8900.h b/c/src/libchip/network/cs8900.h index 036b6d6ced..67b37c7b48 100644 --- a/c/src/libchip/network/cs8900.h +++ b/c/src/libchip/network/cs8900.h @@ -2,10 +2,10 @@ ------------------------------------------------------------------------ cs8900.h,v 1.3 2002/09/07 23:09:47 joel Exp ------------------------------------------------------------------------ - + Copyright Cybertec Pty Ltd, 2000 All rights reserved Cybertec Pty Ltd, 2000 - + Port to the DIMM PC copyright (c) 2004 Angelo Fraietta This project has been assisted by the Commonwealth Government through the Australia Council, its arts funding and advisory body. @@ -16,7 +16,7 @@ The license and distribution terms for this file may be found in the file LICENSE in this distribution or at http://www.OARcorp.com/rtems/license.html. - + ------------------------------------------------------------------------ CS8900 RTEMS driver. @@ -27,7 +27,7 @@ completely different bus, byte order and interrupt structures. An example BSP backend is provided in the pci386 BSP. - + The BSP provides the following functions: cs8900_io_set_reg @@ -70,7 +70,7 @@ attached to the networking stack. It also creates a 'struct rtems_bsdnet_ifconfig' which is used to attach the interface to the networking stack. The following code declares the BSD config: - + static cs8900_device cs8900; static struct rtems_bsdnet_ifconfig cs8900_ifconfig = @@ -113,9 +113,9 @@ #define ETHERNET_IRQ_LEVEL 0 cs8900_device *cs = &cs8900; - + memset (cs, 0, sizeof (cs8900_device)); - + cs->dev = 0; cs->io_base = ETHERNET_IO_BASE; cs->mem_base = ETHERNET_MEM_BASE; @@ -123,11 +123,11 @@ cs->rx_queue_size = 30; cs8900_ifconfig.drv_ctrl = &cs8900; - + printf ("CS8900 initialisation\n"); - + rtems_bsdnet_attach (&cs8900_ifconfig); - + flags = IFF_UP; if (rtems_bsdnet_ifconfig (cs8900_ifconfig.name, SIOCSIFFLAGS, @@ -422,7 +422,7 @@ #define CS8900_SELF_STATUS_3_3_V (1 << 6) #define CS8900_SELF_STATUS_INITD (1 << 7) #define CS8900_SELF_STATUS_SIBUST (1 << 8) -#define CS8900_SELF_STATUS_EEPROM_PRESENT (1 << 9) +#define CS8900_SELF_STATUS_EEPROM_PRESENT (1 << 9) #define CS8900_SELF_STATUS_EEPROM_OK (1 << 10) #define CS8900_SELF_STATUS_EL_PRESENT (1 << 11) #define CS8900_SELF_STATUS_EE_SIZE (1 << 12) @@ -453,7 +453,7 @@ #define CS8900_TRACE_SIZE (400) /* - * The default receive queue size. If the BSP sets this field to + * The default receive queue size. If the BSP sets this field to * 0 this default is used. */ #define CS8900_RX_QUEUE_SIZE (30) @@ -489,12 +489,12 @@ typedef struct unsigned long tx_underrun_errors; unsigned long tx_dropped; unsigned long tx_resends; - + /* interrupt watch dog */ unsigned long int_swint_req; unsigned long int_swint_res; unsigned long int_lockup; - + unsigned long interrupts; } eth_statistics; @@ -538,7 +538,7 @@ typedef struct unsigned char mac_address[6]; /* - * The bsdnet information structure. + * The bsdnet information structure. */ struct arpcom arpcom; @@ -549,29 +549,29 @@ typedef struct int accept_bcast; int tx_active; - + rtems_id rx_task; rtems_id tx_task; - /* + /* * The queues. FIXME : these should be changed to be mbuf lists. */ struct mbuf *rx_ready_head; struct mbuf *rx_ready_tail; int rx_ready_len; - + struct mbuf *rx_loaded_head; struct mbuf *rx_loaded_tail; int rx_loaded_len; /* - * Number of mbufs queued for the interrupt handler to + * Number of mbufs queued for the interrupt handler to * loop reading. */ int rx_queue_size; - + #if CS8900_TRACE unsigned short trace_key[CS8900_TRACE_SIZE]; unsigned long trace_var[CS8900_TRACE_SIZE]; @@ -580,11 +580,11 @@ typedef struct #endif /** - * Standard(!) ethernet statistics + * Standard(!) ethernet statistics */ eth_statistics eth_stats; - + } cs8900_device; /* @@ -611,7 +611,7 @@ int cs8900_link_active (cs8900_device *cs); int cs8900_driver_attach (struct rtems_bsdnet_ifconfig *config, int attaching); - + /** * The BSP specific interrupt wrapper calls this function when a device * interrupt occurs. @@ -700,7 +700,7 @@ unsigned short cs8900_io_get_reg (cs8900_device *cs, unsigned short reg); * @param data The data to be written to the register. */ -void cs8900_mem_set_reg (cs8900_device *cs, +void cs8900_mem_set_reg (cs8900_device *cs, unsigned long reg, unsigned short data); /** diff --git a/c/src/libchip/network/dec21140.c b/c/src/libchip/network/dec21140.c index 9184b6648b..b7099cb3b7 100644 --- a/c/src/libchip/network/dec21140.c +++ b/c/src/libchip/network/dec21140.c @@ -82,7 +82,7 @@ #include #include #include - + #if defined(__i386__) #include #endif @@ -94,7 +94,7 @@ #undef malloc #endif #ifdef free -#undef free +#undef free #endif #define DEC_DEBUG @@ -158,12 +158,12 @@ #define CSR0_MODE 0x0020e002 /* 01b08000 */ #endif #define ROM_ADDRESS 0x00004800 -#define CSR6_INIT 0x022cc000 /* 022c0000 020c0000 */ -#define CSR6_TX 0x00002000 -#define CSR6_TXRX 0x00002002 +#define CSR6_INIT 0x022cc000 /* 022c0000 020c0000 */ +#define CSR6_TX 0x00002000 +#define CSR6_TXRX 0x00002002 #define IT_SETUP 0x000100c0 /* 000100e0 */ -#define CLEAR_IT 0xFFFFFFFF -#define NO_IT 0x00000000 +#define CLEAR_IT 0xFFFFFFFF +#define NO_IT 0x00000000 @@ -172,7 +172,7 @@ struct MD { /* used by hardware */ volatile uint32_t status; volatile uint32_t counts; - volatile uint32_t buf1, buf2; + volatile uint32_t buf1, buf2; /* used by software */ volatile struct mbuf *m; volatile struct MD *next; @@ -222,13 +222,13 @@ struct MD { ** events so only requesting units are serviced. */ -static rtems_event_set unit_signals[NDECDRIVER]= { RTEMS_EVENT_1, +static rtems_event_set unit_signals[NDECDRIVER]= { RTEMS_EVENT_1, RTEMS_EVENT_2, - RTEMS_EVENT_3, + RTEMS_EVENT_3, RTEMS_EVENT_4, - RTEMS_EVENT_5, + RTEMS_EVENT_5, RTEMS_EVENT_6, - RTEMS_EVENT_7, + RTEMS_EVENT_7, RTEMS_EVENT_8 }; @@ -279,7 +279,7 @@ struct dec21140_softc { volatile struct MD *nextRxMD; volatile unsigned char *bufferBase; int acceptBroadcast; - + volatile struct MD *TxMD; volatile struct MD *SentTxMD; int PendingTxCount; @@ -300,7 +300,7 @@ struct dec21140_softc { unsigned long rxBadCRC; unsigned long rxOverrun; unsigned long rxCollision; - + unsigned long txInterrupts; unsigned long txDeferred; unsigned long txHeartbeat; @@ -353,10 +353,10 @@ static int eeget16(volatile unsigned int *ioaddr, int location) int i; unsigned short retval = 0; int read_cmd = location | EE_READ_CMD; - + st_le32(ioaddr, EE_ENB & ~EE_CS); st_le32(ioaddr, EE_ENB); - + /* Shift the read command bits out. */ for (i = 10; i >= 0; i--) { short dataval = (read_cmd & (1 << i)) ? EE_DATA_WRITE : 0; @@ -368,7 +368,7 @@ static int eeget16(volatile unsigned int *ioaddr, int location) rtems_bsp_delay_in_bus_cycles(200); } st_le32(ioaddr, EE_ENB); - + for (i = 16; i > 0; i--) { st_le32(ioaddr, EE_ENB | EE_SHIFT_CLK); rtems_bsp_delay_in_bus_cycles(200); @@ -481,7 +481,7 @@ dec21140Enet_initialize_hardware (struct dec21140_softc *sc) { int i,st; volatile unsigned int *tbase; - volatile unsigned char *cp, *setup_frm, *eaddrs; + volatile unsigned char *cp, *setup_frm, *eaddrs; volatile unsigned char *buffer; volatile struct MD *rmd; @@ -503,16 +503,16 @@ dec21140Enet_initialize_hardware (struct dec21140_softc *sc) * WARNING : First write in CSR6 * Then Reset the chip ( 1 in CSR0) */ - st_le32( (tbase+memCSR6), CSR6_INIT); - st_le32( (tbase+memCSR0), RESET_CHIP); + st_le32( (tbase+memCSR6), CSR6_INIT); + st_le32( (tbase+memCSR0), RESET_CHIP); rtems_bsp_delay_in_bus_cycles(200); - st_le32( (tbase+memCSR7), NO_IT); + st_le32( (tbase+memCSR7), NO_IT); /* * Init CSR0 */ - st_le32( (tbase+memCSR0), CSR0_MODE); + st_le32( (tbase+memCSR0), CSR0_MODE); /* * Init RX ring @@ -523,7 +523,7 @@ dec21140Enet_initialize_hardware (struct dec21140_softc *sc) sc->bufferBase = cp; cp += (CPU_CACHE_ALIGNMENT_FOR_BUFFER - (int)cp) & (CPU_CACHE_ALIGNMENT_FOR_BUFFER - 1); #if defined(__i386__) -#ifdef PCI_BRIDGE_DOES_NOT_ENSURE_CACHE_COHERENCY_FOR_DMA +#ifdef PCI_BRIDGE_DOES_NOT_ENSURE_CACHE_COHERENCY_FOR_DMA if (_CPU_is_paging_enabled()) _CPU_change_memory_mapping_attribute (NULL, cp, @@ -542,7 +542,7 @@ dec21140Enet_initialize_hardware (struct dec21140_softc *sc) for (i=0 ; inumRxbuffers; i++) { struct mbuf *m; - + /* allocate an mbuf for each receive descriptor */ MGETHDR (m, M_WAIT, MT_DATA); MCLGET (m, M_WAIT); @@ -550,7 +550,7 @@ dec21140Enet_initialize_hardware (struct dec21140_softc *sc) rmd->m = m; rmd->buf2 = phys_to_bus(rmd+1); - rmd->buf1 = phys_to_bus(mtod(m, void *)); + rmd->buf1 = phys_to_bus(mtod(m, void *)); rmd->status = 0x80000000; rmd->counts = 0xfdc00000 | (RBUF_SIZE); rmd->next = rmd+1; @@ -576,7 +576,7 @@ dec21140Enet_initialize_hardware (struct dec21140_softc *sc) (rmd+i)->status = 0x0; (rmd+i)->next = rmd+i+1; (rmd+i)->m = 0; - } + } /* * mark last TX buffer. @@ -614,7 +614,7 @@ dec21140Enet_initialize_hardware (struct dec21140_softc *sc) st_le32( (tbase+memCSR1), 1); while (rmd->status != 0x7fffffff); - rmd->counts = 0x01000000; + rmd->counts = 0x01000000; sc->TxMD = rmd+1; @@ -680,7 +680,7 @@ dec21140_rxDaemon (void *arg) while((rmd->status & 0x80000000) == 0) { /* printk("unit %i rx\n", ifp->if_unit ); */ - + /* pass on the packet in the mbuf */ len = (rmd->status >> 16) & 0x7ff; m = (struct mbuf *)(rmd->m); @@ -698,7 +698,7 @@ dec21140_rxDaemon (void *arg) /* mark the descriptor as ready to receive */ rmd->status = 0x80000000; - + rmd=rmd->next; } @@ -729,7 +729,7 @@ sendpacket (struct ifnet *ifp, struct mbuf *m) tbase = dp->base; /* * Waiting for Transmitter ready - */ + */ tmd = dp->TxMD; n = m; @@ -741,7 +741,7 @@ sendpacket (struct ifnet *ifp, struct mbuf *m) len = 0; temp = (volatile unsigned char *)(bus_to_phys(tmd->buf1)); - + for (;;) { len += m->m_len; @@ -752,7 +752,7 @@ sendpacket (struct ifnet *ifp, struct mbuf *m) } if (len < ET_MINLEN) len = ET_MINLEN; - tmd->counts = 0xe1000000 | (len & 0x7ff); + tmd->counts = 0xe1000000 | (len & 0x7ff); tmd->status = 0x80000000; st_le32( (tbase+memCSR1), 0x1); @@ -778,13 +778,13 @@ dec21140_txDaemon (void *arg) int i; rtems_event_set events; - for (;;) + for (;;) { /* * Wait for packets bound for any of the dec units */ rtems_bsdnet_event_receive( RTEMS_ALL_EVENTS, - RTEMS_EVENT_ANY | RTEMS_WAIT, + RTEMS_EVENT_ANY | RTEMS_WAIT, RTEMS_NO_TIMEOUT, &events); for(i=0; i< NDECDRIVER; i++ ) @@ -799,7 +799,7 @@ dec21140_txDaemon (void *arg) /* * Send packets till queue is empty */ - for(;;) + for(;;) { IF_DEQUEUE(&ifp->if_snd, m); if( !m ) break; @@ -853,7 +853,7 @@ dec21140_init (void *arg) */ tbase = sc->base; st_le32( (tbase+memCSR5), IT_SETUP); - st_le32( (tbase+memCSR7), IT_SETUP); + st_le32( (tbase+memCSR7), IT_SETUP); st_le32( (unsigned int*)(tbase+memCSR6), CSR6_INIT | CSR6_TXRX); /* @@ -957,7 +957,7 @@ dec21140_ioctl (struct ifnet *ifp, int command, caddr_t data) case SIO_RTEMS_SHOW_STATS: dec21140_stats (sc); break; - + /* * FIXME: All sorts of multicast commands need to be added here! */ @@ -1044,7 +1044,7 @@ rtems_dec21140_driver_attach (struct rtems_bsdnet_ifconfig *config, int attach) if (pcib_init() == PCIB_ERR_NOTPRESENT) rtems_panic("PCI BIOS not found !!"); - + /* * Try to find the network card on the PCI bus. Probe for a DEC 21140 * card first. If not found probe the bus for a DEC/Intel 21143 card. @@ -1063,7 +1063,7 @@ rtems_dec21140_driver_attach (struct rtems_bsdnet_ifconfig *config, int attach) else rtems_panic("DEC PCI network card not found !!\n"); } -#endif +#endif #if defined(__PPC__) /* * Find the board @@ -1074,7 +1074,7 @@ rtems_dec21140_driver_attach (struct rtems_bsdnet_ifconfig *config, int attach) if( BSP_pciFindDevice( PCI_VENDOR_ID_DEC, PCI_DEVICE_ID_DEC_21143, unitNumber-1, &pbus, &pdev, &pfun) != -1 ) { - printk("dec21143 : found device '%s', PPC support has not been tested. Using it anyway.\n", + printk("dec21143 : found device '%s', PPC support has not been tested. Using it anyway.\n", config->name ); pci_write_config_dword(pbus, @@ -1092,9 +1092,9 @@ rtems_dec21140_driver_attach (struct rtems_bsdnet_ifconfig *config, int attach) } #ifdef DEC_DEBUG - else + else { - printk("dec21140 : found device '%s', bus 0x%02x, dev 0x%02x, func 0x%02x\n", + printk("dec21140 : found device '%s', bus 0x%02x, dev 0x%02x, func 0x%02x\n", config->name, pbus, pdev, pfun); } #endif @@ -1112,7 +1112,7 @@ rtems_dec21140_driver_attach (struct rtems_bsdnet_ifconfig *config, int attach) sc = &dec21140_softc[unitNumber - 1]; ifp = &sc->arpcom.ac_if; - if (ifp->if_softc != NULL) + if (ifp->if_softc != NULL) { printk("dec2114x : unit %i already in use.\n", unitNumber ); return 0; @@ -1125,7 +1125,7 @@ rtems_dec21140_driver_attach (struct rtems_bsdnet_ifconfig *config, int attach) sc->ioevent = unit_signals[unitNumber-1]; /* - ** Save the buffer counts + ** Save the buffer counts */ sc->numRxbuffers = (config->rbuf_count) ? config->rbuf_count : NRXBUFS; sc->numTxbuffers = (config->xbuf_count) ? config->xbuf_count : NTXBUFS; @@ -1142,7 +1142,7 @@ rtems_dec21140_driver_attach (struct rtems_bsdnet_ifconfig *config, int attach) pcib_conf_read32(signature, 16, &value); sc->port = value & ~IO_MASK; - + pcib_conf_read32(signature, 20, &value); if (_CPU_is_paging_enabled()) _CPU_map_phys_address((void **) &(sc->base), @@ -1151,7 +1151,7 @@ rtems_dec21140_driver_attach (struct rtems_bsdnet_ifconfig *config, int attach) PTE_CACHE_DISABLE | PTE_WRITABLE); else sc->base = (unsigned int *)(value & ~MEM_MASK); - + pcib_conf_read8(signature, 60, &interrupt); cvalue = interrupt; #endif @@ -1163,14 +1163,14 @@ rtems_dec21140_driver_attach (struct rtems_bsdnet_ifconfig *config, int attach) &lvalue); sc->port = lvalue & (unsigned int)(~IO_MASK); - + (void)pci_read_config_dword(pbus, pdev, pfun, PCI_BASE_ADDRESS_1, &lvalue); - tmp = (unsigned int)(lvalue & (unsigned int)(~MEM_MASK)) + tmp = (unsigned int)(lvalue & (unsigned int)(~MEM_MASK)) + (unsigned int)PCI_MEM_BASE; sc->base = (unsigned int *)(tmp); @@ -1191,8 +1191,8 @@ rtems_dec21140_driver_attach (struct rtems_bsdnet_ifconfig *config, int attach) pci_write_config_word(pbus, pdev, pfun, PCI_COMMAND, (uint16_t) ( PCI_COMMAND_MEMORY | - PCI_COMMAND_MASTER | - PCI_COMMAND_INVALIDATE | + PCI_COMMAND_MASTER | + PCI_COMMAND_INVALIDATE | PCI_COMMAND_WAIT | PCI_COMMAND_FAST_BACK ) ); #endif @@ -1230,7 +1230,7 @@ rtems_dec21140_driver_attach (struct rtems_bsdnet_ifconfig *config, int attach) for (i=0 ; i<(ETHER_ADDR_LEN/2); i++){ sc->arpcom.ac_enaddr[2*i] = rombuf.c[20+2*i+1]; sc->arpcom.ac_enaddr[2*i+1] = rombuf.c[20+2*i]; - } + } #endif #if defined(__PPC__) memcpy (sc->arpcom.ac_enaddr, rombuf.c+20, ETHER_ADDR_LEN); @@ -1276,11 +1276,11 @@ rtems_dec21140_driver_attach (struct rtems_bsdnet_ifconfig *config, int attach) /* * Start driver tasks if this is the first dec unit initialized */ - if (txDaemonTid == 0) + if (txDaemonTid == 0) { rxDaemonTid = rtems_bsdnet_newproc( "DCrx", 4096, dec21140_rxDaemon, NULL); - + txDaemonTid = rtems_bsdnet_newproc( "DCtx", 4096, dec21140_txDaemon, NULL); #ifdef DEC_DEBUG diff --git a/c/src/libchip/network/elnk.c b/c/src/libchip/network/elnk.c index 2f6bc18d0a..8ec84daed0 100644 --- a/c/src/libchip/network/elnk.c +++ b/c/src/libchip/network/elnk.c @@ -127,7 +127,7 @@ #undef malloc #endif #ifdef free -#undef free +#undef free #endif #define ELNK_DEBUG @@ -181,13 +181,13 @@ ** events so only requesting units are serviced. */ -static rtems_event_set unit_signals[NUM_UNITS]= { RTEMS_EVENT_1, +static rtems_event_set unit_signals[NUM_UNITS]= { RTEMS_EVENT_1, RTEMS_EVENT_2, - RTEMS_EVENT_3, + RTEMS_EVENT_3, RTEMS_EVENT_4, - RTEMS_EVENT_5, + RTEMS_EVENT_5, RTEMS_EVENT_6, - RTEMS_EVENT_7, + RTEMS_EVENT_7, RTEMS_EVENT_8 }; @@ -757,7 +757,7 @@ struct xl_mii_frame { -struct xl_stats +struct xl_stats { /* accumulated stats */ u_int16_t xl_carrier_lost; @@ -797,7 +797,7 @@ struct xl_stats -struct xl_type +struct xl_type { u_int16_t xl_vid; u_int16_t xl_did; @@ -876,7 +876,7 @@ static struct xl_type xl_devs[] = { /* rx message descriptor entry, ensure the struct is aligned to 8 bytes */ -struct RXMD +struct RXMD { /* used by hardware */ volatile uint32_t next; @@ -894,7 +894,7 @@ struct RXMD #define NUM_FRAGS 6 -/* +/* * tx message descriptor entry, ensure the struct is aligned to 8 bytes */ @@ -904,7 +904,7 @@ struct tfrag volatile uint32_t length; } __attribute__ ((packed)); -struct TXMD +struct TXMD { /* used by hardware */ volatile uint32_t next; @@ -926,7 +926,7 @@ struct TXMD /* * Per-device data */ -struct elnk_softc +struct elnk_softc { struct arpcom arpcom; @@ -1043,7 +1043,7 @@ xl_wait(sc) { register int i; - for(i = 0; i < XL_TIMEOUT; i++) + for(i = 0; i < XL_TIMEOUT; i++) { if (!(CSR_READ_2(sc, XL_STATUS) & XL_STAT_CMDBUSY)) break; @@ -1130,7 +1130,7 @@ static int xl_mii_readreg(sc, frame) struct elnk_softc *sc; struct xl_mii_frame *frame; - + { int i, ack; @@ -1141,7 +1141,7 @@ xl_mii_readreg(sc, frame) frame->mii_opcode = XL_MII_READOP; frame->mii_turnaround = 0; frame->mii_data = 0; - + /* * Select register window 4. */ @@ -1214,7 +1214,7 @@ static int xl_mii_writereg(sc, frame) struct elnk_softc *sc; struct xl_mii_frame *frame; - + { /* * Set up frame for TX. @@ -1223,7 +1223,7 @@ xl_mii_writereg(sc, frame) frame->mii_stdelim = XL_MII_STARTDELIM; frame->mii_opcode = XL_MII_WRITEOP; frame->mii_turnaround = XL_MII_TURNAROUND; - + /* * Select the window 4. */ @@ -1371,7 +1371,7 @@ xl_read_eeprom(sc, dest, off, cnt, swap) for (i = 0; i < cnt; i++) { if (sc->xl_flags & XL_FLAG_8BITROM) - CSR_WRITE_2(sc, XL_W0_EE_CMD, + CSR_WRITE_2(sc, XL_W0_EE_CMD, XL_EE_8BIT_READ | EEPROM_8BIT_OFFSET(off + i)); else CSR_WRITE_2(sc, XL_W0_EE_CMD, @@ -1384,7 +1384,7 @@ xl_read_eeprom(sc, dest, off, cnt, swap) if (swap) *ptr = ntohs(word); else - *ptr = word; + *ptr = word; } return(err ? 1 : 0); @@ -1403,12 +1403,12 @@ xl_stats_update(timerid,xsc) u_int32_t t1; sc->xl_stats.intstatus = CSR_READ_2(sc, XL_STATUS); - + sc->xl_stats.miianr = xl_miibus_readreg(sc, 0x18, MII_ANAR ); sc->xl_stats.miipar = xl_miibus_readreg(sc, 0x18, MII_ANLPAR ); sc->xl_stats.miistatus = xl_miibus_readreg(sc, 0x18, MII_BMSR ); sc->xl_stats.miicmd = xl_miibus_readreg(sc, 0x18, MII_BMCR ); - + XL_SEL_WIN(1); sc->xl_stats.rxstatus = CSR_READ_2(sc, XL_W1_RX_STATUS ); sc->xl_stats.txstatus = CSR_READ_1(sc, XL_W1_TX_STATUS ); @@ -1418,7 +1418,7 @@ xl_stats_update(timerid,xsc) sc->xl_stats.internalconfig = CSR_READ_4(sc, XL_W3_INTERNAL_CFG); sc->xl_stats.mac_control = CSR_READ_2(sc, XL_W3_MAC_CTRL); sc->xl_stats.txfree = CSR_READ_2(sc, XL_W3_FREE_TX ); - + /* Read all the stats registers. */ XL_SEL_WIN(6); @@ -1486,7 +1486,7 @@ xl_reset(sc) register int i; XL_SEL_WIN(0); - CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_RESET | + CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_RESET | ((sc->xl_flags & XL_FLAG_WEIRDRESET) ? XL_RESETOPT_DISADVFD:0)); @@ -1512,12 +1512,12 @@ xl_reset(sc) CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_TX_RESET); xl_wait(sc); - if (sc->xl_flags & XL_FLAG_INVERT_LED_PWR || - sc->xl_flags & XL_FLAG_INVERT_MII_PWR) + if (sc->xl_flags & XL_FLAG_INVERT_LED_PWR || + sc->xl_flags & XL_FLAG_INVERT_MII_PWR) { XL_SEL_WIN(2); CSR_WRITE_2(sc, XL_W2_RESET_OPTIONS, CSR_READ_2(sc, - XL_W2_RESET_OPTIONS) + XL_W2_RESET_OPTIONS) | ((sc->xl_flags & XL_FLAG_INVERT_LED_PWR)?XL_RESETOPT_INVERT_LED:0) | ((sc->xl_flags & XL_FLAG_INVERT_MII_PWR)?XL_RESETOPT_INVERT_MII:0) ); @@ -1896,7 +1896,7 @@ static int elnkIsOn(const rtems_irq_connect_data* irq) -static void +static void elnk_start_txchain( struct elnk_softc *sc, struct TXMD *chainhead ) { xl_wait(sc); @@ -1935,7 +1935,7 @@ elnk_interrupt_handler ( struct elnk_softc *sc ) printk("etherlink : unit elnk%d intstatus %04x\n", sc->xl_unit, status ); #endif - if (status & XL_STAT_UP_COMPLETE) + if (status & XL_STAT_UP_COMPLETE) { #if 0 printk("etherlink : unit elnk%d rx\n", sc->xl_unit ); @@ -1990,7 +1990,7 @@ elnk_interrupt_handler ( struct elnk_softc *sc ) */ if( (int)sc->last_txchain_head->chainptr == -1 ) { - /* + /* ** single packet was sent so no indirection to the last ** entry in the chain. since chainptr is != 0, then ** another chain is ready starting from the packet AFTER @@ -2032,18 +2032,18 @@ elnk_interrupt_handler ( struct elnk_softc *sc ) } - if (status & XL_STAT_ADFAIL) + if (status & XL_STAT_ADFAIL) { printk("etherlink : unit elnk%d Catastrophic bus failure\n", sc->xl_unit ); } - if (status & XL_STAT_STATSOFLOW) + if (status & XL_STAT_STATSOFLOW) { sc->xl_stats_no_timeout = 1; xl_stats_update(sc->stat_timer_id,sc); sc->xl_stats_no_timeout = 0; } } - + #if 0 { @@ -2102,13 +2102,13 @@ elnk_initialize_hardware (struct elnk_softc *sc) /* * Init RX ring */ - cp = (unsigned char *)malloc( (ringsize = ((rxsize = (sc->numRxbuffers * sizeof(struct RXMD))) + + cp = (unsigned char *)malloc( (ringsize = ((rxsize = (sc->numRxbuffers * sizeof(struct RXMD))) + (txsize = (sc->numTxbuffers * sizeof(struct TXMD)))) ) + + CPU_CACHE_ALIGNMENT_FOR_BUFFER); sc->bufferBase = cp; cp += (CPU_CACHE_ALIGNMENT_FOR_BUFFER - (int)cp) & (CPU_CACHE_ALIGNMENT_FOR_BUFFER - 1); #if defined(__i386__) -#ifdef PCI_BRIDGE_DOES_NOT_ENSURE_CACHE_COHERENCY_FOR_DMA +#ifdef PCI_BRIDGE_DOES_NOT_ENSURE_CACHE_COHERENCY_FOR_DMA if (_CPU_is_paging_enabled()) _CPU_change_memory_mapping_attribute (NULL, cp, ringsize, PTE_CACHE_DISABLE | PTE_WRITABLE); @@ -2124,7 +2124,7 @@ elnk_initialize_hardware (struct elnk_softc *sc) { struct mbuf *m; struct RXMD *nxtmd; - /* + /* * The rx ring is easy as its just an array of RXMD structs. New * mbuf entries are allocated from the stack whenever the rx * daemon forwards an incoming packet into it. Here, we @@ -2136,7 +2136,7 @@ elnk_initialize_hardware (struct elnk_softc *sc) { rtems_panic ("etherlink : unit elnk%d rx ring entry %d not aligned to 8 bytes\n", sc->xl_unit, i ); } - + /* allocate an mbuf for each receive descriptor */ MGETHDR (m, M_WAIT, MT_DATA); MCLGET (m, M_WAIT); @@ -2161,7 +2161,7 @@ elnk_initialize_hardware (struct elnk_softc *sc) { struct TXMD *thismd, *nxtmd; - /* + /* * The tx ring is more complex. Each MD has an array of fragment * descriptors that are loaded from each packet as they arrive * from the stack. Each packet gets one ring entry, this allows @@ -2217,7 +2217,7 @@ elnk_initialize_hardware (struct elnk_softc *sc) sc->arpcom.ac_enaddr[0], sc->arpcom.ac_enaddr[1], sc->arpcom.ac_enaddr[2], sc->arpcom.ac_enaddr[3], sc->arpcom.ac_enaddr[4], sc->arpcom.ac_enaddr[5], - sc->xl_unit, + sc->xl_unit, (unsigned)sc->ioaddr, sc->irqInfo.name ); #endif @@ -2291,13 +2291,13 @@ elnk_rxDaemon (void *arg) */ while( (rxstat = ld_le32(&rmd->status)) ) { - if (rxstat & XL_RXSTAT_UP_ERROR) + if (rxstat & XL_RXSTAT_UP_ERROR) { printk("unit %i up error\n", sc->xl_unit ); ifp->if_ierrors++; } - if( (rxstat & XL_RXSTAT_UP_CMPLT) ) + if( (rxstat & XL_RXSTAT_UP_CMPLT) ) { #if 0 @@ -2337,7 +2337,7 @@ elnk_rxDaemon (void *arg) } /* clear descriptor status */ rmd->status = 0; - + rmd = rmd->next_md; } @@ -2377,13 +2377,13 @@ elnk_txDaemon (void *arg) int chainCount,i; rtems_event_set events; - for (;;) + for (;;) { /* * Wait for any unit's signal to wake us up */ rtems_bsdnet_event_receive( RTEMS_ALL_EVENTS, - RTEMS_EVENT_ANY | RTEMS_WAIT, + RTEMS_EVENT_ANY | RTEMS_WAIT, RTEMS_NO_TIMEOUT, &events); for(i=0; i< NUM_UNITS; i++ ) @@ -2401,10 +2401,10 @@ elnk_txDaemon (void *arg) chainCount = 0; firstmd = NULL; - + lastmd = sc->last_tx_md; - for(;;) + for(;;) { /* ** Check the chain recovery queue whenever the tx @@ -2462,7 +2462,7 @@ elnk_txDaemon (void *arg) break; } - + IF_DEQUEUE(&ifp->if_snd, m); if( !m ) break; @@ -2482,7 +2482,7 @@ elnk_txDaemon (void *arg) if( m ) { printk("etherlink : unit elnk%d tx fragments exhausted, truncating packet!\n", sc->xl_unit); - st_le32( &nextmd->txfrags[NUM_FRAGS-1].length, XL_LAST_FRAG | + st_le32( &nextmd->txfrags[NUM_FRAGS-1].length, XL_LAST_FRAG | ld_le32( &nextmd->txfrags[NUM_FRAGS-1].length) ); } } @@ -2493,7 +2493,7 @@ elnk_txDaemon (void *arg) int i; printk("unit %d queued pkt (%08x) ", sc->xl_unit, (uint32_t)pkt ); for(delim="", i=0; i < sizeof(struct ether_header); i++, delim=":") - printk("%s%02x", delim, (char) pkt[i] ); + printk("%s%02x", delim, (char) pkt[i] ); printk("\n"); } #endif @@ -2504,7 +2504,7 @@ elnk_txDaemon (void *arg) st_le32( &nextmd->status, 0); if( !firstmd ) - { + { /* keep track of the first packet we add to the chain */ firstmd = nextmd; @@ -2540,21 +2540,21 @@ elnk_txDaemon (void *arg) /* save the last descriptor we set up in the chain */ sc->last_tx_md = lastmd; - /* + /* * We've added one or more packets to a chain, flag * the last packet so we get an dnComplete interrupt * when the card finishes accepting the chain */ st_le32( &lastmd->status, XL_TXSTAT_DL_INTR ); - /* + /* * point the chain head's chainptr to the tail so we * can jump to the next chain to send inside the isr. * If we're only sending one packet, then don't bother * with the link, as the chainptr value will either be * 0 if theres no next chain or -1 if there is. */ - if( chainCount > 1 ) + if( chainCount > 1 ) { firstmd->chainptr = lastmd; @@ -2562,7 +2562,7 @@ elnk_txDaemon (void *arg) if( ++sc->chlenIndex == NUM_CHAIN_LENGTHS ) sc->chlenIndex = 0; } - /* + /* ** clear the last packet's chainptr flag. If another ** chain is added later but before this chain is ** finished being sent, this flag on this packet will @@ -2571,19 +2571,19 @@ elnk_txDaemon (void *arg) lastmd->chainptr = NULL; #if 0 - printk("unit %d queued %d pkts, lastpkt status %08X\n", - sc->xl_unit, - chainCount, + printk("unit %d queued %d pkts, lastpkt status %08X\n", + sc->xl_unit, + chainCount, (uint32_t)ld_le32( &lastmd->status) ); #endif - if( sc->tx_idle == 0 && CSR_READ_4(sc, XL_DOWNLIST_PTR) == 0 ) + if( sc->tx_idle == 0 && CSR_READ_4(sc, XL_DOWNLIST_PTR) == 0 ) { printk("etherlink : unit elnk%d tx forced!\n", sc->xl_unit); sc->tx_idle = -1; } - /* + /* ** start sending this chain of packets if tx isn't ** busy, else the dnComplete interrupt will see there ** is another chain waiting and begin it immediately. @@ -2660,7 +2660,7 @@ elnk_init (void *arg) uint32_t cr,sr; xl_miibus_writereg(sc, 0x18, MII_BMCR, BMCR_RESET ); - + while( (cr = xl_miibus_readreg(sc, 0x18, MII_BMCR )) & BMCR_RESET ) { DELAY(100000); @@ -2669,7 +2669,7 @@ elnk_init (void *arg) xl_miibus_writereg(sc, 0x18, MII_ANAR, ANAR_10 | ANAR_TX | ANAR_10_FD | ANAR_TX_FD ); /* ANAR_T4 */ xl_miibus_writereg(sc, 0x18, MII_BMCR, BMCR_STARTNEG | BMCR_AUTOEN ); - while( ((sr = xl_miibus_readreg(sc, 0x18, MII_BMSR)) & BMSR_ACOMP) == 0 ); + while( ((sr = xl_miibus_readreg(sc, 0x18, MII_BMSR)) & BMSR_ACOMP) == 0 ); } @@ -2689,7 +2689,7 @@ elnk_init (void *arg) /* Init our MAC address */ XL_SEL_WIN(2); - for (i = 0; i < ETHER_ADDR_LEN; i++) + for (i = 0; i < ETHER_ADDR_LEN; i++) { CSR_WRITE_1(sc, XL_W2_STATION_ADDR_LO + i, sc->arpcom.ac_enaddr[i]); } @@ -2852,7 +2852,7 @@ elnk_init (void *arg) CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_COAX_STOP); /* increase packet size to allow reception of 802.1q or ISL packets */ - if (sc->xl_type == XL_TYPE_905B) + if (sc->xl_type == XL_TYPE_905B) CSR_WRITE_2(sc, XL_W3_MAXPKTSIZE, XL_PACKET_SIZE); /* Clear out the stats counters. */ @@ -2960,13 +2960,13 @@ elnk_stop (struct elnk_softc *sc) static void elnk_stats (struct elnk_softc *sc) { - printf(" MII PHY data { anr:%04x lpar:%04x stat:%04x ctl:%04x }\n", - sc->xl_stats.miianr, - sc->xl_stats.miipar, + printf(" MII PHY data { anr:%04x lpar:%04x stat:%04x ctl:%04x }\n", + sc->xl_stats.miianr, + sc->xl_stats.miipar, sc->xl_stats.miistatus, sc->xl_stats.miicmd); - printf(" internalcfg:%08x macctl:%04x dmactl:%08x\n", + printf(" internalcfg:%08x macctl:%04x dmactl:%08x\n", sc->xl_stats.internalconfig, sc->xl_stats.mac_control, sc->xl_stats.dmactl); @@ -3000,27 +3000,27 @@ elnk_stats (struct elnk_softc *sc) (totalLengths / numLengths) ); } - printf(" carrier_lost:%-5d sqe_errs:%-5d\n", - sc->xl_stats.xl_carrier_lost, + printf(" carrier_lost:%-5d sqe_errs:%-5d\n", + sc->xl_stats.xl_carrier_lost, sc->xl_stats.xl_sqe_errs); - printf(" tx_multi_collision:%-5d tx_single_collision:%-5d\n", - sc->xl_stats.xl_tx_multi_collision, + printf(" tx_multi_collision:%-5d tx_single_collision:%-5d\n", + sc->xl_stats.xl_tx_multi_collision, sc->xl_stats.xl_tx_single_collision); - printf(" tx_late_collision:%-5d rx_overrun:%-5d\n", - sc->xl_stats.xl_tx_late_collision, + printf(" tx_late_collision:%-5d rx_overrun:%-5d\n", + sc->xl_stats.xl_tx_late_collision, sc->xl_stats.xl_rx_overrun); - printf(" tx_deferred:%-5d badssd:%-5d\n", - sc->xl_stats.xl_tx_deferred, + printf(" tx_deferred:%-5d badssd:%-5d\n", + sc->xl_stats.xl_tx_deferred, sc->xl_stats.xl_badssd); - printf(" rx_frames_ok:%-9d tx_frames_ok:%-9d\n", + printf(" rx_frames_ok:%-9d tx_frames_ok:%-9d\n", sc->xl_stats.xl_rx_frames_ok, sc->xl_stats.xl_tx_frames_ok); - printf(" rx_bytes_ok:%-9d tx_bytes_ok:%-9d\n", + printf(" rx_bytes_ok:%-9d tx_bytes_ok:%-9d\n", sc->xl_stats.xl_rx_bytes_ok, sc->xl_stats.xl_tx_bytes_ok ); } @@ -3069,7 +3069,7 @@ elnk_ioctl (struct ifnet *ifp, int command, caddr_t data) case SIO_RTEMS_SHOW_STATS: elnk_stats (sc); break; - + /* * FIXME: All sorts of multicast commands need to be added here! */ @@ -3095,12 +3095,12 @@ static int iftap(struct ifnet *ifp, struct ether_header *eh, struct mbuf *m ) char *delim, *pkt; printk("unit %i, src ", ifp->if_unit ); - for(delim= "", i=0; i< ETHER_ADDR_LEN; i++, delim=":") + for(delim= "", i=0; i< ETHER_ADDR_LEN; i++, delim=":") printk("%s%02x", delim, (char) eh->ether_shost[i] ); printk(" dest "); - for(delim= "", i=0; i< ETHER_ADDR_LEN; i++, delim=":") + for(delim= "", i=0; i< ETHER_ADDR_LEN; i++, delim=":") printk("%s%02x", delim, (char) eh->ether_dhost[i] ); printk(" pkt "); @@ -3108,7 +3108,7 @@ static int iftap(struct ifnet *ifp, struct ether_header *eh, struct mbuf *m ) for(delim="", i=0; i < sizeof(struct ether_header); i++, delim=":") printk("%s%02x", delim, (char) pkt[i] ); - printk("\n"); + printk("\n"); return 0; } #endif @@ -3179,9 +3179,9 @@ rtems_elnk_driver_attach (struct rtems_bsdnet_ifconfig *config, int attach) */ for( i=0; !done && xl_devs[i].xl_vid; i++) { - for(unum= 1; !done && BSP_pciFindDevice( xl_devs[i].xl_vid, xl_devs[i].xl_did, unum-1, - &sysboards[numFound].pbus, - &sysboards[numFound].pdev, + for(unum= 1; !done && BSP_pciFindDevice( xl_devs[i].xl_vid, xl_devs[i].xl_did, unum-1, + &sysboards[numFound].pbus, + &sysboards[numFound].pdev, &sysboards[numFound].pfun)==0; unum++) { if( numFound == NUM_UNITS ) @@ -3254,7 +3254,7 @@ rtems_elnk_driver_attach (struct rtems_bsdnet_ifconfig *config, int attach) sc = &elnk_softc[unitNumber - 1]; ifp = &sc->arpcom.ac_if; - if (ifp->if_softc != NULL) + if (ifp->if_softc != NULL) { printk("etherlink : unit %i already in use.\n", unitNumber ); return 0; @@ -3287,9 +3287,9 @@ rtems_elnk_driver_attach (struct rtems_bsdnet_ifconfig *config, int attach) #ifdef ELNK_DEBUG - printk("etherlink : device '%s', name 'elnk%d', pci %02x:%02x.%02x, %d rx/%d tx buffers\n", - xl_devs[sc->xl_type].xl_name, sc->xl_unit, - pbus, pdev, pfun, + printk("etherlink : device '%s', name 'elnk%d', pci %02x:%02x.%02x, %d rx/%d tx buffers\n", + xl_devs[sc->xl_type].xl_name, sc->xl_unit, + pbus, pdev, pfun, sc->numRxbuffers, sc->numTxbuffers); #endif @@ -3329,9 +3329,9 @@ rtems_elnk_driver_attach (struct rtems_bsdnet_ifconfig *config, int attach) */ pci_write_config_word(pbus, pdev, pfun, PCI_COMMAND, - (uint16_t)( PCI_COMMAND_IO | - PCI_COMMAND_MASTER | - PCI_COMMAND_INVALIDATE | + (uint16_t)( PCI_COMMAND_IO | + PCI_COMMAND_MASTER | + PCI_COMMAND_INVALIDATE | PCI_COMMAND_WAIT ) ); /* * Get the device's base address @@ -3348,7 +3348,7 @@ rtems_elnk_driver_attach (struct rtems_bsdnet_ifconfig *config, int attach) pci_read_config_byte(pbus, pdev, pfun, PCI_INTERRUPT_LINE, &cvalue); -#endif +#endif memset(&sc->irqInfo,0,sizeof(rtems_irq_connect_data)); sc->irqInfo.name = cvalue; @@ -3373,7 +3373,7 @@ rtems_elnk_driver_attach (struct rtems_bsdnet_ifconfig *config, int attach) #if defined(__PPC__) pci_read_config_byte(pbus,pdev,pfun, PCI_LATENCY_TIMER, &pci_latency); #endif - if (pci_latency < new_latency) + if (pci_latency < new_latency) { printk("etherlink : unit elnk%d Overriding PCI latency, timer (CFLT) setting of %d, new value is %d.\n", sc->xl_unit, pci_latency, new_latency ); #if defined(__i386__) @@ -3429,8 +3429,8 @@ rtems_elnk_driver_attach (struct rtems_bsdnet_ifconfig *config, int attach) if (sc->deviceID == TC_DEVICEID_TORNADO_10_100BT_920B) sc->xl_flags |= XL_FLAG_PHYOK; - - if (config->hardware_address) + + if (config->hardware_address) { memcpy(sc->arpcom.ac_enaddr, config->hardware_address, ETHER_ADDR_LEN); } @@ -3441,7 +3441,7 @@ rtems_elnk_driver_attach (struct rtems_bsdnet_ifconfig *config, int attach) printk("etherlink : unit elnk%d Failed to read station address\n", sc->xl_unit ); return 0; } - memcpy((char *)&sc->arpcom.ac_enaddr, eaddr, ETHER_ADDR_LEN); + memcpy((char *)&sc->arpcom.ac_enaddr, eaddr, ETHER_ADDR_LEN); } /* @@ -3500,7 +3500,7 @@ rtems_elnk_driver_attach (struct rtems_bsdnet_ifconfig *config, int attach) printk("etherlink : unit elnk%d available media : %s\n", sc->xl_unit, &msg[1]); } - + XL_SEL_WIN(7); } @@ -3538,7 +3538,7 @@ rtems_elnk_driver_attach (struct rtems_bsdnet_ifconfig *config, int attach) /* * Start driver tasks if this is the first unit initialized */ - if (txDaemonTid == 0) + if (txDaemonTid == 0) { if( rtems_message_queue_create( rtems_build_name('X','L','c','r'), sc->numTxbuffers+1, @@ -3548,11 +3548,11 @@ rtems_elnk_driver_attach (struct rtems_bsdnet_ifconfig *config, int attach) { rtems_panic( "etherlink : Unable to create TX buffer recovery queue\n" ); } - + rxDaemonTid = rtems_bsdnet_newproc( "XLrx", 4096, elnk_rxDaemon, NULL); - + txDaemonTid = rtems_bsdnet_newproc( "XLtx", 4096, elnk_txDaemon, NULL); #ifdef ELNK_DEBUG diff --git a/c/src/libchip/network/i82586.c b/c/src/libchip/network/i82586.c index 788641d027..2afd015d8b 100644 --- a/c/src/libchip/network/i82586.c +++ b/c/src/libchip/network/i82586.c @@ -237,12 +237,12 @@ char *bitmask_snprintf(unsigned long value, const char *format, char *buf, int b { char *b = buf; int bit = 31; - + while (bit-- > *format) value <<= 1; format++; - + while (*format) { if (value & 0x80000000) @@ -252,13 +252,13 @@ char *bitmask_snprintf(unsigned long value, const char *format, char *buf, int b *b++ = '0'; *b++ = ','; - + while (bit-- > *format) value <<= 1; - + format++; } - + *b = '\0'; return buf; } @@ -268,7 +268,7 @@ char *ether_sprintf(unsigned char *addr) static char buf[32]; char *b = buf; int i; - + for (i = 0; i < ETHER_ADDR_LEN; i++) { sprintf(b, "%02x:", *addr++); @@ -309,17 +309,17 @@ i82586_attach(struct rtems_bsdnet_ifconfig *config, int attaching) char *name; int unit; int mtu; - + /* * Parse driver name */ - + if ((unit = rtems_bsdnet_parse_driver_name (config, &name)) < 0) return 0; - - sc = config->drv_ctrl; + + sc = config->drv_ctrl; ifp = &sc->arpcom.ac_if; - + #if I82586_DEBUG sc->sc_debug = 0; //IED_TINT | IED_XMIT; #endif @@ -331,18 +331,18 @@ i82586_attach(struct rtems_bsdnet_ifconfig *config, int attaching) printf ("Driver `%s' already in use.\n", config->name); return 0; } - + /* * Process options */ - + memcpy (sc->arpcom.ac_enaddr, config->hardware_address, ETHER_ADDR_LEN); - + if (config->mtu) mtu = config->mtu; else mtu = ETHERMTU; - + ifp->if_softc = sc; ifp->if_unit = unit; ifp->if_name = name; @@ -514,7 +514,7 @@ iexmit(struct ie_softc *sc) #if I82586_DEBUG I82586_TRACE(sc, I82586_TX_EMIT, cur); #endif - + #if I82586_DEBUG if (sc->sc_debug & IED_XMIT) printf("%s: xmit buffer %d\n", sc->arpcom.ac_if.if_name, cur); @@ -611,7 +611,7 @@ i82586_cmd_wait(struct ie_softc *sc) off = IE_SCB_STATUS(sc->scb); printf("i82586_cmd_wait: timo(%ssync): scb status: 0x%x, cmd: 0x%x\n", - sc->async_cmd_inprogress?"a":"", + sc->async_cmd_inprogress?"a":"", sc->ie_bus_read16(sc, off), cmd); return (1); /* Timeout */ @@ -726,7 +726,7 @@ i82586_intr(rtems_vector_number vec, void *arg) static unsigned long icnt = 0; I82586_TRACE(sc, I82586_INTS_REQ, icnt++); #endif - + /* * Implementation dependent interrupt handling. It must at least * disabled interrupts from the i82586. It is hoped this can @@ -756,7 +756,7 @@ i82586_intr_task(void *arg) u_int status; int off; int reset; - + /* * Not sure this is a good idea but as a out path exists and * roads lead to it, it seems ok. @@ -775,14 +775,14 @@ i82586_intr_task(void *arg) #endif reset = 0; - + while ((status & IE_ST_WHENCE) != 0) { #if I82586_DEBUG if (sc->sc_debug) printf ("%s: -------\n%s: scbstatus=0x%x\n", sc->arpcom.ac_if.if_name, sc->arpcom.ac_if.if_name, status); #endif - + #if 1 /* Ack interrupts FIRST in case we receive more during the ISR. */ ie_ack(sc, status & IE_ST_WHENCE); @@ -816,7 +816,7 @@ i82586_intr_task(void *arg) /* * Interrupt ACK was posted asynchronously; wait for * completion here before reading SCB status again. - * + * * If ACK fails, try to reset the chip, in hopes that * it helps. */ @@ -825,14 +825,14 @@ i82586_intr_task(void *arg) break; } #endif - + IE_BUS_BARRIER(sc, off, 2, BUS_SPACE_BARRIER_READ); status = sc->ie_bus_read16(sc, off); #if I82586_DEBUG I82586_TRACE(sc, I82586_INTS_LOOPS, status); #endif } - + if (reset) { #if I82586_DEBUG printf("%s: intr reset; status=0x%x\n", sc->arpcom.ac_if.if_name, status); @@ -840,11 +840,11 @@ i82586_intr_task(void *arg) i82586_cmd_wait(sc); i82586_reset(sc, 1); } - + #if I82586_DEBUG I82586_TRACE(sc, I82586_INTS_OUT, status); #endif - + if (sc->intrhook) (sc->intrhook)(sc, INTR_EXIT); } @@ -861,7 +861,7 @@ i82586_rint(struct ie_softc *sc, int scbstatus) #if I82586_DEBUG I82586_TRACE(sc, I82586_RX_INT, scbstatus); - + if (sc->sc_debug & IED_RINT) printf("%s: rint: status 0x%x\n", sc->arpcom.ac_if.if_name, scbstatus); @@ -904,7 +904,7 @@ i82586_rint(struct ie_softc *sc, int scbstatus) */ i82586_rx_errors(sc, i, status); drop = 1; - + #if I82586_DEBUG I82586_TRACE(sc, I82586_RX_DROP, status); #endif @@ -1294,7 +1294,7 @@ ie_readframe(struct ie_softc *sc, int num) /* frame number to read */ */ ether_input (&sc->arpcom.ac_if, eh, m); sc->arpcom.ac_if.if_ipackets++; - + #if I82586_DEBUG I82586_TRACE(sc, I82586_RX_OK, sc->arpcom.ac_if.if_ipackets); #endif @@ -1309,14 +1309,14 @@ void i82586_start(struct ifnet *ifp) { struct ie_softc *sc = ifp->if_softc; - + if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING) return; - + #if I82586_DEBUG I82586_TRACE(sc, I82586_TX_REQ, sc->xmit_busy); #endif - + rtems_event_send (sc->tx_task, i82586_TX_EVENT); } @@ -1330,10 +1330,10 @@ i82586_tx_task(void *arg) rtems_bsdnet_event_receive (i82586_TX_EVENT, RTEMS_WAIT | RTEMS_EVENT_ANY, 0, &events); - + #if I82586_DEBUG I82586_TRACE(sc, I82586_TX_EVT, sc->xmit_busy); - + if (sc->sc_debug) printf ("%s: =======\n", sc->arpcom.ac_if.if_name); #endif @@ -1350,11 +1350,11 @@ i82586_start_tx(struct ie_softc *sc) int buffer, head, xbase; u_short len; int s; - + #if I82586_DEBUG I82586_TRACE(sc, I82586_START_TX, sc->xmit_busy); #endif - + if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING) { #if I82586_DEBUG @@ -1362,7 +1362,7 @@ i82586_start_tx(struct ie_softc *sc) #endif return; } - + for (;;) { if (sc->xmit_busy == NTXBUF) { ifp->if_flags |= IFF_OACTIVE; @@ -1421,14 +1421,14 @@ i82586_start_tx(struct ie_softc *sc) #if I82586_DEBUG I82586_TRACE(sc, I82586_TX_START, sc->xmit_busy); #endif - + s = splnet(); /* Start the first packet transmitting. */ if (sc->xmit_busy == 0) iexmit(sc); sc->xmit_busy++; - + splx(s); } } @@ -1770,7 +1770,7 @@ ie_ia_setup(struct ie_softc *sc, int cmdbuf) (sc->memcopyout)(sc, sc->arpcom.ac_enaddr, IE_CMD_IAS_EADDR(cmdbuf), ETHER_ADDR_LEN); - + cmdresult = i82586_start_cmd(sc, IE_CUC_START, cmdbuf, IE_STAT_COMPL, 0); status = sc->ie_bus_read16(sc, IE_CMD_COMMON_STATUS(cmdbuf)); if (cmdresult != 0) { @@ -1852,13 +1852,13 @@ i82586_init(void *arg) sc->trace_flow_wrap = 0; #endif sc->trace_flow_in = 0; - + cmd = sc->buf_area; - + #if I82586_DEBUG printf ("%s: sc_debug at 0x%08x\n", sc->arpcom.ac_if.if_name, (unsigned int) &sc->sc_debug); #endif - + /* * Send the configure command first. */ @@ -1923,7 +1923,7 @@ i82586_start_transceiver(struct ie_softc *sc) #if I82586_DEBUG I82586_TRACE(sc, I82586_RX_START, 0); #endif - + /* * Start RU at current position in frame & RBD lists. */ @@ -2075,7 +2075,7 @@ void i82586_mediastatus(struct ifnet *ifp, struct ifmediareq *ifmr) { struct ie_softc *sc = ifp->if_softc; - + if (sc->sc_mediastatus) (*sc->sc_mediastatus)(sc, ifmr); } @@ -2104,13 +2104,13 @@ print_softie(struct ie_softc *sc) "TX_ACTIVE", "TRACE_CNT" }; - + int i; - + printf("i82586 %s:\n", sc->arpcom.ac_if.if_name); printf(" iobase=%p\n", sc->sc_iobase); - + printf(" scp=0x%08x\t\tiscp=0x%08x\t\tscb=0x%08x\n", sc->scp, sc->iscp, sc->scb); printf(" buf_area=0x%08x\tbuf_area_sz=0x%08x\n", @@ -2139,7 +2139,7 @@ print_softie(struct ie_softc *sc) int in; int lfdone = 0; char *tabs; - + if (!sc->trace_flow_wrap) { cnt = sc->trace_flow_in; in = 0; @@ -2152,7 +2152,7 @@ print_softie(struct ie_softc *sc) sc->trace_flow_in = sc->trace_flow_wrap = 0; cnt /= 2; - + for (i = 0; i < cnt; i++) { if (!lfdone) { switch (sc->trace_flow[in]) { @@ -2168,7 +2168,7 @@ print_softie(struct ie_softc *sc) tabs = "\t\t"; else tabs = "\t"; - + printf(" %d\t%s%s0x%08x (%d)\n", i, trace_labels[sc->trace_flow[in]], tabs, sc->trace_flow[in + 1], sc->trace_flow[in + 1]); @@ -2179,9 +2179,9 @@ print_softie(struct ie_softc *sc) lfdone = 1; printf("\n"); } - + in += 2; - + if (in >= I82586_TRACE_FLOW) in = 0; } diff --git a/c/src/libchip/network/i82586reg.h b/c/src/libchip/network/i82586reg.h index bd5024563c..6ee381b091 100644 --- a/c/src/libchip/network/i82586reg.h +++ b/c/src/libchip/network/i82586reg.h @@ -260,7 +260,7 @@ struct __ie_recv_buf_desc { * All commands share this in common. *- struct __ie_cmd_common { - u_int16_t ie_cmd_status; // status of this command + u_int16_t ie_cmd_status; // status of this command u_int16_t ie_cmd_cmd; // command word u_int16_t ie_cmd_link; // link to next command }; diff --git a/c/src/libchip/network/i82586var.h b/c/src/libchip/network/i82586var.h index f250fe03d0..c9421a6732 100644 --- a/c/src/libchip/network/i82586var.h +++ b/c/src/libchip/network/i82586var.h @@ -199,7 +199,7 @@ struct ie_softc { struct arpcom arpcom; /* - * For RTEMS we run the tx and rx handlers under a task due to the + * For RTEMS we run the tx and rx handlers under a task due to the * network semaphore stuff. */ @@ -225,7 +225,7 @@ struct ie_softc { u_int16_t value); void (*ie_bus_write24) (struct ie_softc *, int offset, int addr); - void (*ie_bus_barrier) (struct ie_softc *, int offset, + void (*ie_bus_barrier) (struct ie_softc *, int offset, int length, int flags); /* Media management */ @@ -296,9 +296,9 @@ do { rtems_interrupt_level level; rtems_interrupt_disable (level); \ int sc_debug; unsigned int trace_flow[I82586_TRACE_FLOW * 2]; - unsigned int trace_flow_wrap; + unsigned int trace_flow_wrap; #endif - unsigned int trace_flow_in; + unsigned int trace_flow_in; }; /* Exported functions */ diff --git a/c/src/libchip/network/if_fxp.c b/c/src/libchip/network/if_fxp.c index c72e90c7d7..0de7c2a508 100644 --- a/c/src/libchip/network/if_fxp.c +++ b/c/src/libchip/network/if_fxp.c @@ -427,7 +427,7 @@ rtems_fxp_attach(struct rtems_bsdnet_ifconfig *config, int attaching) */ if ((unitNumber = rtems_bsdnet_parse_driver_name (config, &unitName)) < 0) return 0; - + /* * Is driver free? */ @@ -448,7 +448,7 @@ rtems_fxp_attach(struct rtems_bsdnet_ifconfig *config, int attaching) callout_handle_init(&sc->stat_ch); mtx_init(&sc->sc_mtx, device_get_nameunit(dev), MTX_DEF | MTX_RECURSE); #endif - s = splimp(); + s = splimp(); /* * init PCI Bios interface... @@ -459,10 +459,10 @@ rtems_fxp_attach(struct rtems_bsdnet_ifconfig *config, int attaching) device_printf(dev, "could not initialize pci bios interface\n"); return 0; } - + /* * find device on pci bus - */ + */ { int j; for (j=0; fxp_ident_table[j].devid; j++ ) { @@ -475,7 +475,7 @@ rtems_fxp_attach(struct rtems_bsdnet_ifconfig *config, int attaching) i,sc->pci_signature); if (PCIB_ERR_SUCCESS == i) break; - } + } } /* @@ -485,7 +485,7 @@ rtems_fxp_attach(struct rtems_bsdnet_ifconfig *config, int attaching) device_printf(dev, "could not find 82559ER device\n"); return 0; } - + /* * Enable bus mastering. Enable memory space too, in case @@ -572,7 +572,7 @@ rtems_fxp_attach(struct rtems_bsdnet_ifconfig *config, int attaching) sc->pci_regs_are_io = TRUE; pcib_conf_read32(sc->pci_signature, PCI_BASE_ADDRESS_1, - &val32); + &val32); sc->pci_regs_base = val32 & PCI_BASE_ADDRESS_IO_MASK; } else { @@ -599,7 +599,7 @@ rtems_fxp_attach(struct rtems_bsdnet_ifconfig *config, int attaching) sc->irqInfo.hdl = (rtems_irq_hdl)fxp_intr; sc->irqInfo.on = nopOn; sc->irqInfo.off = nopOn; - sc->irqInfo.isOn = fxpIsOn; + sc->irqInfo.isOn = fxpIsOn; s = BSP_install_rtems_irq_handler (&sc->irqInfo); if (!s) rtems_panic ("Can't attach fxp interrupt handler for irq %d\n", @@ -616,7 +616,7 @@ rtems_fxp_attach(struct rtems_bsdnet_ifconfig *config, int attaching) DBGLVL_PRINTK(3,"fxp_attach: sc->cbl_base = 0x%x\n",sc->cbl_base); if (sc->cbl_base == NULL) goto failmem; - else + else memset(sc->cbl_base, 0, sizeof(struct fxp_cb_tx) * FXP_NTXCB); sc->fxp_stats = malloc(sizeof(struct fxp_stats), M_DEVBUF, @@ -669,7 +669,7 @@ rtems_fxp_attach(struct rtems_bsdnet_ifconfig *config, int attaching) * * Systems based on the ICH2/ICH2-M chip from Intel have a defect * where the chip can cause a PCI protocol violation if it receives - * a CU_RESUME command when it is entering the IDLE state. The + * a CU_RESUME command when it is entering the IDLE state. The * workaround is to disable Dynamic Standby Mode, so the chip never * deasserts CLKRUN#, and always remains in an active state. * @@ -706,7 +706,7 @@ rtems_fxp_attach(struct rtems_bsdnet_ifconfig *config, int attaching) "EEPROM checksum @ 0x%x: 0x%x -> 0x%x\n", i, data, cksum); /* - * We need to do a full PCI reset here. A software + * We need to do a full PCI reset here. A software * reset to the port doesn't cut it, but let's try * anyway. */ @@ -951,7 +951,7 @@ fxp_stats(struct fxp_softc *sc) printf (" Input errors:%-8lu\n", ifp->if_ierrors); } -static void +static void fxp_eeprom_shiftin(struct fxp_softc *sc, int data, int length) { u_int16_t reg; @@ -1236,7 +1236,7 @@ tbdinit: ifp->if_timer = 5; } txp->tx_threshold = tx_threshold; - + /* * Advance the end of list forward. */ @@ -1290,7 +1290,7 @@ tbdinit: static rtems_isr fxp_intr(rtems_vector_number v) { /* - * FIXME: currently only works with one interface... + * FIXME: currently only works with one interface... */ struct fxp_softc *sc = &(fxp_softc[0]); @@ -1333,11 +1333,11 @@ static void fxp_daemon(void *xsc) #ifdef NOTUSED /* * It should not be possible to have all bits set; the - * FXP_SCB_INTR_SWI bit always returns 0 on a read. If + * FXP_SCB_INTR_SWI bit always returns 0 on a read. If * all bits are set, this may indicate that the card has * been physically ejected, so ignore it. - */ - if (statack == 0xff) + */ + if (statack == 0xff) return; #endif @@ -1516,7 +1516,7 @@ fxp_tick(void *xsc) * with external storage to be released in a timely manner rather * than being defered for a potentially long time. This limits * the delay to a maximum of one second. - */ + */ for (txp = sc->cbl_first; sc->tx_queued && (txp->cb_status & FXP_CB_STATUS_C) != 0; txp = txp->next) { @@ -1579,7 +1579,7 @@ fxp_tick(void *xsc) } else if (sc->stat_ch == fxp_timeout_stop_rq) { sc->stat_ch = fxp_timeout_stopped; - } + } } /* diff --git a/c/src/libchip/network/if_fxpreg.h b/c/src/libchip/network/if_fxpreg.h index 28bf3b98ea..9bf4e59ff5 100644 --- a/c/src/libchip/network/if_fxpreg.h +++ b/c/src/libchip/network/if_fxpreg.h @@ -226,7 +226,7 @@ struct fxp_cb_mcs { * chosen to make the total struct size an even power of two. It's * critical that no TxCB be split across a page boundry since * no attempt is made to allocate physically contiguous memory. - * + * */ #ifdef __alpha__ /* XXX - should be conditional on pointer size */ #define FXP_NTXSEG 28 @@ -251,7 +251,7 @@ struct fxp_cb_tx { /* * The following structure isn't actually part of the TxCB, * unless the extended TxCB feature is being used. In this - * case, the first two elements of the structure below are + * case, the first two elements of the structure below are * fetched along with the TxCB. */ volatile struct fxp_tbd tbd[FXP_NTXSEG]; @@ -331,7 +331,7 @@ struct fxp_stats { }; #define FXP_STATS_DUMP_COMPLETE 0xa005 #define FXP_STATS_DR_COMPLETE 0xa007 - + /* * Serial EEPROM control register bits */ diff --git a/c/src/libchip/network/if_fxpvar.h b/c/src/libchip/network/if_fxpvar.h index 710d3ffaf2..1c61dda945 100644 --- a/c/src/libchip/network/if_fxpvar.h +++ b/c/src/libchip/network/if_fxpvar.h @@ -1,13 +1,13 @@ -/* +/* * Copyright (c) 1995, David Greenman * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions - * are met: + * are met: * 1. Redistributions of source code must retain the above copyright * notice unmodified, this list of conditions, and the following - * disclaimer. + * disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. @@ -119,7 +119,7 @@ struct fxp_softc { struct fxp_cb_tx *cbl_last; /* last active TxCB in list */ struct fxp_stats *fxp_stats; /* Pointer to interface stats */ int rx_idle_secs; /* # of seconds RX has been idle */ - enum {fxp_timeout_stopped,fxp_timeout_running,fxp_timeout_stop_rq} + enum {fxp_timeout_stopped,fxp_timeout_running,fxp_timeout_stop_rq} stat_ch; /* status of status updater */ struct fxp_cb_tx *cbl_base; /* base of TxCB list */ struct fxp_cb_mcs *mcsp; /* Pointer to mcast setup descriptor */ @@ -194,7 +194,7 @@ struct fxp_softc { *((u_int32_t*)((u_int8_t*)((sc)->pci_regs_base)+(reg))) = val; \ }while (0) -#endif +#endif #define sc_if arpcom.ac_if diff --git a/c/src/libchip/network/mii.h b/c/src/libchip/network/mii.h index dca3ff4ed5..14e45b0462 100644 --- a/c/src/libchip/network/mii.h +++ b/c/src/libchip/network/mii.h @@ -1,5 +1,5 @@ /* $NetBSD: mii.h,v 1.9 2001/05/31 03:07:14 thorpej Exp $ */ - + /* * Copyright (c) 1997 Manuel Bouyer. All rights reserved. * diff --git a/c/src/libchip/network/open_eth.c b/c/src/libchip/network/open_eth.c index 4ba88f85c2..fdbbf78ae3 100644 --- a/c/src/libchip/network/open_eth.c +++ b/c/src/libchip/network/open_eth.c @@ -240,13 +240,13 @@ open_eth_initialize_hardware (struct open_eth_softc *sc) #ifdef OETH_RATE_10MHZ mii_cr = 0; #endif - write_mii(0, mii_cr | 0x8000); + write_mii(0, mii_cr | 0x8000); while (read_mii(0) & 0x8000) {} write_mii(20, 0x1422); #ifdef OETH_RATE_10MHZ mii_cr = 0; #endif - write_mii(0, mii_cr); + write_mii(0, mii_cr); printf("open_eth: driver attached, PHY config : 0x%04x\n", read_mii(0)); #ifdef OPEN_ETH_DEBUG diff --git a/c/src/libchip/network/open_eth.h b/c/src/libchip/network/open_eth.h index 88627d178d..88d05255d8 100644 --- a/c/src/libchip/network/open_eth.h +++ b/c/src/libchip/network/open_eth.h @@ -52,14 +52,14 @@ typedef struct _oeth_regs { #define OETH_TOTAL_BD 128 #define OETH_MAXBUF_LEN 0x610 - -/* Tx BD */ + +/* Tx BD */ #define OETH_TX_BD_READY 0x8000 /* Tx BD Ready */ #define OETH_TX_BD_IRQ 0x4000 /* Tx BD IRQ Enable */ #define OETH_TX_BD_WRAP 0x2000 /* Tx BD Wrap (last BD) */ #define OETH_TX_BD_PAD 0x1000 /* Tx BD Pad Enable */ #define OETH_TX_BD_CRC 0x0800 /* Tx BD CRC Enable */ - + #define OETH_TX_BD_UNDERRUN 0x0100 /* Tx BD Underrun Status */ #define OETH_TX_BD_RETRY 0x00F0 /* Tx BD Retry Status */ #define OETH_TX_BD_RETLIM 0x0008 /* Tx BD Retransmission Limit Status */ @@ -72,12 +72,12 @@ typedef struct _oeth_regs { OETH_TX_BD_LATECOL | \ OETH_TX_BD_DEFER | \ OETH_TX_BD_CARRIER) - -/* Rx BD */ + +/* Rx BD */ #define OETH_RX_BD_EMPTY 0x8000 /* Rx BD Empty */ #define OETH_RX_BD_IRQ 0x4000 /* Rx BD IRQ Enable */ #define OETH_RX_BD_WRAP 0x2000 /* Rx BD Wrap (last BD) */ - + #define OETH_RX_BD_MISS 0x0080 /* Rx BD Miss Status */ #define OETH_RX_BD_OVERRUN 0x0040 /* Rx BD Overrun Status */ #define OETH_RX_BD_INVSIMB 0x0020 /* Rx BD Invalid Symbol Status */ @@ -113,7 +113,7 @@ typedef struct _oeth_regs { #define OETH_MODER_HUGEN 0x00004000 /* Huge Enable */ #define OETH_MODER_PAD 0x00008000 /* Pad Enable */ #define OETH_MODER_RECSMALL 0x00010000 /* Receive Small */ - + /* Interrupt Source Register */ #define OETH_INT_TXB 0x00000001 /* Transmit Buffer IRQ */ #define OETH_INT_TXE 0x00000002 /* Transmit Error IRQ */ @@ -131,26 +131,26 @@ typedef struct _oeth_regs { #define OETH_INT_MASK_BUSY 0x00000010 /* Busy IRQ Mask */ #define OETH_INT_MASK_TXC 0x00000020 /* Transmit Control Frame IRQ Mask */ #define OETH_INT_MASK_RXC 0x00000040 /* Received Control Frame IRQ Mask */ - + /* Control Module Mode Register */ #define OETH_CTRLMODER_PASSALL 0x00000001 /* Pass Control Frames */ #define OETH_CTRLMODER_RXFLOW 0x00000002 /* Receive Control Flow Enable */ #define OETH_CTRLMODER_TXFLOW 0x00000004 /* Transmit Control Flow Enable */ - -/* MII Mode Register */ + +/* MII Mode Register */ #define OETH_MIIMODER_CLKDIV 0x000000FF /* Clock Divider */ #define OETH_MIIMODER_NOPRE 0x00000100 /* No Preamble */ #define OETH_MIIMODER_RST 0x00000200 /* MIIM Reset */ - + /* MII Command Register */ #define OETH_MIICOMMAND_SCANSTAT 0x00000001 /* Scan Status */ #define OETH_MIICOMMAND_RSTAT 0x00000002 /* Read Status */ #define OETH_MIICOMMAND_WCTRLDATA 0x00000004 /* Write Control Data */ - + /* MII Address Register */ #define OETH_MIIADDRESS_FIAD 0x0000001F /* PHY Address */ #define OETH_MIIADDRESS_RGAD 0x00001F00 /* RGAD Address */ - + /* MII Status Register */ #define OETH_MIISTATUS_LINKFAIL 0x00000001 /* Link Fail */ #define OETH_MIISTATUS_BUSY 0x00000002 /* MII Busy */ diff --git a/c/src/libchip/network/sonic.c b/c/src/libchip/network/sonic.c index a70782be2b..644653ebab 100644 --- a/c/src/libchip/network/sonic.c +++ b/c/src/libchip/network/sonic.c @@ -27,9 +27,9 @@ * which had a 100 Mhz PPC603e. * * This driver also works with DP83934CVUL-20/25 MHz, tested on - * Tharsys ERC32 VME board. + * Tharsys ERC32 VME board. * - * Rehaul to fix lost interrupts and buffers, and to use to use + * Rehaul to fix lost interrupts and buffers, and to use to use * interrupt-free transmission by Jiri, 22/03/1999. */ @@ -55,7 +55,7 @@ #include /* - * XXX fix this + * XXX fix this */ void *set_vector(void *, uint32_t, uint32_t); @@ -68,7 +68,7 @@ void *set_vector(void *, uint32_t, uint32_t); * Use the top line if you want more symbols. */ -#define SONIC_STATIC +#define SONIC_STATIC /* #define SONIC_STATIC static */ /* @@ -79,7 +79,7 @@ void *set_vector(void *, uint32_t, uint32_t); #endif /* - * + * * As suggested by National Application Note 746, make the * receive resource area bigger than the receive descriptor area. * @@ -138,11 +138,11 @@ struct sonic_softc { void *sonic; /* - * Register access routines + * Register access routines */ sonic_write_register_t write_register; sonic_read_register_t read_register; - + /* * Interrupt vector */ @@ -480,7 +480,7 @@ SONIC_STATIC void sonic_retire_tda (struct sonic_softc *sc) #if (SONIC_DEBUG & SONIC_DEBUG_ERRORS) /* - * If there is an error that was not a collision, + * If there is an error that was not a collision, * then someone may want to see it. */ @@ -588,13 +588,13 @@ SONIC_STATIC void sonic_sendpacket (struct ifnet *ifp, struct mbuf *m) */ while (sc->tdaHead->next->status != 0) { - + /* * Free up transmit descriptors */ sonic_retire_tda (sc); - if (sc->tdaHead->next->status == 0) + if (sc->tdaHead->next->status == 0) break; #if (SONIC_DEBUG & SONIC_DEBUG_ERRORS) @@ -893,12 +893,12 @@ SONIC_STATIC void sonic_rda_wait( * Routine to align the received packet so that the ip header * is on a 32-bit boundary. Necessary for cpu's that do not * allow unaligned loads and stores and when the 32-bit DMA - * mode is used. - * - * Transfers are done on word basis to avoid possibly slow byte + * mode is used. + * + * Transfers are done on word basis to avoid possibly slow byte * and half-word writes. */ - + void ipalign(struct mbuf *m) { unsigned int *first, *last, data; @@ -979,7 +979,7 @@ SONIC_STATIC void sonic_rxDaemon (void *arg) sonic_print_rx_descriptor( rdp ); if ((LSW(rdp->mbufp->m_data) != rdp->pkt_lsw) || (MSW(rdp->mbufp->m_data) != rdp->pkt_msw)) - printf ("SONIC RDA/RRA %p, %08x\n",rdp->mbufp->m_data,(rdp->pkt_msw << 16) | + printf ("SONIC RDA/RRA %p, %08x\n",rdp->mbufp->m_data,(rdp->pkt_msw << 16) | (rdp->pkt_lsw & 0x0ffff)); #endif rdp->byte_count &= 0x0ffff; /* ERC32 pollutes msb of byte_count */ @@ -989,7 +989,7 @@ SONIC_STATIC void sonic_rxDaemon (void *arg) sizeof(struct ether_header); eh = mtod (m, struct ether_header *); m->m_data += sizeof(struct ether_header); - + #ifdef CPU_U32_FIX ipalign(m); /* Align packet on 32-bit boundary */ #endif @@ -1122,7 +1122,7 @@ SONIC_STATIC void sonic_initialize_hardware(struct sonic_softc *sc) if ( (*sc->read_register)( rp, SONIC_REG_SR ) <= SONIC_REVISION_B ) { rtems_fatal_error_occurred( 0x0BADF00D ); /* don't eat this part :) */ } - + /* * Set up circular linked list in Transmit Descriptor Area. * Use the PINT bit in the transmit configuration field to @@ -1138,11 +1138,11 @@ SONIC_STATIC void sonic_initialize_hardware(struct sonic_softc *sc) tdp = sc->tdaTail; for (i = 0 ; i < sc->tdaCount ; i++) { /* - * Start off with the table of outstanding mbuf's + * Start off with the table of outstanding mbuf's */ /* - * status, pkt_config, pkt_size, and all fragment fields + * status, pkt_config, pkt_size, and all fragment fields * are set to zero by sonic_allocate. */ @@ -1176,7 +1176,7 @@ SONIC_STATIC void sonic_initialize_hardware(struct sonic_softc *sc) */ sc->rda = sonic_allocate( - (sc->rdaCount * sizeof(ReceiveDescriptor_t)) + + (sc->rdaCount * sizeof(ReceiveDescriptor_t)) + sizeof(CamDescriptor_t) ); sc->cdp = (CamDescriptorPointer_t) ((unsigned char *)sc->rda + (sc->rdaCount * sizeof(ReceiveDescriptor_t))); @@ -1204,7 +1204,7 @@ SONIC_STATIC void sonic_initialize_hardware(struct sonic_softc *sc) ordp->next = sc->rda; ordp->link = LSW(sc->rda) | RDA_LINK_EOL; sc->rdp_last = ordp; - + /* * Allocate the receive resource area. * In accordance with National Application Note 746, make the @@ -1232,7 +1232,7 @@ SONIC_STATIC void sonic_initialize_hardware(struct sonic_softc *sc) * so we can find the mbuf when the SONIC returns the buffer * to the driver. */ - + MGETHDR (m, M_WAIT, MT_DATA); MCLGET (m, M_WAIT); m->m_pkthdr.rcvif = &sc->arpcom.ac_if; @@ -1374,7 +1374,7 @@ SONIC_STATIC void sonic_initialize_hardware(struct sonic_softc *sc) (*sc->write_register)( rp, SONIC_REG_CEP, 0 ); /* Select first entry in CAM */ printf ("Loaded Ethernet address into SONIC CAM.\n" " Wrote %04x%04x%04x - %#x\n" - " Read %04x%04x%04x - %#x\n", + " Read %04x%04x%04x - %#x\n", cdp->cap2, cdp->cap1, cdp->cap0, cdp->ce, (*sc->read_register)( rp, SONIC_REG_CAP2 ), (*sc->read_register)( rp, SONIC_REG_CAP1 ), @@ -1388,7 +1388,7 @@ SONIC_STATIC void sonic_initialize_hardware(struct sonic_softc *sc) || ((*sc->read_register)( rp, SONIC_REG_CE ) != cdp->ce)) { printf ("Failed to load Ethernet address into SONIC CAM.\n" " Wrote %04x%04x%04x - %#x\n" - " Read %04x%04x%04x - %#x\n", + " Read %04x%04x%04x - %#x\n", cdp->cap2, cdp->cap1, cdp->cap0, cdp->ce, (*sc->read_register)( rp, SONIC_REG_CAP2 ), (*sc->read_register)( rp, SONIC_REG_CAP1 ), @@ -1511,7 +1511,7 @@ sonic_ioctl (struct ifnet *ifp, int command, caddr_t data) case SIO_RTEMS_SHOW_STATS: sonic_stats (sc); break; - + /* * FIXME: All sorts of multicast commands need to be added here! */ diff --git a/c/src/libchip/network/sonic.h b/c/src/libchip/network/sonic.h index b4a28ea6d4..6a4b98f22c 100644 --- a/c/src/libchip/network/sonic.h +++ b/c/src/libchip/network/sonic.h @@ -323,7 +323,7 @@ struct TransmitDescriptor { uint32_t link_pad; /* - * Extra RTEMS stuff + * Extra RTEMS stuff */ struct TransmitDescriptor *next; /* Circularly-linked list */ struct mbuf *mbufp; /* First mbuf in packet */ @@ -400,7 +400,7 @@ struct ReceiveDescriptor { uint32_t in_use; /* - * Extra RTEMS stuff + * Extra RTEMS stuff */ volatile struct ReceiveDescriptor *next; /* Circularly-linked list */ struct mbuf *mbufp; /* First mbuf in packet */ @@ -443,7 +443,7 @@ typedef volatile CamDescriptor_t *CamDescriptorPointer_t; #define RDA_IN_USE 0x0000 /* SONIC has finished with the packet */ /* and the driver can process it */ #define RDA_FREE 0xFFFF /* SONIC can use it */ - + /* * Attach routine */ diff --git a/c/src/libchip/rtc/icm7170.c b/c/src/libchip/rtc/icm7170.c index c0e89ec81f..1c7827b7ae 100644 --- a/c/src/libchip/rtc/icm7170.c +++ b/c/src/libchip/rtc/icm7170.c @@ -1,5 +1,5 @@ /* - * This file interfaces with the real-time clock found in + * This file interfaces with the real-time clock found in * a Harris ICM7170 * * Year 2K Notes: @@ -42,7 +42,7 @@ void icm7170_initialize( ) { uint32_t icm7170; - setRegister_f setReg; + setRegister_f setReg; uint32_t clock; icm7170 = RTC_Table[ minor ].ulCtrlPort1; @@ -97,7 +97,7 @@ int icm7170_get_time( time->hour = (*getReg)( icm7170, ICM7170_HOUR ); time->minute = (*getReg)( icm7170, ICM7170_MINUTE ); time->second = (*getReg)( icm7170, ICM7170_SECOND ); - + time->ticks = 0; /* @@ -147,7 +147,7 @@ int icm7170_set_time( (*setReg)( icm7170, ICM7170_HOUR, time->hour ); (*setReg)( icm7170, ICM7170_MINUTE, time->minute ); (*setReg)( icm7170, ICM7170_SECOND, time->second ); - + /* * This is not really right. */ diff --git a/c/src/libchip/rtc/icm7170_reg.c b/c/src/libchip/rtc/icm7170_reg.c index cf96917100..de85bec7e5 100644 --- a/c/src/libchip/rtc/icm7170_reg.c +++ b/c/src/libchip/rtc/icm7170_reg.c @@ -20,13 +20,13 @@ #ifndef _ICM7170_MULTIPLIER #define _ICM7170_MULTIPLIER 1 #define _ICM7170_NAME(_X) _X -#define _ICM7170_TYPE uint8_t +#define _ICM7170_TYPE uint8_t #endif #define CALCULATE_REGISTER_ADDRESS( _base, _reg ) \ (_ICM7170_TYPE *)((_base) + ((_reg) * _ICM7170_MULTIPLIER )) -/* +/* * ICM7170 Get Register Routine */ diff --git a/c/src/libchip/rtc/icm7170_reg2.c b/c/src/libchip/rtc/icm7170_reg2.c index b760956eeb..7131423605 100644 --- a/c/src/libchip/rtc/icm7170_reg2.c +++ b/c/src/libchip/rtc/icm7170_reg2.c @@ -17,6 +17,6 @@ #define _ICM7170_MULTIPLIER 2 #define _ICM7170_NAME(_X) _X##_2 -#define _ICM7170_TYPE uint8_t +#define _ICM7170_TYPE uint8_t #include "icm7170_reg.c" diff --git a/c/src/libchip/rtc/icm7170_reg4.c b/c/src/libchip/rtc/icm7170_reg4.c index a98798608f..784c176509 100644 --- a/c/src/libchip/rtc/icm7170_reg4.c +++ b/c/src/libchip/rtc/icm7170_reg4.c @@ -17,6 +17,6 @@ #define _ICM7170_MULTIPLIER 4 #define _ICM7170_NAME(_X) _X##_4 -#define _ICM7170_TYPE uint8_t +#define _ICM7170_TYPE uint8_t #include "icm7170_reg.c" diff --git a/c/src/libchip/rtc/icm7170_reg8.c b/c/src/libchip/rtc/icm7170_reg8.c index fa029d8ab6..92c3960fb0 100644 --- a/c/src/libchip/rtc/icm7170_reg8.c +++ b/c/src/libchip/rtc/icm7170_reg8.c @@ -17,6 +17,6 @@ #define _ICM7170_MULTIPLIER 8 #define _ICM7170_NAME(_X) _X##_8 -#define _ICM7170_TYPE uint8_t +#define _ICM7170_TYPE uint8_t #include "icm7170_reg.c" diff --git a/c/src/libchip/rtc/m48t08.c b/c/src/libchip/rtc/m48t08.c index f11bf3a4cf..b8412611b2 100644 --- a/c/src/libchip/rtc/m48t08.c +++ b/c/src/libchip/rtc/m48t08.c @@ -1,5 +1,5 @@ /* - * This file interfaces with the real-time clock found in + * This file interfaces with the real-time clock found in * a Mostek M48T08 or M48T18 or compatibles. * * Year 2K Notes: @@ -74,7 +74,7 @@ int m48t08_get_time( controlReg = (*getReg)( m48t08, M48T08_CONTROL ); (*setReg)( m48t08, M48T08_CONTROL, controlReg | M48T08_CONTROL_READ ); - + value1 = (*getReg)( m48t08, M48T08_YEAR ); value2 = From_BCD( value1 ); if ( value2 < 88 ) @@ -96,7 +96,7 @@ int m48t08_get_time( value1 = (*getReg)( m48t08, M48T08_SECOND ); time->second = From_BCD( value1 ); - + time->ticks = 0; /* @@ -132,7 +132,7 @@ int m48t08_set_time( controlReg = (*getReg)( m48t08, M48T08_CONTROL ); (*setReg)( m48t08, M48T08_CONTROL, controlReg | M48T08_CONTROL_WRITE ); - + if ( time->year >= 2088 ) rtems_fatal_error_occurred( RTEMS_INVALID_NUMBER ); @@ -142,7 +142,7 @@ int m48t08_set_time( (*setReg)( m48t08, M48T08_HOUR, To_BCD(time->hour) ); (*setReg)( m48t08, M48T08_MINUTE, To_BCD(time->minute) ); (*setReg)( m48t08, M48T08_SECOND, To_BCD(time->second) ); - + /* * Put the RTC back into normal mode. */ diff --git a/c/src/libchip/rtc/m48t08.h b/c/src/libchip/rtc/m48t08.h index 496d288ab7..026a38dea2 100644 --- a/c/src/libchip/rtc/m48t08.h +++ b/c/src/libchip/rtc/m48t08.h @@ -2,7 +2,7 @@ * This file contains the definitions for the following real-time clocks: * * + Mostek M48T08 - * + Mostek M48T18 + * + Mostek M48T18 * + Dallas Semiconductor DS1643 * * COPYRIGHT (c) 1989-1999. @@ -30,7 +30,7 @@ #define M48T08_DATE 5 #define M48T08_MONTH 6 #define M48T08_YEAR 7 - + /* * Driver function table */ diff --git a/c/src/libchip/rtc/m48t08_reg.c b/c/src/libchip/rtc/m48t08_reg.c index 32eecaac7a..d4373a8d26 100644 --- a/c/src/libchip/rtc/m48t08_reg.c +++ b/c/src/libchip/rtc/m48t08_reg.c @@ -20,13 +20,13 @@ #ifndef _M48T08_MULTIPLIER #define _M48T08_MULTIPLIER 1 #define _M48T08_NAME(_X) _X -#define _M48T08_TYPE uint8_t +#define _M48T08_TYPE uint8_t #endif #define CALCULATE_REGISTER_ADDRESS( _base, _reg ) \ (_M48T08_TYPE *)((_base) + ((_reg) * _M48T08_MULTIPLIER )) -/* +/* * M48T08 Get Register Routine */ diff --git a/c/src/libchip/rtc/m48t08_reg2.c b/c/src/libchip/rtc/m48t08_reg2.c index 94ab9984c5..f8c2cad2f3 100644 --- a/c/src/libchip/rtc/m48t08_reg2.c +++ b/c/src/libchip/rtc/m48t08_reg2.c @@ -17,6 +17,6 @@ #define _M48T08_MULTIPLIER 2 #define _M48T08_NAME(_X) _X##_2 -#define _M48T08_TYPE uint8_t +#define _M48T08_TYPE uint8_t #include "m48t08_reg.c" diff --git a/c/src/libchip/rtc/m48t08_reg4.c b/c/src/libchip/rtc/m48t08_reg4.c index 9e07fad2ee..57c45c2238 100644 --- a/c/src/libchip/rtc/m48t08_reg4.c +++ b/c/src/libchip/rtc/m48t08_reg4.c @@ -17,6 +17,6 @@ #define _M48T08_MULTIPLIER 4 #define _M48T08_NAME(_X) _X##_4 -#define _M48T08_TYPE uint8_t +#define _M48T08_TYPE uint8_t #include "m48t08_reg.c" diff --git a/c/src/libchip/rtc/m48t08_reg8.c b/c/src/libchip/rtc/m48t08_reg8.c index 02e6900916..44ac347b1a 100644 --- a/c/src/libchip/rtc/m48t08_reg8.c +++ b/c/src/libchip/rtc/m48t08_reg8.c @@ -17,6 +17,6 @@ #define _M48T08_MULTIPLIER 8 #define _M48T08_NAME(_X) _X##_8 -#define _M48T08_TYPE uint8_t +#define _M48T08_TYPE uint8_t #include "m48t08_reg.c" diff --git a/c/src/libchip/rtc/rtc.h b/c/src/libchip/rtc/rtc.h index 39dd5981b1..8d2f37d2e1 100644 --- a/c/src/libchip/rtc/rtc.h +++ b/c/src/libchip/rtc/rtc.h @@ -37,8 +37,8 @@ typedef enum { /* * Each field is interpreted thus: - * - * sDeviceName This is the name of the device. + * + * sDeviceName This is the name of the device. * * deviceType This indicates the chip type. * diff --git a/c/src/libchip/serial/mc68681.c b/c/src/libchip/serial/mc68681.c index 83cf6cbb37..6319dea2b1 100644 --- a/c/src/libchip/serial/mc68681.c +++ b/c/src/libchip/serial/mc68681.c @@ -84,7 +84,7 @@ MC68681_STATIC int mc68681_baud_rate( * port settings. */ -MC68681_STATIC int mc68681_set_attributes( +MC68681_STATIC int mc68681_set_attributes( int minor, const struct termios *t ) @@ -147,7 +147,7 @@ MC68681_STATIC int mc68681_set_attributes( /* * Stop Bits */ - + if (t->c_cflag & CSTOPB) { mode2 |= 0x0F; /* 2 stop bits */ } else { @@ -194,14 +194,14 @@ MC68681_STATIC void mc68681_initialize_context( int port; unsigned int pMC68681; unsigned int pMC68681_port; - + pMC68681 = Console_Port_Tbl[minor].ulCtrlPort1; pMC68681_port = Console_Port_Tbl[minor].ulCtrlPort2; pmc68681Context->mate = -1; for (port=0 ; portmate = port; pmc68681Context->imr = 0; @@ -282,13 +282,13 @@ MC68681_STATIC int mc68681_open( rtems_interrupt_level Irql; setRegister_f setReg; unsigned int status; - - + + pMC68681 = Console_Port_Tbl[minor].ulCtrlPort1; pMC68681_port = Console_Port_Tbl[minor].ulCtrlPort2; setReg = Console_Port_Tbl[minor].setRegister; vector = Console_Port_Tbl[minor].ulIntVector; - + /* XXX default baud rate should be from configuration table */ status = mc68681_baud_rate( minor, B9600, &baud, &acr_bit, &command ); @@ -350,14 +350,14 @@ MC68681_STATIC int mc68681_close( return(RTEMS_SUCCESSFUL); } -/* +/* * mc68681_write_polled * * This routine polls out the requested character. */ MC68681_STATIC void mc68681_write_polled( - int minor, + int minor, char cChar ) { @@ -417,7 +417,7 @@ MC68681_STATIC rtems_isr mc68681_isr( int minor; for(minor=0 ; minor>= 4; } - + /* See if is usefull to call rtems_termios_dequeue */ if(Console_Port_Data[minor].bActive == FALSE) { ucISRStatus = ucISRStatus & ~MC68681_IR_TX_READY; @@ -668,10 +668,10 @@ MC68681_STATIC void mc68681_process( continue; } cChar = (*getReg)(pMC68681_port, MC68681_RX_BUFFER); - rtems_termios_enqueue_raw_characters( + rtems_termios_enqueue_raw_characters( Console_Port_Data[minor].termios_data, - &cChar, - 1 + &cChar, + 1 ); } @@ -710,7 +710,7 @@ MC68681_STATIC unsigned int mc68681_build_imr( unsigned int pMC68681_port; mc68681_context *pmc68681Context; mc68681_context *mateContext; - + pMC68681 = Console_Port_Tbl[minor].ulCtrlPort1; pMC68681_port = Console_Port_Tbl[minor].ulCtrlPort2; pmc68681Context = (mc68681_context *) Console_Port_Data[minor].pDeviceContext; @@ -720,14 +720,14 @@ MC68681_STATIC unsigned int mc68681_build_imr( mate_mask = 0; is_a = (pMC68681 == pMC68681_port); - + /* * If there is a mate for this port, get its IMR mask. */ if ( mate != -1 ) { mateContext = Console_Port_Data[mate].pDeviceContext; - + if (mateContext) mate_mask = mateContext->imr; } diff --git a/c/src/libchip/serial/mc68681.h b/c/src/libchip/serial/mc68681.h index 8b21cee0ce..a945777e0b 100644 --- a/c/src/libchip/serial/mc68681.h +++ b/c/src/libchip/serial/mc68681.h @@ -55,7 +55,7 @@ typedef mc68681_baud_t mc68681_baud_table_t[RTEMS_TERMIOS_NUMBER_BAUD_RATES]; #define MC68681_BAUD_NOT_VALID 0xFF -extern mc68681_baud_t +extern mc68681_baud_t mc68681_baud_rate_table[4][RTEMS_TERMIOS_NUMBER_BAUD_RATES]; diff --git a/c/src/libchip/serial/mc68681_p.h b/c/src/libchip/serial/mc68681_p.h index 7e2480d706..2fe7789fae 100644 --- a/c/src/libchip/serial/mc68681_p.h +++ b/c/src/libchip/serial/mc68681_p.h @@ -253,7 +253,7 @@ typedef struct _mc68681_context */ MC68681_STATIC boolean mc68681_probe(int minor); -MC68681_STATIC int mc68681_set_attributes( +MC68681_STATIC int mc68681_set_attributes( int minor, const struct termios *t ); @@ -273,7 +273,7 @@ MC68681_STATIC int mc68681_close( ); MC68681_STATIC void mc68681_write_polled( - int minor, + int minor, char cChar ); diff --git a/c/src/libchip/serial/mc68681_reg.c b/c/src/libchip/serial/mc68681_reg.c index bf6e2d3254..e81db068cd 100644 --- a/c/src/libchip/serial/mc68681_reg.c +++ b/c/src/libchip/serial/mc68681_reg.c @@ -20,13 +20,13 @@ #ifndef _MC68681_MULTIPLIER #define _MC68681_MULTIPLIER 1 #define _MC68681_NAME(_X) _X -#define _MC68681_TYPE uint8_t +#define _MC68681_TYPE uint8_t #endif #define CALCULATE_REGISTER_ADDRESS( _base, _reg ) \ (_MC68681_TYPE *)((_base) + ((_reg) * _MC68681_MULTIPLIER )) -/* +/* * MC68681 Get Register Routine */ diff --git a/c/src/libchip/serial/mc68681_reg2.c b/c/src/libchip/serial/mc68681_reg2.c index 4a7fb8fb0d..fa7944b373 100644 --- a/c/src/libchip/serial/mc68681_reg2.c +++ b/c/src/libchip/serial/mc68681_reg2.c @@ -17,6 +17,6 @@ #define _MC68681_MULTIPLIER 2 #define _MC68681_NAME(_X) _X##_2 -#define _MC68681_TYPE uint8_t +#define _MC68681_TYPE uint8_t #include "mc68681_reg.c" diff --git a/c/src/libchip/serial/mc68681_reg4.c b/c/src/libchip/serial/mc68681_reg4.c index 8c26cdeb2a..134473300d 100644 --- a/c/src/libchip/serial/mc68681_reg4.c +++ b/c/src/libchip/serial/mc68681_reg4.c @@ -17,6 +17,6 @@ #define _MC68681_MULTIPLIER 4 #define _MC68681_NAME(_X) _X##_4 -#define _MC68681_TYPE uint8_t +#define _MC68681_TYPE uint8_t #include "mc68681_reg.c" diff --git a/c/src/libchip/serial/mc68681_reg8.c b/c/src/libchip/serial/mc68681_reg8.c index 25e51cbcc5..69574c759f 100644 --- a/c/src/libchip/serial/mc68681_reg8.c +++ b/c/src/libchip/serial/mc68681_reg8.c @@ -17,6 +17,6 @@ #define _MC68681_MULTIPLIER 8 #define _MC68681_NAME(_X) _X##_8 -#define _MC68681_TYPE uint8_t +#define _MC68681_TYPE uint8_t #include "mc68681_reg.c" diff --git a/c/src/libchip/serial/ns16550.c b/c/src/libchip/serial/ns16550.c index 53c7f0592f..d98cd01f1f 100644 --- a/c/src/libchip/serial/ns16550.c +++ b/c/src/libchip/serial/ns16550.c @@ -1,7 +1,7 @@ /* * This file contains the TTY driver for the National Semiconductor NS16550. * - * This part is widely cloned and second sourced. It is found in a number + * This part is widely cloned and second sourced. It is found in a number * of "Super IO" controllers. * * COPYRIGHT (c) 1998 by Radstone Technology @@ -176,12 +176,12 @@ NS16550_STATIC int ns16550_close( return(RTEMS_SUCCESSFUL); } -/* +/* * ns16550_write_polled */ NS16550_STATIC void ns16550_write_polled( - int minor, + int minor, char cChar ) { @@ -415,7 +415,7 @@ NS16550_STATIC int ns16550_set_attributes( rtems_interrupt_disable(Irql); /* - * Set the baud rate + * Set the baud rate */ (*setReg)(pNS16550, NS16550_LINE_CONTROL, SP_LINE_DLAB); @@ -444,7 +444,7 @@ NS16550_STATIC void ns16550_process( ) { uint32_t pNS16550; - volatile uint8_t ucLineStatus; + volatile uint8_t ucLineStatus; volatile uint8_t ucInterruptId; unsigned char cChar; getRegister_f getReg; @@ -464,10 +464,10 @@ NS16550_STATIC void ns16550_process( break; } cChar = (*getReg)(pNS16550, NS16550_RECEIVE_BUFFER); - rtems_termios_enqueue_raw_characters( + rtems_termios_enqueue_raw_characters( Console_Port_Data[minor].termios_data, - &cChar, - 1 + &cChar, + 1 ); } @@ -521,7 +521,7 @@ NS16550_STATIC rtems_isr ns16550_isr( int minor; for(minor=0;minor>8) & 0xff ); - + /* * Enable the baud rate generator enable with clock from the * SCC's PCLK input via register 14. @@ -310,7 +310,7 @@ Z85C30_STATIC int z85c30_assert_RTS(int minor) setReg = Console_Port_Tbl[minor].setRegister; pz85c30Context = (z85c30_context *) Console_Port_Data[minor].pDeviceContext; - + /* * Assert RTS */ @@ -339,7 +339,7 @@ Z85C30_STATIC int z85c30_negate_RTS(int minor) setReg = Console_Port_Tbl[minor].setRegister; pz85c30Context = (z85c30_context *) Console_Port_Data[minor].pDeviceContext; - + /* * Negate RTS */ @@ -373,7 +373,7 @@ Z85C30_STATIC int z85c30_assert_DTR(int minor) setReg = Console_Port_Tbl[minor].setRegister; pz85c30Context = (z85c30_context *) Console_Port_Data[minor].pDeviceContext; - + /* * Assert DTR */ @@ -402,7 +402,7 @@ Z85C30_STATIC int z85c30_negate_DTR(int minor) setReg = Console_Port_Tbl[minor].setRegister; pz85c30Context = (z85c30_context *) Console_Port_Data[minor].pDeviceContext; - + /* * Negate DTR */ @@ -450,7 +450,7 @@ Z85C30_STATIC int z85c30_set_attributes( if (!baud_requested) baud_requested = B9600; /* default to 9600 baud */ - ulBaudDivisor = Z85C30_Baud( + ulBaudDivisor = Z85C30_Baud( (uint32_t) Console_Port_Tbl[minor].ulClock, (uint32_t) termios_baud_to_number( baud_requested ) ); @@ -467,7 +467,7 @@ Z85C30_STATIC int z85c30_set_attributes( wr4 |= SCC_WR4_PAR_EN; if (!(t->c_cflag & PARODD)) wr4 |= SCC_WR4_PAR_EVEN; - } + } /* * Character Size @@ -588,7 +588,7 @@ Z85C30_STATIC void z85c30_process( */ break; } - + #if 0 if (!Z85C30_Status_Is_CTS_asserted(z85c30_status)) { /* @@ -601,7 +601,7 @@ Z85C30_STATIC void z85c30_process( break; } #endif - + rtems_termios_dequeue_characters(Console_Port_Data[minor].termios_data, 1); if (rtems_termios_dequeue_characters( Console_Port_Data[minor].termios_data, 1)) { @@ -647,7 +647,7 @@ Z85C30_STATIC rtems_isr z85c30_isr( getRegister_f getReg; for (minor=0;minorfront; diff --git a/c/src/libchip/shmdr/shm_driver.h b/c/src/libchip/shmdr/shm_driver.h index 63f08c48ef..822f78d1c6 100644 --- a/c/src/libchip/shmdr/shm_driver.h +++ b/c/src/libchip/shmdr/shm_driver.h @@ -190,14 +190,14 @@ extern "C" { * size of stuff before preamble in envelope. * It must be a constant since we will use it to generate MAX_PACKET_SIZE */ - + #define SHM_ENVELOPE_PREFIX_OVERHEAD (4 * sizeof(vol_u32)) /* * The following is adjusted so envelopes are MAX_ENVELOPE_SIZE bytes long. * It must be >= RTEMS_MINIMUM_PACKET_SIZE in mppkt.h. */ - + #ifndef MAX_ENVELOPE_SIZE #define MAX_ENVELOPE_SIZE 0x180 #endif -- cgit v1.2.3