Skip to content

Commit

Permalink
Mostly figured out message fields #13
Browse files Browse the repository at this point in the history
  • Loading branch information
ea committed May 30, 2021
1 parent e1ed89d commit e93f058
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 5 deletions.
1 change: 1 addition & 0 deletions scripts/rtos_interaction/dynload.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ handle = (struct link_map*) dlopen("/opt/bosch/processes/libosal_linux_so.so",
*(void**)(&pu32GetSharedBaseAdress) = dlsym(handle,"pu32GetSharedBaseAdress");
*(void**)(&vDebugFacility) = dlsym(handle,"vDebugFacility");
*(void**)(&vPrintSharedMemoryTable) = dlsym(handle,"vPrintSharedMemoryTable");
*(void**)(&vPrintMsgInfo) = dlsym(handle,"vPrintMsgInfo");

pOsalData = dlsym(handle,"pOsalData");

Expand Down
1 change: 1 addition & 0 deletions scripts/rtos_interaction/dynload.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ void * (*pu32GetSharedBaseAdress)();
void * (*vDebugFacility)();
int *pOsalData;
void * (*vPrintSharedMemoryTable)();
void (*vPrintMsgInfo)(char *,uint8_t flag);

int dynload();
void cleanup();
22 changes: 22 additions & 0 deletions scripts/rtos_interaction/osal_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,28 @@ typedef struct messageStruct {
int time;
} MessageStruct ;


typedef struct messageDataStruct {
uint32_t magic;
uint32_t unknown2;
uint32_t blocks;
uint16_t sender;
uint16_t receiver;
uint32_t size;
uint16_t unknown3;
uint8_t unknown4;
uint8_t type;
uint16_t s_sub;
uint16_t d_sub;
uint32_t time;
uint16_t serv_id;
uint16_t unknown5;
uint16_t func_id;
uint8_t opcode;
} MessageDataStruct;



// code: 0x0d60, len: 0x04
struct ECORoute {
uint8_t FuelType : 1; // byte 0
Expand Down
27 changes: 22 additions & 5 deletions scripts/rtos_interaction/rtos_message_testing.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,32 @@ int main(int argc, char **argv){
,message->unknownWord4
,message->queueSubId
,message->time);
char *p = pu32GetSharedBaseAdress();
p = p+ (int)msg_handle * 0xc;
MessageDataStruct *p = pu32GetSharedBaseAdress();
p = (MessageDataStruct*)((char*)p+ (int)msg_handle * 0xc);

// it seems like all valid messages should start with 0xdaca
dump((char*)(p),message->numBytes); printf("\n\n");

//dump((char*)(p),message->numBytes); printf("\n\n");

printf("mgk:0x%04x unk2: 0x%04x #blk:%d sndr:%d rcvr: %d sz:%d unk3:0x%02x unk4:0x%01x typ:%d s_sub:0x%02x, d_sub:0x%02x, time:%d serv_id:%d, unk5:0x%02x, fn:%d op:%d\n"
,p->magic
,p->unknown2
,p->blocks
,p->sender
,p->receiver
,p->size
,p->unknown3
,p->unknown4
,p->type
,p->s_sub
,p->d_sub
,p->time
,p->serv_id
,p->unknown5
,p->func_id
,p->opcode);
dump((char*)(p),p->blocks*12);
}


cleanup();
return 0;

Expand Down

0 comments on commit e93f058

Please sign in to comment.