Beispiel #1
0
    void HDRPage::SetShutter( int image, unsigned int shutterValue )
    {
        unsigned int regOffset = GetRegisterOffset( m_hdrRegOffset, image );

        Error error;
        unsigned int value;
        if ( IsLadybug2() )
        {
            value = 0x82000000 |  shutterValue;
        }
        else
        {
            error = m_pCamera->ReadRegister( regOffset, &value );
            if ( error != PGRERROR_OK )
            {
                // Error
                ShowErrorMessageDialog( "Error reading HDR shutter register", error );
            }

            value &= ~0xFFF;
            value += shutterValue;
        }

        error = m_pCamera->WriteRegister( regOffset, value );
        if ( error != PGRERROR_OK )
        {
            // Error
            ShowErrorMessageDialog( "Error writing HDR shutter register", error );
        }
    }  
Beispiel #2
0
    void HDRPage::SetGain( int image, unsigned int gainValue )
    {
        unsigned int regOffset = GetRegisterOffset( m_hdrRegOffset, image ) + m_hdrRegIncrement;

        Error error;
        unsigned int value;
        if ( IsLadybug2() )
        {
            // LD2 camera
            value = 0x82000000 |  gainValue;
        }
        else
        {

            error = m_pCamera->ReadRegister( regOffset, &value );
            if ( error != PGRERROR_OK )
            {
                // Error
                ShowErrorMessageDialog( "Error reading HDR gain register", error );
            }

            value &= ~0xFFF;
            value += gainValue;
        }

        error = m_pCamera->WriteRegister( regOffset, value );
        if ( error != PGRERROR_OK )
        {
            // Error
            ShowErrorMessageDialog( "Error writing HDR gain register", error );
        }
    }
bool
RegisterContextPOSIXProcessMonitor_arm64::ReadRegister(const unsigned reg,
                                                       lldb_private::RegisterValue &value)
{
    ProcessMonitor &monitor = GetMonitor();
    return monitor.ReadRegisterValue(m_thread.GetID(),
                                     GetRegisterOffset(reg),
                                     GetRegisterName(reg),
                                     GetRegisterSize(reg),
                                     value);
}
bool
RegisterContextPOSIXProcessMonitor_arm64::WriteRegister(const unsigned reg,
                                                         const lldb_private::RegisterValue &value)
{
    unsigned reg_to_write = reg;
    lldb_private::RegisterValue value_to_write = value;

    // Check if this is a subregister of a full register.
    const lldb_private::RegisterInfo *reg_info = GetRegisterInfoAtIndex(reg);
    if (reg_info->invalidate_regs && (reg_info->invalidate_regs[0] != LLDB_INVALID_REGNUM))
    {
        lldb_private::RegisterValue full_value;
        uint32_t full_reg = reg_info->invalidate_regs[0];
        const lldb_private::RegisterInfo *full_reg_info = GetRegisterInfoAtIndex(full_reg);

        // Read the full register.
        if (ReadRegister(full_reg_info, full_value))
        {
            lldb_private::Error error;
            lldb::ByteOrder byte_order = GetByteOrder();
            uint8_t dst[lldb_private::RegisterValue::kMaxRegisterByteSize];

            // Get the bytes for the full register.
            const uint32_t dest_size = full_value.GetAsMemoryData (full_reg_info,
                                                                   dst,
                                                                   sizeof(dst),
                                                                   byte_order,
                                                                   error);
            if (error.Success() && dest_size)
            {
                uint8_t src[lldb_private::RegisterValue::kMaxRegisterByteSize];

                // Get the bytes for the source data.
                const uint32_t src_size = value.GetAsMemoryData (reg_info, src, sizeof(src), byte_order, error);
                if (error.Success() && src_size && (src_size < dest_size))
                {
                    // Copy the src bytes to the destination.
                    ::memcpy (dst + (reg_info->byte_offset & 0x1), src, src_size);
                    // Set this full register as the value to write.
                    value_to_write.SetBytes(dst, full_value.GetByteSize(), byte_order);
                    value_to_write.SetType(full_reg_info);
                    reg_to_write = full_reg;
                }
            }
        }
    }

    ProcessMonitor &monitor = GetMonitor();
    return monitor.WriteRegisterValue(m_thread.GetID(),
                                      GetRegisterOffset(reg_to_write),
                                      GetRegisterName(reg_to_write),
                                      value_to_write);
}
Beispiel #5
0
    unsigned int HDRPage::GetShutter( int image )
    {
        unsigned int regOffset = GetRegisterOffset( m_hdrRegOffset, image );

        Error error;
        unsigned int value;
        error = m_pCamera->ReadRegister( regOffset, &value );
        if ( error != PGRERROR_OK )
        {
            // Error
            ShowErrorMessageDialog( "Error reading HDR shutter register", error );
        }

        return (value & 0x00000FFF);
    }
Beispiel #6
0
/*
// EXP_getValue - Get a value from the supplied string
//
// Returns 0 no value, 1 on success, <0 on error
*/
int EXP_getValue( SOURCEFILE *ps, char *s, int *pIdx, uint *pValue )
{
    int     base = 10,index,i,j,k;
    int     rc = 1;
    uint    tval = 0;
    char    c;

    index = *pIdx;

    c = s[index];
    while( c==' ' || c==9 )
    {
        index++;
        c = s[index];
    }

    if( !c )
        return(0);

    /* Look for a label */
    if( LabelChar(c,1) || c=='.' || c=='&' )
    {
        LABEL *pl;
        char lblstr[LABEL_NAME_LEN];
        int  lblidx = 0;

        for(;;)
        {
            lblstr[lblidx++]=c;
            index++;
            c = s[index];
            if( !LabelChar(c,0) && c!='.' )
                break;
        }
        lblstr[lblidx]=0;
        *pIdx = index;

        if( CheckTokenType(lblstr) & TOKENTYPE_FLG_REG_ADDR )
        {
            if( GetRegisterOffset(lblstr+1,&tval) )
            {
                *pValue = tval;
                return(1);
            }
        }
        pl = LabelFind(lblstr);
        if(!pl && Pass==1)
            *pValue = 0;
        else if( !pl )
            { Report(ps,REP_ERROR,"Not found: '%s'",lblstr); return(0); }
        else
            *pValue = pl->Offset;
        return(1);
    }

    if( c=='-' )
    {
        index++;
        i = EXP_getValue( ps, s, &index, &tval );
        if( i<0 )
            rc = i;
        else
            tval = (uint)(-(int)tval);
        goto EGV_EXIT;
    }
    if( c=='~' )
    {
        index++;
        i = EXP_getValue( ps, s, &index, &tval );
        if( i<0 )
            rc = i;
        else
            tval = ~tval;
        goto EGV_EXIT;
    }
    if( c=='(' )
    {
        /* Scan to the far ')' */
        index++;
        j = index;
        i=1;
        for(;;)
        {
            c = *(s+j);
            if( !c )
            {
                rc = -1;
                goto EGV_EXIT;
            }
            if( c=='(' )
                i++;
            if( c==')' )
            {
                i--;
                if(!i)
                {
                    /* Terminate the string and eval the () */
                    *(s+j) = 0;
                    i = Expression( 0, s+index, &tval, &k );
                    if( i<0 )
                    {
                        index+=k;
                        rc=i;
                    }
                    else
                        index=j+1;
                    goto EGV_EXIT;
                }
            }
            j++;
        }
    }

    /* This character must be a number */
    if( c<'0' || c>'9' )
    {
        rc = -1;
        goto EGV_EXIT;
    }
    index++;
    tval = c-'0';
    if( tval==0 )
    {
        c = s[index];
        if( c=='x' )
        {
            base=16;
            index++;
        }
        else if( c=='b' )
        {
            base=2;
            index++;
        }
        else
            base=8;
    }

    for(;;)
    {
        c = s[index];
        if( c>='0' && c<='9' )
            i = c-'0';
        else if( c>='a' && c<='f' )
            i = c-'a'+10;
        else if( c>='A' && c<='F' )
            i = c-'A'+10;
        else
            break;

        if( i>=base )
        {
            rc = -1;
            goto EGV_EXIT;
        }
        tval *= base;
        tval += i;
        index++;
    }

EGV_EXIT:
    *pValue = tval;
    *pIdx = index;
    return(rc);
}