Skip to content

Commit

Permalink
add missing functions
Browse files Browse the repository at this point in the history
  • Loading branch information
avtolstoy committed Oct 22, 2021
1 parent 0ad6c18 commit f2a3e21
Show file tree
Hide file tree
Showing 14 changed files with 357 additions and 4 deletions.
4 changes: 2 additions & 2 deletions build/gcc-tools.mk
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@ CPPFLAGS += -Wno-unused-private-field
endif

ifeq ($(BUILD_STANDALONE_LIB),y)
CFLAGS += -fPIC -rdynamic
LDFLAGS += -fPIC -rdynamic
CFLAGS += -fPIC -fpic -rdynamic
LDFLAGS += -fPIC -fpic -rdynamic
endif
222 changes: 222 additions & 0 deletions hal/src/template/concurrent_hal.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,222 @@
/*
* Copyright (c) 2021 Particle Industries, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation, either
* version 3 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
*/

#include "concurrent_hal.h"

os_result_t os_thread_create(os_thread_t* thread, const char* name, os_thread_prio_t priority, os_thread_fn_t fun, void* thread_param, size_t stack_size)
{
return 0;
}

os_thread_t os_thread_current(void* reserved)
{
return nullptr;
}

bool os_thread_is_current(os_thread_t thread)
{
return false;
}

os_result_t os_thread_yield(void)
{
return 0;
}

bool os_thread_current_within_stack()
{
return true;
}

os_result_t os_thread_join(os_thread_t thread)
{
return 0;
}

os_result_t os_thread_exit(os_thread_t thread)
{
return 0;
}

os_result_t os_thread_cleanup(os_thread_t thread)
{
return 0;
}

os_result_t os_thread_delay_until(system_tick_t *previousWakeTime, system_tick_t timeIncrement)
{
return 0;
}

os_thread_notify_t os_thread_wait(system_tick_t ms, void* reserved)
{
return 0;
}

int os_thread_notify(os_thread_t thread, void* reserved)
{
return 0;
}

int os_queue_create(os_queue_t* queue, size_t item_size, size_t item_count, void*)
{
return 0;
}

int os_queue_put(os_queue_t queue, const void* item, system_tick_t delay, void*)
{
return 0;
}

int os_queue_take(os_queue_t queue, void* item, system_tick_t delay, void*)
{
return 0;
}

int os_queue_peek(os_queue_t queue, void* item, system_tick_t delay, void*)
{
return 0;
}

int os_queue_destroy(os_queue_t queue, void*)
{
return 0;
}

int os_mutex_create(os_mutex_t* mutex)
{
return 0;
}

int os_mutex_destroy(os_mutex_t mutex)
{
return 0;
}

int os_mutex_lock(os_mutex_t mutex)
{
return 0;
}

int os_mutex_trylock(os_mutex_t mutex)
{
return 0;
}

int os_mutex_unlock(os_mutex_t mutex)
{
return 0;
}

int os_mutex_recursive_create(os_mutex_recursive_t* mutex)
{
return 0;
}

int os_mutex_recursive_destroy(os_mutex_recursive_t mutex)
{
return 0;
}

int os_mutex_recursive_lock(os_mutex_recursive_t mutex)
{
return 0;
}

int os_mutex_recursive_trylock(os_mutex_recursive_t mutex)
{
return 0;
}

int os_mutex_recursive_unlock(os_mutex_recursive_t mutex)
{
return 0;
}

void os_thread_scheduling(bool enabled, void* reserved)
{
}

os_scheduler_state_t os_scheduler_get_state(void* reserved)
{
return OS_SCHEDULER_STATE_NOT_STARTED;
}

int os_semaphore_create(os_semaphore_t* semaphore, unsigned max, unsigned initial)
{
return 0;
}

int os_semaphore_destroy(os_semaphore_t semaphore)
{
return 0;
}

int os_semaphore_take(os_semaphore_t semaphore, system_tick_t timeout, bool reserved)
{
return 0;
}

int os_semaphore_give(os_semaphore_t semaphore, bool reserved)
{
return 0;
}

/**
* Create a new timer. Returns 0 on success.
*/
int os_timer_create(os_timer_t* timer, unsigned period, void (*callback)(os_timer_t timer), void* const timer_id, bool one_shot, void* reserved)
{
return 0;
}

int os_timer_get_id(os_timer_t timer, void** timer_id)
{
return 0;
}

int os_timer_set_id(os_timer_t timer, void* timer_id)
{
return 0;
}

int os_timer_change(os_timer_t timer, os_timer_change_t change, bool fromISR, unsigned period, unsigned block, void* reserved)
{
return 0;
}

int os_timer_destroy(os_timer_t timer, void* reserved)
{
return 0;
}

int os_timer_is_active(os_timer_t timer, void* reserved)
{
return 0;
}

void __flash_acquire() {
}

void __flash_release() {
}

void periph_lock() {
}

void periph_unlock() {
}
5 changes: 5 additions & 0 deletions hal/src/template/core_hal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,3 +213,8 @@ void HAL_Core_System_Reset_Ex(int reason, uint32_t data, void *reserved)
{

}

uint16_t HAL_Bootloader_Get_Flag(BootloaderFlag flag)
{
return 0;
}
22 changes: 22 additions & 0 deletions hal/src/template/device_code.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* Copyright (c) 2021 Particle Industries, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation, either
* version 3 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
*/

#include "device_code.h"

bool fetch_or_generate_setup_ssid(device_code_t* code) {
return false;
}
5 changes: 5 additions & 0 deletions hal/src/template/deviceid_hal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,8 @@ unsigned HAL_Platform_ID()
{
return PLATFORM_ID;
}

int HAL_Get_Device_Identifier(const char** name, char* buf, size_t buflen, unsigned index, void* reserved)
{
return -1;
}
5 changes: 5 additions & 0 deletions hal/src/template/gpio_hal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,8 @@ int HAL_Pin_Configure(pin_t pin, const hal_gpio_config_t* conf, void* reserved)
{
return 0;
}

uint32_t HAL_Pulse_In(pin_t pin, uint16_t value)
{
return 0;
}
15 changes: 14 additions & 1 deletion hal/src/template/ota_flash_hal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,4 +117,17 @@ bool HAL_IsDeviceClaimed(void* reserved)
int HAL_FLASH_OTA_Validate(bool userDepsOptional, module_validation_flags_t flags, void* reserved)
{
return 0;
}
}

int HAL_FLASH_ApplyPendingUpdate(bool dryRun, void* reserved)
{
return SYSTEM_ERROR_UNKNOWN;
}

void HAL_FLASH_Write_ServerAddress(const uint8_t *buf, bool udp)
{
}

void HAL_FLASH_Write_ServerPublicKey(const uint8_t *keyBuffer, bool udp)
{
}
5 changes: 5 additions & 0 deletions hal/src/template/sleep_hal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,8 @@
int hal_sleep_enter(const hal_sleep_config_t* config, hal_wakeup_source_base_t** wakeup_source, void* reserved) {
return SYSTEM_ERROR_NOT_SUPPORTED;
}

int hal_sleep_validate_config(const hal_sleep_config_t* config, void* reserved) {
return 0;
}

10 changes: 10 additions & 0 deletions hal/src/template/socket_hal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,3 +132,13 @@ sock_result_t socket_peer(sock_handle_t sd, sock_peer_t* peer, void* reserved)
{
return -1;
}

sock_result_t socket_create_tcp_server(uint16_t port, network_interface_t nif)
{
return -1;
}

sock_result_t socket_receivefrom_ex(sock_handle_t sd, void* buffer, socklen_t len, uint32_t flags, sockaddr_t* address, socklen_t* addr_size, system_tick_t timeout, void* reserved)
{
return -1;
}
2 changes: 1 addition & 1 deletion hal/src/template/spi_hal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ bool hal_spi_is_enabled(hal_spi_interface_t spi)
return false;
}

void hal_spi_transfer_dma(hal_spi_interface_t spi, void* tx_buffer, void* rx_buffer, uint32_t length, hal_spi_dma_user_callback userCallback)
void hal_spi_transfer_dma(hal_spi_interface_t spi, const void* tx_buffer, void* rx_buffer, uint32_t length, hal_spi_dma_user_callback userCallback)
{
}

Expand Down
16 changes: 16 additions & 0 deletions hal/src/template/system_interrupts.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@

#include "interrupts_hal.h"

uint8_t HAL_Set_System_Interrupt_Handler(hal_irq_t irq, const HAL_InterruptCallback* callback, HAL_InterruptCallback* previous, void* reserved)
{
return false;
}

uint8_t HAL_Get_System_Interrupt_Handler(hal_irq_t irq, HAL_InterruptCallback* callback, void* reserved)
{
return false;
}

void HAL_System_Interrupt_Trigger(hal_irq_t irq, void* reserved)
{
}
14 changes: 14 additions & 0 deletions hal/src/template/usart_hal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,17 @@ int hal_usart_sleep(hal_usart_interface_t serial, bool sleep, void* reserved)
void hal_usart_begin_config(hal_usart_interface_t serial, uint32_t baud, uint32_t config, void *ptr)
{
}

uint32_t hal_usart_write_nine_bits(hal_usart_interface_t serial, uint16_t data)
{
return 0;
}

uint8_t hal_usart_break_detected(hal_usart_interface_t serial)
{
return 0;
}

void hal_usart_send_break(hal_usart_interface_t serial, void* reserved)
{
}
10 changes: 10 additions & 0 deletions hal/src/template/wlan_hal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,3 +188,13 @@ int wlan_set_hostname(const char* hostname, void* reserved)
// Unsupported
return -1;
}

int wlan_select_antenna(WLanSelectAntenna_TypeDef antenna)
{
return 0;
}

int wlan_get_credentials(wlan_scan_result_t callback, void* callback_data)
{
return -1;
}
Loading

0 comments on commit f2a3e21

Please sign in to comment.