otam_protocol.h 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /**************************************************************************************************
  2. Phyplus Microelectronics Limited confidential and proprietary.
  3. All rights reserved.
  4. IMPORTANT: All rights of this software belong to Phyplus Microelectronics
  5. Limited ("Phyplus"). Your use of this Software is limited to those
  6. specific rights granted under the terms of the business contract, the
  7. confidential agreement, the non-disclosure agreement and any other forms
  8. of agreements as a customer or a partner of Phyplus. You may not use this
  9. Software unless you agree to abide by the terms of these agreements.
  10. You acknowledge that the Software may not be modified, copied,
  11. distributed or disclosed unless embedded on a Phyplus Bluetooth Low Energy
  12. (BLE) integrated circuit, either as a product or is integrated into your
  13. products. Other than for the aforementioned purposes, you may not use,
  14. reproduce, copy, prepare derivative works of, modify, distribute, perform,
  15. display or sell this Software and/or its documentation for any purposes.
  16. YOU FURTHER ACKNOWLEDGE AND AGREE THAT THE SOFTWARE AND DOCUMENTATION ARE
  17. PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED,
  18. INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY, TITLE,
  19. NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL
  20. PHYPLUS OR ITS SUBSIDIARIES BE LIABLE OR OBLIGATED UNDER CONTRACT,
  21. NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR OTHER
  22. LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES
  23. INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE
  24. OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT
  25. OF SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES
  26. (INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.
  27. **************************************************************************************************/
  28. #ifndef __OTA_MAST_PROTO_
  29. #define __OTA_MAST_PROTO_
  30. #include "ota_flash.h"
  31. #define OTA_BURST_SIZE_DEFAULT 16
  32. #define OTA_BURST_SIZE_HISPEED 0xff
  33. enum{
  34. OTAP_EVT_DISCONNECTED =1,
  35. OTAP_EVT_CONNECTED,
  36. OTAP_EVT_NOTIFY,
  37. OTAP_EVT_DATA_WR_DELAY,
  38. OTAP_EVT_BLE_TIMEOUT,
  39. };
  40. typedef struct{
  41. uint8_t run_mode;
  42. uint16_t mtu;
  43. }otam_proto_conn_param_t;
  44. typedef struct{
  45. uint8_t ev;
  46. uint16_t len;
  47. void* data;
  48. }otap_evt_t;
  49. typedef int (*otam_clear_t)(void);
  50. typedef int (*otam_wcmd_op_t)(uint8_t* data, uint16_t len, uint32_t timeout);
  51. typedef int (*otam_wdata_op_t)(uint8_t* data, uint16_t len);
  52. typedef int (*otam_wdata_delay_t)(uint32_t msec_delay);
  53. typedef struct{
  54. otam_clear_t clear;
  55. otam_wcmd_op_t write_cmd;
  56. otam_wdata_op_t write_data;
  57. otam_wdata_delay_t write_data_delay;
  58. }otam_proto_meth_t;
  59. void otamProtocol_event(otap_evt_t* pev);
  60. int otamProtocol_start_ota(ota_fw_t* pffw);
  61. int otamProtocol_stop_ota(void);
  62. int otamProtocol_app_start_ota(uint8_t mode);
  63. int otamProtocol_init(otam_proto_meth_t* method);
  64. #endif