summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoachim Naulet2008-04-29 17:46:28 +0200
committerJoachim Naulet2008-04-29 17:46:28 +0200
commitf5744f1ab515e794fbc933abbbe136793e36fdc8 (patch)
treefaace935673bfa234c617e6f9f9a062fea2bf7f3
parentd6cd14eebb92a82f794ce4444a7eaadfc2c6e81e (diff)
Lots of debug & gpios added
-rw-r--r--app/sm-plc-drv/src/ce_core.c14
-rw-r--r--app/sm-plc-drv/src/linux_drv.c6
-rw-r--r--app/sm-plc-drv/src/mac_interface.c2
-rw-r--r--app/sm-plc-drv/src/mac_network_discovery.c23
-rw-r--r--app/sm-plc-drv/src/mac_rx.c9
-rw-r--r--app/sm-plc-drv/src/plc_proc.c47
-rw-r--r--app/sm-plc-drv/src/plcp_fmode.c1
-rw-r--r--app/sm-plc-drv/src/plcp_frame.c5
-rw-r--r--app/sm-plc-drv/src/scheduler_v2.c3
-rw-r--r--include/gpio_event.h21
10 files changed, 96 insertions, 35 deletions
diff --git a/app/sm-plc-drv/src/ce_core.c b/app/sm-plc-drv/src/ce_core.c
index d801fc6810..c7805d9c36 100644
--- a/app/sm-plc-drv/src/ce_core.c
+++ b/app/sm-plc-drv/src/ce_core.c
@@ -4406,7 +4406,9 @@ static void ce_event_request (struct plc_drv_unit *unit, struct MmduIndicate *mm
ce_execute_step (unit, host, pframe);
/* free received frame */
+ GPIO_WRITE(GPIO_EVENT_CE_FREE, 1);
plcp_free_rx_frame (pframe);
+ GPIO_WRITE(GPIO_EVENT_CE_FREE, 0);
}
/* handle channel indications */
@@ -4466,7 +4468,9 @@ static void ce_event_indicate (struct plc_drv_unit *unit, struct MmduIndicate *m
else
{
RT_PRINTM (TRACE_MCAST, TRACE_ERROR, "ce: bad bssid\n");
+ GPIO_WRITE(GPIO_EVENT_CE_FREE, 1);
plcp_free_rx_frame (input);
+ GPIO_WRITE(GPIO_EVENT_CE_FREE, 0);
return;
}
own = 0;
@@ -4515,7 +4519,9 @@ static void ce_event_indicate (struct plc_drv_unit *unit, struct MmduIndicate *m
}
/* free received frame */
+ GPIO_WRITE(GPIO_EVENT_CE_FREE, 1);
plcp_free_rx_frame (input);
+ GPIO_WRITE(GPIO_EVENT_CE_FREE, 0);
}
/* -----------------------------------------------------------------------
@@ -4654,7 +4660,9 @@ static void ce_event_reply (struct plc_drv_unit *unit, struct MmduIndicate *mm_i
}
/* free received frame */
+ GPIO_WRITE(GPIO_EVENT_CE_FREE, 1);
plcp_free_rx_frame (pframe);
+ GPIO_WRITE(GPIO_EVENT_CE_FREE, 0);
}
/* the frame has been sent */
@@ -5555,7 +5563,9 @@ void ce_handle_rx (struct plc_drv_unit *unit, struct plcp_host *host, struct plc
/* no control buffer, drop */
RT_PRINTM (TRACE_CHANNEL, TRACE_ERROR, "ce_recv: no host. subtype type=%d\n", pframe->control->l_frm.subtype);
unit->stats.ce.nb_host_unknown++;
+ GPIO_WRITE(GPIO_EVENT_CE_FREE, 1);
plcp_free_rx_frame (pframe);
+ GPIO_WRITE(GPIO_EVENT_CE_FREE, 0);
}
else
{ /* send a signal to the ce_process */
@@ -5633,6 +5643,7 @@ OS_PROCESS (ce_process)
sig = receive (anysel);
ASSERT (ce_lock_sem);
wait_sem (ce_lock_sem);
+ GPIO_WRITE(GPIO_EVENT_CE_ACTIVITY, 1);
GPIO_WRITE (GPIO_EVENT_CE_PROCESS, 1);
switch (sig->sigNo)
{
@@ -5779,7 +5790,9 @@ OS_PROCESS (ce_process)
RT_PRINTM (TRACE_CHANNEL, TRACE_DEBUG, " efr=%d\n", pframe->control->l_frm.efr);
RT_PRINTM (TRACE_CHANNEL, TRACE_DEBUG, " flags=%d\n", pframe->control->l_frm.flags);
RT_PRINTM (TRACE_CHANNEL, TRACE_DEBUG, " channel=%d\n", pframe->control->l_frm.channel_id);
+ GPIO_WRITE(GPIO_EVENT_CE_FREE, 1);
plcp_free_rx_frame (pframe);
+ GPIO_WRITE(GPIO_EVENT_CE_FREE, 0);
}
break;
}
@@ -5868,6 +5881,7 @@ OS_PROCESS (ce_process)
/* free the signal */
free_buf (&sig);
signal_sem (ce_lock_sem);
+ GPIO_WRITE(GPIO_EVENT_CE_ACTIVITY, 0);
}
}
diff --git a/app/sm-plc-drv/src/linux_drv.c b/app/sm-plc-drv/src/linux_drv.c
index 7c2aa2675d..cd36431bee 100644
--- a/app/sm-plc-drv/src/linux_drv.c
+++ b/app/sm-plc-drv/src/linux_drv.c
@@ -1727,11 +1727,13 @@ static int drv_poll_recv_done (struct net_device *dev, int *budget)
list_del_init (&pframe->link);
hard_local_irq_restore (flags);
- n += sar_switch[pframe->sar_enable].mac_handle_rx (ze_unit, pframe);
- GPIO_PULSE(GPIO_EVENT_RX_FRAME_FREE);
+ GPIO_WRITE(GPIO_EVENT_RX_FRAME_FREE, 1);
+
+ n += sar_switch[pframe->sar_enable].mac_handle_rx (ze_unit, pframe);
plcp_free_rx_frame (pframe);
+ GPIO_WRITE(GPIO_EVENT_RX_FRAME_FREE, 0);
hard_local_irq_save (flags);
}
if (!list_empty (&plcp_rx_queue[PLCP_PRIO_DATA]))
diff --git a/app/sm-plc-drv/src/mac_interface.c b/app/sm-plc-drv/src/mac_interface.c
index affaca39e8..e344372508 100644
--- a/app/sm-plc-drv/src/mac_interface.c
+++ b/app/sm-plc-drv/src/mac_interface.c
@@ -1333,7 +1333,7 @@ bool phy_tx_data_request (struct plc_drv_unit *unit, struct plcp_frame *pframe)
#ifdef DEBUG_SEQNO
#ifdef CONFIG_PLC_PPC
-#error DEBUG_SEQNO can't be defined alongside CONFIG_PLC_PPC
+#error DEBUG_SEQNO can\'t be defined alongside CONFIG_PLC_PPC
#endif
switch (pframe->control->l_frm.type)
{
diff --git a/app/sm-plc-drv/src/mac_network_discovery.c b/app/sm-plc-drv/src/mac_network_discovery.c
index 3742e4a560..c52c354d48 100644
--- a/app/sm-plc-drv/src/mac_network_discovery.c
+++ b/app/sm-plc-drv/src/mac_network_discovery.c
@@ -1940,6 +1940,7 @@ OS_PROCESS (network_discovery)
struct plc_drv_unit *unit = plc_drv_get_unit (0);
struct plcp_frame *pframe;
struct nd_header *head;
+ uint8_t rx_bands;
#ifdef CONFIG_PLC_DEBUG
network_discovery_saved = network_discovery_;
@@ -1979,6 +1980,8 @@ OS_PROCESS (network_discovery)
DBG_ND_STATE = ND_STATE_RUNNING;
#endif
+ GPIO_WRITE(GPIO_EVENT_ND_ACTIVITY, 1);
+
switch (sig->sigNo)
{
case MMDU_INDICATE:
@@ -1987,6 +1990,13 @@ OS_PROCESS (network_discovery)
#endif
pframe = (struct plcp_frame *) sig->nd_signal.MmduIndicate.pframe;
head = (struct nd_header *) pframe->d_buf;
+ rx_bands = pframe->rx_bands;
+
+ /* free the plcp frame now */
+ GPIO_WRITE(GPIO_EVENT_ND_FREE, 1);
+ plcp_free_rx_frame (pframe);
+ GPIO_WRITE(GPIO_EVENT_ND_FREE, 0);
+
// check that the frame are addressed to us
if (plcp_same_mac (head->dstEthAddr.addr, unit->mac_addr)
|| plcp_same_mac (head->dstEthAddr.addr, broadcast_addr))
@@ -2000,10 +2010,10 @@ OS_PROCESS (network_discovery)
probe_reply (unit, (struct probe_reply *) head);
break;
case MA_SUBTYPE_ASSOC_REQUEST:
- assoc_request (unit, (struct assoc_request *) head, sync_band (pframe->rx_bands));
+ assoc_request (unit, (struct assoc_request *) head, sync_band (rx_bands));
break;
case MA_SUBTYPE_ASSOC_REPLY:
- assoc_reply (unit, (struct assoc_reply *) head, sync_band (pframe->rx_bands));
+ assoc_reply (unit, (struct assoc_reply *) head, sync_band (rx_bands));
break;
case MA_SUBTYPE_DISASSOC_REQUEST:
disassoc_request (unit, (struct disassoc_request *) head);
@@ -2013,16 +2023,16 @@ OS_PROCESS (network_discovery)
break;
#ifdef CONFIG_PLC_PPC
case MA_SUBTYPE_REASSOC_REQUEST:
- reassoc_request (unit, (struct reassoc_request *) head, sync_band (pframe->rx_bands));
+ reassoc_request (unit, (struct reassoc_request *) head, sync_band (rx_bands));
break;
#endif
#ifdef PLC_RECOVERY
case MA_SUBTYPE_RECOVERY_REQUEST:
- recovery_request (unit, (struct recovery_request *) head, sync_band (pframe->rx_bands));
+ recovery_request (unit, (struct recovery_request *) head, sync_band (rx_bands));
break;
case MA_SUBTYPE_RECOVERY_REPLY:
- recovery_reply (unit, (struct recovery_reply *) head, sync_band (pframe->rx_bands));
+ recovery_reply (unit, (struct recovery_reply *) head, sync_band (rx_bands));
break;
#endif
default:
@@ -2031,8 +2041,6 @@ OS_PROCESS (network_discovery)
}
}
- /* free the plcp frame now */
- plcp_free_rx_frame (pframe);
break;
case MLME_SCAN_REQUEST:
@@ -2077,6 +2085,7 @@ OS_PROCESS (network_discovery)
/* Free the signal */
free_buf (&sig);
+ GPIO_WRITE(GPIO_EVENT_ND_ACTIVITY, 0);
}
}
diff --git a/app/sm-plc-drv/src/mac_rx.c b/app/sm-plc-drv/src/mac_rx.c
index 307a55f98f..659d02a503 100644
--- a/app/sm-plc-drv/src/mac_rx.c
+++ b/app/sm-plc-drv/src/mac_rx.c
@@ -75,7 +75,9 @@ void mng_handle_rx (struct plc_drv_unit *unit, struct plcp_host *host, struct pl
#endif
else if (is_channel_estimation (subtype))
{
+ GPIO_WRITE(GPIO_EVENT_CE_SIGNAL, 1);
ce_handle_rx (unit, host, pframe, failed);
+ GPIO_WRITE(GPIO_EVENT_CE_SIGNAL, 0);
unit->stats.drv.handle_rx_channel++;
}
else if ((subtype >= MA_SUBTYPE_PROBE_REQUEST && subtype <= MA_SUBTYPE_DISASSOC_REPLY)
@@ -88,12 +90,16 @@ void mng_handle_rx (struct plc_drv_unit *unit, struct plcp_host *host, struct pl
#endif
)
{
+ GPIO_WRITE(GPIO_EVENT_ND_SIGNAL, 1);
nd_handle_rx (unit, host, pframe, failed);
+ GPIO_WRITE(GPIO_EVENT_ND_SIGNAL, 0);
unit->stats.drv.handle_rx_nd++;
}
else
{ /* PLCP_TEST */
+ GPIO_WRITE(GPIO_EVENT_RX_MGT_DROP, 1);
plcp_free_rx_frame (pframe);
+ GPIO_WRITE(GPIO_EVENT_RX_MGT_DROP, 0);
}
}
@@ -719,6 +725,7 @@ OS_PROCESS (rx_management_process)
LOCK_SAVE (msr);
while (!(list_empty (&plcp_rx_queue[PLCP_PRIO_MM])))
{
+ GPIO_WRITE (GPIO_EVENT_RX_MANAGEMENT, 1);
pframe = list_entry (plcp_rx_queue[PLCP_PRIO_MM].next, struct plcp_frame, link);
list_del_init (&pframe->link);
@@ -726,6 +733,7 @@ OS_PROCESS (rx_management_process)
LOCK_RESTORE (msr);
mm_handle_rx (unit, pframe);
LOCK_SAVE (msr);
+ GPIO_WRITE (GPIO_EVENT_RX_MANAGEMENT, 0);
}
LOCK_RESTORE (msr);
@@ -771,6 +779,7 @@ void mac_handle_rx_end (struct plc_drv_unit *unit, struct plcp_frame *pframe)
/* the queue is handled under Linux context */
if (unit->rx_int_enabled)
{
+ GPIO_PULSE(GPIO_EVENT_RX_FRAME_ALLOC);
rt_pend_linux_irq (POLL_IRQ);
}
unit->stats.mac.rx_pframe++;
diff --git a/app/sm-plc-drv/src/plc_proc.c b/app/sm-plc-drv/src/plc_proc.c
index 9c29d16d67..77acd3c502 100644
--- a/app/sm-plc-drv/src/plc_proc.c
+++ b/app/sm-plc-drv/src/plc_proc.c
@@ -2985,32 +2985,41 @@ char *gpio_event_names[GPIO_EVENT_MAX] = {
[GPIO_STATE_BIT2_CS_STATE] = "GPIO_STATE_BIT2_CS_STATE",
[GPIO_BACKOFF_ALLOWED] = "GPIO_BACKOFF_ALLOWED",
[GPIO_PCF_STATEMATE] = "GPIO_PCF_STATEMATE",
+
+ /* tmp */
[GPIO_EVENT_TIME_SCHED] = "GPIO_EVENT_TIME_SCHED",
[GPIO_EVENT_RX_FRAME_ALLOC] = "GPIO_EVENT_RX_FRAME_ALLOC",
- [GPIO_EVENT_RX_FRAME_FREE] = "GPIO_EVENT_RX_FRAME_FREE"
+ [GPIO_EVENT_RX_FRAME_FREE] = "GPIO_EVENT_RX_FRAME_FREE",
+ [GPIO_EVENT_RX_BUF_UNDERRUN] = "GPIO_EVENT_RX_BUF_UNDERRUN",
+
+ [GPIO_EVENT_RX_MANAGEMENT] = "GPIO_EVENT_RX_MANAGEMENT",
+ [GPIO_EVENT_CE_SIGNAL] = "GPIO_EVENT_CE_SIGNAL",
+ [GPIO_EVENT_ND_SIGNAL] = "GPIO_EVENT_ND_SIGNAL",
+ [GPIO_EVENT_RX_MGT_DROP] = "GPIO_EVENT_RX_MGT_DROP",
+
+ [GPIO_EVENT_CE_ACTIVITY] = "GPIO_EVENT_CE_ACTIVITY",
+ [GPIO_EVENT_CE_FREE] = "GPIO_EVENT_CE_FREE",
+ [GPIO_EVENT_ND_ACTIVITY] = "GPIO_EVENT_ND_ACTIVITY",
+ [GPIO_EVENT_ND_FREE] = "GPIO_EVENT_ND_FREE",
};
int proc_r_gpio (char *buf, char **start, off_t offset, int count, int *eof, void *data)
{
- int i;
- char *p = buf;
-
- for (i = 0; i < GPIO_EVENT_MAX; i++)
- {
- p += sprintf (p, "%36s ", gpio_event_names[i]);
- if (gpio_map[i] == GPIO_NOT_MAPPED)
- {
- p += sprintf (p, "-\n");
- }
- else
- {
- p += sprintf (p, "%d\n", gpio_map[i] + 16);
- }
- }
-
- *eof = 1;
- return (int) (p - buf) + 1;
+ uint len = 0, n = 0, i;
+
+ for(i = offset; len < count - 40 && i < GPIO_EVENT_MAX; i++, n++){
+ len += sprintf (buf+len, "%36s ", gpio_event_names[i]);
+ if(gpio_map[i] == GPIO_NOT_MAPPED)
+ len += sprintf (buf+len, "-\n");
+ else
+ len += sprintf (buf+len, "%d\n", gpio_map[i] + 16);
+ }
+
+ /* Prepare next offset */
+ *start = (char*)n;
+ *eof = (i == GPIO_EVENT_MAX ? 1 : 0);
+ return len;
}
int proc_w_gpio (struct file *file, const char *buffer, unsigned long count, void *data)
diff --git a/app/sm-plc-drv/src/plcp_fmode.c b/app/sm-plc-drv/src/plcp_fmode.c
index 9dd5bf2150..a83f1d879d 100644
--- a/app/sm-plc-drv/src/plcp_fmode.c
+++ b/app/sm-plc-drv/src/plcp_fmode.c
@@ -2590,7 +2590,6 @@ static int __gen_rx_start (struct plc_drv_unit *unit, uint16_t date)
else
{
/* allocate a new frame */
- GPIO_PULSE(GPIO_EVENT_RX_FRAME_ALLOC);
plcp_rx_frame = plcp_alloc_rx_frame (DMA_POOL2_BUFFER_SIZE);
PLCP_LOG (0, "allocated plcp_rx_frame", plcp_rx_frame);
diff --git a/app/sm-plc-drv/src/plcp_frame.c b/app/sm-plc-drv/src/plcp_frame.c
index 45e7f873c8..e4cbb7f5be 100644
--- a/app/sm-plc-drv/src/plcp_frame.c
+++ b/app/sm-plc-drv/src/plcp_frame.c
@@ -186,6 +186,11 @@ struct dma_node *dma_rx_alloc_node (int size)
while (i < NB_DMA_POOLS)
{
pool = &dma_rx_pools[i];
+
+ /* tmp */
+ if(dma_rx_pools[2].count < 30)
+ GPIO_PULSE(GPIO_EVENT_RX_BUF_UNDERRUN);
+
if (size <= pool->buf_size)
{
LOCK_SAVE (flags);
diff --git a/app/sm-plc-drv/src/scheduler_v2.c b/app/sm-plc-drv/src/scheduler_v2.c
index 2ce2dd62cc..ab581185ba 100644
--- a/app/sm-plc-drv/src/scheduler_v2.c
+++ b/app/sm-plc-drv/src/scheduler_v2.c
@@ -62,7 +62,6 @@ static void update_host_stat(struct plcp_host *host) {
host->last_plcp_rx_duration + host->last_plcp_tx_duration;
host->sched_stat.pos = (host->sched_stat.pos + 1) % PLCP_SCHED_STAT_MAX;
-
if(host->sched_stat.nb < PLCP_SCHED_STAT_MAX)
host->sched_stat.nb++;
}
@@ -146,7 +145,7 @@ struct plcp_host *sched_v2_next_poll(struct plc_drv_unit *unit){
if(!likely(cco_started))
return NULL;
-
+
/*
* Loop until we find a pollable host
* Which means a host that is either unicast
diff --git a/include/gpio_event.h b/include/gpio_event.h
index 038150e1c9..70d55ffea7 100644
--- a/include/gpio_event.h
+++ b/include/gpio_event.h
@@ -127,9 +127,24 @@ enum gpio_event_t {
GPIO_STATE_BIT2_CS_STATE,
GPIO_BACKOFF_ALLOWED,
GPIO_PCF_STATEMATE,
- GPIO_EVENT_TIME_SCHED, /* tmp */
- GPIO_EVENT_RX_FRAME_ALLOC, /* tmp */
- GPIO_EVENT_RX_FRAME_FREE, /* tmp */
+
+ /* tmp */
+ GPIO_EVENT_TIME_SCHED,
+ GPIO_EVENT_RX_FRAME_ALLOC,
+ GPIO_EVENT_RX_FRAME_FREE,
+ GPIO_EVENT_RX_DATA,
+ GPIO_EVENT_RX_BUF_UNDERRUN,
+
+ GPIO_EVENT_RX_MANAGEMENT,
+ GPIO_EVENT_CE_SIGNAL,
+ GPIO_EVENT_ND_SIGNAL,
+ GPIO_EVENT_RX_MGT_DROP,
+
+ GPIO_EVENT_CE_ACTIVITY,
+ GPIO_EVENT_CE_FREE,
+ GPIO_EVENT_ND_ACTIVITY,
+ GPIO_EVENT_ND_FREE,
+
GPIO_EVENT_MAX
};