VxWorks, calculate tick receive timouts from systick, fixes #310
This commit is contained in:
parent
131158dda8
commit
5c71c281fc
|
@ -38,6 +38,7 @@
|
||||||
#include <muxLib.h>
|
#include <muxLib.h>
|
||||||
#include <ipProto.h>
|
#include <ipProto.h>
|
||||||
#include <wvLib.h>
|
#include <wvLib.h>
|
||||||
|
#include <sysLib.h>
|
||||||
|
|
||||||
#include "oshw.h"
|
#include "oshw.h"
|
||||||
#include "osal.h"
|
#include "osal.h"
|
||||||
|
@ -98,6 +99,10 @@ const uint16 secMAC[3] = { 0x0404, 0x0404, 0x0404 };
|
||||||
/** second MAC word is used for identification */
|
/** second MAC word is used for identification */
|
||||||
#define RX_SEC secMAC[1]
|
#define RX_SEC secMAC[1]
|
||||||
|
|
||||||
|
/* usec per tick for timeconversion, default to 1kHz */
|
||||||
|
#define USECS_PER_SEC 1000000
|
||||||
|
static unsigned int usec_per_tick = 1000;
|
||||||
|
|
||||||
/** Receive hook called by Mux driver. */
|
/** Receive hook called by Mux driver. */
|
||||||
static int mux_rx_callback(void* pCookie, long type, M_BLK_ID pMblk, LL_HDR_INFO *llHdrInfo, void *muxUserArg);
|
static int mux_rx_callback(void* pCookie, long type, M_BLK_ID pMblk, LL_HDR_INFO *llHdrInfo, void *muxUserArg);
|
||||||
|
|
||||||
|
@ -128,6 +133,11 @@ int ecx_setupnic(ecx_portt *port, const char *ifname, int secondary)
|
||||||
int unit_no = -1;
|
int unit_no = -1;
|
||||||
ETHERCAT_PKT_DEV * pPktDev;
|
ETHERCAT_PKT_DEV * pPktDev;
|
||||||
|
|
||||||
|
/* Get systick info, sysClkRateGet return ticks per second */
|
||||||
|
usec_per_tick = USECS_PER_SEC / sysClkRateGet();
|
||||||
|
/* Don't allow 0 since it is used in DIV */
|
||||||
|
if(usec_per_tick == 0)
|
||||||
|
usec_per_tick = 1;
|
||||||
/* Make reference to packet device struct, keep track if the packet
|
/* Make reference to packet device struct, keep track if the packet
|
||||||
* device is the redundant or not.
|
* device is the redundant or not.
|
||||||
*/
|
*/
|
||||||
|
@ -672,7 +682,7 @@ static int ecx_recvpkt(ecx_portt *port, int idx, int stacknumber, M_BLK_ID * pMb
|
||||||
{
|
{
|
||||||
int bytesrx = 0;
|
int bytesrx = 0;
|
||||||
MSG_Q_ID msgQId;
|
MSG_Q_ID msgQId;
|
||||||
int tick_timeout = max((timeout / 1000), 1);
|
int tick_timeout = max((timeout / usec_per_tick), 1);
|
||||||
|
|
||||||
if (stacknumber == 1)
|
if (stacknumber == 1)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue