mirror of
https://github.com/apache/nuttx.git
synced 2026-06-07 01:05:54 +08:00
SAMA5 PHY: Add more debug instrumentation; Fix logic that would be used to disable PHY interrupts
This commit is contained in:
@@ -349,4 +349,17 @@ config ETH1_PHY_DM9161
|
||||
bool "Davicom DM9161 PHY"
|
||||
|
||||
endchoice
|
||||
|
||||
config NETDEV_PHY_DEBUG
|
||||
bool "PHY debug"
|
||||
default n
|
||||
depends on DEBUG
|
||||
---help---
|
||||
Normally debug output is controlled by DEBUG_NET. However, that
|
||||
may generate a LOT of debug output, especially if DEBUG_VERBOSE is
|
||||
also selected. This option is intended to force VERVOSE debug
|
||||
output from certain PHY-related even if DEBUG_NET or DEBUG_VERBOSE
|
||||
are not selected. This allows for focused, unit-level debug of
|
||||
the NSH network initialization logic.
|
||||
|
||||
endif # ARCH_HAVE_PHY
|
||||
|
||||
@@ -39,6 +39,15 @@
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
/* Force verbose debug on in this file only to support unit-level testing. */
|
||||
|
||||
#ifdef CONFIG_NETDEV_PHY_DEBUG
|
||||
# undef CONFIG_DEBUG_VERBOSE
|
||||
# define CONFIG_DEBUG_VERBOSE 1
|
||||
# undef CONFIG_DEBUG_NET
|
||||
# define CONFIG_DEBUG_NET 1
|
||||
#endif
|
||||
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <semaphore.h>
|
||||
@@ -66,6 +75,19 @@
|
||||
# define CONFIG_PHY_NOTIFICATION_NCLIENTS 4
|
||||
#endif
|
||||
|
||||
/* Debug ********************************************************************/
|
||||
/* Extra, in-depth debug output that is only available if
|
||||
* CONFIG_NETDEV_PHY_DEBUG us defined.
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_NETDEV_PHY_DEBUG
|
||||
# define phydbg dbg
|
||||
# define phylldbg lldbg
|
||||
#else
|
||||
# define phydbg(x...)
|
||||
# define phylldbg(x...)
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Private Types
|
||||
****************************************************************************/
|
||||
@@ -183,6 +205,7 @@ static FAR struct phy_notify_s *phy_find_unassigned(void)
|
||||
/* Return the client entry assigned to the caller */
|
||||
|
||||
phy_semgive();
|
||||
phydbg("Returning client %d\n", i);
|
||||
return client;
|
||||
}
|
||||
}
|
||||
@@ -217,6 +240,7 @@ static FAR struct phy_notify_s *phy_find_assigned(FAR const char *intf,
|
||||
/* Return the matching client entry to the caller */
|
||||
|
||||
phy_semgive();
|
||||
phydbg("Returning client %d\n", i);
|
||||
return client;
|
||||
}
|
||||
}
|
||||
@@ -240,10 +264,12 @@ static int phy_handler(FAR struct phy_notify_s *client)
|
||||
int ret;
|
||||
|
||||
DEBUGASSERT(client && client->assigned);
|
||||
phylldbg("Entry client %d, signalling PID=%d with signal %d\n",
|
||||
client->index, client->pid, client->signo);
|
||||
|
||||
/* Signal the client that the PHY has something interesting to say to us */
|
||||
|
||||
#ifdef CONFIG_CAN_PASS_STRUCTS
|
||||
#ifdef CONFIG_CAN_PASS_STRUCTS
|
||||
value.sival_ptr = client->arg;
|
||||
ret = sigqueue(client->pid, client->signo, value);
|
||||
#else
|
||||
@@ -328,6 +354,8 @@ int phy_notify_subscribe(FAR const char *intf, pid_t pid, int signo,
|
||||
FAR struct phy_notify_s *client;
|
||||
DEBUGASSERT(intf);
|
||||
|
||||
nvdbg("%s: PID=%d signo=%d arg=%p\n", intf, pid, signo, arg);
|
||||
|
||||
/* Find an unused slot in the client notification table */
|
||||
|
||||
client = phy_find_unassigned();
|
||||
@@ -342,6 +370,7 @@ int phy_notify_subscribe(FAR const char *intf, pid_t pid, int signo,
|
||||
if (pid == 0)
|
||||
{
|
||||
pid = getpid();
|
||||
phydbg("Actual PID=%d\n", pid);
|
||||
}
|
||||
|
||||
/* Initialize the client entry */
|
||||
@@ -386,6 +415,8 @@ int phy_notify_unsubscribe(FAR const char *intf, pid_t pid)
|
||||
{
|
||||
FAR struct phy_notify_s *client;
|
||||
|
||||
nvdbg("%s: PID=%d\n", intf, pid);
|
||||
|
||||
/* Find the client entry for this interface */
|
||||
|
||||
client = phy_find_assigned(intf, pid);
|
||||
|
||||
Reference in New Issue
Block a user