src/occ_405/gpu/gpu.c
// Get GPU number for a GPU that needs to be checked if driver is loaded
// returns 0xFF if no GPU needs to be checked
Get GPU number for a GPU that needs to be checked if driver is loaded
returns 0xFF if no GPU needs to be checked
Get GPU number for a GPU that needs to be checked if driver is loaded returns 0xFF if no GPU needs to be checked
uint8_t gpu_id_need_driver_check(void)
{
    uint8_t gpu_id = 0xFF;  
    uint8_t i = 0;
    static uint8_t L_current_gpu_id = 0;
    if(L_current_gpu_id == 0xFF)
    {
       L_current_gpu_id = 0;
    }
    else
    {
       for (i=L_current_gpu_id; i<MAX_NUM_GPU_PER_DOMAIN; i++)
       {
           if((GPU_PRESENT(i)) && (!g_amec->gpu[i].status.disabled) &&
              (g_amec->gpu[i].status.readOnce) && (g_amec->gpu[i].status.checkDriverLoaded))
           {
              gpu_id = i;
              break;
           }
       }
       if(gpu_id == 0xFF)
       {
          L_current_gpu_id = 0;
       }
       else if(gpu_id == (MAX_NUM_GPU_PER_DOMAIN - 1) )
       {
          L_current_gpu_id = 0xFF;
       }
       else
       {
          L_current_gpu_id = gpu_id + 1;
       }
    }
    return gpu_id;
}
uint8_t gpu_id_need_driver_check ( void ) { uint8_t gpu_id = 0xFF ; uint8_t i = 0 ; static uint8_t L_current_gpu_id = 0 ; if ( L_current_gpu_id == 0xFF ) { L_current_gpu_id = 0 ; } else { for ( i = L_current_gpu_id ; i < MAX_NUM_GPU_PER_DOMAIN ; i ++ ) { if ( ( GPU_PRESENT ( i ) ) && ( ! g_amec -> gpu [ i ] . status . disabled ) && ( g_amec -> gpu [ i ] . status . readOnce ) && ( g_amec -> gpu [ i ] . status . checkDriverLoaded ) ) { gpu_id = i ; break ; } } if ( gpu_id == 0xFF ) { L_current_gpu_id = 0 ; } else if ( gpu_id == ( MAX_NUM_GPU_PER_DOMAIN - 1 ) ) { L_current_gpu_id = 0xFF ; } else { L_current_gpu_id = gpu_id + 1 ; } } return gpu_id ; }
Get GPU number for a GPU that needs to be checked if driver is loaded
returns 0xFF if no GPU needs to be checked
Get GPU number for a GPU that needs to be checked if driver is loaded returns 0xFF if no GPU needs to be checked
// default none needs checking // checking for driver loaded can be repeated until driver is loaded which may never happen // to avoid infinite loop checking the same GPU over and over we will use a static and each call // will start looking at the next GPU, after all GPUs checked will allow none before re-checking all GPUs // checked all GPUs once, do not check any this time and start over with GPU 0 on next call // only check for driver after i2c comm (readOnce) has been established //  setup L_current_gpu_id for next call based on what is happening this time // no GPU needs checking start back at 0 next time // last GPU is having driver checked do not check any next time // next time look at the next GPU ID first