Skip to content

Commit

Permalink
tests/debug_print: Add new test to test building with debug enabled.
Browse files Browse the repository at this point in the history
Signed-off-by: Damien George <dpgeorge@georgerobotics.com.au>
  • Loading branch information
Damien George committed Oct 3, 2023
1 parent 2ae383b commit 2ab0db6
Show file tree
Hide file tree
Showing 5 changed files with 1,257 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tests/debug_print/Makefile
@@ -0,0 +1,5 @@
SRC += \
main.c \
../mock_sdio.c \

include ../test_common.mk
78 changes: 78 additions & 0 deletions tests/debug_print/cyw43_configport.h
@@ -0,0 +1,78 @@
#ifndef CYW43_INCLUDED_CONFIGPORT_H
#define CYW43_INCLUDED_CONFIGPORT_H

#include <stdint.h>

#define MIN(a, b) ((a) <= (b) ? (a) : (b))
#define static_assert(expr, msg) typedef int static_assert_##__LINE__[(expr) ? 1 : -1]
#define CYW43_ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))

#define CYW43_USE_SPI (0)
#define CYW43_LWIP (0)

#define CYW43_VERBOSE_DEBUG (1)
#define CYW43_VDEBUG(...) printf(__VA_ARGS__)
#define CYW43_DEBUG(...) printf(__VA_ARGS__)
#define CYW43_DEBUG(...) printf(__VA_ARGS__)
#define CYW43_INFO(...) printf(__VA_ARGS__)
#define CYW43_WARN(...) printf(__VA_ARGS__)

#define CYW43_PIN_WL_REG_ON (1)
#define CYW43_PIN_WL_RFSW_VDD (2)
#define CYW43_PIN_WL_SDIO_1 (3)
#define CYW43_PIN_WL_HOST_WAKE (4)

#define CYW43_EPERM (1)
#define CYW43_EIO (5)
#define CYW43_EINVAL (22)
#define CYW43_ETIMEDOUT (110)

#define CYW43_THREAD_ENTER do { } while (0)
#define CYW43_THREAD_EXIT do { } while (0)
#define CYW43_THREAD_LOCK_CHECK do { } while (0)

#define CYW43_SDPCM_SEND_COMMON_WAIT do { } while (0)
#define CYW43_DO_IOCTL_WAIT do { } while (0)

#define CYW43_HAL_PIN_MODE_INPUT (0)
#define CYW43_HAL_PIN_MODE_OUTPUT (1)
#define CYW43_HAL_PIN_PULL_NONE (0)
#define CYW43_HAL_MAC_WLAN0 (0)

static inline unsigned int cyw43_hal_ticks_us(void) {
return 0;
}

static inline unsigned int cyw43_hal_ticks_ms(void) {
return 0;
}

static inline void cyw43_delay_us(unsigned int us) {
}

static inline void cyw43_delay_ms(unsigned int ms) {
}

static inline void cyw43_hal_get_mac(int interface, uint8_t mac[6]) {
}

static inline void cyw43_hal_pin_config(int pin, int mode, int pull, int alt) {
}

static inline void cyw43_hal_pin_config_irq_falling(int pin, int enable) {
}

static inline int cyw43_hal_pin_read(int pin) {
return 0;
}

static inline void cyw43_hal_pin_low(int pin) {
}

static inline void cyw43_hal_pin_high(int pin) {
}

static inline void cyw43_schedule_internal_poll_dispatch(void (*func)(void)) {
}

#endif // CYW43_INCLUDED_CONFIGPORT_H
34 changes: 34 additions & 0 deletions tests/debug_print/main.c
@@ -0,0 +1,34 @@
#include "src/cyw43.h"
#include "src/cyw43_country.h"

struct pbuf;

uint16_t pbuf_copy_partial(const struct pbuf *p, void *dataptr, uint16_t len, uint16_t offset) {
return 0;
}

void cyw43_cb_tcpip_init(cyw43_t *self, int itf) {
}

void cyw43_cb_tcpip_deinit(cyw43_t *self, int itf) {
}

void cyw43_cb_tcpip_set_link_up(cyw43_t *self, int itf) {
}

void cyw43_cb_tcpip_set_link_down(cyw43_t *self, int itf) {
}

void cyw43_cb_process_ethernet(void *cb_data, int itf, size_t len, const uint8_t *buf) {
}

uint32_t storage_read_blocks(uint8_t *dest, uint32_t block_num, uint32_t num_blocks) {
return 0;
}

int main(int argc, char **argv) {
cyw43_init(&cyw43_state);
cyw43_wifi_set_up(&cyw43_state, CYW43_ITF_STA, true, CYW43_COUNTRY_WORLDWIDE);
cyw43_deinit(&cyw43_state);
return 0;
}

0 comments on commit 2ab0db6

Please sign in to comment.