Changeset 818f10bc in rtems


Ignore:
Timestamp:
May 11, 2017, 10:54:46 AM (3 years ago)
Author:
Daniel Hellstrom <daniel@…>
Branches:
master
Children:
1ea73e2b
Parents:
6fdded2c
git-author:
Daniel Hellstrom <daniel@…> (05/11/17 10:54:46)
git-committer:
Daniel Hellstrom <daniel@…> (05/14/17 10:32:00)
Message:

leon, grtc: updated overrun condition handling

The following functions now reports to the user that an overrun has
occured by returning errno EIO:

  • grtc_read, on overrun and no more data in the DMA buffer
  • ioctl(GRTC_IOC_RECV), on overrun and no more frames in the DMA buffer
  • ioctl(GRTC_IOC_ISSTARTED), EIO is returned on overrun
File:
1 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/sparc/shared/tmtc/grtc.c

    r6fdded2c r818f10bc  
    524524}
    525525
    526 /* Reads as much as possiböe but not more than 'max' bytes from the TC receive buffer.
     526/* Reads as much as possible but not more than 'max' bytes from the TC receive buffer.
    527527 * Number of bytes put into 'buf' is returned.
    528528 */
     
    600600}
    601601
    602 /* Reads as much as possiböe but not more than 'max' bytes from the TC receive buffer.
     602/* Reads as much as possible but not more than 'max' bytes from the TC receive buffer.
    603603 * Number of bytes put into 'buf' is returned.
    604604 */
     
    659659                return RTEMS_IO_ERROR;
    660660        }
     661
     662        /* make sure the RX semaphore is in the correct state when starting.
     663         * In case of a previous overrun condition it could be in incorrect
     664         * state (where rtems_semaphore_flush was used).
     665         */
     666        rtems_semaphore_obtain(pDev->sem_rx, RTEMS_NO_WAIT, 0);
    661667
    662668        /* Set operating modes */
     
    815821
    816822        pDev->running = 0;
     823        pDev->overrun_condition = 0;
    817824
    818825        memset(&pDev->config,0,sizeof(pDev->config));
     
    842849                pDev->running = 0;
    843850        }
    844        
     851
    845852        /* Reset core */
    846853        grtc_hw_reset(pDev);
     
    911918                return RTEMS_TIMEOUT;
    912919        }
    913        
     920
    914921        /* Tell caller how much was read. */
    915        
     922
    916923        DBG("READ returning %d bytes, left: %d\n",rw_args->count-left,left);
    917        
     924
    918925        rw_args->bytes_moved = rw_args->count - left;
    919         if ( rw_args->bytes_moved == 0 ){
     926        if ( rw_args->bytes_moved == 0 ) {
     927                if ( pDev->overrun_condition ) {
     928                        /* signal to the user that overrun has happend when
     929                         * no more data can be read out.
     930                         */
     931                        return RTEMS_IO_ERROR;
     932                }
    920933                return RTEMS_TIMEOUT;
    921934        }
    922        
     935
    923936        return RTEMS_SUCCESSFUL;
    924937}
     
    15701583                if ( !pDev->running ) {
    15711584                        return RTEMS_RESOURCE_IN_USE;
     1585                } else if ( pDev->overrun_condition ) {
     1586                        return RTEMS_IO_ERROR;
    15721587                }
    15731588                break;
     
    18511866                frmlist->tail = pDev->ready.tail;
    18521867                frmlist->cnt = pDev->ready.cnt;
    1853                
     1868
    18541869                /* Empty list */
    18551870                pDev->ready.head = NULL;
    18561871                pDev->ready.tail = NULL;
    18571872                pDev->ready.cnt = 0;
     1873
     1874                if ((frmlist->cnt == 0) && pDev->overrun_condition) {
     1875                        /* signal to the user that overrun has happend when
     1876                         * no more data can be read out.
     1877                         */
     1878                        return RTEMS_IO_ERROR;
     1879                }
    18581880                break;
    1859                
     1881
    18601882                case GRTC_IOC_GET_CLCW_ADR:
    18611883                if ( !data ) {
     
    18791901        /* Clear interrupt by reading it */
    18801902        status = READ_REG(&regs->pisr);
    1881        
     1903
    18821904        /* Spurious Interrupt? */
    18831905        if ( !pDev->running )
Note: See TracChangeset for help on using the changeset viewer.