90 lines
		
	
	
		
			2.4 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			90 lines
		
	
	
		
			2.4 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
/****************************************************************************
 | 
						|
 | 
						|
Copyright(c) 2019 by Aerospace C.Power (Chongqing) Microelectronics. ALL RIGHTS RESERVED.
 | 
						|
 | 
						|
This Information is proprietary to Aerospace C.Power (Chongqing) Microelectronics and MAY NOT
 | 
						|
be copied by any method or incorporated into another program without
 | 
						|
the express written consent of Aerospace C.Power. This Information or any portion
 | 
						|
thereof remains the property of Aerospace C.Power. The Information contained herein
 | 
						|
is believed to be accurate and Aerospace C.Power assumes no responsibility or
 | 
						|
liability for its use in any way and conveys no license or title under
 | 
						|
any patent or copyright and makes no representation or warranty that this
 | 
						|
Information is free from patent or copyright infringement.
 | 
						|
 | 
						|
****************************************************************************/
 | 
						|
/* os shim includes */
 | 
						|
#include "os_types.h"
 | 
						|
#include "os_utils.h"
 | 
						|
#include "os_task.h"
 | 
						|
#include "platform.h"
 | 
						|
#include "cpu.h"
 | 
						|
 | 
						|
/* driver includes */
 | 
						|
#include "iot_uart.h"
 | 
						|
#include "uart.h"
 | 
						|
#include "iot_gptmr_api.h"
 | 
						|
#include "iot_board.h"
 | 
						|
 | 
						|
/* common includes */
 | 
						|
#include "iot_bitops.h"
 | 
						|
 | 
						|
#include "iot_config.h"
 | 
						|
#include "mac.h"
 | 
						|
#include "bb_init.h"
 | 
						|
#include "bb_cpu_mac_init.h"
 | 
						|
#include "bb_cpu_fsm.h"
 | 
						|
#include "bb_cpu_utils.h"
 | 
						|
#include "rf_spi_api.h"
 | 
						|
#include "mac_rf_common_hw.h"
 | 
						|
#include "bb_rf_cfg.h"
 | 
						|
 | 
						|
/* define alloc memory size */
 | 
						|
#define ALLOC_MEM_SIZE     1024
 | 
						|
uint8_t bbcpu_alloc_mem[ALLOC_MEM_SIZE] = { 0 };
 | 
						|
 | 
						|
extern void gp_timer_init();
 | 
						|
 | 
						|
void iot_module_init(void)
 | 
						|
{
 | 
						|
    /* start gp timer */
 | 
						|
    gp_timer_init();
 | 
						|
    iot_gp_timer_set(0, 0xFFFFFFFF, 1);
 | 
						|
    iot_gp_timer_start(0);
 | 
						|
 | 
						|
    bb_cpu_printf("this is bbcpu, cpuid:%d\n", cpu_get_mhartid());
 | 
						|
 | 
						|
    /* init common modules */
 | 
						|
    iot_bitops_init();
 | 
						|
    /* init dtest mem */
 | 
						|
    os_mem_init(bbcpu_alloc_mem, ALLOC_MEM_SIZE);
 | 
						|
}
 | 
						|
 | 
						|
int main(void)
 | 
						|
{
 | 
						|
    iot_module_init();
 | 
						|
    mac_rf_to_wphy_interface_init(0);
 | 
						|
    /* spi init */
 | 
						|
    rf_spi_init();
 | 
						|
    phy_rf_band_info_init((PHY_RF_BAND_T)mac_rf_get_band_sel());
 | 
						|
 | 
						|
    bb_cpu_mac_init();
 | 
						|
    bb_cpu_fsm_init();
 | 
						|
 | 
						|
    /* init rf chip version */
 | 
						|
    if (bb_rf_init_ver()) {
 | 
						|
        bb_cpu_printf("rf ver init fail\n");
 | 
						|
        IOT_ASSERT(0);
 | 
						|
    }
 | 
						|
    bb_cpu_printf("this is rf ver:%d\n", bb_rf_get_ver());
 | 
						|
 | 
						|
    /* set the bbcpu status is ready */
 | 
						|
    mac_rf_set_bbcpu_sts();
 | 
						|
 | 
						|
    while(1){
 | 
						|
        /* cpu1 entry */
 | 
						|
        bb_cpu_fsm_main();
 | 
						|
        __asm volatile ("nop");
 | 
						|
    }
 | 
						|
    return 0;
 | 
						|
}
 |