From: Subrata <sub...@us...> - 2008-07-26 04:41:41
|
Update of /cvsroot/ltp/ltp/testcases/open_hpi_testsuite/plugins/simulator In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14452/ltp/testcases/open_hpi_testsuite/plugins/simulator Added Files: sim_dimi.c sim_dimi.h sim_fumi.c sim_fumi.h sim_fumi_func.c sim_fumi_func.h Log Message: Update to OpenHPI 2.12.0 (see www.openhpi.org for more info) --- NEW FILE: sim_fumi_func.c --- /* -*- linux-c -*- * * (C) Copyright IBM Corp. 2008 * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. This * file and program are licensed under a BSD style license. See * the Copying file included with the OpenHPI distribution for * full licensing terms. * * Authors: * Suntrupth S Yadav <sun...@in...> */ #include <sim_init.h> SaErrorT sim_set_fumi_source(void *hnd, SaHpiResourceIdT rid, SaHpiFumiNumT fnum, SaHpiBankNumT bnum, SaHpiTextBufferT *sourceuri) { return SA_ERR_HPI_INVALID_CMD; } void* oh_set_fumi_source (void *, SaHpiResourceIdT,SaHpiFumiNumT, SaHpiBankNumT, SaHpiTextBufferT *) __attribute__ ((weak, alias("sim_set_fumi_source"))); --- NEW FILE: sim_fumi_func.h --- /* -*- linux-c -*- * * (C) Copyright IBM Corp. 2008 * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. This * file and program are licensed under a BSD style license. See * the Copying file included with the OpenHPI distribution for * full licensing terms. * * Authors: * Suntrupth S Yadav <sun...@in...> */ #ifndef __SIM_FUMI_FUNC_H #define __SIM_FUMI_FUNC_H SaErrorT sim_set_fumi_source(void *hnd, SaHpiResourceIdT rid, SaHpiFumiNumT fnum, SaHpiBankNumT bnum, SaHpiTextBufferT *sourceuri); #endif --- NEW FILE: sim_dimi.h --- /* -*- linux-c -*- * * (C) Copyright IBM Corp. 2008 * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. This * file and program are licensed under a BSD style license. See * the Copying file included with the OpenHPI distribution for * full licensing terms. * * Authors: * Suntrupth S Yadav <sun...@in...> */ #ifndef __SIM_DIMI_H #define __SIM_DIMI_H struct sim_dimi_info { SaHpiDimiInfoT info; SaHpiDimiTestT test; }; struct sim_dimi { SaHpiDimiRecT dimirec; SaHpiDimiInfoT info; SaHpiDimiTestT test; const char *comment; }; extern struct sim_dimi sim_chassis_dimis[]; SaErrorT sim_discover_chassis_dimis(struct oh_handler_state *state, struct oh_event *e); #endif --- NEW FILE: sim_fumi.c --- /* -*- linux-c -*- * * (C) Copyright IBM Corp. 2008 * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. This * file and program are licensed under a BSD style license. See * the Copying file included with the OpenHPI distribution for * full licensing terms. * * Authors: * Suntrupth S Yadav <sun...@in...> */ #include <sim_init.h> #include <rpt_utils.h> static SaErrorT new_fumi(struct oh_handler_state *state, struct oh_event *e, struct sim_fumi *myfumi) { SaHpiRdrT *rdr = NULL; struct sim_fumi_info *info; SaErrorT error = SA_OK; rdr = (SaHpiRdrT *)g_malloc0(sizeof(SaHpiRdrT)); // Copy information from rdr array to res_rdr rdr->RdrType = SAHPI_FUMI_RDR; memcpy(&rdr->RdrTypeUnion.FumiRec, &myfumi->fumirec, sizeof(SaHpiFumiRecT)); oh_init_textbuffer(&rdr->IdString); oh_append_textbuffer(&rdr->IdString, myfumi->comment); rdr->RecordId = oh_get_rdr_uid(SAHPI_FUMI_RDR, rdr->RdrTypeUnion.FumiRec.Num); // get the entity path rdr->Entity = e->resource.ResourceEntity; //set up our private data info = (struct sim_fumi_info *)g_malloc(sizeof(struct sim_fumi_info)); memcpy(&info->srcinfo, &myfumi->srcinfo, sizeof(SaHpiFumiSourceInfoT)); memcpy(&info->info, &myfumi->info, sizeof(SaHpiFumiBankInfoT)); /* everything ready so inject the rdr */ error = sim_inject_rdr(state, e, rdr, info); if (error) { g_free(rdr); g_free(info); } return error; } SaErrorT sim_discover_chassis_fumis(struct oh_handler_state *state, struct oh_event *e) { SaErrorT rc; int i = 0; int j = 0; while (sim_chassis_fumis[i].fumirec.Num != 0) { rc = new_fumi(state, e, &sim_chassis_fumis[i]); if (rc) { err("Error %d returned when adding chassis fumi", rc); } else { j++; } i++; } dbg("%d of %d chassis fumis injected", j, i); return 0; } --- NEW FILE: sim_dimi.c --- /* -*- linux-c -*- * * (C) Copyright IBM Corp. 2008 * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. This * file and program are licensed under a BSD style license. See * the Copying file included with the OpenHPI distribution for * full licensing terms. * * Authors: * Suntrupth S Yadav <sun...@in...> */ #include <sim_init.h> #include <rpt_utils.h> static SaErrorT new_dimi(struct oh_handler_state *state, struct oh_event *e, struct sim_dimi *mydimi) { SaHpiRdrT *rdr = NULL; struct sim_dimi_info *info; SaErrorT error = SA_OK; rdr = (SaHpiRdrT *)g_malloc0(sizeof(SaHpiRdrT)); // Copy information from rdr array to res_rdr rdr->RdrType = SAHPI_DIMI_RDR; memcpy(&rdr->RdrTypeUnion.DimiRec, &mydimi->dimirec, sizeof(SaHpiDimiRecT)); oh_init_textbuffer(&rdr->IdString); oh_append_textbuffer(&rdr->IdString, mydimi->comment); rdr->RecordId = oh_get_rdr_uid(SAHPI_DIMI_RDR, rdr->RdrTypeUnion.DimiRec.DimiNum); // get the entity path rdr->Entity = e->resource.ResourceEntity; //set up our private data info = (struct sim_dimi_info *)g_malloc(sizeof(struct sim_dimi_info)); memcpy(&info->info, &mydimi->info, sizeof(SaHpiDimiInfoT)); memcpy(&info->test, &mydimi->test, sizeof(SaHpiDimiTestT)); /* everything ready so inject the rdr */ error = sim_inject_rdr(state, e, rdr, info); if (error) { g_free(rdr); g_free(info); } return error; } SaErrorT sim_discover_chassis_dimis(struct oh_handler_state *state, struct oh_event *e) { SaErrorT rc; int i = 0; int j = 0; while (sim_chassis_dimis[i].dimirec.DimiNum != 0) { rc = new_dimi(state, e, &sim_chassis_dimis[i]); if (rc) { err("Error %d returned when adding chassis dimi", rc); } else { j++; } i++; } dbg("%d of %d chassis dimis injected", j, i); return 0; } --- NEW FILE: sim_fumi.h --- /* -*- linux-c -*- * * (C) Copyright IBM Corp. 2008 * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. This * file and program are licensed under a BSD style license. See * the Copying file included with the OpenHPI distribution for * full licensing terms. * * Authors: * Suntrupth S Yadav <sun...@in...> */ #ifndef __SIM_FUMI_H #define __SIM_FUMI_H struct sim_fumi_info { SaHpiFumiSourceInfoT srcinfo; SaHpiFumiBankInfoT info; }; struct sim_fumi { SaHpiFumiRecT fumirec; SaHpiFumiSourceInfoT srcinfo; SaHpiFumiBankInfoT info; const char *comment; }; extern struct sim_fumi sim_chassis_fumis[]; SaErrorT sim_discover_chassis_fumis(struct oh_handler_state *state, struct oh_event *e); #endif |