@@ -52,82 +52,97 @@ typedef struct cyw43_firmware_details {
5252} cyw43_firmware_details_t ;
5353//!\}
5454
55+ /** \brief Firmware types
56+ */
57+ typedef enum cyw43_firmare_type {
58+ CYW43_FIRMWARE_WIFI ,
59+ CYW43_FIRMWARE_NVRAM ,
60+ CYW43_FIRMWARE_CLM ,
61+ CYW43_FIRMWARE_BLUETOOTH ,
62+ } cyw43_firmare_type_t ;
63+
5564/*!
5665 * \brief Structure to hold function pointers for loading firmware
5766 */
5867//!\{
5968typedef struct cyw43_firmware_funcs {
6069 const cyw43_firmware_details_t * (* firmware_details )(void ); ///< get wifi firmware details
61- int (* start_wifi_fw )(const cyw43_firmware_details_t * fw_details ); ///< start wifi firmware loading
62- int (* start_bt_fw )(const cyw43_firmware_details_t * fw_details ); ///< start bt firmware loading
63- const uint8_t * (* get_wifi_fw )(const uint8_t * addr , size_t sz_in , uint8_t * buffer , size_t buffer_sz ); ///< get block of wifi firmware data
64- const uint8_t * (* get_bt_fw )(const uint8_t * addr , size_t sz_in , uint8_t * buffer , size_t buffer_sz ); ///< get block of bt firmware data
65- const uint8_t * (* get_nvram )(const uint8_t * addr , size_t sz_in , uint8_t * buffer , size_t buffer_sz ); ///< get block of nvram data
66- const uint8_t * (* get_clm )(const uint8_t * addr , size_t sz_in , uint8_t * buffer , size_t buffer_sz ); ///< get block of clm data
67- void (* end )(void ); ///< end firmware loading
70+ int (* start_fw_stream )(const cyw43_firmware_details_t * fw_details , cyw43_firmare_type_t which_firmware , void * * streaming_context ); ///< start fw streaming
71+ const uint8_t * (* stream_fw )(void * streaming_context , size_t sz_required , uint8_t * working_buffer ); ///< get block of firmware data
72+ void (* end_fw_stream )(void * streaming_context , cyw43_firmare_type_t which_firmware ); ///< end firmware loading
6873} cyw43_firmware_funcs_t ;
6974//!\}
7075
7176/*!
7277 * \brief Get the functions used to load firmware
7378 *
74- * This method returns pointers to functions that load firmware
79+ * Return pointers to functions that load firmware
7580 *
7681 * \return structure that contains functions that load firmware
7782 */
7883const cyw43_firmware_funcs_t * cyw43_get_firmware_funcs (void );
7984
85+ /*!
86+ * \brief Start reading wifi firmware data
87+ *
88+ * Starts the process of reading uncompressed wifi firmware
89+ *
90+ * \param fw_details Firmware details
91+ * \param which_firmware Firmware to start reading
92+ * \param streaming_context On return a pointer to the internal streaming state
93+ * \return Zero on success or else an error code
94+ */
95+
96+ int cyw43_start_uncompressed_firmware (const cyw43_firmware_details_t * fw_details , cyw43_firmare_type_t which_firmware , void * * streaming_context );
97+
8098/*!
8199 * \brief Read an uncompressed firmware data
82100 *
83- * This method reads uncompressed firmware data
101+ * Reads uncompressed firmware data
84102 *
85- * \param addr Address to start reading
86- * \param sz_in Amount data to read in bytes
103+ * \param streaming_context context created by the start function
104+ * \param sz_required Amount data to read in bytes
87105 * \param buffer Temporary buffer that can be used to read data into
88- * \param buffer_sz Size of buffer in bytes
89106 * \return Pointer to data read
90107 */
91- const uint8_t * cyw43_read_uncompressed_firmware (const uint8_t * addr , size_t sz_in , uint8_t * buffer , size_t buffer_sz );
108+ const uint8_t * cyw43_read_uncompressed_firmware (void * streaming_context , size_t sz_required , __unused uint8_t * buffer );
92109
93110/*!
94- * \brief Start reading wifi firmware data
95- *
96- * This method starts the process of reading compressed wifi firmware
111+ * \brief End reading uncompressed firmware data
97112 *
98- * \param fw Firmware details
99- * \return Zero on success or else an error code
113+ * Ends the process of reading compressed firmware and frees resources
100114 */
101- int cyw43_start_compressed_wifi_firmware ( const cyw43_firmware_details_t * fw );
115+ void cyw43_end_uncompressed_firmware ( void * streaming_context , cyw43_firmare_type_t which_firmware );
102116
103117/*!
104- * \brief Start reading bluetooth firmware data
118+ * \brief Start reading compressed wifi firmware data
105119 *
106- * This method starts the process of reading compressed bluetooth firmware
120+ * Starts the process of reading compressed wifi firmware
107121 *
108- * \param fw Firmware details
122+ * \param fw_details Firmware details
123+ * \param which_firmware Firmware to start reading
124+ * \param streaming_context On return a pointer to the internal streaming state
109125 * \return Zero on success or else an error code
110126 */
111- int cyw43_start_compressed_bt_firmware ( __unused const cyw43_firmware_details_t * fw );
127+ int cyw43_start_compressed_firmware ( const cyw43_firmware_details_t * fw_details , cyw43_firmare_type_t which_firmware , void * * streaming_context );
112128
113129/*!
114130 * \brief Read compressed firmware data
115131 *
116- * This method reads compressed firmware data
132+ * Reads compressed firmware data
117133 *
118- * \param addr Address to start reading
119- * \param sz_in Amount data to read in bytes
134+ * \param streaming_context context created by the start function
135+ * \param sz_required Amount data to read in bytes
120136 * \param buffer Temporary buffer that can be used to read data into
121- * \param buffer_sz Size of buffer in bytes
122137 * \return Pointer to data read
123138 */
124- const uint8_t * cyw43_read_compressed_firmware (const uint8_t * addr , size_t sz_in , uint8_t * buffer , size_t buffer_sz );
139+ const uint8_t * cyw43_read_compressed_firmware (void * streaming_context , size_t sz_required , uint8_t * buffer );
125140
126141/*!
127142 * \brief End reading compressed firmware data
128143 *
129- * This method ends the process of reading compressed firmware
144+ * Ends the process of reading compressed firmware and frees resources
130145 */
131- void cyw43_end_compressed_firmware (void );
146+ void cyw43_end_compressed_firmware (void * streaming_context , cyw43_firmare_type_t which_firmware );
132147
133148#endif
0 commit comments