Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .github/workflows/uncrustify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Uncrustify

on: [ push, pull_request ]

jobs:
uncrustify:
runs-on: ubuntu-slim
steps:
- name: Checkout
uses: actions/checkout@v6

- name: Install uncrustify
run: |
sudo apt-get update
sudo apt-get install -y uncrustify

- name: Check formatting
run: find . -iname "*.[hc]" -type f -exec uncrustify --check -c uncrustify.cfg -l C {} +
2 changes: 1 addition & 1 deletion include/arch/pico_arm9.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ static inline unsigned long PICO_TIME_MS(void)
static inline void PICO_IDLE(void)
{
unsigned long tick_now = __str9_tick;
while(tick_now == __str9_tick) ;
while (tick_now == __str9_tick);
}

4 changes: 2 additions & 2 deletions include/arch/pico_atsamd21j18.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ static inline void sam_dbg(const char *format, ...)
print_uart(msg);
}

//#define dbg sam_dbg
/*#define dbg sam_dbg */
#define dbg(...) do { } while(0)

extern volatile uint32_t sam_tick;
Expand All @@ -56,6 +56,6 @@ static inline unsigned long PICO_TIME_MS(void)
static inline void PICO_IDLE(void)
{
unsigned long tick_now = sam_tick;
while(tick_now == sam_tick) ;
while (tick_now == sam_tick);
}

2 changes: 1 addition & 1 deletion include/arch/pico_avr.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@ static inline unsigned long PICO_TIME_MS(void)
static inline void PICO_IDLE(void)
{
unsigned long tick_now = __avr_tick;
while(tick_now == __avr_tick) ;
while (tick_now == __avr_tick);
}

7 changes: 3 additions & 4 deletions include/arch/pico_cortex_m.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@
See COPYING, LICENSE.GPLv2 and LICENSE.GPLv3 for usage.

*********************************************************************/
#ifndef _INCLUDE_PICO_CORTEX_M
#define _INCLUDE_PICO_CORTEX_M
#ifndef INCLUDE_PICO_CORTEX_M
#define INCLUDE_PICO_CORTEX_M

#include "pico_generic_gcc.h"

#endif /* PICO_CORTEX_M */

#endif /* INCLUDE_PICO_CORTEX_M */
10 changes: 5 additions & 5 deletions include/arch/pico_esp8266.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
See COPYING, LICENSE.GPLv2 and LICENSE.GPLv3 for usage.

*********************************************************************/
#ifndef _INCLUDE_PICO_ESP8266
#define _INCLUDE_PICO_ESP8266
#ifndef INCLUDE_PICO_ESP8266
#define INCLUDE_PICO_ESP8266

#include <stdio.h>

Expand All @@ -19,16 +19,16 @@
#define dbg printf

/* -------------- MEMORY ------------- */
extern void *pvPortMalloc( size_t xWantedSize );
extern void vPortFree( void *pv );
extern void *pvPortMalloc(size_t xWantedSize);
extern void vPortFree(void *pv);

#define pico_free vPortFree

static inline void *pico_zalloc(size_t size)
{
void *ptr = (void *)pvPortMalloc(size);

if(ptr)
if (ptr)
memset(ptr, 0u, size);

return ptr;
Expand Down
29 changes: 14 additions & 15 deletions include/arch/pico_generic_gcc.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
See COPYING, LICENSE.GPLv2 and LICENSE.GPLv3 for usage.

*********************************************************************/
#ifndef _INCLUDE_PICO_GCC
#define _INCLUDE_PICO_GCC
#ifndef INCLUDE_PICO_GCC
#define INCLUDE_PICO_GCC

#include <stdint.h>
#include <stdlib.h>
Expand All @@ -29,8 +29,8 @@ extern volatile unsigned int pico_ms_tick;
extern void *pico_mutex_init(void);
extern void pico_mutex_lock(void*);
extern void pico_mutex_unlock(void*);
extern void *pvPortMalloc( size_t xSize );
extern void vPortFree( void *pv );
extern void *pvPortMalloc(size_t xSize);
extern void vPortFree(void *pv);

#define pico_free(x) vPortFree(x)
#define free(x) vPortFree(x)
Expand All @@ -39,7 +39,7 @@ static inline void *pico_zalloc(size_t size)
{
void *ptr = pvPortMalloc(size);

if(ptr)
if (ptr)
memset(ptr, 0u, size);

return ptr;
Expand All @@ -53,25 +53,25 @@ extern int32_t prescale_time;
static inline pico_time PICO_TIME_MS()
{
#ifdef TIME_PRESCALE
return pico_ms_tick << prescale_time;
return pico_ms_tick << prescale_time;
#else
return pico_ms_tick;
return pico_ms_tick;
#endif
}

static inline pico_time PICO_TIME()
{
#ifdef TIME_PRESCALE
return (pico_ms_tick / 1000) << prescale_time;
return (pico_ms_tick / 1000) << prescale_time;
#else
return (pico_ms_tick / 1000);
return (pico_ms_tick / 1000);
#endif
}

static inline void PICO_IDLE(void)
{
pico_time now = PICO_TIME_MS();
while(now == PICO_TIME_MS()) ;
while (now == PICO_TIME_MS());
}

#else /* NO RTOS SUPPORT */
Expand All @@ -88,7 +88,7 @@ extern void memmeas_free(void *);
static inline void *pico_zalloc(size_t size)
{
void *ptr = malloc(size);
if(ptr)
if (ptr)
memset(ptr, 0u, size);

return ptr;
Expand All @@ -108,10 +108,9 @@ static inline pico_time PICO_TIME(void)
static inline void PICO_IDLE(void)
{
unsigned int now = pico_ms_tick;
while(now == pico_ms_tick) ;
while (now == pico_ms_tick);
}

#endif /* IFNDEF RTOS */

#endif /* PICO_GCC */
#endif /* PICO_SUPPORT_RTOS */

#endif /* INCLUDE_PICO_GCC */
8 changes: 4 additions & 4 deletions include/arch/pico_mbed.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
#define dbg(...)

/*
#define MEMORY_MEASURE
#define JENKINS_DEBUG
#define MEMORY_MEASURE
#define JENKINS_DEBUG
*/

/* Intended for Mr. Jenkins endurance test loggings */
Expand Down Expand Up @@ -80,7 +80,7 @@ static inline void *pico_zalloc(int x)
#ifdef JENKINS_DEBUG
if (!stats) {
jenkins_dbg(">> OUT OF MEM\n");
while(1) ;
while (1);
;
}

Expand All @@ -106,7 +106,7 @@ static inline void pico_free(void *x)
#ifdef MEMORY_MEASURE_ADV
if ((stats->signature != 0xdeadbeef) || (x != stats->mem)) {
jenkins_dbg(">> FREE ERROR: caller is %p\n", __builtin_return_address(0));
while(1) ;
while (1);
;
}

Expand Down
6 changes: 3 additions & 3 deletions include/arch/pico_msp430.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
See COPYING, LICENSE.GPLv2 and LICENSE.GPLv3 for usage.

*********************************************************************/
#ifndef _INCLUDE_PICO_LPC
#define _INCLUDE_PICO_LPC
#ifndef INCLUDE_PICO_LPC
#define INCLUDE_PICO_LPC

#include <stdint.h>
#include <stdlib.h>
Expand All @@ -27,7 +27,7 @@ static inline void *pico_zalloc(size_t size)
{
void *ptr = malloc(size);

if(ptr)
if (ptr)
memset(ptr, 0u, size);

return ptr;
Expand Down
1 change: 0 additions & 1 deletion include/arch/pico_none.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,3 @@
#define PICO_IDLE() do {} while(0)

#endif /* PICO_SUPPORT_ARCHNONE */

10 changes: 5 additions & 5 deletions include/arch/pico_pic24.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
#endif

/*
#ifndef __PIC24FJ256GA106__
#define __PIC24FJ256GA106__
#endif
#ifndef __PIC24FJ256GA106__
#define __PIC24FJ256GA106__
#endif
*/

#ifndef PICO_MAX_SOCKET_FRAMES
Expand Down Expand Up @@ -59,7 +59,7 @@ static inline void pico_free(void *tgt)
# define pico_free(x) free(x)
#endif

extern void *pvPortMalloc( size_t xWantedSize );
extern void *pvPortMalloc(size_t xWantedSize);
extern volatile pico_time __pic24_tick;

static inline unsigned long PICO_TIME(void)
Expand Down Expand Up @@ -94,7 +94,7 @@ static inline void PICO_IDLE(void)
TIMBASE_INT_E = 1;
/* Doesn't matter that this call isn't interrupt safe, */
/* we just check for the value to change */
while(tick_now == __pic24_tick) ;
while (tick_now == __pic24_tick);
}

#endif
11 changes: 5 additions & 6 deletions include/arch/pico_pic32.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
See COPYING, LICENSE.GPLv2 and LICENSE.GPLv3 for usage.

*********************************************************************/
#ifndef _INCLUDE_PICO_PIC32
#define _INCLUDE_PICO_PIC32
#ifndef INCLUDE_PICO_PIC32
#define INCLUDE_PICO_PIC32

#include <stdint.h>
#include <stdlib.h>
Expand All @@ -28,7 +28,7 @@ extern volatile unsigned int pico_ms_tick;
static inline void *pico_zalloc(size_t size)
{
void *ptr = malloc(size);
if(ptr)
if (ptr)
memset(ptr, 0u, size);

return ptr;
Expand All @@ -47,8 +47,7 @@ static inline pico_time PICO_TIME(void)
static inline void PICO_IDLE(void)
{
unsigned int now = pico_ms_tick;
while(now == pico_ms_tick) ;
while (now == pico_ms_tick);
}

#endif /* PICO_PIC32 */

#endif /* INCLUDE_PICO_PIC32 */
15 changes: 7 additions & 8 deletions include/arch/pico_posix.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
#include <sys/time.h>

/*
#define MEMORY_MEASURE
#define TIME_PRESCALE
#define PICO_SUPPORT_THREADING
#define MEMORY_MEASURE
#define TIME_PRESCALE
#define PICO_SUPPORT_THREADING
*/

/* uncomment for debugging */
Expand Down Expand Up @@ -71,18 +71,18 @@ extern volatile uint32_t pico_ms_tick;
static inline uint32_t PICO_TIME(void)
{
#ifdef TIME_PRESCALE
return (pico_ms_tick / 1000) << prescale_time;
return (pico_ms_tick / 1000) << prescale_time;
#else
return (pico_ms_tick / 1000);
return (pico_ms_tick / 1000);
#endif
}

static inline uint32_t PICO_TIME_MS(void)
{
#ifdef TIME_PRESCALE
return pico_ms_tick << prescale_time;
return pico_ms_tick << prescale_time;
#else
return pico_ms_tick;
return pico_ms_tick;
#endif
}

Expand Down Expand Up @@ -140,4 +140,3 @@ static inline void PICO_IDLE(void)
}

#endif /* PICO_SUPPORT_POSIX */

4 changes: 2 additions & 2 deletions include/heap.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/*********************************************************************
* PicoTCP-NG
* PicoTCP-NG
* Copyright (c) 2020 Daniele Lacamera <root@danielinux.net>
*
* This file also includes code from:
* PicoTCP
* Copyright (c) 2012-2017 Altran Intelligent Systems
*
*
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
*
* PicoTCP-NG is free software; you can redistribute it and/or modify
Expand Down
4 changes: 2 additions & 2 deletions include/pico_addressing.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ PACKED_STRUCT_DEF pico_6lowpan_ext
PACKED_STRUCT_DEF pico_ll {
uint16_t proto;
uint16_t hatype;
uint8_t pktype;
uint8_t halen;
uint8_t pktype;
uint8_t halen;
struct pico_eth hwaddr;
struct pico_device *dev;
};
Expand Down
4 changes: 2 additions & 2 deletions include/pico_config.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/*********************************************************************
* PicoTCP-NG
* PicoTCP-NG
* Copyright (c) 2020 Daniele Lacamera <root@danielinux.net>
*
* This file also includes code from:
* PicoTCP
* Copyright (c) 2012-2017 Altran Intelligent Systems
*
*
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
*
* PicoTCP-NG is free software; you can redistribute it and/or modify
Expand Down
Loading
Loading