// ******************************************************************************
//  FreeRTOS configuration
//
//  Version/Date    Comment
//   2026.05.28     - First release
// ******************************************************************************

#ifndef FREERTOS_CONFIG_H
#define FREERTOS_CONFIG_H

extern void vAssertCalled( void );

#ifdef DEBUG
  #include "utils/uartstdio.h"
  extern void UARTprintf( const char * pcFormatString, ... );
  #undef configPRINTF
  #define configPRINTF( x) UARTprintf x
#endif

#define configASSERT_DEFINED    1
#define configASSERT( x )    if( ( x ) == 0 ) vAssertCalled( )

#define configUSE_PREEMPTION                1
#define configUSE_TIME_SLICING              1

#define configUSE_IDLE_HOOK                 0
#define configUSE_TICK_HOOK                 0
#define configCPU_CLOCK_HZ                  ( ( unsigned long ) 120000000 )
#define configTICK_RATE_HZ                  ( ( TickType_t ) 1000 )
#define configMINIMAL_STACK_SIZE            ( ( unsigned short ) 200 )
// The heap size must be large enough (accept strange behaviour otherwise)
#define configTOTAL_HEAP_SIZE               ( ( size_t ) ( 128*1024 ) )
#define configMAX_TASK_NAME_LEN             ( 10 )
#define configUSE_TRACE_FACILITY            0
#define configUSE_16_BIT_TICKS              0
#define configIDLE_SHOULD_YIELD             0
#define configMAX_PRIORITIES                ( 10 )
#define configUSE_COUNTING_SEMAPHORES       1

#define configSUPPORT_STATIC_ALLOCATION     1


/* Set the following definitions to 1 to include the API function, or zero
 * to exclude the API function. */

// #define configUSE_MALLOC_FAILED_HOOK            1
#define configUSE_MUTEXES                       1
#define configUSE_RECURSIVE_MUTEXES             1
#define INCLUDE_vTaskPrioritySet                0
#define INCLUDE_uxTaskPriorityGet               0
#define INCLUDE_vTaskDelete                     1
#define INCLUDE_vTaskCleanUpResources           0
#define INCLUDE_vTaskSuspend                    1
#define INCLUDE_vTaskDelayUntil                 0
#define INCLUDE_vTaskDelay                      1



/* networking definitions */
#define configMAC_ISR_SIMULATOR_PRIORITY    ( configMAX_PRIORITIES - 2 )
#define ipconfigUSE_NETWORK_EVENT_HOOK      1
#define configNETWORK_INTERFACE_TO_USE      1L

#ifdef __NVIC_PRIO_BITS
    #define configPRIO_BITS       __NVIC_PRIO_BITS
#else
    #define configPRIO_BITS       3     /* 8 priority levels */
#endif
#define configLIBRARY_LOWEST_INTERRUPT_PRIORITY         0x07
#define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY    5
#define configKERNEL_INTERRUPT_PRIORITY         ( configLIBRARY_LOWEST_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )
#define configMAX_SYSCALL_INTERRUPT_PRIORITY    ( configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )


#endif /* FREERTOS_CONFIG_H */
