#include "nv_push_clc46f.h"

#include <stdio.h>

#include "util/u_math.h"





const char *P_PARSE_NVC36F_MTHD(uint16_t idx) ATTRIBUTE_COLD;
void P_DUMP_NVC36F_MTHD_DATA(FILE *fp, uint16_t idx, uint32_t data,
                                   const char *prefix) ATTRIBUTE_COLD;

const char*
P_PARSE_NVC46F_MTHD(uint16_t idx)
{
    switch (idx) {

  
    default:

    return P_PARSE_NVC36F_MTHD(idx);

                                                                                            case NVC46F_CLEAR_FAULTED:
        return "NVC46F_CLEAR_FAULTED";

    }
}

void
P_DUMP_NVC46F_MTHD_DATA(FILE *fp, uint16_t idx, uint32_t data,
                         const char *prefix)
{
    UNUSED uint32_t parsed;
    switch (idx) {

  
    default:

    P_DUMP_NVC36F_MTHD_DATA(fp, idx, data, prefix);
    break;

                                                                                          
    case NVC46F_CLEAR_FAULTED:

    
        parsed = (data >> 0) & ((1u << 31) - 1);
        fprintf(fp, "%s.HANDLE = ", prefix);
        fprintf(fp, "(0x%x)\n", parsed);
    
        parsed = (data >> 31) & ((1u << 1) - 1);
        fprintf(fp, "%s.TYPE = ", prefix);
        switch (parsed) {
        case NVC46F_CLEAR_FAULTED_TYPE_PBDMA_FAULTED:
            fprintf(fp, "PBDMA_FAULTED\n");
            break;
        case NVC46F_CLEAR_FAULTED_TYPE_ENG_FAULTED:
            fprintf(fp, "ENG_FAULTED\n");
            break;
        default:
            fprintf(fp, "0x%x\n", parsed);
            break;
        }
        break;
    }
}
