102 lines
		
	
	
		
			4.0 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			102 lines
		
	
	
		
			4.0 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.
 | 
						|
 | 
						|
****************************************************************************/
 | 
						|
 | 
						|
#ifndef IOT_OEM_STRUCT_V1_H
 | 
						|
#define IOT_OEM_STRUCT_V1_H
 | 
						|
 | 
						|
#ifdef __cplusplus
 | 
						|
extern "C" {
 | 
						|
#endif
 | 
						|
 | 
						|
/* pack for the structures in the whole file */
 | 
						|
#pragma pack(push)  // save the pack status
 | 
						|
#pragma pack(1)     // 1 byte align
 | 
						|
 | 
						|
/* ================= board information structures version 1 ================= */
 | 
						|
/* defines most peripherals resource allocation, supports differential saving
 | 
						|
 * of different resource tables, differential data is saved after the oem structure.
 | 
						|
 */
 | 
						|
 | 
						|
/* define the number of hardware resource */
 | 
						|
#define IOT_PIN_MAX_NUM_V1         62  //gpio connected to pins, 42(kl3) + 20(resv)
 | 
						|
#define IOT_UART_MAX_NUM_V1        8
 | 
						|
#define IOT_PWM_MAX_NUM_V1         (6 * 2)  //channel number
 | 
						|
#define IOT_ADC_MAX_NUM_V1         (2 * 10)  //channel number
 | 
						|
#define IOT_LEDC_MAX_NUM_V1        8
 | 
						|
#define IOT_SPI_MAX_NUM_V1         4   //mseter * 3, slaver * 1
 | 
						|
#define IOT_I2C_MAX_NUM_V1         4
 | 
						|
#define IOT_SPINLOCK_MAX_NUM_V1    16
 | 
						|
#define IOT_DMA_MAX_NUM_V1         (11 + 10 + 4)  //channel number
 | 
						|
#define IOT_GPTIMER_MAX_NUM_V1     (3 * 4)
 | 
						|
#define IOT_MAILBOX_MAX_NUM_V1     6
 | 
						|
#define IOT_WDG_MAX_NUM_V1         3
 | 
						|
 | 
						|
typedef struct _iot_pin_cfg_v1_t{
 | 
						|
    uint8_t gpio;   //gpio number
 | 
						|
    uint8_t core;   //which core is gpio used by
 | 
						|
    uint8_t func;   //pin function
 | 
						|
    uint8_t inid;   //input signal number
 | 
						|
    uint8_t outid;  //output signal number
 | 
						|
    uint8_t purpose;    //purpose of gpio, see iot_board_api.h/GPIO_XXX
 | 
						|
} iot_pin_cfg_v1_t;
 | 
						|
 | 
						|
typedef struct _iot_peripheral_cfg_v1_t {
 | 
						|
    uint8_t core;   //which core is peripheral used by
 | 
						|
    uint8_t purpose;    //purpose of peripheral
 | 
						|
} iot_peripheral_cfg_v1_t;
 | 
						|
 | 
						|
typedef struct _iot_oem_rc_hdr_v1_t {
 | 
						|
    uint32_t crc;   //crc of the current complete resource table
 | 
						|
    uint32_t hw_version;    //hardware version of current resource table
 | 
						|
    uint32_t diff_hw_ver;   //hardware version of difference resource table
 | 
						|
    uint16_t length;   //resource length, not include hdr_t
 | 
						|
    uint16_t mode        : 2,    //diff mode or not
 | 
						|
             have_next   : 1,    //have next resource or not
 | 
						|
             resv        : 13;
 | 
						|
} iot_oem_rc_hdr_v1_t;
 | 
						|
 | 
						|
 | 
						|
// 差分模式的差异 是对比的二进制差异
 | 
						|
typedef struct _iot_oem_rc_diff_v1_t {
 | 
						|
    uint16_t offset;    //diff beginning offset, respect to iot_board_info_v1_t
 | 
						|
    uint16_t length;    //current diff block length
 | 
						|
    uint8_t data[0];    //diff data
 | 
						|
} iot_oem_rc_diff_v1_t;
 | 
						|
 | 
						|
typedef struct _iot_board_info_v1_t {
 | 
						|
    iot_oem_rc_hdr_v1_t hdr;
 | 
						|
    iot_pin_cfg_v1_t pin[IOT_PIN_MAX_NUM_V1];
 | 
						|
    iot_peripheral_cfg_v1_t uart[IOT_UART_MAX_NUM_V1];
 | 
						|
    iot_peripheral_cfg_v1_t pwm[IOT_PWM_MAX_NUM_V1];
 | 
						|
    iot_peripheral_cfg_v1_t adc[IOT_ADC_MAX_NUM_V1];
 | 
						|
    iot_peripheral_cfg_v1_t ledc[IOT_LEDC_MAX_NUM_V1];
 | 
						|
    iot_peripheral_cfg_v1_t spi[IOT_SPI_MAX_NUM_V1];
 | 
						|
    iot_peripheral_cfg_v1_t i2c[IOT_I2C_MAX_NUM_V1];
 | 
						|
    iot_peripheral_cfg_v1_t spinlock[IOT_SPINLOCK_MAX_NUM_V1];
 | 
						|
    iot_peripheral_cfg_v1_t dma[IOT_DMA_MAX_NUM_V1];
 | 
						|
    iot_peripheral_cfg_v1_t gptimer[IOT_GPTIMER_MAX_NUM_V1];
 | 
						|
    iot_peripheral_cfg_v1_t mailbox[IOT_MAILBOX_MAX_NUM_V1];
 | 
						|
    iot_peripheral_cfg_v1_t wdg[IOT_WDG_MAX_NUM_V1];
 | 
						|
    uint8_t padding[18];  //642 - 608(rc) - 16(hdr)
 | 
						|
} iot_board_info_v1_t;
 | 
						|
 | 
						|
#pragma pack(pop)   // restore the pack status
 | 
						|
 | 
						|
#ifdef __cplusplus
 | 
						|
}
 | 
						|
#endif
 | 
						|
 | 
						|
#endif
 |