Revert Portable/WizC Formatting (#888)

* Revert formatting on WizC ports

* Fix spelling mistakes

---------

Co-authored-by: Rahul Kar <118818625+kar-rahul-aws@users.noreply.github.com>
Co-authored-by: Gaurav-Aggarwal-AWS <33462878+aggarg@users.noreply.github.com>
This commit is contained in:
Soren Ptak 2023-11-23 04:04:07 -08:00 committed by GitHub
parent b3febb7416
commit cb196ddbb1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 396 additions and 401 deletions

View file

@ -27,22 +27,22 @@
*/
/*
* Changes from V3.0.0
Changes from V3.0.0
+ ISRcode is pulled inline and portTICKisr() is therefore
+ deleted from this file.
+
deleted from this file.
+ Prescaler logic for Timer1 added to allow for a wider
+ range of TickRates.
+
+ Changes from V3.0.1
*/
range of TickRates.
Changes from V3.0.1
*/
#include <FreeRTOS.h>
#include <task.h>
/* IO port constants. */
#define portBIT_SET ( 1 )
#define portBIT_CLEAR ( 0 )
#define portBIT_SET (1)
#define portBIT_CLEAR (0)
/*
* Hardware setup for the tick.
@ -50,27 +50,27 @@
* and requested tickrate, a prescaled value with a matching
* prescaler are determined.
*/
#define portTIMER_COMPARE_BASE ( ( APROCFREQ / 4 ) / configTICK_RATE_HZ )
#define portTIMER_COMPARE_BASE ((APROCFREQ/4)/configTICK_RATE_HZ)
#if portTIMER_COMPARE_BASE < 0x10000
#define portTIMER_COMPARE_VALUE ( portTIMER_COMPARE_BASE )
#define portTIMER_COMPARE_PS1 ( portBIT_CLEAR )
#define portTIMER_COMPARE_PS0 ( portBIT_CLEAR )
#define portTIMER_COMPARE_VALUE (portTIMER_COMPARE_BASE)
#define portTIMER_COMPARE_PS1 (portBIT_CLEAR)
#define portTIMER_COMPARE_PS0 (portBIT_CLEAR)
#elif portTIMER_COMPARE_BASE < 0x20000
#define portTIMER_COMPARE_VALUE ( portTIMER_COMPARE_BASE / 2 )
#define portTIMER_COMPARE_PS1 ( portBIT_CLEAR )
#define portTIMER_COMPARE_PS0 ( portBIT_SET )
#define portTIMER_COMPARE_VALUE (portTIMER_COMPARE_BASE / 2)
#define portTIMER_COMPARE_PS1 (portBIT_CLEAR)
#define portTIMER_COMPARE_PS0 (portBIT_SET)
#elif portTIMER_COMPARE_BASE < 0x40000
#define portTIMER_COMPARE_VALUE ( portTIMER_COMPARE_BASE / 4 )
#define portTIMER_COMPARE_PS1 ( portBIT_SET )
#define portTIMER_COMPARE_PS0 ( portBIT_CLEAR )
#define portTIMER_COMPARE_VALUE (portTIMER_COMPARE_BASE / 4)
#define portTIMER_COMPARE_PS1 (portBIT_SET)
#define portTIMER_COMPARE_PS0 (portBIT_CLEAR)
#elif portTIMER_COMPARE_BASE < 0x80000
#define portTIMER_COMPARE_VALUE ( portTIMER_COMPARE_BASE / 8 )
#define portTIMER_COMPARE_PS1 ( portBIT_SET )
#define portTIMER_COMPARE_PS0 ( portBIT_SET )
#else /* if portTIMER_COMPARE_BASE < 0x10000 */
#define portTIMER_COMPARE_VALUE (portTIMER_COMPARE_BASE / 8)
#define portTIMER_COMPARE_PS1 (portBIT_SET)
#define portTIMER_COMPARE_PS0 (portBIT_SET)
#else
#error "TickRate out of range"
#endif /* if portTIMER_COMPARE_BASE < 0x10000 */
#endif
/*-----------------------------------------------------------*/
@ -128,12 +128,12 @@ void portSetupTick( void )
/*
* Setup the timer
*/
bRD16 = portBIT_SET; /* 16-bit */
bT1CKPS1 = portTIMER_COMPARE_PS1; /* prescaler */
bT1CKPS0 = portTIMER_COMPARE_PS0; /* prescaler */
bT1OSCEN = portBIT_SET; /* Oscillator enable */
bT1SYNC = portBIT_SET; /* No external clock sync */
bTMR1CS = portBIT_CLEAR; /* Internal clock */
bRD16 = portBIT_SET; // 16-bit
bT1CKPS1 = portTIMER_COMPARE_PS1; // prescaler
bT1CKPS0 = portTIMER_COMPARE_PS0; // prescaler
bT1OSCEN = portBIT_SET; // Oscillator enable
bT1SYNC = portBIT_SET; // No external clock sync
bTMR1CS = portBIT_CLEAR; // Internal clock
bTMR1ON = portBIT_SET; /* Start timer1 */
bTMR1ON = portBIT_SET; // Start timer1
}

View file

@ -27,17 +27,17 @@
*/
/*
* Changes from V3.0.0
Changes from V3.0.0
+ ISRcode pulled inline to reduce stack-usage.
+
+ Added functionality to only call vTaskSwitchContext() once
+ when handling multiple interruptsources in a single interruptcall.
+
when handling multiple interruptsources in a single interruptcall.
+ Filename changed to a .c extension to allow stepping through code
+ using F7.
+
+ Changes from V3.0.1
*/
using F7.
Changes from V3.0.1
*/
/*
* ISR for the tick.

View file

@ -27,13 +27,13 @@
*/
/*
* Changes from V3.0.0
*
* Changes from V3.0.1
*
* Changes from V4.0.1
* Uselib pragma added for Croutine.c
*/
Changes from V3.0.0
Changes from V3.0.1
Changes from V4.0.1
Uselib pragma added for Croutine.c
*/
/*
* The installation script will automatically prepend this file to the default FreeRTOS.h.

View file

@ -27,19 +27,19 @@
*/
/*
* Changes from V3.2.1
Changes from V3.2.1
+ CallReturn Depth increased from 8 to 10 levels to accommodate wizC/fedC V12.
+
+ Changes from V3.2.0
Changes from V3.2.0
+ TBLPTRU is now initialised to zero during the initial stack creation of a new task. This solves
+ an error on devices with more than 64kB ROM.
+
+ Changes from V3.0.0
an error on devices with more than 64kB ROM.
Changes from V3.0.0
+ ucCriticalNesting is now initialised to 0x7F to prevent interrupts from being
+ handled before the scheduler is started.
+
+ Changes from V3.0.1
*/
handled before the scheduler is started.
Changes from V3.0.1
*/
/* Scheduler include files. */
#include <FreeRTOS.h>
@ -106,20 +106,16 @@ register uint8_t ucCriticalNesting = 0x7F;
* Initialise the stack of a new task.
* See portSAVE_CONTEXT macro for description.
*/
StackType_t * pxPortInitialiseStack( StackType_t * pxTopOfStack,
TaskFunction_t pxCode,
void * pvParameters )
StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, TaskFunction_t pxCode, void *pvParameters )
{
uint8_t ucScratch;
uint8_t ucScratch;
/*
* Get the size of the RAMarea in page 0 used by the compiler
* We do this here already to avoid W-register conflicts.
*/
_Pragma("asm")
movlw OVERHEADPAGE0 - LOCOPTSIZE + MAXLOCOPTSIZE
movwf PRODL, ACCESS;
PRODL is used as temp register
movlw OVERHEADPAGE0-LOCOPTSIZE+MAXLOCOPTSIZE
movwf PRODL,ACCESS ; PRODL is used as temp register
_Pragma("asmend")
ucScratch = PRODL;
@ -127,9 +123,9 @@ StackType_t * pxPortInitialiseStack( StackType_t * pxTopOfStack,
* Place a few bytes of known values on the bottom of the stack.
* This is just useful for debugging.
*/
/* *pxTopOfStack-- = 0x11; */
/* *pxTopOfStack-- = 0x22; */
/* *pxTopOfStack-- = 0x33; */
// *pxTopOfStack-- = 0x11;
// *pxTopOfStack-- = 0x22;
// *pxTopOfStack-- = 0x33;
/*
* Simulate how the stack would look after a call to vPortYield()
@ -140,7 +136,7 @@ StackType_t * pxPortInitialiseStack( StackType_t * pxTopOfStack,
* First store the function parameters. This is where the task expects
* to find them when it starts running.
*/
*pxTopOfStack-- = ( StackType_t ) ( ( ( uint16_t ) pvParameters >> 8 ) & 0x00ff );
*pxTopOfStack-- = ( StackType_t ) ( (( uint16_t ) pvParameters >> 8) & 0x00ff );
*pxTopOfStack-- = ( StackType_t ) ( ( uint16_t ) pvParameters & 0x00ff );
/*
@ -156,20 +152,20 @@ StackType_t * pxPortInitialiseStack( StackType_t * pxTopOfStack,
*pxTopOfStack-- = ( StackType_t ) 0x88; /* FSR1H. */
*pxTopOfStack-- = ( StackType_t ) 0x99; /* FSR1L. */
*pxTopOfStack-- = ( StackType_t ) 0xAA; /* TABLAT. */
#if _ROMSIZE > 0x8000
#if _ROMSIZE > 0x8000
*pxTopOfStack-- = ( StackType_t ) 0x00; /* TBLPTRU. */
#endif
#endif
*pxTopOfStack-- = ( StackType_t ) 0xCC; /* TBLPTRH. */
*pxTopOfStack-- = ( StackType_t ) 0xDD; /* TBLPTRL. */
#if _ROMSIZE > 0x8000
#if _ROMSIZE > 0x8000
*pxTopOfStack-- = ( StackType_t ) 0xEE; /* PCLATU. */
#endif
#endif
*pxTopOfStack-- = ( StackType_t ) 0xFF; /* PCLATH. */
/*
* Next the compiler's scratchspace.
*/
while( ucScratch-- > 0 )
while(ucScratch-- > 0)
{
*pxTopOfStack-- = ( StackType_t ) 0;
}
@ -180,9 +176,9 @@ StackType_t * pxPortInitialiseStack( StackType_t * pxTopOfStack,
* stack, too. TOSU is always written as zero here because wizC does not allow
* functionpointers to point above 64kB in ROM.
*/
#if _ROMSIZE > 0x8000
#if _ROMSIZE > 0x8000
*pxTopOfStack-- = ( StackType_t ) 0;
#endif
#endif
*pxTopOfStack-- = ( StackType_t ) ( ( ( uint16_t ) pxCode >> 8 ) & 0x00ff );
*pxTopOfStack-- = ( StackType_t ) ( ( uint16_t ) pxCode & 0x00ff );
@ -211,9 +207,9 @@ uint16_t usPortCALCULATE_MINIMAL_STACK_SIZE( void )
* Fetch the size of compiler's scratchspace.
*/
_Pragma("asm")
movlw OVERHEADPAGE0 - LOCOPTSIZE + MAXLOCOPTSIZE
movlb usCalcMinStackSize >> 8
movwf usCalcMinStackSize, BANKED
movlw OVERHEADPAGE0-LOCOPTSIZE+MAXLOCOPTSIZE
movlb usCalcMinStackSize>>8
movwf usCalcMinStackSize,BANKED
_Pragma("asmend")
/*
@ -223,7 +219,7 @@ uint16_t usPortCALCULATE_MINIMAL_STACK_SIZE( void )
+ ( portSTACK_MINIMAL_CALLRETURN_DEPTH * portSTACK_CALLRETURN_ENTRY_SIZE )
+ ( portSTACK_OTHER_BYTES );
return( usCalcMinStackSize );
return(usCalcMinStackSize);
}
/*-----------------------------------------------------------*/
@ -286,11 +282,11 @@ void vPortYield( void )
}
/*-----------------------------------------------------------*/
#if ( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
#if( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
void * pvPortMalloc( uint16_t usWantedSize )
void *pvPortMalloc( uint16_t usWantedSize )
{
void * pvReturn;
void *pvReturn;
vTaskSuspendAll();
{
@ -305,9 +301,9 @@ void vPortYield( void )
/*-----------------------------------------------------------*/
#if ( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
#if( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
void vPortFree( void * pv )
void vPortFree( void *pv )
{
if( pv )
{

View file

@ -27,18 +27,18 @@
*/
/*
* Changes from V3.0.0
*
* Changes from V3.0.1
*/
Changes from V3.0.0
Changes from V3.0.1
*/
#ifndef PORTMACRO_H
#define PORTMACRO_H
#if !defined( _SERIES ) || _SERIES != 18
#if !defined(_SERIES) || _SERIES != 18
#error "WizC supports FreeRTOS on the Microchip PIC18-series only"
#endif
#if !defined( QUICKCALL ) || QUICKCALL != 1
#if !defined(QUICKCALL) || QUICKCALL != 1
#error "QuickCall must be enabled (see ProjectOptions/Optimisations)"
#endif
@ -58,7 +58,7 @@ typedef signed char BaseType_t;
typedef unsigned char UBaseType_t;
#if ( configTICK_TYPE_WIDTH_IN_BITS == TICK_TYPE_WIDTH_16_BITS )
#if( configTICK_TYPE_WIDTH_IN_BITS == TICK_TYPE_WIDTH_16_BITS )
typedef uint16_t TickType_t;
#define portMAX_DELAY ( TickType_t ) ( 0xFFFF )
#elif ( configTICK_TYPE_WIDTH_IN_BITS == TICK_TYPE_WIDTH_32_BITS )
@ -76,18 +76,18 @@ typedef unsigned char UBaseType_t;
* Constant used for context switch macro when we require the interrupt
* enable state to be forced when the interrupted task is switched back in.
*/
#define portINTERRUPTS_FORCED ( 0x01 )
#define portINTERRUPTS_FORCED (0x01)
/*
* Constant used for context switch macro when we require the interrupt
* enable state to be unchanged when the interrupted task is switched back in.
*/
#define portINTERRUPTS_UNCHANGED ( 0x00 )
#define portINTERRUPTS_UNCHANGED (0x00)
/* Initial interrupt enable state for newly created tasks. This value is
* used when a task switches in for the first time.
*/
#define portINTERRUPTS_INITIAL_STATE ( portINTERRUPTS_FORCED )
#define portINTERRUPTS_INITIAL_STATE (portINTERRUPTS_FORCED)
/*
* Macros to modify the global interrupt enable bit in INTCON.
@ -95,14 +95,14 @@ typedef unsigned char UBaseType_t;
#define portDISABLE_INTERRUPTS() \
do \
{ \
bGIE = 0; \
} while( bGIE ) /* MicroChip recommends this check! */
bGIE=0; \
} while(bGIE) // MicroChip recommends this check!
#define portENABLE_INTERRUPTS() \
do \
{ \
bGIE = 1; \
} while( 0 )
bGIE=1; \
} while(0)
/*-----------------------------------------------------------*/
@ -125,12 +125,12 @@ extern uint8_t ucCriticalNesting;
* many times portENTER_CRITICAL() has been called. \
*/ \
ucCriticalNesting++; \
} while( 0 )
} while(0)
#define portEXIT_CRITICAL() \
do \
{ \
if( ucCriticalNesting > portNO_CRITICAL_SECTION_NESTING ) \
if(ucCriticalNesting > portNO_CRITICAL_SECTION_NESTING) \
{ \
/* \
* Decrement the nesting count as we are leaving a \
@ -147,7 +147,7 @@ extern uint8_t ucCriticalNesting;
{ \
portENABLE_INTERRUPTS(); \
} \
} while( 0 )
} while(0)
/*-----------------------------------------------------------*/
@ -160,7 +160,7 @@ extern uint16_t usPortCALCULATE_MINIMAL_STACK_SIZE( void );
extern uint16_t usCalcMinStackSize;
#define portMINIMAL_STACK_SIZE \
( ( usCalcMinStackSize == 0 ) \
((usCalcMinStackSize == 0) \
? usPortCALCULATE_MINIMAL_STACK_SIZE() \
: usCalcMinStackSize )
@ -318,7 +318,7 @@ extern uint16_t usCalcMinStackSize;
; and store them on the hardwarestack. \
; The datasheets say we can't use movff here... \
; \
movff PREINC2,PRODL /* Use PRODL as tempregister */ \
movff PREINC2,PRODL // Use PRODL as tempregister \
clrf STKPTR,ACCESS \
_rtos_R1: \
push \
@ -405,15 +405,14 @@ extern uint16_t usCalcMinStackSize;
extern void vPortYield( void );
#define portYIELD() vPortYield()
#define portNOP() \
_Pragma("asm") \
#define portNOP() _Pragma("asm") \
nop \
_Pragma("asmend")
/*-----------------------------------------------------------*/
#define portTASK_FUNCTION( xFunction, pvParameters ) \
void pointed xFunction( void * pvParameters ) \
void pointed xFunction( void *pvParameters ) \
_Pragma(asmfunc xFunction)
#define portTASK_FUNCTION_PROTO portTASK_FUNCTION