void pixyInit(uint32_t slaveRomStart, const unsigned char slaveImage[], uint32_t imageSize) { // write stack guard word STACK_GUARD = STACK_GUARD_WORD; commonInit(); IPC_haltSlave(); ADCInit(); SCTInit(); CameraInit(); // start slave if (slaveRomStart && slaveImage && imageSize) { IPC_downloadSlaveImage(slaveRomStart, slaveImage, imageSize); IPC_startSlave(); } // initialize chirp objects USBLink *usbLink = new USBLink; g_chirpUsb = new Chirp(false, false, usbLink); SMLink *smLink = new SMLink; g_chirpM0 = new Chirp(false, true, smLink); // initialize devices/modules led_init(); if (prm_init(g_chirpUsb)<0) // error, let user know (don't just continue like nothing's happened) showError(1, 0x0000ff, "Flash is corrupt, parameters have been lost\n"); pwr_init(); cam_init(); rcs_init(); //cc_init(); }
void pixyInit(uint32_t slaveRomStart, const unsigned char slaveImage[], uint32_t imageSize) { platformInit(); // button, SPI_SSEL LPC_GPIO_PORT->MASK[5] = 0; LPC_GPIO_PORT->PIN[5] = 0x20; // negate SPI_SS LPC_GPIO_PORT->DIR[5] = 0x20; // SPI_SS - output // deal with P4_1, GPIO2[1] LPC_GPIO_PORT->MASK[2] = 0; LPC_GPIO_PORT->DIR[2] = 0; // set timer so we count clock cycles LPC_TIMER1->IR = 0; LPC_TIMER1->TCR = 1; LPC_TIMER1->PR = 0; // microsecond timer LPC_TIMER2->IR = 0; LPC_TIMER2->TCR = 1; LPC_TIMER2->PR = CLKFREQ_US-1; debug_frmwrk_init_clk(CLKFREQ); USB_UserInit(); lpc_printf("M4 start\n"); IPC_haltSlave(); ADCInit(); SCTInit(); CameraInit(); // start slave IPC_downloadSlaveImage(slaveRomStart, slaveImage, imageSize); IPC_startSlave(); // initialize chirp objects g_chirpUsb = new ChirpUsb(); g_chirpM0 = new ChirpM0(); // initialize devices/modules pwr_init(); spi_init(); cam_init(); rcs_init(); led_init(); //cc_init(); }
void pixyInit(void) #endif { // write stack guard word // STACK_GUARD = STACK_GUARD_WORD; commonInit(); #ifdef KEIL IPC_haltSlave(); #endif // clear RC servo registers to prevent and glitches upon initialization rcs_enable(0, 0); rcs_enable(1, 0); ADCInit(); SCTInit(); CameraInit(); // initialize shared memory interface before running M0 SMLink *smLink = new SMLink; // start slave #ifdef KEIL if (slaveRomStart && slaveImage && imageSize) { IPC_downloadSlaveImage(slaveRomStart, slaveImage, imageSize); IPC_startSlave(); } #else cr_start_m0(SLAVE_M0APP,&__core_m0app_START__); #endif // initialize chirp objects USBLink *usbLink = new USBLink; g_chirpUsb = new Chirp(false, false, usbLink); g_chirpUsb->setSendTimeout(3000); // set a high timeout because the host can sometimes go AWOL for a second or two.... g_chirpUsb->setRecvTimeout(3000); // set a high timeout because the host can sometimes go AWOL for a second or two.... g_chirpM0 = new Chirp(false, true, smLink); // initialize devices/modules led_init(); prm_init(g_chirpUsb); pwr_init(); cam_init(); }
/* download a processor image to the SLAVE CPU */ void IPC_downloadSlaveImage(uint32_t slaveRomStart, const unsigned char slaveImage[], uint32_t imageSize) { uint32_t i; volatile uint8_t *pu8SRAM; IPC_haltSlave(); //Copy application into Slave ROM pu8SRAM = (uint8_t *) slaveRomStart; for (i = 0; i < imageSize; i++) { pu8SRAM[i] = slaveImage[i]; } // Set Slave shadow pointer to begining of rom (where application is located) SET_SLAVE_SHADOWREG(slaveRomStart); }
//void pixyInit(uint32_t slaveRomStart, const unsigned char slaveImage[], uint32_t imageSize) void pixyInit(void) { // write stack guard word // STACK_GUARD = STACK_GUARD_WORD; commonInit(); IPC_haltSlave(); ADCInit(); SCTInit(); CameraInit(); /* IPC_startSlave(); */ // start slave /* if (slaveRomStart && slaveImage && imageSize) { IPC_downloadSlaveImage(slaveRomStart, slaveImage, imageSize); } */ // initialize shared memory interface before running M0 SMLink *smLink = new SMLink; // run M0 cr_start_m0(SLAVE_M0APP,&__core_m0app_START__); // initialize chirp objects USBLink *usbLink = new USBLink; g_chirpUsb = new Chirp(false, false, usbLink); g_chirpM0 = new Chirp(false, true, smLink); // initialize devices/modules led_init(); if (prm_init(g_chirpUsb)<0) // error, let user know (don't just continue like nothing's happened) showError(1, 0x0000ff, "Flash is corrupt, parameters have been lost\n"); pwr_init(); cam_init(); rcs_init(); //cc_init(); }
void pixyInit(uint32_t slaveRomStart, const unsigned char slaveImage[], uint32_t imageSize) { // write stack guard word STACK_GUARD = STACK_GUARD_WORD; commonInit(); IPC_haltSlave(); // clear RC servo registers to prevent and glitches upon initialization rcs_enable(0, 0); rcs_enable(1, 0); ADCInit(); SCTInit(); CameraInit(); // start slave if (slaveRomStart && slaveImage && imageSize) { IPC_downloadSlaveImage(slaveRomStart, slaveImage, imageSize); IPC_startSlave(); } // initialize chirp objects USBLink *usbLink = new USBLink; g_chirpUsb = new Chirp(false, false, usbLink); g_chirpUsb->setSendTimeout(3000); // set a high timeout because the host can sometimes go AWOL for a second or two.... SMLink *smLink = new SMLink; g_chirpM0 = new Chirp(false, true, smLink); // initialize devices/modules led_init(); prm_init(g_chirpUsb); pwr_init(); cam_init(); rcs_init(); //cc_init(); }