Changeset f031251c in rtems for c/src/libchip


Ignore:
Timestamp:
Aug 2, 2008, 6:26:29 AM (11 years ago)
Author:
Chris Johns <chrisj@…>
Branches:
4.10, 4.11, 4.9, master
Children:
c0cc985
Parents:
2eb89ad
Message:

2008-08-02 Chris Johns <chrisj@…>

  • libchip/i2c/spi-sd-card.c, libchip/ide/ata.c: Remove rtems_blkdev_request count and start references. Use RTEMS_BLKDEV_START_BLOCK.
Location:
c/src/libchip
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • c/src/libchip/i2c/spi-sd-card.c

    r2eb89ad rf031251c  
    563563        rtems_status_code sc = RTEMS_SUCCESSFUL;
    564564        int rv = 0;
    565         uint32_t start_address = r->start << e->block_size_shift;
     565        uint32_t start_address = RTEMS_BLKDEV_START_BLOCK (r) << e->block_size_shift;
    566566        uint32_t i = 0;
    567567
    568         DEBUG_PRINT( "start = %u, count = %u, bufnum = %u\n", r->start, r->count, r->bufnum);
     568        DEBUG_PRINT( "start = %u, bufnum = %u\n", r->start, r->bufnum);
    569569
    570570#ifdef DEBUG
    571571        /* Check request */
    572         if (r->count != r->bufnum) {
    573                 SYSLOG_ERROR( "Block count and buffer number are not equal");
    574                 return -RTEMS_INTERNAL_ERROR;
    575         } else if (r->start >= e->block_number) {
     572  if (r->bufs[0].block >= e->block_number) {
    576573                SYSLOG_ERROR( "Start block number out of range");
    577574                return -RTEMS_INTERNAL_ERROR;
    578         } else if (r->count > e->block_number - r->start) {
     575        } else if (r->bufnum > e->block_number - RTEMS_BLKDEV_START_BLOCK (r)) {
    579576                SYSLOG_ERROR( "Block count out of range");
    580577                return -RTEMS_INTERNAL_ERROR;
     
    586583        CLEANUP_SCRV( sc, rv, sd_card_disk_block_read_cleanup, "Start");
    587584
    588         if (r->count == 1) {
     585        if (r->bufnum == 1) {
    589586#ifdef DEBUG
    590587                /* Check buffer */
     
    606603
    607604                /* Multiple block read */
    608                 for (i = 0; i < r->count; ++i) {
     605                for (i = 0; i < r->bufnum; ++i) {
    609606#ifdef DEBUG
    610607                        /* Check buffer */
     
    653650        rtems_status_code sc = RTEMS_SUCCESSFUL;
    654651        int rv = 0;
    655         uint32_t start_address = r->start << e->block_size_shift;
     652        uint32_t start_address = RTEMS_BLKDEV_START_BLOCK (r) << e->block_size_shift;
    656653        uint32_t i = 0;
    657654
     
    660657#ifdef DEBUG
    661658        /* Check request */
    662         if (r->count != r->bufnum) {
    663                 SYSLOG_ERROR( "Block count and buffer number are not equal");
    664                 return -RTEMS_INTERNAL_ERROR;
    665         } else if (r->start >= e->block_number) {
     659  if (r->bufs[0].block >= e->block_number) {
    666660                SYSLOG_ERROR( "Start block number out of range");
    667661                return -RTEMS_INTERNAL_ERROR;
    668         } else if (r->count > e->block_number - r->start) {
     662        } else if (r->bufnum > e->block_number - RTEMS_BLKDEV_START_BLOCK (r)) {
    669663                SYSLOG_ERROR( "Block count out of range");
    670664                return -RTEMS_INTERNAL_ERROR;
     
    676670        CLEANUP_SCRV( sc, rv, sd_card_disk_block_write_cleanup, "Start");
    677671
    678         if (r->count == 1) {
     672        if (r->bufnum == 1) {
    679673#ifdef DEBUG
    680674                /* Check buffer */
     
    696690
    697691                /* Multiple block write */
    698                 for (i = 0; i < r->count; ++i) {
     692                for (i = 0; i < r->bufnum; ++i) {
    699693#ifdef DEBUG
    700694                        /* Check buffer */
     
    759753                        case RTEMS_BLKDEV_REQ_WRITE:
    760754                                return sd_card_disk_block_write( e, r);
     755                        case RTEMS_BLKDEV_CAPABILITIES:
     756                                *((uint32_t*) arg)  = RTEMS_BLKDEV_CAP_MULTISECTOR_CONT;
     757                                return 0;
    761758                        default:
    762759                                errno = EBADRQC;
  • c/src/libchip/ide/ata.c

    r2eb89ad rf031251c  
    2727#include "ata_internal.h"
    2828#include <libchip/ata.h>
    29 //#define DEBUG
     29/* #define DEBUG */
    3030
    3131#ifdef DEBUG
     
    212212
    213213    areq->breq = req;
    214     areq->cnt = req->count;
     214    areq->cnt = req->bufnum;
    215215    areq->cbuf = 0;
    216216    areq->pos = 0;
     
    240240#ifdef DEBUG
    241241            printf("ata_io_data_request: type: READ: %d, %d\n",
    242                    req->bufs[0].block, req->count);
     242                   req->bufs[0].block, req->bufnum);
    243243#endif           
    244244            areq->type = ATA_COMMAND_TYPE_PIO_IN;
     
    252252            areq->regs.regs[IDE_REGISTER_COMMAND] =
    253253                ((ATA_DEV_INFO(ctrl_minor, dev).max_multiple) &&
    254                  (req->count > 1) &&
     254                 (req->bufnum > 1) &&
    255255                 (ATA_DEV_INFO(ctrl_minor, dev).current_multiple > 1)) ?
    256256                 ATA_COMMAND_READ_MULTIPLE :
     
    261261#ifdef DEBUG
    262262            printf("ata_io_data_request: type: WRITE: %d, %d\n",
    263                    req->bufs[0].block, req->count);
     263                   req->bufs[0].block, req->bufnum);
    264264#endif           
    265265            areq->type = ATA_COMMAND_TYPE_PIO_OUT;
     
    273273            areq->regs.regs[IDE_REGISTER_COMMAND] =
    274274              ((ATA_DEV_INFO(ctrl_minor, dev).max_multiple) &&
    275                (req->count > 1) &&
     275               (req->bufnum > 1) &&
    276276               (ATA_DEV_INFO(ctrl_minor, dev).current_multiple > 1)) ?
    277277               ATA_COMMAND_WRITE_MULTIPLE :
     
    313313
    314314    /* fill sector count register */
    315     areq->regs.regs[IDE_REGISTER_SECTOR_COUNT] = areq->breq->count;
     315    areq->regs.regs[IDE_REGISTER_SECTOR_COUNT] = areq->breq->bufnum;
    316316
    317317    /* add request to the queue of awaiting requests to the controller */
     
    11971197    breq.req.done_arg = &breq;
    11981198    breq.req.bufnum = 1;
    1199     breq.req.count = 1;
    12001199    breq.req.bufs[0].length = ATA_SECTOR_SIZE;
    12011200    breq.req.bufs[0].buffer = buffer;
     
    13661365            areq.breq = (rtems_blkdev_request *)&breq;
    13671366
    1368             areq.cnt = breq.req.count;
     1367            areq.cnt = breq.req.bufnum;
    13691368
    13701369            areq.regs.regs[IDE_REGISTER_DEVICE_HEAD] |=
Note: See TracChangeset for help on using the changeset viewer.