Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of d7a_1x by
include/d7a_modem.h
- Committer:
- Jeej
- Date:
- 2016-05-25
- Revision:
- 30:d775c1409849
- Parent:
- 29:8e7c5c1e9aab
- Child:
- 34:1311cc53201a
File content as of revision 30:d775c1409849:
#ifndef _D7A_MODEM_H_
#define _D7A_MODEM_H_
enum {
WM_ERR_COM_LINK=10,
WM_ERR_NOT_READY,
};
// Msg/Cmd exchanged on CMD FLOW ID
enum {
WM_READY,
};
//======================================================================
// MODEM commands over COM port
//======================================================================
typedef enum
{
/// Soft-reset Modem Device
/// ARGS: none
WM_CMD_RST = 0x01,
/// Start D7A communication stack
/// ARGS: none TODO: pass number of fifos ?
WM_CMD_D7A_STACK_START = 0x02,
/// Stop D7A communication stack
/// ARGS: none
WM_CMD_D7A_STACK_STOP = 0x03,
/// Register a File for notification
/// ARGS: register_file_param_t
WM_CMD_REGISTER_FILE = 0x04,
/// Notify a (previously registered) file
/// ARGS: notify_file_param_t
WM_CMD_NOTIFY_FILE = 0x05,
/// Send by the Modem Device after a command has been executed/taken
/// into account, and the Modem is ready to handle a new command.
/// Can be used as a command that will be instantly answered with WM_CMD_READY
/// ARGS: none
WM_CMD_READY = 0x80,
/// Send by the Modem Device after a (re)boot.
/// ARGS: boot_status_t
WM_CMD_BOOT = 0x81,
} wm_cmd_t;
typedef union {
uint32_t w;
struct {
uint32_t cause : 8;
uint32_t rfu : 8;
uint32_t nb_boot :16;
} bf;
} boot_status_t;
typedef union {
uint32_t w;
struct {
uint32_t fid : 8;
uint32_t retry_policy : 8;
} bf;
} register_file_param_t;
typedef union {
uint32_t w;
struct {
uint32_t fid : 8;
uint32_t offset : 12;
uint32_t size : 12;
} bf;
} notify_file_param_t;
typedef struct {
union {
uint8_t b[8];
uint32_t w[2];
} uid;
uint8_t calib;
} wm_status_t;
//======================================================================
// Firmware version Structure
//
// Used within the revision structure
//======================================================================
TYPEDEF_STRUCT_PACKED
{
uint8_t id;
uint8_t major;
uint8_t minor;
uint16_t patch;
uint32_t hash;
} fw_version_t;
//======================================================================
// Revision Structure
//
// Usage within D7B server:
// An XML describing the File system of a device is associated to a
// couple manufacturer_id/device_id (==Device).
// Different versions of the Device's XML can exist and can be mapped
// according to fw_version
//======================================================================
TYPEDEF_STRUCT_PACKED
{
/// Manufacturer ID: provided by Wizzilab
// comes from: here
uint32_t manufacturer_id;
/// Device ID: Arbitrary number, at user/customer choice
// comes from: application
uint32_t device_id;
/// Hardware Board ID:
// comes from: board definition
uint32_t hw_version;
/// Firmware Version: made of
/// - major,minor and patch indexes : comes from versioning tool
/// - fw_id : "build-flavour" : comes from build setup
/// FW_ID | MAJOR | MINOR | PATCH | HASH |
// 1B | 1B | 1B | 2B | 4B |
fw_version_t fw_version;
/// "file-system" signature XXX: to be worked out
// comes from: application
uint32_t fs_crc;
} revision_t;
void d7a_modem_open( PinName reset_pin );
void d7a_modem_reset( void );
bool d7a_modem_wait_ready( uint32_t millisec = osWaitForever );
void d7a_modem_new_pkt(d7a_com_rx_msg_t* pkt);
d7a_com_rx_msg_t* d7a_modem_wait_pkt( uint32_t millisec = osWaitForever );
void d7a_modem_msg(uint8_t value, uint8_t* buf, uint8_t len);
bool d7a_modem_register_file(uint8_t fid, uint8_t retry_policy);
void d7a_modem_notify_file(uint8_t fid, uint32_t offset, uint32_t length);
void d7a_modem_print_infos(void);
#endif
