/*
 * grifo_pc_if.h
 *
 */

#ifndef GRIFO_PC_IF_H_
#define GRIFO_PC_IF_H_


#include <stdint.h>

namespace grifo_fw
{

struct pc_raw_if_t
{
    template<unsigned int S_, unsigned int E_> struct spare_t {uint32_t xxx[(E_-S_)/4];};

    enum { PC_MHZ=56};

    enum mof_t
    {
        mof_pass=0, //FOUT=16MHz (Mspbs)
        mof_ss=1,   //2MHz
        mof_fs=2,   //2MHz
        mof_fi=3,   //4Mhz
        mof_is=4    //2Mhz
    };

    struct basic_settings_t
    {
        uint32_t mof; //mof_t
        uint32_t lpf_filter_id;

        uint32_t lsn_start_56mhz;
        uint32_t lsn_len_56mhz;

        uint32_t out_ofs; //unused

        uint32_t n_samples;  //PC number of sample tellback - read only
    };


    basic_settings_t settings;

    uint32_t spare_[1024];
    //PC full: TBD
};


class pc_blob_t;

extern pc_raw_if_t* pc_blob_payload(const pc_blob_t* b=0);

extern void pc_initialize_raw_default_blob(void* raw_memory);

extern pc_blob_t* pc_get_default_blob();
extern pc_raw_if_t* pc_get_default_if(void);

static inline float pc_us2ticks(float us)
{
    return us*float(pc_raw_if_t::PC_MHZ);
}

}//namespace

#endif /* GRIFO_PC_IF_H_ */
