view src/cs/services/fcbm/fcbm_env.c @ 235:ee04ca45053d

config system: add FCBM
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 01 May 2021 10:36:52 +0000
parents baa738eeb842
children
line wrap: on
line source

/*
 * This module provides the glue to the RiViera environment
 * for our FCBM SWE.
 */

#include "fcbm/fcbm_env.h"
#include "rv/rv_general.h"
#include "rvf/rvf_api.h"
#include "rvm/rvm_priorities.h"
#include "rvm/rvm_api.h"
#include "rvm/rvm_use_id_list.h"
#include <string.h>

/* Global variables for FCBM addr_id and prim_id */
T_RVF_ADDR_ID fcbm_addr_id;
T_RVF_MB_ID fcbm_prim_id;

T_RVM_RETURN fcbm_get_info (T_RVM_INFO_SWE  *infoSWE)
{
   /* SWE info */

   infoSWE->swe_type = RVM_SWE_TYPE_4;
   infoSWE->type_info.type4.swe_use_id = FCBM_USE_ID;
   memcpy( infoSWE->type_info.type4.swe_name, "FCBM", 5 );

   infoSWE->type_info.type4.stack_size = FCBM_STACK_SIZE;
   infoSWE->type_info.type4.priority   = RVM_FCBM_TASK_PRIORITY;

   /* memory bank info */
   infoSWE->type_info.type4.nb_mem_bank = 1;

   memcpy ((UINT8 *) infoSWE->type_info.type4.mem_bank[0].bank_name, "FCBM_PRIM", 10);
   infoSWE->type_info.type4.mem_bank[0].initial_params.size          = FCBM_MB_PRIM_SIZE;
   infoSWE->type_info.type4.mem_bank[0].initial_params.watermark     = FCBM_MB_PRIM_WATERMARK;

   /* linked SWE info: we depend on FCHG, R2D, KPD */
   infoSWE->type_info.type4.nb_linked_swe    = 3;
   infoSWE->type_info.type4.linked_swe_id[0] = FCHG_USE_ID;
   infoSWE->type_info.type4.linked_swe_id[1] = R2D_USE_ID;
   infoSWE->type_info.type4.linked_swe_id[2] = KPD_USE_ID;

   /* generic functions */
   infoSWE->type_info.type4.set_info = fcbm_set_info;
   infoSWE->type_info.type4.init     = fcbm_init;
   infoSWE->type_info.type4.core     = fcbm_core;
   infoSWE->type_info.type4.stop     = fcbm_stop;
   infoSWE->type_info.type4.kill     = fcbm_kill;

   /* Set the return path */
   infoSWE->type_info.type4.return_path.callback_func = NULL;
   infoSWE->type_info.type4.return_path.addr_id	      = 0;

   return RV_OK;
}

T_RVM_RETURN fcbm_set_info(T_RVF_ADDR_ID   addr_id,
                           T_RV_RETURN     return_path[],
                           T_RVF_MB_ID     mbId[],
                           T_RVM_RETURN  (*callBackFct) (T_RVM_NAME SWEntName,
                                                         T_RVM_RETURN errorCause,
                                                         T_RVM_ERROR_TYPE errorType,
                                                         T_RVM_STRING errorMsg))
{
    /* Store the addr id */
    fcbm_addr_id = addr_id;

    /* Store the memory bank id */
    fcbm_prim_id = mbId[0];

    return RV_OK;
}

T_RVM_RETURN fcbm_init(void)
{
   return RV_OK;
}

T_RVM_RETURN fcbm_stop(void)
{
   return RV_OK;
}

T_RVM_RETURN fcbm_kill(void)
{
   return RV_OK;
}