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@27:934ab7455115, 2016-04-01 (annotated)
- Committer:
- Jeej
- Date:
- Fri Apr 01 10:55:30 2016 +0000
- Revision:
- 27:934ab7455115
- Parent:
- 26:9f0b9833cac6
- Child:
- 29:8e7c5c1e9aab
Read file function.
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| Jeej | 25:aac250164497 | 1 | #ifndef _D7A_MODEM_H_ |
| Jeej | 25:aac250164497 | 2 | #define _D7A_MODEM_H_ |
| Jeej | 25:aac250164497 | 3 | |
| Jeej | 25:aac250164497 | 4 | //====================================================================== |
| Jeej | 25:aac250164497 | 5 | // MODEM commands over COM port |
| Jeej | 25:aac250164497 | 6 | //====================================================================== |
| Jeej | 25:aac250164497 | 7 | typedef enum |
| Jeej | 25:aac250164497 | 8 | { |
| Jeej | 26:9f0b9833cac6 | 9 | /// Soft reset MOTE |
| Jeej | 25:aac250164497 | 10 | WM_CMD_RST, |
| Jeej | 25:aac250164497 | 11 | /// Set radio to IDLE |
| Jeej | 25:aac250164497 | 12 | WM_CMD_RADIO_IDLE, |
| Jeej | 25:aac250164497 | 13 | /// Mask D7A Scan Series |
| Jeej | 25:aac250164497 | 14 | WM_CMD_SCAN_PAUSE, |
| Jeej | 25:aac250164497 | 15 | /// Unmask D7A Scan Series |
| Jeej | 25:aac250164497 | 16 | WM_CMD_SCAN_RESUME, |
| Jeej | 25:aac250164497 | 17 | // To be continued... |
| Jeej | 25:aac250164497 | 18 | |
| Jeej | 26:9f0b9833cac6 | 19 | WM_CMD_BOOT, |
| Jeej | 25:aac250164497 | 20 | WM_CMD_READY, |
| Jeej | 25:aac250164497 | 21 | WM_CMD_REGISTER_FILE, |
| Jeej | 25:aac250164497 | 22 | WM_CMD_NOTIFY_FILE, |
| Jeej | 25:aac250164497 | 23 | |
| Jeej | 25:aac250164497 | 24 | } d7a_cmd_t; |
| Jeej | 25:aac250164497 | 25 | |
| Jeej | 26:9f0b9833cac6 | 26 | typedef enum { |
| Jeej | 26:9f0b9833cac6 | 27 | ALP_POLICY_NONE = 0x00, |
| Jeej | 26:9f0b9833cac6 | 28 | ALP_POLICY_DEFAULT = 0x01, |
| Jeej | 26:9f0b9833cac6 | 29 | ALP_POLICY_ONESHOT = 0x80, |
| Jeej | 26:9f0b9833cac6 | 30 | } alp_retry_policy_t; |
| Jeej | 26:9f0b9833cac6 | 31 | |
| Jeej | 25:aac250164497 | 32 | typedef union { |
| Jeej | 25:aac250164497 | 33 | uint32_t w; |
| Jeej | 25:aac250164497 | 34 | struct { |
| Jeej | 25:aac250164497 | 35 | uint32_t fid : 8; |
| Jeej | 25:aac250164497 | 36 | uint32_t fifo_size : 8; |
| Jeej | 25:aac250164497 | 37 | uint32_t flush_policy : 8; |
| Jeej | 25:aac250164497 | 38 | } bf; |
| Jeej | 25:aac250164497 | 39 | } register_file_param_t; |
| Jeej | 25:aac250164497 | 40 | |
| Jeej | 25:aac250164497 | 41 | typedef union { |
| Jeej | 25:aac250164497 | 42 | uint32_t w; |
| Jeej | 25:aac250164497 | 43 | struct { |
| Jeej | 25:aac250164497 | 44 | uint32_t fid : 8; |
| Jeej | 25:aac250164497 | 45 | uint32_t offset : 12; |
| Jeej | 25:aac250164497 | 46 | uint32_t size : 12; |
| Jeej | 25:aac250164497 | 47 | } bf; |
| Jeej | 25:aac250164497 | 48 | } notify_file_param_t; |
| Jeej | 25:aac250164497 | 49 | |
| Jeej | 27:934ab7455115 | 50 | //====================================================================== |
| Jeej | 27:934ab7455115 | 51 | // Firmware version Structure |
| Jeej | 27:934ab7455115 | 52 | // |
| Jeej | 27:934ab7455115 | 53 | // Used within the revision structure |
| Jeej | 27:934ab7455115 | 54 | //====================================================================== |
| Jeej | 27:934ab7455115 | 55 | TYPEDEF_STRUCT_PACKED |
| Jeej | 27:934ab7455115 | 56 | { |
| Jeej | 27:934ab7455115 | 57 | uint8_t id; |
| Jeej | 27:934ab7455115 | 58 | uint8_t major; |
| Jeej | 27:934ab7455115 | 59 | uint8_t minor; |
| Jeej | 27:934ab7455115 | 60 | uint16_t patch; |
| Jeej | 27:934ab7455115 | 61 | uint32_t hash; |
| Jeej | 27:934ab7455115 | 62 | } fw_version_t; |
| Jeej | 27:934ab7455115 | 63 | |
| Jeej | 27:934ab7455115 | 64 | //====================================================================== |
| Jeej | 27:934ab7455115 | 65 | // Revision Structure |
| Jeej | 27:934ab7455115 | 66 | // |
| Jeej | 27:934ab7455115 | 67 | // Usage within D7B server: |
| Jeej | 27:934ab7455115 | 68 | // An XML describing the File system of a device is associated to a |
| Jeej | 27:934ab7455115 | 69 | // couple manufacturer_id/device_id (==Device). |
| Jeej | 27:934ab7455115 | 70 | // Different versions of the Device's XML can exist and can be mapped |
| Jeej | 27:934ab7455115 | 71 | // according to fw_version |
| Jeej | 27:934ab7455115 | 72 | //====================================================================== |
| Jeej | 27:934ab7455115 | 73 | TYPEDEF_STRUCT_PACKED |
| Jeej | 27:934ab7455115 | 74 | { |
| Jeej | 27:934ab7455115 | 75 | /// Manufacturer ID: provided by Wizzilab |
| Jeej | 27:934ab7455115 | 76 | // comes from: here |
| Jeej | 27:934ab7455115 | 77 | uint32_t manufacturer_id; |
| Jeej | 27:934ab7455115 | 78 | /// Device ID: Arbitrary number, at user/customer choice |
| Jeej | 27:934ab7455115 | 79 | // comes from: application |
| Jeej | 27:934ab7455115 | 80 | uint32_t device_id; |
| Jeej | 27:934ab7455115 | 81 | /// Hardware Board ID: |
| Jeej | 27:934ab7455115 | 82 | // comes from: board definition |
| Jeej | 27:934ab7455115 | 83 | uint32_t hw_version; |
| Jeej | 27:934ab7455115 | 84 | /// Firmware Version: made of |
| Jeej | 27:934ab7455115 | 85 | /// - major,minor and patch indexes : comes from versioning tool |
| Jeej | 27:934ab7455115 | 86 | /// - fw_id : "build-flavour" : comes from build setup |
| Jeej | 27:934ab7455115 | 87 | /// FW_ID | MAJOR | MINOR | PATCH | HASH | |
| Jeej | 27:934ab7455115 | 88 | // 1B | 1B | 1B | 2B | 4B | |
| Jeej | 27:934ab7455115 | 89 | fw_version_t fw_version; |
| Jeej | 27:934ab7455115 | 90 | /// "file-system" signature XXX: to be worked out |
| Jeej | 27:934ab7455115 | 91 | // comes from: application |
| Jeej | 27:934ab7455115 | 92 | uint32_t fs_crc; |
| Jeej | 27:934ab7455115 | 93 | } revision_t; |
| Jeej | 27:934ab7455115 | 94 | |
| Jeej | 25:aac250164497 | 95 | |
| Jeej | 26:9f0b9833cac6 | 96 | void d7a_modem_open( PinName reset_pin ); |
| Jeej | 26:9f0b9833cac6 | 97 | int32_t d7a_modem_wait_ready( uint32_t millisec = osWaitForever); |
| Jeej | 25:aac250164497 | 98 | void d7a_modem_new_pkt(d7a_com_rx_msg_t* pkt); |
| Jeej | 25:aac250164497 | 99 | d7a_com_rx_msg_t* d7a_modem_wait_pkt( uint32_t millisec = osWaitForever ); |
| Jeej | 25:aac250164497 | 100 | void d7a_modem_register_file(uint8_t fid, uint8_t fifo_size, uint8_t flush_policy); |
| Jeej | 25:aac250164497 | 101 | void d7a_modem_notify_file(uint8_t fid, uint32_t offset, uint32_t length); |
| Jeej | 27:934ab7455115 | 102 | void d7a_modem_infos( void ); |
| Jeej | 25:aac250164497 | 103 | |
| Jeej | 25:aac250164497 | 104 | |
| Jeej | 25:aac250164497 | 105 | #endif |
