diff options
author | Philippe Langlais <philippe.langlais@stericsson.com> | 2012-06-04 19:45:37 +0800 |
---|---|---|
committer | Philippe Langlais <philippe.langlais@stericsson.com> | 2012-06-04 19:45:37 +0800 |
commit | d3aeada8de410edd0ea3cb1b73381ebae469c584 (patch) | |
tree | 8b22bec8a39e599c9250e50ab4078425ca749b35 /drivers/modem/m6718_spi/modem_statemachine.h | |
parent | 591e5e125f9de0513a732371378eeffe09ef4da5 (diff) | |
parent | 7338b0ab88d72b11989f40394069164d9326afbf (diff) |
Merge topic branch 'modem' into integration-linux-ux500
Signed-off-by: Philippe Langlais <philippe.langlais@stericsson.com>
Diffstat (limited to 'drivers/modem/m6718_spi/modem_statemachine.h')
-rw-r--r-- | drivers/modem/m6718_spi/modem_statemachine.h | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/drivers/modem/m6718_spi/modem_statemachine.h b/drivers/modem/m6718_spi/modem_statemachine.h new file mode 100644 index 00000000000..6a2a32cad3a --- /dev/null +++ b/drivers/modem/m6718_spi/modem_statemachine.h @@ -0,0 +1,71 @@ +/* + * Copyright (C) ST-Ericsson SA 2011 + * + * Author: Chris Blair <chris.blair@stericsson.com> for ST-Ericsson + * + * License terms: GNU General Public License (GPL) version 2 + * + * Modem IPC driver protocol interface header: + * statemachine functionality. + */ +#ifndef _MODEM_STATEMACHINE_H_ +#define _MODEM_STATEMACHINE_H_ + +#include <linux/kernel.h> + +/* valid states for the driver state machine */ +enum ipc_sm_state_id { + IPC_SM_INIT, + IPC_SM_HALT, + IPC_SM_RESET, + IPC_SM_WAIT_SLAVE_STABLE, + IPC_SM_WAIT_HANDSHAKE_INACTIVE, + IPC_SM_SLW_TX_BOOTREQ, + IPC_SM_ACT_TX_BOOTREQ, + IPC_SM_SLW_RX_BOOTRESP, + IPC_SM_ACT_RX_BOOTRESP, + IPC_SM_IDL, + IPC_SM_SLW_TX_WR_CMD, + IPC_SM_ACT_TX_WR_CMD, + IPC_SM_SLW_TX_WR_DAT, + IPC_SM_ACT_TX_WR_DAT, + IPC_SM_SLW_TX_RD_CMD, + IPC_SM_ACT_TX_RD_CMD, + IPC_SM_SLW_RX_WR_CMD, + IPC_SM_ACT_RX_WR_CMD, + IPC_SM_ACT_RX_WR_DAT, + IPC_SM_STATE_ID_NBR +}; + +/* state machine trigger causes events */ +#define IPC_SM_RUN_NONE (0x00) +#define IPC_SM_RUN_SLAVE_IRQ (0x01) +#define IPC_SM_RUN_TFR_COMPLETE (0x02) +#define IPC_SM_RUN_TX_REQ (0x04) +#define IPC_SM_RUN_INIT (0x08) +#define IPC_SM_RUN_ABORT (0x10) +#define IPC_SM_RUN_COMMS_TMO (0x20) +#define IPC_SM_RUN_STABLE_TMO (0x40) +#define IPC_SM_RUN_RESET (0x80) + +struct ipc_link_context; /* forward declaration */ + +typedef u8 (*ipc_sm_enter_func)(u8 event, struct ipc_link_context *context); +typedef const struct ipc_sm_state *(*ipc_sm_exit_func)(u8 event, + struct ipc_link_context *context); + +struct ipc_sm_state { + enum ipc_sm_state_id id; + ipc_sm_enter_func enter; + ipc_sm_exit_func exit; + u8 events; +}; + +const struct ipc_sm_state *ipc_sm_idle_state(struct ipc_link_context *context); +const struct ipc_sm_state *ipc_sm_init_state(struct ipc_link_context *context); +const struct ipc_sm_state *ipc_sm_state(u8 id); +bool ipc_sm_valid_for_state(u8 event, const struct ipc_sm_state *state); + +void ipc_sm_kick(u8 event, struct ipc_link_context *context); + +#endif /* _MODEM_STATEMACHINE_H_ */ |