Refactor reboot code for test harness

This commit is contained in:
David Lacey
2014-01-17 11:04:33 +00:00
parent 7c4b7a702b
commit 833be5511e

View File

@@ -10,9 +10,7 @@ unsigned get_tile_id(tileref);
extern tileref tile[]; extern tileref tile[];
/* Reboots XMOS device by writing to the PLL config register */ void device_reboot_aux(void) {
void device_reboot_implementation(chanend spare)
{
#ifdef XUD_ON_U_SERIES #ifdef XUD_ON_U_SERIES
/* Disconnect from bus */ /* Disconnect from bus */
unsigned data[] = {4}; unsigned data[] = {4};
@@ -27,12 +25,6 @@ void device_reboot_implementation(chanend spare)
unsigned int tileId; unsigned int tileId;
unsigned int tileArrayLength; unsigned int tileArrayLength;
outct(spare, XS1_CT_END); // have to do this before freeing the chanend
inct(spare); // Receive end ct from usb_buffer to close down in both directions
/* Need a spare chanend so we can talk to the pll register */
asm("freer res[%0]"::"r"(spare));
/* Find size of tile array - note in future tools versions this will be available from platform.h */ /* Find size of tile array - note in future tools versions this will be available from platform.h */
asm volatile ("ldc %0, tile.globound":"=r"(tileArrayLength)); asm volatile ("ldc %0, tile.globound":"=r"(tileArrayLength));
@@ -54,5 +46,17 @@ void device_reboot_implementation(chanend spare)
read_sswitch_reg(localTileId, 6, pllVal); read_sswitch_reg(localTileId, 6, pllVal);
write_sswitch_reg_no_ack(localTileId, 6, pllVal); write_sswitch_reg_no_ack(localTileId, 6, pllVal);
#endif #endif
}
/* Reboots XMOS device by writing to the PLL config register */
void device_reboot_implementation(chanend spare)
{
#ifndef XUD_ON_U_SERIES
outct(spare, XS1_CT_END); // have to do this before freeing the chanend
inct(spare); // Receive end ct from usb_buffer to close down in both directions
/* Need a spare chanend so we can talk to the pll register */
asm("freer res[%0]"::"r"(spare));
#endif
device_reboot_aux();
} }