(void)HIVE_ADDR_sp_sw_state; /* Suppres warnings in CRUN */
if (sp_id == SP0_ID)
state = sp_dmem_load_uint32(sp_id, (unsigned)sp_address_of(sp_sw_state));
-#if defined(HAS_SEC_SP)
- else
- state = sp_dmem_load_uint32(sp_id, (unsigned)sp1_address_of(sp_sw_state));
-#endif /* HAS_SEC_SP */
-
return state;
}
/* Name of the sp program: should not be built-in */
#define SP_PROG_NAME "sp"
-#if defined(HAS_SEC_SP)
-#define SP1_PROG_NAME "sp1"
-#endif /* HAS_SEC_SP */
#if defined(HAS_BL)
#define BL_PROG_NAME "bootloader"
#endif
unsigned int *extra_row, unsigned int *extra_column);
#endif
-#if defined(HAS_SEC_SP)
-static enum ia_css_err
-sh_css_start_sp1(void);
-
-static enum ia_css_err
-sh_css_stop_sp1(void);
-#endif
-
#ifdef ISP2401
#ifdef USE_INPUT_SYSTEM_VERSION_2401
static enum ia_css_err
#if defined(HAS_BL)
ia_css_blctrl_cfg blctrl_cfg;
#endif
-#if defined(HAS_SEC_SP)
- ia_css_spctrl_cfg sp1ctrl_cfg;
-#endif /* HAS_SEC_SP */
void *(*malloc_func)(size_t size, bool zero_mem);
void (*free_func)(void *ptr);
IA_CSS_LEAVE_ERR(err);
return err;
}
-#if defined(HAS_SEC_SP)
- if(!sh_css_setup_spctrl_config(&sh_css_sp1_fw,SP1_PROG_NAME,&sp1ctrl_cfg))
- return IA_CSS_ERR_INTERNAL_ERROR;
- err = ia_css_spctrl_load_fw(SP1_ID, &sp1ctrl_cfg);
- if (err != IA_CSS_SUCCESS) {
- IA_CSS_LEAVE_ERR(err);
- return err;
- }
-#endif /* HAS_SEC_SP */
#if defined(HAS_BL)
if (!sh_css_setup_blctrl_config(&sh_css_bl_fw, BL_PROG_NAME, &blctrl_cfg))
IA_CSS_LEAVE_ERR(err);
return err;
}
-#if defined(HAS_SEC_SP)
- err = ia_css_blctrl_add_target_fw_info(&sh_css_sp1_fw, IA_CSS_SP1,
- get_sp_code_addr(SP1_ID));
- if (err != IA_CSS_SUCCESS) {
- IA_CSS_LEAVE_ERR(err);
- return err;
- }
-#endif
+
#ifdef ISP2401
err = ia_css_blctrl_add_target_fw_info(&sh_css_sp_fw, IA_CSS_SP0,
get_sp_code_addr(SP0_ID));
}
ia_css_spctrl_unload_fw(SP0_ID);
sh_css_sp_set_sp_running(false);
-#if defined(HAS_SEC_SP)
- ia_css_spctrl_unload_fw(SP1_ID);
- sh_css_sp1_set_sp1_running(false);
-#endif /* HAS_SEC_SP */
-
#if defined(HAS_BL)
ia_css_blctrl_unload_fw();
#endif
#define SP_START_TIMEOUT_US 30000000
-#if defined(HAS_SEC_SP)
-
-static enum ia_css_err
-sh_css_start_sp1(void)
-{
-
- unsigned long timeout;
-
- IA_CSS_ENTER_PRIVATE("void");
- sh_css_sp1_start();
- /* waiting for the SP is completely started */
- timeout = SP_START_TIMEOUT_US;
- while((ia_css_spctrl_get_state(SP1_ID) != IA_CSS_SP_SW_INITIALIZED) && timeout) {
- timeout--;
- hrt_sleep();
- }
- if (timeout == 0) {
- IA_CSS_LEAVE_ERR_PRIVATE(IA_CSS_ERR_INTERNAL_ERROR);
- return IA_CSS_ERR_INTERNAL_ERROR;
- }
- sh_css_write_host2sp1_command(host2sp_cmd_ready);
-
- IA_CSS_LEAVE_ERR_PRIVATE(IA_CSS_SUCCESS);
- return IA_CSS_SUCCESS;
-}
-#endif
-
enum ia_css_err
ia_css_start_sp(void)
{
sh_css_setup_queues();
ia_css_bufq_dump_queue_info();
-#if defined(HAS_SEC_SP)
- /* Start the SP1 Core */
- err = sh_css_start_sp1();
-#endif /* HAS_SEC_SP */
-
#ifdef ISP2401
if (ia_css_is_system_mode_suspend_or_resume() == false) { /* skip in suspend/resume flow */
ia_css_set_system_mode(IA_CSS_SYS_MODE_WORKING);
*/
#define SP_SHUTDOWN_TIMEOUT_US 200000
-#if defined(HAS_SEC_SP)
-
-static enum ia_css_err
-sh_css_stop_sp1(void)
-{
- unsigned long timeout;
-
- IA_CSS_ENTER_PRIVATE("void");
-
- /* For now, stop whole SP1 */
- sh_css_write_host2sp1_command(host2sp_cmd_terminate);
- sh_css_sp1_set_sp1_running(false);
-
- timeout = SP_SHUTDOWN_TIMEOUT_US;
- while ((ia_css_spctrl_get_state(SP1_ID)!= IA_CSS_SP_SW_TERMINATED) && timeout) {
- timeout--;
- hrt_sleep();
- }
- if (timeout == 0) {
- IA_CSS_WARNING("SP1 is not terminated");
- } else {
- timeout = SP_SHUTDOWN_TIMEOUT_US;
- while (!ia_css_spctrl_is_idle(SP1_ID) && 0 != timeout) {
- timeout--;
- hrt_sleep();
- }
- if (0 == timeout) {
- IA_CSS_WARNING("SP1 is not idle");
- }
- }
-
- IA_CSS_LEAVE_ERR_PRIVATE(IA_CSS_SUCCESS);
- return IA_CSS_SUCCESS;
-}
-#endif
-
enum ia_css_err
ia_css_stop_sp(void)
{
}
#endif
-#if defined(HAS_SEC_SP)
- /* Stop SP1 Core */
- sh_css_stop_sp1();
-#endif /* HAS_SEC_SP */
-
IA_CSS_LEAVE_ERR(err);
return err;
}
static char FW_rel_ver_name[MAX_FW_REL_VER_NAME] = "---";
struct ia_css_fw_info sh_css_sp_fw;
-#if defined(HAS_SEC_SP)
-struct ia_css_fw_info sh_css_sp1_fw;
-#endif /* HAS_SEC_SP */
#if defined(HAS_BL)
struct ia_css_fw_info sh_css_bl_fw;
#endif /* HAS_BL */
bd->header = *bi;
if ((bi->type == ia_css_isp_firmware) || (bi->type == ia_css_sp_firmware)
-#if defined(HAS_SEC_SP)
- || (bi->type == ia_css_sp1_firmware)
-#endif /* HAS_SEC_SP */
#if defined(HAS_BL)
|| (bi->type == ia_css_bootloader_firmware)
#endif /* HAS_BL */
err = setup_binary(bi, fw_data, &sh_css_sp_fw, i);
if (err != IA_CSS_SUCCESS)
return err;
-#if defined(HAS_SEC_SP)
- } else if (bi->type == ia_css_sp1_firmware) {
- if (i != SP1_FIRMWARE)
- return IA_CSS_ERR_INTERNAL_ERROR;
- err = setup_binary(bi, fw_data, &sh_css_sp1_fw, i);
- if (err != IA_CSS_SUCCESS)
- return err;
-#endif /* HAS_SEC_SP */
#if defined(HAS_BL)
} else if (bi->type == ia_css_bootloader_firmware) {
if (i != BOOTLOADER_FIRMWARE)
}
memset(&sh_css_sp_fw, 0, sizeof(sh_css_sp_fw));
-#if defined(HAS_SEC_SP)
- memset(&sh_css_sp1_fw, 0, sizeof(sh_css_sp1_fw));
-#endif /* HAS_SEC_SP */
if (sh_css_blob_info) {
sh_css_free(sh_css_blob_info);
sh_css_blob_info = NULL;
};
extern struct ia_css_fw_info sh_css_sp_fw;
-#if defined(HAS_SEC_SP)
-extern struct ia_css_fw_info sh_css_sp1_fw;
-#endif /* HAS_SEC_SP */
#if defined(HAS_BL)
extern struct ia_css_fw_info sh_css_bl_fw;
#endif /* HAS_BL */
#define SIZE_OF_IA_CSS_PTR sizeof(uint32_t)
/* Number of SP's */
-#if defined(HAS_SEC_SP)
-#define NUM_OF_SPS 2
-#else
#define NUM_OF_SPS 1
-#endif /* HAS_SEC_SP */
#if defined(HAS_BL)
#define NUM_OF_BLS 1
/* Enum for order of Binaries */
enum sh_css_order_binaries {
SP_FIRMWARE = 0,
-#if defined(HAS_SEC_SP)
- SP1_FIRMWARE,
-#endif /* HAS_SEC_SP */
#if defined(HAS_BL)
BOOTLOADER_FIRMWARE,
#endif
/* For the moment there is only code that sets this bool to true */
/* TODO: add code that sets this bool to false */
static bool sp_running;
-#if defined(HAS_SEC_SP)
-static bool sp1_running;
-#endif /* HAS_SEC_SP */
static enum ia_css_err
set_output_frame_buffer(const struct ia_css_frame *frame,
case ia_css_sp_firmware:
HIVE_ADDR_sp_per_frame_data = fw->info.sp.per_frame_data;
break;
-#if defined(HAS_SEC_SP)
- case ia_css_sp1_firmware:
- (void)fw;
- break;
-#endif /* HAS_SEC_SP */
case ia_css_acc_firmware:
HIVE_ADDR_sp_per_frame_data = fw->info.acc.per_frame_data;
break;
sh_css_sp_group.pipe[thread_id].num_stages = 0;
}
-#if defined(HAS_SEC_SP)
-void
-sh_css_write_host2sp1_command(enum host2sp_commands host2sp_command)
-{
- unsigned int HIVE_ADDR_host_sp1_com = sh_css_sp1_fw.info.sp1.host_sp_com;
- unsigned int offset = (unsigned int)offsetof(struct host_sp_communication, host2sp_command)
- / sizeof(int);
- (void)HIVE_ADDR_host_sp1_com; /* Suppres warnings in CRUN */
-
- /* Previous command must be handled by SP1 (by design) */
- if (host2sp_command == host2sp_cmd_terminate)
- assert(load_sp1_array_uint(host_sp1_com, offset) == host2sp_cmd_ready);
-
- store_sp1_array_uint(host_sp1_com, offset, host2sp_command);
-}
-#endif /* HAS_SEC_SP */
-
bool sh_css_write_host2sp_command(enum host2sp_commands host2sp_command)
{
unsigned int HIVE_ADDR_host_sp_com = sh_css_sp_fw.info.sp.host_sp_com;
sp_running = flag;
}
-#if defined(HAS_SEC_SP)
-void
-sh_css_sp1_set_sp1_running(bool flag)
-{
- sp1_running = flag;
-}
-#endif /* HAS_SEC_SP */
-
bool
sh_css_sp_is_running(void)
{
return sp_running;
}
-#if defined(HAS_SEC_SP)
-void
-sh_css_sp1_start(void)
-{
- const struct ia_css_fw_info *fw;
- unsigned int HIVE_ADDR_sp_sw_state;
- fw = &sh_css_sp1_fw;
- HIVE_ADDR_sp_sw_state = fw->info.sp1.sw_state;
-
- if (sp1_running)
- return;
-
- (void)HIVE_ADDR_sp_sw_state; /* Suppres warnings in CRUN */
-
- /* no longer here, sp started immediately */
- /*ia_css_debug_pipe_graph_dump_epilogue();*/
-
- /*store_sp_group_data();
- store_sp_per_frame_data(fw);*/
- sp_dmem_store_uint32(SP1_ID,
- (unsigned int)sp1_address_of(sp_sw_state),
- (uint32_t)(IA_CSS_SP_SW_TERMINATED));
-
- /* Note 1: The sp_start_isp function contains a wait till
- * the input network is configured by the SP.
- * Note 2: Not all SP binaries supports host2sp_commands.
- * In case a binary does support it, the host2sp_command
- * will have status cmd_ready after return of the function
- * sh_css_hrt_sp_start_isp. There is no race-condition here
- * because only after the process_frame command has been
- * received, the SP starts configuring the input network.
- */
-
- /* we need to set sp_running before we call ia_css_mmu_invalidate_cache
- * as ia_css_mmu_invalidate_cache checks on sp_running to
- * avoid that it accesses dmem while the SP is not powered
- */
- sp1_running = true;
- /* ia_css_mmu_invalidate_cache(); */
- /* Invalidate all MMU caches */
- /* mmu_invalidate_cache_all(); */
-
- ia_css_spctrl_start(SP1_ID);
-
-}
-#endif /* HAS_SEC_SP */
-
void
sh_css_sp_start_isp(void)
{
bool sh_css_write_host2sp_command(enum host2sp_commands host2sp_command);
-#if defined(HAS_SEC_SP)
-void
-sh_css_write_host2sp1_command(enum host2sp_commands host2sp_command);
-#endif /* HAS_SEC_SP */
-
enum host2sp_commands
sh_css_read_host2sp_command(void);
void
sh_css_sp_start_isp(void);
-#if defined(HAS_SEC_SP)
-void
-sh_css_sp1_start(void);
-#endif /* HAS_SEC_SP */
void
sh_css_sp_set_sp_running(bool flag);
-#if defined(HAS_SEC_SP)
-void
-sh_css_sp1_set_sp1_running(bool flag);
-#endif /* HAS_SEC_SP */
-
bool
sh_css_sp_is_running(void);