46 lines
1.3 KiB
C
46 lines
1.3 KiB
C
#include <propeller.h>
|
|
#include "spinix.h"
|
|
|
|
static int run_prog[] = {
|
|
0xa0bc65f0, 0x08bc6e32, 0x80fc6404, 0x08bc7032, 0x80fc6404, 0x08bc6032,
|
|
0x80fc6404, 0x08bc6232, 0x80fc63ff, 0x28fc6209, 0x08fc6600, 0x00fc6804,
|
|
0x083c6029, 0x083c5c2a, 0x083c582b, 0x08bc642b, 0x863c642c, 0x5c68000f,
|
|
0x80fc6001, 0x80fc5d00, 0x80fc5d00, 0xe4fc620c, 0x087c6600, 0x007c6804,
|
|
0x04fc6a08, 0x04fc6c0a, 0xa0bc6236, 0x84bc6235, 0x28fc6202, 0x083c5a35,
|
|
0x80fc6a04, 0xe4fc621d, 0x083c5a36, 0x80fc6c04, 0x083c6e36, 0x80fc6c04,
|
|
0x083c7036, 0x0cfc6401, 0x60fc6407, 0x68bc5e32, 0x0c7c5e02, 0x00007fd8,
|
|
0x00007fdc, 0x00007fd4, 0x00000072, 0x00000000, 0x00000000, 0x0007c010};
|
|
|
|
static int arg_list[] = {0, 0, 0, 0};
|
|
|
|
void spinix_enter(int argc, char **argv)
|
|
{
|
|
}
|
|
|
|
void spinix_exit(int retval)
|
|
{
|
|
int i;
|
|
int cogspi = (*(int *)spinix_spi_engine_cog) - 1;
|
|
arg_list[2] = *(int *)spinix_shell_sector;
|
|
arg_list[3] = *(int *)spinix_shell_size;
|
|
|
|
*(int *)spinix_return_value = retval;
|
|
|
|
// Stop all the cogs except this one and the SD SPI cog
|
|
for (i = 0; i < 8; i++)
|
|
{
|
|
if (i != cogid() && i != cogspi)
|
|
cogstop(i);
|
|
}
|
|
|
|
// Clear and return all the locks
|
|
for (i = 0; i < 8; i++)
|
|
{
|
|
lockclr(i);
|
|
lockret(i);
|
|
}
|
|
|
|
// Start run_prog in this cog
|
|
coginit(cogid(), run_prog, arg_list);
|
|
}
|