URL
https://opencores.org/ocsvn/fade_ether_protocol/fade_ether_protocol/trunk
Go to most recent revision |
Show entire file |
Details |
Blame |
View Log
Rev 18 |
Rev 19 |
Line 225... |
Line 225... |
/* Function used to send the user command and wait for confirmation */
|
/* Function used to send the user command and wait for confirmation */
|
static inline
|
static inline
|
long send_cmd(slave_data * sd, uint16_t cmd, uint32_t arg, void * resp, int nof_retries, int timeout)
|
long send_cmd(slave_data * sd, uint16_t cmd, uint32_t arg, void * resp, int nof_retries, int timeout)
|
{
|
{
|
long result = -ETIMEDOUT;
|
long result = -ETIMEDOUT;
|
|
//First check, if the Ethernet device is claimed, otherwise return an error
|
|
if(sd->dev==NULL) return -ENODEV;
|
//Each slave may perform only one user command, so first check, if no other thread
|
//Each slave may perform only one user command, so first check, if no other thread
|
//attempts to send the command
|
//attempts to send the command
|
if ( mutex_trylock(&sd->usercmd_lock)==0) return -EBUSY;
|
if ( mutex_trylock(&sd->usercmd_lock)==0) return -EBUSY;
|
//Mutex acquired, we can proceed
|
//Mutex acquired, we can proceed
|
//First allocate the sequence number for the command
|
//First allocate the sequence number for the command
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.