Skip to content

Commit

Permalink
RevPi Generic PiBridge: Add new base device
Browse files Browse the repository at this point in the history
This base device can be used as a generic piBridge device to bring the
pibridge functionality to any board. It supports left and right piBridge,
both with ethernet for gateways.

Signed-off-by: Markus Kaupert <m.kaupert@kunbus.com>
  • Loading branch information
Markus Kaupert committed May 27, 2024
1 parent c950405 commit 6ffbfb3
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/RevPiDevice.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,17 @@ const MODGATECOM_IDResp RevPiFlat_ID_g = {
.i16uFeatureDescriptor = MODGATE_feature_IODataExchange
};

const MODGATECOM_IDResp RevPiGeneric_ID_g = {
.i32uSerialnumber = 1,
.i16uModulType = KUNBUS_FW_DESCR_TYP_PI_REVPI_GENERIC_PB,
.i16uHW_Revision = 1,
.i16uSW_Major = 1,
.i16uSW_Minor = 0,
.i32uSVN_Revision = 0,
.i16uFBS_InputLength = 0,
.i16uFBS_OutputLength = 0,
.i16uFeatureDescriptor = 0
};

void RevPiDevice_init(void)
{
Expand Down Expand Up @@ -154,6 +165,11 @@ void RevPiDevice_init(void)
RevPiDevice_getDev(RevPiDevice_getDevCnt())->i16uInputOffset = 0;
RevPiDevice_getDev(RevPiDevice_getDevCnt())->i16uOutputOffset = RevPiFlat_ID_g.i16uFBS_InputLength;
break;
case REVPI_GENERIC_PB:
RevPiDevice_getDev(RevPiDevice_getDevCnt())->sId = RevPiGeneric_ID_g;
RevPiDevice_getDev(RevPiDevice_getDevCnt())->i16uInputOffset = 0;
RevPiDevice_getDev(RevPiDevice_getDevCnt())->i16uOutputOffset = RevPiGeneric_ID_g.i16uFBS_InputLength;
break;
}

RevPiDevice_incDevCnt();
Expand Down
5 changes: 5 additions & 0 deletions src/piControlMain.c
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,11 @@ static int __init piControlInit(void)
piDev_g.machine_type = REVPI_CONNECT_4;
piDev_g.pibridge_supported = 1;
pr_info("RevPi Connect 4\n");
} else if (of_machine_is_compatible("kunbus,revpi-pibridge")) {
piDev_g.machine_type = REVPI_GENERIC_PB;
piDev_g.pibridge_supported = 1;
piDev_g.revpi_gate_supported = 1;
pr_info("RevPi Generic PiBridge\n");
} else if (of_machine_is_compatible("kunbus,revpi-flat")) {
piDev_g.machine_type = REVPI_FLAT;
pr_info("RevPi Flat\n");
Expand Down
1 change: 1 addition & 0 deletions src/piControlMain.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ enum revpi_machine {
REVPI_CONNECT_SE = 5,
REVPI_CORE_SE = 6,
REVPI_CONNECT_4 = 7,
REVPI_GENERIC_PB = 255,
};

typedef struct spiControlDev {
Expand Down

0 comments on commit 6ffbfb3

Please sign in to comment.