26#ifndef CAFFEINE_HAL_HAL_TYPES_H
27#define CAFFEINE_HAL_HAL_TYPES_H
103#define CFN_HAL_MAKE_TYPE(a, b, c, d) \
104 (((uint32_t) (uint8_t) (a)) | ((uint32_t) (uint8_t) (b) << 8U) | ((uint32_t) (uint8_t) (c) << 16U) | \
105 ((uint32_t) (uint8_t) (d) << 24U))
111#define CFN_HAL_PERIPHERAL_PREFIX 'A'
117#define CFN_HAL_PERIPHERAL_TYPE(a, b, c) CFN_HAL_MAKE_TYPE(CFN_HAL_PERIPHERAL_PREFIX, a, b, c)
119#define CFN_HAL_PERIPHERAL_TYPE_UNKNOWN 0
120#define CFN_HAL_PERIPHERAL_TYPE_ADC CFN_HAL_PERIPHERAL_TYPE('A', 'D', 'C')
121#define CFN_HAL_PERIPHERAL_TYPE_CAN CFN_HAL_PERIPHERAL_TYPE('C', 'A', 'N')
122#define CFN_HAL_PERIPHERAL_TYPE_CLOCK CFN_HAL_PERIPHERAL_TYPE('C', 'L', 'K')
123#define CFN_HAL_PERIPHERAL_TYPE_DAC CFN_HAL_PERIPHERAL_TYPE('D', 'A', 'C')
124#define CFN_HAL_PERIPHERAL_TYPE_DMA CFN_HAL_PERIPHERAL_TYPE('D', 'M', 'A')
125#define CFN_HAL_PERIPHERAL_TYPE_GPIO CFN_HAL_PERIPHERAL_TYPE('G', 'P', 'O')
126#define CFN_HAL_PERIPHERAL_TYPE_I2C CFN_HAL_PERIPHERAL_TYPE('I', '2', 'C')
127#define CFN_HAL_PERIPHERAL_TYPE_PWM CFN_HAL_PERIPHERAL_TYPE('P', 'W', 'M')
128#define CFN_HAL_PERIPHERAL_TYPE_RTC CFN_HAL_PERIPHERAL_TYPE('R', 'T', 'C')
129#define CFN_HAL_PERIPHERAL_TYPE_SPI CFN_HAL_PERIPHERAL_TYPE('S', 'P', 'I')
130#define CFN_HAL_PERIPHERAL_TYPE_TIMER CFN_HAL_PERIPHERAL_TYPE('T', 'I', 'M')
131#define CFN_HAL_PERIPHERAL_TYPE_UART CFN_HAL_PERIPHERAL_TYPE('U', 'R', 'T')
132#define CFN_HAL_PERIPHERAL_TYPE_WDT CFN_HAL_PERIPHERAL_TYPE('W', 'D', 'T')
133#define CFN_HAL_PERIPHERAL_TYPE_IRQ CFN_HAL_PERIPHERAL_TYPE('I', 'R', 'Q')
134#define CFN_HAL_PERIPHERAL_TYPE_NVM CFN_HAL_PERIPHERAL_TYPE('N', 'V', 'M')
135#define CFN_HAL_PERIPHERAL_TYPE_I2S CFN_HAL_PERIPHERAL_TYPE('I', '2', 'S')
136#define CFN_HAL_PERIPHERAL_TYPE_QSPI CFN_HAL_PERIPHERAL_TYPE('Q', 'S', 'P')
137#define CFN_HAL_PERIPHERAL_TYPE_CRYPTO CFN_HAL_PERIPHERAL_TYPE('C', 'R', 'Y')
138#define CFN_HAL_PERIPHERAL_TYPE_SDIO CFN_HAL_PERIPHERAL_TYPE('S', 'D', 'I')
139#define CFN_HAL_PERIPHERAL_TYPE_USB CFN_HAL_PERIPHERAL_TYPE('U', 'S', 'B')
140#define CFN_HAL_PERIPHERAL_TYPE_ETH CFN_HAL_PERIPHERAL_TYPE('E', 'T', 'H')
141#define CFN_HAL_PERIPHERAL_TYPE_COMP CFN_HAL_PERIPHERAL_TYPE('C', 'M', 'P')
164struct cfn_hal_clock_s;
178#if (CFN_HAL_USE_LOCK == 1)
cfn_hal_config_phase_t
Definition cfn_hal_types.h:43
@ CFN_HAL_CONFIG_PHASE_INIT
Definition cfn_hal_types.h:45
@ CFN_HAL_CONFIG_PHASE_DEINIT
Definition cfn_hal_types.h:44
cfn_hal_driver_status_t
Definition cfn_hal_types.h:144
@ CFN_HAL_DRIVER_STATUS_ERROR
Definition cfn_hal_types.h:150
@ CFN_HAL_DRIVER_STATUS_CONSTRUCTED
Definition cfn_hal_types.h:146
@ CFN_HAL_DRIVER_STATUS_INITIALIZED
Definition cfn_hal_types.h:148
@ CFN_HAL_DRIVER_STATUS_UNKNOWN
Definition cfn_hal_types.h:145
void(* cfn_hal_callback_t)(void)
Generic function pointer for HAL callbacks. Used as a standard-compliant carrier in the base layer.
Definition cfn_hal_types.h:98
enum cfn_hal_error_codes cfn_hal_error_code_t
uint32_t cfn_hal_peripheral_type_t
Definition cfn_hal_types.h:85
cfn_hal_power_state_t
Definition cfn_hal_types.h:156
@ CFN_HAL_POWER_STATE_UNKNOWN
Definition cfn_hal_types.h:157
@ CFN_HAL_POWER_STATE_ON
Definition cfn_hal_types.h:158
@ CFN_HAL_POWER_STATE_LOW_POWER
Definition cfn_hal_types.h:159
@ CFN_HAL_POWER_STATE_OFF
Definition cfn_hal_types.h:161
cfn_hal_error_codes
Definition cfn_hal_types.h:49
@ CFN_HAL_ERROR_MEMORY_NULL
Definition cfn_hal_types.h:74
@ CFN_HAL_ERROR_OK
Definition cfn_hal_types.h:50
@ CFN_HAL_ERROR_UNKNOWN
Definition cfn_hal_types.h:82
@ CFN_HAL_ERROR_PERIPHERAL_FAIL
Definition cfn_hal_types.h:62
@ CFN_HAL_ERROR_MEMORY_ALLOC
Definition cfn_hal_types.h:76
@ CFN_HAL_ERROR_DATA_BAD_FORMAT
Definition cfn_hal_types.h:71
@ CFN_HAL_ERROR_EXTERNAL
Definition cfn_hal_types.h:58
@ CFN_HAL_ERROR_TIMING_TIMEOUT
Definition cfn_hal_types.h:64
@ CFN_HAL_ERROR_NOT_FOUND
Definition cfn_hal_types.h:55
@ CFN_HAL_ERROR_DRIVER_GENERAL
Definition cfn_hal_types.h:66
@ CFN_HAL_ERROR_MEMORY_EMPTY
Definition cfn_hal_types.h:77
@ CFN_HAL_ERROR_DATA_CRC
Definition cfn_hal_types.h:70
@ CFN_HAL_ERROR_FAIL
Definition cfn_hal_types.h:52
@ CFN_HAL_ERROR_BAD_PARAM
Definition cfn_hal_types.h:53
@ CFN_HAL_ERROR_NOT_READY
Definition cfn_hal_types.h:54
@ CFN_HAL_ERROR_BAD_CONFIG
Definition cfn_hal_types.h:60
@ CFN_HAL_ERROR_DATA_MISMATCH
Definition cfn_hal_types.h:72
@ CFN_HAL_ERROR_BUSY
Definition cfn_hal_types.h:59
@ CFN_HAL_ERROR_MEMORY_FULL
Definition cfn_hal_types.h:75
@ CFN_HAL_ERROR_DEVICE_FAIL
Definition cfn_hal_types.h:79
@ CFN_HAL_ERROR_OUT_OF_BOUND
Definition cfn_hal_types.h:56
@ CFN_HAL_ERROR_DRIVER_ALREADY_INIT
Definition cfn_hal_types.h:68
@ CFN_HAL_ERROR_DEVICE_NOT_FOUND
Definition cfn_hal_types.h:80
@ CFN_HAL_ERROR_DRIVER_NOT_INIT
Definition cfn_hal_types.h:67
@ CFN_HAL_ERROR_NOT_SUPPORTED
Definition cfn_hal_types.h:57
struct cfn_hal_driver_s cfn_hal_driver_t
Base structure for all peripheral drivers. Contains common state and polymorphic interface linkage.
Base API structure for all peripheral drivers. Every peripheral-specific API struct MUST have this as...
Definition cfn_hal_base.h:63
Base structure for all peripheral drivers. Contains common state and polymorphic interface linkage.
Definition cfn_hal_types.h:171
struct cfn_hal_clock_s * clock_driver
Definition cfn_hal_types.h:176
uint32_t flags
Definition cfn_hal_types.h:197
void * dependency
Definition cfn_hal_types.h:192
void * extension
Definition cfn_hal_types.h:194
cfn_hal_error_code_t(* on_config)(struct cfn_hal_driver_s *base, void *user_arg, cfn_hal_config_phase_t phase)
Board-level configuration hook (BSP). Called by the generic HAL to handle hardware-specific setup lik...
Definition cfn_hal_types.h:188
cfn_hal_power_state_t power_state
Definition cfn_hal_types.h:174
cfn_hal_peripheral_type_t type
Definition cfn_hal_types.h:172
const struct cfn_hal_api_base_s * vmt
Definition cfn_hal_types.h:199
uint32_t peripheral_id
Definition cfn_hal_types.h:198
void * on_config_arg
Definition cfn_hal_types.h:190
cfn_hal_driver_status_t status
Definition cfn_hal_types.h:173