Esempio n. 1
0
int main(int argc, char **argv)
{
    bool pass = true;
    uint32_t i;

    GLX_ARB_create_context_setup();
    piglit_require_glx_extension(dpy, "GLX_ARB_create_context_profile");

    /* The GLX_ARB_create_context_profile spec says:
     *
     *     "* If attribute GLX_CONTEXT_PROFILE_MASK_ARB has no bits set;
     *        has any bits set other than GLX_CONTEXT_CORE_PROFILE_BIT_ARB
     *        and GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB; has more than
     *        one of these bits set...then GLXBadProfileARB is generated."
     */
    pass = try_profile(0)
           && pass;

    pass = try_profile(GLX_CONTEXT_CORE_PROFILE_BIT_ARB
                       | GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB)
           && pass;

    /* This loop will need to be modified as new profiles are defined by
     * the GLX spec.  The conditional code below for
     * GLX_EXT_create_context_es2_profile is an example of how this should
     * be handled.
     */
    for (i = 0x00000008; i != 0; i <<= 1) {
        pass = try_profile(i)
               && pass;
    }

    if (!piglit_is_glx_extension_supported(dpy, "GLX_EXT_create_context_es2_profile")) {
        pass = try_profile(GLX_CONTEXT_ES2_PROFILE_BIT_EXT)
               && pass;
    }

    GLX_ARB_create_context_teardown();

    piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);
    return 0;
}
Esempio n. 2
0
void do_best_profile(uint8_t slave_addr)    //TODO should we test if current draw already > some threshold (e.g. 0.8A) then skip this?
{
    uint8_t draw_best, best_profile, best_dce, cnt; //draw_now
//    uint8_t* draw_now_ptr, draw_best_ptr, best_profile_ptr, best_dce_ptr;
//
//    draw_now_ptr = &draw_now;
//    draw_best_ptr = &draw_best;
//    best_profile_ptr = &best_profile;
//    best_dce_ptr = &best_dce_ptr;

//    INTERRUPT_GlobalInterruptDisable();
    INTCONbits.IOCIE = 0;

    putstring0("do best profile"); terpri0();
    for (cnt = 0; cnt < PRFL_WAIT_MS/10; cnt++)  //debug - the a_det is very sensitive, stall while connector is finished inserting
        __delay_ms(10);

    //REG21 disable all legacy profiles, enable one by one during DCE cycling
    i2c_slave_command(slave_addr, 0x21, 0x7F);
 
//    draw_now = i2c_slave_read(slave_addr, 0x00); //update the current reading
    draw_best = i2c_slave_read(slave_addr, 0x00); //update the current reading

    // Try the different emulation profiles, make note of the best
    putstring0("trying SDP"); terpri0();
    try_profile(slave_addr, SDP, 0, &draw_best, &best_profile, &best_dce);

    putstring0("trying CDP"); terpri0();
    try_profile(slave_addr, CDP, 0, &draw_best, &best_profile, &best_dce);

    putstring0("trying DCP"); terpri0();
    try_profile(slave_addr, DCP, 0, &draw_best, &best_profile, &best_dce);

    putstring0("trying DCE1"); terpri0();
    try_profile(slave_addr, DCE, DCE_P1, &draw_best, &best_profile, &best_dce);

    putstring0("trying DCE2"); terpri0();
    try_profile(slave_addr, DCE, DCE_P2, &draw_best, &best_profile, &best_dce);

    putstring0("trying DCE3"); terpri0();
    try_profile(slave_addr, DCE, DCE_P3, &draw_best, &best_profile, &best_dce);

    putstring0("trying DCE4"); terpri0();
    try_profile(slave_addr, DCE, DCE_P4, &draw_best, &best_profile, &best_dce);

    putstring0("trying DCE5"); terpri0();
    try_profile(slave_addr, DCE, DCE_P5, &draw_best, &best_profile, &best_dce);

    putstring0("trying DCE6"); terpri0();
    try_profile(slave_addr, DCE, DCE_P6, &draw_best, &best_profile, &best_dce);

    putstring0("trying DCE7"); terpri0();
    try_profile(slave_addr, DCE, DCE_P7, &draw_best, &best_profile, &best_dce);

// apply the best one
    putstring0("Best DCE (hex): "); puthexbyte0(best_dce); terpri0();
    putstring0("Best Profile (hex): "); puthexbyte0(best_profile); terpri0();
    if (best_profile == DCE) // only sent if legacy is best
        i2c_slave_command(slave_addr, 0x21, best_dce);
    i2c_slave_command(slave_addr, 0x17, (best_profile & ~(1 << 1))); //disable port power
//    i2c_slave_command(slave_addr, 0x15, 0x10);       // discharge vbus, disable port power
    for (cnt = 0; cnt < PRFL_WAIT_MS/10; cnt++)  //TODO see how much this can be reduced
        __delay_ms(10);
    i2c_slave_command(slave_addr, 0x17, best_profile); //enable port power
//    i2c_slave_command(slave_addr, 0x15, 0x00);  //

//    INTERRUPT_GlobalInterruptEnable();
    terpri0(); terpri0();
    print_selections_msg();
    INTCONbits.IOCIE = 1;
    return;
}