Infineon Logo AIROC BTSDK v4.6 - Documentation
 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Groups
miadriver.h File Reference

Define functions to high-level driver functions. More...

Typedefs

struct {
   void(*   mia_virtualSetupTimedWake )(UINT32 wakeupTime,
      MiaTimedWakeRefClock ref)
 Pointer to the timed wake setup function.
 
   UINT8   inited: 1
 Whether mia HW is initialized or not.
 
   UINT8   keyscanRegistered: 1
 Whether KS driver is registered with this instance.
 
   UINT8   quadRegistered: 1
 Whether Quad driver is registered with this instance.
 
   UINT8   lhlInterruptState: 1
 Whether interrupt is enabled/disabled.
 
   UINT8   miaInterruptState: 1
 Whether interrupt is enabled/disabled.
 
   UINT8   lpo32kWasRunning: 1
 Whether lpo 32k was running.
 
   UINT8   resetReasonPor: 1
 Whether reason for reset was power on.
 
MiaState
 Internal state of the MIA driver.
 

Enumerations

enum  {
  MIA_P2_OPSR_SEL_PORT_2_6_BIT_MASK = 0xC0, MIA_P2_OPSR_SEL_PORT_2_6_IS_KSO14 = 0x40, MIA_OPSR_SEL0_PORT_2_7_BIT_MASK = 0x03, MIA_OPSR_SEL0_PORT_2_7_IS_KSO15 = 0x01,
  MIA_OPSR_SEL0_PORT_3_0_BIT_MASK = 0x0C, MIA_OPSR_SEL0_PORT_3_0_IS_KSO16 = 0x04, MIA_OPSR_SEL0_PORT_3_1_BIT_MASK = 0x10, MIA_OPSR_SEL0_PORT_3_1_IS_KSO17 = 0x10,
  MIA_OPSR_SEL0_PORT_3_2_BIT_MASK = 0x60, MIA_OPSR_SEL0_PORT_3_2_IS_KSO18 = 0x20, MIA_OPSR_SEL1_PORT_3_3_BIT_MASK = 0x03, MIA_OPSR_SEL1_PORT_3_3_IS_KSO19 = 0x01
}
 Defines a MIA driver. More...
 
enum  {
  HW_MIA_CTRL_CLK_FREEZE_MASK = 0x0001, HW_MIA_CTRL_CLK_FREEZE_REQ = 0x0001, HW_MIA_CTRL_CLK_UNFREEZE_REQ = 0x0000, HW_MIA_STATUS_CLK_FROZEN_MASK = 0x0001,
  HW_MIA_STATUS_CLK_FROZEN = 0x0001, HW_MIA_STATUS_CLK_RUNNING = 0x0000, HW_MIA_STATUS_KEYCODE_SET_MASK = 0x0002, HW_MIA_STATUS_KEYCODE_SET = 0x0002,
  HW_MIA_STATUS_QUAD_SET = 0x0010, HW_MIA_STATUS_EVT_SET_MASK = 0x0012, HW_MIA_STATUS_EVT_SET = 0x0012, HW_LHL_CTL_HID_OFF_MASK = 0x0001,
  HW_LHL_CTL_KS_EN_MASK = 0x0002, HW_LHL_CTL_QD_EN_MASK = 0x0004, HW_LHL_CTL_KSI_USED_MASK = 0xE000, HW_LHL_CTL_HID_OFF = 0x0001,
  HW_LHL_CTL_KS_EN = 0x0002, HW_LHL_CTL_QD_EN = 0x0004, HW_LHL_CTL_KSI_USED_SHIFT_COUNT = 13, HW_LHL_STATUS_HID_OFF_WAKEUP_MASK = 0x0001,
  HW_LHL_STATUS_GPIO_ASYNC_WAKEUP_MASK = 0x0002, HW_LHL_STATUS_HID_OFF_WAKEUP = 0x0001, HW_LHL_STATUS_GPIO_ASYNC_WAKEUP = 0x0002, HW_LDO_CTL_EN_HV_POK_MASK = 0x8000,
  HW_LDO_CTL_EN_LHL_POK_MASK = 0x4000, HW_LDO_CTL_EN_MIA_FB_DIS_MASK = 0x0200, HW_LDO_CTL_EN_MIA_PASSTH_MASK = 0x0100, HW_LDO_CTL_EN_FW_REG_OFF_MASK = 0x0002,
  HW_LDO_CTL_EN_CTL_EN_MASK = 0x0001, HW_LDO_CTL_EN_HV_POK = 0x8000, HW_LDO_CTL_EN_LHL_POK = 0x4000, HW_LDO_CTL_EN_MIA_FB_DIS = 0x0200,
  HW_LDO_CTL_EN_MIA_PASSTH = 0x0100, HW_LDO_CTL_EN_FW_REG_OFF = 0x0002, HW_LDO_CTL_EN_BG_PD_EN = 0x0002, HW_LDO_CTL_EN_CTL_EN = 0x0001,
  HW_HID_OFF_CNT1_EN_MASK = 0x8000, HW_HID_OFF_CNT1_EN = 0x8000, HW_LHL_ADC_CTL_RTC_TERM_CNT_STATUS_EN = 0x1000, HW_LHL_ADC_CTL_RTC_CNT_RESET = 0x2000,
  HW_LHL_ADC_CTL_RTC_TIMER_FN_EN = 0x4000, HW_LHL_ADC_CTL_RTC_CNT_EN = 0x8000, HW_LHL_LDO_CTL_EN_LHL_RTC_CLOCK_SEL_MASK = 0x0040, HW_LHL_LDO_CTL_EN_LHL_MIA_CLOCK_SEL_MASK = 0x0080,
  HW_LHL_LDO_CTL_EN_LHL_RTC_CLOCK_SEL_32KHZ = 0x0040, HW_LHL_LDO_CTL_EN_LHL_MIA_CLOCK_SEL_32KHZ = 0x0080, HW_LHL_LDO_CTL_EN_LHL_RTC_CLOCK_SEL_128KHZ = 0x0000, HW_LHL_LDO_CTL_EN_LHL_MIA_CLOCK_SEL_128KHZ = 0x0000,
  HW_HIDOFF_CNT0_MASK = 0xFC00, HW_HIDOFF_CNT0_REG_SHIFT = 0x000A, HW_HIDOFF_CNT0_RTC_SHIFT = 0x000D, HW_HIDOFF_CNT1_MASK = 0xFFFF,
  HW_HIDOFF_CNT1_RTC_SHIFT = 0x0013
}
 Defines the miadriver class. More...
 
enum  { HW_LPO_POWER_DOWN_EN = 0x0080, HW_LPO_POWER_DOWN_SEL_MASK = 0x0300, HW_LPO_POWER_DOWN_SEL_AUTO = 0x0100, HW_LPO_POWER_DOWN_SEL_FORCE = 0x0200 }
 MIA LPO control bits.
 
enum  {
  KEEPSTATE0_HID_OFF_MASK = 0x0001, KEEPSTATE0_SOFT_POWER_OFF_MASK = 0x0002, KEEPSTATE0_FUNC_LOCK_STATE_MASK = 0x0004, KEEPSTATE0_HID_OFF = 0x0001,
  KEEPSTATE0_SOFT_POWER_OFF = 0x0002, KEEPSTATE0_FUNC_LOCK_STATE_ON = 0x0004, KEEPSTATE0_FUNC_LOCK_STATE_OFF = 0x0000
}
 MIA always-on bits.
 
enum  { HID_OFF_WAKEUP_TIME_NONE = 0 }
 MIA timed wake none.
 
enum  { MIA_LPO_NONE = 0, MIA_LPO_LHL_ON = 1, MIA_LPO_32K_ON = 2 }
 MIA LPO selection.
 
enum  MiaTimedWakeRefClock { HID_OFF_TIMED_WAKE_CLK_SRC_32KHZ, HID_OFF_TIMED_WAKE_CLK_SRC_128KHZ }
 Reference clock for timed wake from deep sleep. More...
 

Functions

void mia_init (void)
 Initializes the MIA HW block.
 
void mia_pollHardware (void)
 Poll all HW blocks on the MIA domain if one or more events are detected. More...
 
void mia_flushAllEvents (void)
 Retrieves pending events from HW and also flushes KS events.
 
void mia_notificationRegisterKeyscan (void)
 Register the keyscan driver for event notification. Internal.
 
void mia_notificationRegisterQuad (void)
 Register the quadrature driver for event notification. Internal.
 
int mia_handleLhlInterrupt (void *unused)
 Dispatches a GPIO interrupt to the GPIO driver in thread context. Internal.
 
int mia_handleKsInterrupt (void *unused)
 Dispatches a keyscan interrupt to the keyscan driver in thread context. Internal.
 
int mia_handleQuadInterrupt (void *unused)
 Dispatches a quadrature interrupt to the quadrature driver in thread context. Internal.
 
UINT16 mia_getKeepstate0 (void)
 Get the 16 bits stored in the always on register 0.
 
UINT16 mia_getKeepstate1 (void)
 Get the 16 bits stored in the always on register 1.
 
void mia_setKeepstate0 (UINT16 newVal)
 Set the 16 bits stored in the always on register 0.
 
void mia_setKeepstate1 (UINT16 newVal)
 Set the 16 bits stored in the always on register 0.
 
void mia_addKeepstate0 (UINT16 newVal)
 OR in bits set in the parameter to always on register 0.
 
void mia_addKeepstate1 (UINT16 newVal)
 OR in bits set in the parameter to always on register 1.
 
void mia_delKeepstate0 (UINT16 newVal)
 Remove bits set in the parameter to always on register 0.
 
void mia_delKeepstate1 (UINT16 newVal)
 Remove bits set in the parameter to always on register 1.
 
BOOL32 mia_isResetReasonPor (void)
 Check if the reason for booting is PoR or wake from deep sleep. More...
 
void mia_enableKeyscanPriorToHidOff (void)
 Enables keyscan before entring deep-sleep. Internal.
 
void mia_turnOffLhlLpoIfPossible (void)
 Turn off internal LPOs if possible. Internal.
 
void mia_setupTimedWake (UINT32 wakeupTimeInMs, MiaTimedWakeRefClock ref)
 Set up timed wake from deep sleep. More...
 
void mia_enterHidOff (UINT32 wakeupTime, MiaTimedWakeRefClock ref)
 Enter deep sleep. More...
 
void mia_enableMiaInterrupt (BOOL32 enable)
 Enable or disable keyscan and quadrature interrupts. More...
 
void mia_enableLhlInterrupt (BOOL32 enable)
 Enable or disable GPIO interrupts. More...
 
BOOL32 mia_getMiaInterruptState (void)
 Get the MIA interrupt state. More...
 
BOOL32 mia_getLhlInterruptState (void)
 Get the LHL interrupt state. More...
 
void mia_restoreMiaInterruptState (void)
 Restore the possibly overridden MIA interrupt setting to that of the MIA interrupt state. More...
 
void mia_restoreLhlInterruptState (void)
 Restore the possibly overridden LHL interrupt setting to that of the LHL interrupt state. More...
 

Detailed Description

Define functions to high-level driver functions.