Intel® Quark™ Microcontroller Software Interface 1.4.0 Intel® Quark™ Microcontroller BSP

- Main Page
- Modules
- Data Structures
- Files

Data Structures | Typedefs | Enumerations | Functions
Mailbox

Mailbox driver. More...

## Data Structures
struct | qm_mbox_msg_t
| Definition of the mailbox message. More...
struct | qm_mbox_config_t
| Mailbox Configuration Structure. More...

## Typedefs
typedef void(* | qm_mbox_callback_t )(void *data)
| Definition of the mailbox callback function prototype. More...

## Enumerations
enum | qm_mbox_ch_status_t { QM_MBOX_CH_IDLE = 0, QM_MBOX_CH_DATA_PEND = QM_MBOX_CH_STS, QM_MBOX_CH_INT_AND_DATA_PEND }
| Mailbox channel status return codes. More...
enum | qm_mbox_payload_t { QM_MBOX_PAYLOAD_0 = 0, QM_MBOX_PAYLOAD_1, QM_MBOX_PAYLOAD_2, QM_MBOX_PAYLOAD_3, QM_MBOX_PAYLOAD_NUM }
| Mailbox message payload index values. More...
enum | qm_mbox_mode_t { QM_MBOX_INTERRUPT_MODE = 0, QM_MBOX_POLLING_MODE }
| Definition of the mailbox mode of operation, interrupt mode or polling mode. More...

## Functions
int | qm_mbox_ch_set_config (const qm_mbox_ch_t mbox_ch, const qm_mbox_config_t *const config)
| Set the mailbox channel configuration. More...
int | qm_mbox_ch_write (const qm_mbox_ch_t mbox_ch, const qm_mbox_msg_t *const msg)
| Write to a specified mailbox channel. More...
int | qm_mbox_ch_read (const qm_mbox_ch_t mbox_ch, qm_mbox_msg_t *const msg)
| Read specified mailbox channel. More...
int | qm_mbox_ch_get_status (const qm_mbox_ch_t mbox_ch, qm_mbox_ch_status_t *const status)
| Retrieve the specified mailbox channel status. More...

## Detailed Description

Mailbox driver.

## Typedef Documentation

typedef void(* qm_mbox_callback_t)(void *data)

Definition of the mailbox callback function prototype.

Parameters

  [in] | data | The callback user data.

Definition at line 78 of file qm_mailbox.h.

## Enumeration Type Documentation

enum qm_mbox_ch_status_t

Mailbox channel status return codes.

Enumerator
QM_MBOX_CH_IDLE | No interrupt pending nor any data to consume.
QM_MBOX_CH_DATA_PEND | Receiver has serviced the interrupt and data has not been consumed.
QM_MBOX_CH_INT_AND_DATA_PEND | Receiver hasn't serviced the interrupt and data has not been consumed.

Definition at line 23 of file qm_mailbox.h.

enum qm_mbox_mode_t

Definition of the mailbox mode of operation, interrupt mode or polling mode.

Enumerator
QM_MBOX_INTERRUPT_MODE | Mailbox channel operates in interrupt mode.
QM_MBOX_POLLING_MODE | Mailbox channel operates in polling mode.

Definition at line 54 of file qm_mailbox.h.

enum qm_mbox_payload_t

Mailbox message payload index values.

Enumerator
QM_MBOX_PAYLOAD_0 | Payload index value 0.
QM_MBOX_PAYLOAD_1 | Payload index value 1.
QM_MBOX_PAYLOAD_2 | Payload index value 2.
QM_MBOX_PAYLOAD_3 | Payload index value 3.
QM_MBOX_PAYLOAD_NUM | Number of payloads.

Definition at line 43 of file qm_mailbox.h.

## Function Documentation

int qm_mbox_ch_get_status | ( | const qm_mbox_ch_t | mbox_ch,
|  | qm_mbox_ch_status_t *const | status
| ) |  |

Retrieve the specified mailbox channel status.

Parameters

  [in] | mbox_ch | Mailbox identifier to retrieve the status from.
  [out] | status | Mailbox status. This must not be NULL.

Returns
  Standard errno return type for QMSI.

Return values

  0 | on success.
  Negative | errno for possible error codes.

Definition at line 248 of file qm_mailbox_se.c.

References QM_MBOX_CH_0.

int qm_mbox_ch_read | ( | const qm_mbox_ch_t | mbox_ch,
|  | qm_mbox_msg_t *const | msg
| ) |  |

Read specified mailbox channel.

Parameters

  [in] | mbox_ch | Mailbox channel identifier.
  [out] | msg | Pointer to the data to read from the mailbox channel. This must not be NULL.

Returns
  Standard errno return type for QMSI.

Return values

  0 | on success.
  Negative | errno for possible error codes.

Definition at line 198 of file qm_mailbox_se.c.

References qm_mailbox_t::ch_ctrl, qm_mailbox_t::ch_data, qm_mailbox_t::ch_sts, qm_mbox_msg_t::ctrl, qm_mbox_msg_t::data, and QM_MBOX_CH_0.

int qm_mbox_ch_set_config | ( | const qm_mbox_ch_t | mbox_ch,
|  | const qm_mbox_config_t *const | config
| ) |  |

Set the mailbox channel configuration.

The function registers the interrupt vector to the mailbox ISR handler when at least one mailbox channel is enabled, configured in interrupt mode and the ISR is not handled by the application.

Parameters

  [in] | mbox_ch | Mailbox channel identifier.
  [in] | config | Mailbox configuration.

Returns
  Standard errno return type for QMSI.

Return values

  0 | on success.
  Negative | errno for possible error codes.

Definition at line 99 of file qm_mailbox_se.c.

References qm_mbox_config_t::callback, qm_mbox_config_t::dest, qm_mbox_config_t::mode, QM_MBOX_CH_0, QM_MBOX_INTERRUPT_MODE, and QM_MBOX_POLLING_MODE.

int qm_mbox_ch_write | ( | const qm_mbox_ch_t | mbox_ch,
|  | const qm_mbox_msg_t *const | msg
| ) |  |

Write to a specified mailbox channel.

Parameters

  [in] | mbox_ch | Mailbox channel identifier.
  [in] | msg | Pointer to the data to write to the mailbox channel. This must not be NULL.

Returns
  Standard errno return type for QMSI.

Return values

  0 | on success.
  Negative | errno for possible error codes.

Definition at line 171 of file qm_mailbox_se.c.

References qm_mailbox_t::ch_ctrl, qm_mailbox_t::ch_data, qm_mailbox_t::ch_sts, qm_mbox_msg_t::ctrl, qm_mbox_msg_t::data, QM_MBOX_CH_0, QM_MBOX_PAYLOAD_0, QM_MBOX_PAYLOAD_1, QM_MBOX_PAYLOAD_2, and QM_MBOX_PAYLOAD_3.