Skip to content

Commit

Permalink
Update the radio test packets to the new API.
Browse files Browse the repository at this point in the history
  • Loading branch information
docbacardi committed Aug 13, 2024
1 parent 5ac7f4c commit 7f4eb5e
Showing 1 changed file with 40 additions and 27 deletions.
67 changes: 40 additions & 27 deletions module/src/main_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,15 @@ typedef struct IOLWM_EHCI_COMMAND_HEADER_STRUCT
} IOLWM_EHCI_COMMAND_HEADER_T;


typedef struct IOLWM_SMI_REQ_HEADER_STRUCT
{
unsigned char ucClientID;
unsigned char ucPortNumber;
unsigned short usExpArgBlock;
unsigned short usArgBlockLen;
} IOLWM_SMI_REQ_HEADER_T;


typedef struct IOLWM_SMI_IND_HEADER_STRUCT
{
unsigned char ucClientID;
Expand All @@ -77,6 +86,15 @@ typedef struct IOLWM_SMI_IND_HEADER_STRUCT
} IOLWM_SMI_IND_HEADER_T;


typedef struct IOLWM_SMI_CNF_HEADER_STRUCT
{
unsigned char ucClientID;
unsigned char ucPortNumber;
unsigned short usRefArgBlock;
unsigned short usArgBlockLen;
} IOLWM_SMI_CNF_HEADER_T;


typedef struct IOLWM_PARAM_VS_STACKREADY_IND_STRUCT
{
IOLWM_SMI_IND_HEADER_T tHeader;
Expand Down Expand Up @@ -108,17 +126,14 @@ typedef struct IOLWM_PARAM_SMI_VS_RADIO_TEST_DATA_STRUCT

typedef struct IOLWM_PARAM_SMI_VS_RADIO_TEST_REQ_STRUCT
{
unsigned char ucClientID;
unsigned char ucPortNumber;
unsigned short usArgBlockLength;
IOLWM_SMI_REQ_HEADER_T tHeader;
IOLWM_PARAM_SMI_VS_RADIO_TEST_DATA_T tArgBlockData;
} IOLWM_PARAM_SMI_VS_RADIO_TEST_REQ_T;

typedef struct IOLWM_PARAM_SMI_VS_WRITE_CNF_STRUCT
{
unsigned char ucClientID;
unsigned char ucPortNumber;
unsigned short usResult;
IOLWM_SMI_CNF_HEADER_T tHeader;
unsigned short usID;
} IOLWM_PARAM_SMI_VS_WRITE_CNF_T;


Expand Down Expand Up @@ -321,6 +336,8 @@ typedef enum IOLWM_SMI_EVENT_OPCODE_ENUM

#define ARG_BLK_ID_VS_RADIO_CON_TEST 0xB051

#define ARG_BLK_ID_VOID_BLOCK 0xFFF0

/*-------------------------------------------------------------------------*/

static union {
Expand Down Expand Up @@ -687,18 +704,16 @@ static unsigned long module_waitforpowerup(unsigned char *pucBuffer)
}


#if 0

static void command_create(IOLWM_EHCI_COMMAND_PACKET_T *ptPacket, unsigned short usOpcode, unsigned short sizPayload)
{
ptPacket->uHeader.t.ucPacketType = 0x02;
ptPacket->uHeader.t.usHandle = 0x0001;
ptPacket->uHeader.t.ucPacketType = IOLW_EHCI_API_COMMAND_PACKET_TYPE;
ptPacket->uHeader.t.usOpcode = usOpcode;
/* Set the total length of the packet.
* This includes all header fields after the "usTotalLength", the payload data and the 2 byte checksum.
*/
ptPacket->uHeader.t.usTotalLength = (unsigned short)(4U + sizPayload + 2U);
ptPacket->uHeader.t.usOpcode = usOpcode;
ptPacket->uHeader.t.ucMsgCounter = (unsigned char)(m_uiMsgCounter & 0xffU);
ptPacket->uHeader.t.ucReserved = 0x00;
ptPacket->uHeader.t.ucSize = (unsigned char)(1U + sizPayload + 2U);
ptPacket->uHeader.t.ucMsgCnt = (unsigned char)(m_uiMsgCounter & 0xffU);
}


Expand All @@ -718,7 +733,7 @@ static void generate_command_checksum(unsigned int sizData)
}



#if 0
static unsigned long module_activateSmiMode(void)
{
unsigned long ulResult;
Expand Down Expand Up @@ -770,20 +785,21 @@ static unsigned long module_activateSmiMode(void)
}
#endif

#if 0

static unsigned long smi_vs_radio_test(unsigned char ucTrack, unsigned char ucCommand, unsigned char ucModulation, unsigned char ucTestPattern, unsigned char ucFrequencyIndex, unsigned long ulDataWhitenerIv, unsigned char ucTxPowerValue)
{
unsigned long ulResult;
unsigned long ulSize;
unsigned short usResult;
unsigned short usID;


++m_uiMsgCounter;

command_create(&(m_uBuffer.tCommand), IOLWM_SMI_VS_WRITE_REQ_OPCODE, sizeof(IOLWM_PARAM_SMI_VS_RADIO_TEST_REQ_T));
m_uBuffer.tCommand.uPayload.tSmiVsRadioTestReq.ucClientID = 0x01;
m_uBuffer.tCommand.uPayload.tSmiVsRadioTestReq.ucPortNumber = 0x00;
m_uBuffer.tCommand.uPayload.tSmiVsRadioTestReq.usArgBlockLength = sizeof(IOLWM_PARAM_SMI_VS_RADIO_TEST_REQ_T);
m_uBuffer.tCommand.uPayload.tSmiVsRadioTestReq.tHeader.ucClientID = 0x01;
m_uBuffer.tCommand.uPayload.tSmiVsRadioTestReq.tHeader.ucPortNumber = 0x00;
m_uBuffer.tCommand.uPayload.tSmiVsRadioTestReq.tHeader.usExpArgBlock = ARG_BLK_ID_VOID_BLOCK;
m_uBuffer.tCommand.uPayload.tSmiVsRadioTestReq.tHeader.usArgBlockLen = sizeof(IOLWM_PARAM_SMI_VS_RADIO_TEST_REQ_T);
m_uBuffer.tCommand.uPayload.tSmiVsRadioTestReq.tArgBlockData.usArgBlockID = ARG_BLK_ID_VS_RADIO_CON_TEST;
m_uBuffer.tCommand.uPayload.tSmiVsRadioTestReq.tArgBlockData.ucCommand = ucCommand;
m_uBuffer.tCommand.uPayload.tSmiVsRadioTestReq.tArgBlockData.ucTrack = ucTrack;
Expand All @@ -797,9 +813,11 @@ static unsigned long smi_vs_radio_test(unsigned char ucTrack, unsigned char ucCo
uart_send(m_uBuffer.auc, sizeof(IOLWM_EHCI_COMMAND_HEADER_T) + sizeof(IOLWM_PARAM_SMI_VS_RADIO_TEST_REQ_T) + 2U);

/* Wait for an ACK packet. */
ulResult = event_wait(&ulSize, IOLW_EHCI_SMI_EVENT_CODE_VALUE, IOLWM_SMI_ACK_OPCODE, 10);
ulResult = event_wait(&ulSize, IOLW_EHCI_SMI_EVENT_CODE_VALUE, IOLWM_SMI_EHCI_ACK_IND_OPCODE, 10);
if( ulResult==IOLWM_RESULT_Ok )
{
++m_uiMsgCounter;

ulResult = event_wait(&ulSize, IOLW_EHCI_SMI_EVENT_CODE_VALUE, IOLWM_SMI_VS_WRITE_CNF_OPCODE, 10);
if( ulResult==IOLWM_RESULT_Ok )
{
Expand All @@ -810,13 +828,13 @@ static unsigned long smi_vs_radio_test(unsigned char ucTrack, unsigned char ucCo
else
{
/* Save the result. It would be overwritten by the following ACK. */
usResult = m_uBuffer.tEvent.uPayload.tSmiVsWriteCnf.usResult;
usID = m_uBuffer.tEvent.uPayload.tSmiVsWriteCnf.usID;

/* Send an ACK. */
send_command_ack(m_uBuffer.tEvent.uHeader.t.ucMsgCounter);

/* Check the result. */
if( usResult!=0 )
if( usID!=ARG_BLK_ID_VOID_BLOCK )
{
ulResult = IOLWM_RESULT_EhciError;
}
Expand All @@ -826,11 +844,6 @@ static unsigned long smi_vs_radio_test(unsigned char ucTrack, unsigned char ucCo

return ulResult;
}
#endif
static unsigned long smi_vs_radio_test(unsigned char ucTrack, unsigned char ucCommand, unsigned char ucModulation, unsigned char ucTestPattern, unsigned char ucFrequencyIndex, unsigned long ulDataWhitenerIv, unsigned char ucTxPowerValue)
{
return 0;
}



Expand Down

0 comments on commit 7f4eb5e

Please sign in to comment.