Improved debug output in the high pri, nested interrupt test
This commit is contained in:
parent
e61721fdb1
commit
3905b78169
@ -99,9 +99,7 @@
|
|||||||
struct highpri_s
|
struct highpri_s
|
||||||
{
|
{
|
||||||
FAR struct stm32_tim_dev_s *dev; /* TIM6 driver instance */
|
FAR struct stm32_tim_dev_s *dev; /* TIM6 driver instance */
|
||||||
volatile uint64_t enabled;
|
volatile uint64_t basepri[16];
|
||||||
volatile uint64_t nested;
|
|
||||||
volatile uint64_t other;
|
|
||||||
volatile uint64_t handler;
|
volatile uint64_t handler;
|
||||||
volatile uint64_t thread;
|
volatile uint64_t thread;
|
||||||
};
|
};
|
||||||
@ -127,6 +125,7 @@ static struct highpri_s g_highpri;
|
|||||||
void tim6_handler(void)
|
void tim6_handler(void)
|
||||||
{
|
{
|
||||||
uint8_t basepri;
|
uint8_t basepri;
|
||||||
|
int index;
|
||||||
|
|
||||||
/* Acknowledge the timer interrupt */
|
/* Acknowledge the timer interrupt */
|
||||||
|
|
||||||
@ -135,20 +134,8 @@ void tim6_handler(void)
|
|||||||
/* Increment the count associated with the current basepri */
|
/* Increment the count associated with the current basepri */
|
||||||
|
|
||||||
basepri = getbasepri();
|
basepri = getbasepri();
|
||||||
switch (basepri)
|
index = ((basepri >> 4) & 15);
|
||||||
{
|
g_highpri.basepri[index]++;
|
||||||
case 0: /* BASEPRI==0 disabled all masking */
|
|
||||||
g_highpri.enabled++;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case NVIC_SYSH_DISABLE_PRIORITY: /* Normal interrupts are disabled */
|
|
||||||
g_highpri.nested++;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default: /* There should not be any other values of BASEPRI */
|
|
||||||
g_highpri.other++;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Check if we are in an interrupt handle */
|
/* Check if we are in an interrupt handle */
|
||||||
|
|
||||||
@ -180,15 +167,14 @@ void tim6_handler(void)
|
|||||||
int highpri_main(int argc, char *argv[])
|
int highpri_main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
FAR struct stm32_tim_dev_s *dev;
|
FAR struct stm32_tim_dev_s *dev;
|
||||||
uint64_t enabled;
|
uint64_t basepri[16];
|
||||||
uint64_t nested;
|
|
||||||
uint64_t other;
|
|
||||||
uint64_t handler;
|
uint64_t handler;
|
||||||
uint64_t thread;
|
uint64_t thread;
|
||||||
uint64_t total;
|
uint64_t total;
|
||||||
uint32_t seconds;
|
uint32_t seconds;
|
||||||
int prescaler;
|
int prescaler;
|
||||||
int ret;
|
int ret;
|
||||||
|
int i;
|
||||||
|
|
||||||
printf("highpri_main: Started\n");
|
printf("highpri_main: Started\n");
|
||||||
|
|
||||||
@ -250,32 +236,41 @@ int highpri_main(int argc, char *argv[])
|
|||||||
* and then is a normal consequence of this design.
|
* and then is a normal consequence of this design.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
enabled = g_highpri.enabled;
|
for (i = 0; i < 16; i++)
|
||||||
nested = g_highpri.nested;
|
{
|
||||||
other = g_highpri.other;
|
basepri[i] = g_highpri.basepri[i];
|
||||||
|
}
|
||||||
|
|
||||||
handler = g_highpri.handler;
|
handler = g_highpri.handler;
|
||||||
thread = g_highpri.thread;
|
thread = g_highpri.thread;
|
||||||
|
|
||||||
/* Then print out what is happening */
|
/* Then print out what is happening */
|
||||||
|
|
||||||
printf("Elapsed time: %d seconds\n\n", seconds);
|
printf("Elapsed time: %d seconds\n\n", seconds);
|
||||||
total = enabled + nested + other;
|
for (i = 0, total = 0; i < 16; i++)
|
||||||
|
{
|
||||||
|
total += basepri[i];
|
||||||
|
}
|
||||||
|
|
||||||
if (total > 0)
|
if (total > 0)
|
||||||
{
|
{
|
||||||
printf(" Enabled: %lld (%d%%)\n",
|
for (i = 0; i < 16; i++)
|
||||||
enabled, (int)((100*enabled + (total / 2)) / total));
|
{
|
||||||
printf(" Nested: %lld (%d%%)\n",
|
if (basepri[i] > 0)
|
||||||
nested, (int)((100*nested + (total / 2)) / total));
|
{
|
||||||
printf(" Other: %lld (%d%%)\n\n",
|
printf(" basepri[%02x]: %lld (%d%%)\n",
|
||||||
other, (int)((100*other + (total / 2)) / total));
|
i << 4, basepri[i],
|
||||||
|
(int)((100* basepri[i] + (total / 2)) / total));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
total = handler + thread;
|
total = handler + thread;
|
||||||
if (total > 0)
|
if (total > 0)
|
||||||
{
|
{
|
||||||
printf(" Handler: %lld (%d%%)\n",
|
printf(" Handler: %lld (%d%%)\n",
|
||||||
handler, (int)((100*handler + (total / 2)) / total));
|
handler, (int)((100*handler + (total / 2)) / total));
|
||||||
printf(" Thread: %lld (%d%%)\n\n",
|
printf(" Thread: %lld (%d%%)\n\n",
|
||||||
thread, (int)((100*thread + (total / 2)) / total));
|
thread, (int)((100*thread + (total / 2)) / total));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user