Skip to content

Commit ac7fc39

Browse files
authored
Revert Portable/BCC formatting (#828)
Revert Portable/BCC formatting
1 parent bcf7bda commit ac7fc39

File tree

6 files changed

+225
-241
lines changed

6 files changed

+225
-241
lines changed

portable/BCC/16BitDOS/Flsh186/port.c

Lines changed: 50 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -27,22 +27,22 @@
2727
*/
2828

2929
/*
30-
* Changes from V1.00:
31-
*
32-
+ Call to taskYIELD() from within tick ISR has been replaced by the more
33-
+ efficient portSWITCH_CONTEXT().
34-
+ ISR function definitions renamed to include the prv prefix.
35-
+
36-
+ Changes from V2.6.1
37-
+
38-
+ Replaced the sUsingPreemption variable with the configUSE_PREEMPTION
39-
+ macro to be consistent with the later ports.
40-
*/
30+
Changes from V1.00:
31+
32+
+ Call to taskYIELD() from within tick ISR has been replaced by the more
33+
efficient portSWITCH_CONTEXT().
34+
+ ISR function definitions renamed to include the prv prefix.
35+
36+
Changes from V2.6.1
37+
38+
+ Replaced the sUsingPreemption variable with the configUSE_PREEMPTION
39+
macro to be consistent with the later ports.
40+
*/
4141

4242
/*-----------------------------------------------------------
43-
* Implementation of functions defined in portable.h for the Flashlite 186
44-
* port.
45-
*----------------------------------------------------------*/
43+
* Implementation of functions defined in portable.h for the Flashlite 186
44+
* port.
45+
*----------------------------------------------------------*/
4646

4747
#include <dos.h>
4848
#include <stdlib.h>
@@ -54,9 +54,9 @@
5454

5555
/*lint -e950 Non ANSI reserved words okay in this file only. */
5656

57-
#define portTIMER_EOI_TYPE ( 8 )
58-
#define portRESET_PIC() portOUTPUT_WORD( ( uint16_t ) 0xff22, portTIMER_EOI_TYPE )
59-
#define portTIMER_INT_NUMBER 0x12
57+
#define portTIMER_EOI_TYPE ( 8 )
58+
#define portRESET_PIC() portOUTPUT_WORD( ( uint16_t ) 0xff22, portTIMER_EOI_TYPE )
59+
#define portTIMER_INT_NUMBER 0x12
6060

6161
#define portTIMER_1_CONTROL_REGISTER ( ( uint16_t ) 0xff5e )
6262
#define portTIMER_0_CONTROL_REGISTER ( ( uint16_t ) 0xff56 )
@@ -69,16 +69,14 @@ static void prvSetTickFrequency( uint32_t ulTickRateHz );
6969
static void prvExitFunction( void );
7070

7171
/* The ISR used depends on whether the preemptive or cooperative scheduler
72-
* is being used. */
73-
#if ( configUSE_PREEMPTION == 1 )
74-
75-
/* Tick service routine used by the scheduler when preemptive scheduling is
76-
* being used. */
72+
is being used. */
73+
#if( configUSE_PREEMPTION == 1 )
74+
/* Tick service routine used by the scheduler when preemptive scheduling is
75+
being used. */
7776
static void __interrupt __far prvPreemptiveTick( void );
7877
#else
79-
80-
/* Tick service routine used by the scheduler when cooperative scheduling is
81-
* being used. */
78+
/* Tick service routine used by the scheduler when cooperative scheduling is
79+
being used. */
8280
static void __interrupt __far prvNonPreemptiveTick( void );
8381
#endif
8482

@@ -91,9 +89,9 @@ static void __interrupt __far prvYieldProcessor( void );
9189
static BaseType_t xSchedulerRunning = pdFALSE;
9290

9391
/* Points to the original routine installed on the vector we use for manual
94-
* context switches. This is then used to restore the original routine during
95-
* prvExitFunction(). */
96-
static void( __interrupt __far * pxOldSwitchISR )();
92+
context switches. This is then used to restore the original routine during
93+
prvExitFunction(). */
94+
static void ( __interrupt __far *pxOldSwitchISR )();
9795

9896
/* Used to restore the original DOS context when the scheduler is ended. */
9997
static jmp_buf xJumpBuf;
@@ -106,14 +104,14 @@ BaseType_t xPortStartScheduler( void )
106104
/* This is called with interrupts already disabled. */
107105

108106
/* Remember what was on the interrupts we are going to use
109-
* so we can put them back later if required. */
107+
so we can put them back later if required. */
110108
pxOldSwitchISR = _dos_getvect( portSWITCH_INT_NUMBER );
111109

112110
/* Put our manual switch (yield) function on a known
113-
* vector. */
111+
vector. */
114112
_dos_setvect( portSWITCH_INT_NUMBER, prvYieldProcessor );
115113

116-
#if ( configUSE_PREEMPTION == 1 )
114+
#if( configUSE_PREEMPTION == 1 )
117115
{
118116
/* Put our tick switch function on the timer interrupt. */
119117
_dos_setvect( portTIMER_INT_NUMBER, prvPreemptiveTick );
@@ -146,8 +144,8 @@ BaseType_t xPortStartScheduler( void )
146144
/*-----------------------------------------------------------*/
147145

148146
/* The ISR used depends on whether the preemptive or cooperative scheduler
149-
* is being used. */
150-
#if ( configUSE_PREEMPTION == 1 )
147+
is being used. */
148+
#if( configUSE_PREEMPTION == 1 )
151149
static void __interrupt __far prvPreemptiveTick( void )
152150
{
153151
/* Get the scheduler to update the task states following the tick. */
@@ -160,15 +158,15 @@ BaseType_t xPortStartScheduler( void )
160158
/* Reset the PIC ready for the next time. */
161159
portRESET_PIC();
162160
}
163-
#else /* if ( configUSE_PREEMPTION == 1 ) */
161+
#else
164162
static void __interrupt __far prvNonPreemptiveTick( void )
165163
{
166164
/* Same as preemptive tick, but the cooperative scheduler is being used
167-
* so we don't have to switch in the context of the next task. */
165+
so we don't have to switch in the context of the next task. */
168166
xTaskIncrementTick();
169167
portRESET_PIC();
170168
}
171-
#endif /* if ( configUSE_PREEMPTION == 1 ) */
169+
#endif
172170
/*-----------------------------------------------------------*/
173171

174172
static void __interrupt __far prvYieldProcessor( void )
@@ -181,31 +179,30 @@ static void __interrupt __far prvYieldProcessor( void )
181179
void vPortEndScheduler( void )
182180
{
183181
/* Jump back to the processor state prior to starting the
184-
* scheduler. This means we are not going to be using a
185-
* task stack frame so the task can be deleted. */
182+
scheduler. This means we are not going to be using a
183+
task stack frame so the task can be deleted. */
186184
longjmp( xJumpBuf, 1 );
187185
}
188186
/*-----------------------------------------------------------*/
189187

190188
static void prvExitFunction( void )
191189
{
192-
const uint16_t usTimerDisable = 0x0000;
193-
uint16_t usTimer0Control;
190+
const uint16_t usTimerDisable = 0x0000;
191+
uint16_t usTimer0Control;
194192

195193
/* Interrupts should be disabled here anyway - but no
196-
* harm in making sure. */
194+
harm in making sure. */
197195
portDISABLE_INTERRUPTS();
198-
199196
if( xSchedulerRunning == pdTRUE )
200197
{
201198
/* Put back the switch interrupt routines that was in place
202-
* before the scheduler started. */
199+
before the scheduler started. */
203200
_dos_setvect( portSWITCH_INT_NUMBER, pxOldSwitchISR );
204201
}
205202

206203
/* Disable the timer used for the tick to ensure the scheduler is
207-
* not called before restoring interrupts. There was previously nothing
208-
* on this timer so there is no old ISR to restore. */
204+
not called before restoring interrupts. There was previously nothing
205+
on this timer so there is no old ISR to restore. */
209206
portOUTPUT_WORD( portTIMER_1_CONTROL_REGISTER, usTimerDisable );
210207

211208
/* Restart the DOS tick. */
@@ -220,18 +217,18 @@ static void prvExitFunction( void )
220217

221218
static void prvSetTickFrequency( uint32_t ulTickRateHz )
222219
{
223-
const uint16_t usMaxCountRegister = 0xff5a;
224-
const uint16_t usTimerPriorityRegister = 0xff32;
225-
const uint16_t usTimerEnable = 0xC000;
226-
const uint16_t usRetrigger = 0x0001;
227-
const uint16_t usTimerHighPriority = 0x0000;
228-
uint16_t usTimer0Control;
220+
const uint16_t usMaxCountRegister = 0xff5a;
221+
const uint16_t usTimerPriorityRegister = 0xff32;
222+
const uint16_t usTimerEnable = 0xC000;
223+
const uint16_t usRetrigger = 0x0001;
224+
const uint16_t usTimerHighPriority = 0x0000;
225+
uint16_t usTimer0Control;
229226

230227
/* ( CPU frequency / 4 ) / clock 2 max count [inpw( 0xff62 ) = 7] */
231228

232-
const uint32_t ulClockFrequency = ( uint32_t ) 0x7f31a0UL;
229+
const uint32_t ulClockFrequency = ( uint32_t ) 0x7f31a0UL;
233230

234-
uint32_t ulTimerCount = ulClockFrequency / ulTickRateHz;
231+
uint32_t ulTimerCount = ulClockFrequency / ulTickRateHz;
235232

236233
portOUTPUT_WORD( portTIMER_1_CONTROL_REGISTER, usTimerEnable | portTIMER_INTERRUPT_ENABLE | usRetrigger );
237234
portOUTPUT_WORD( usMaxCountRegister, ( uint16_t ) ulTimerCount );

portable/BCC/16BitDOS/Flsh186/prtmacro.h

Lines changed: 33 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -40,61 +40,60 @@
4040
*/
4141

4242
/* Type definitions. */
43-
#define portCHAR char
44-
#define portFLOAT float
45-
#define portDOUBLE long
46-
#define portLONG long
47-
#define portSHORT int
48-
#define portSTACK_TYPE uint16_t
49-
#define portBASE_TYPE portSHORT
43+
#define portCHAR char
44+
#define portFLOAT float
45+
#define portDOUBLE long
46+
#define portLONG long
47+
#define portSHORT int
48+
#define portSTACK_TYPE uint16_t
49+
#define portBASE_TYPE portSHORT
5050

51-
typedef portSTACK_TYPE StackType_t;
52-
typedef short BaseType_t;
53-
typedef unsigned short UBaseType_t;
51+
typedef portSTACK_TYPE StackType_t;
52+
typedef short BaseType_t;
53+
typedef unsigned short UBaseType_t;
5454

55-
#if ( configTICK_TYPE_WIDTH_IN_BITS == TICK_TYPE_WIDTH_16_BITS )
56-
typedef uint16_t TickType_t;
57-
#define portMAX_DELAY ( TickType_t ) 0xffff
55+
#if( configTICK_TYPE_WIDTH_IN_BITS == TICK_TYPE_WIDTH_16_BITS )
56+
typedef uint16_t TickType_t;
57+
#define portMAX_DELAY ( TickType_t ) 0xffff
5858
#elif ( configTICK_TYPE_WIDTH_IN_BITS == TICK_TYPE_WIDTH_32_BITS )
59-
typedef uint32_t TickType_t;
60-
#define portMAX_DELAY ( TickType_t ) 0xffffffffUL
59+
typedef uint32_t TickType_t;
60+
#define portMAX_DELAY ( TickType_t ) 0xffffffffUL
6161
#else
6262
#error configTICK_TYPE_WIDTH_IN_BITS set to unsupported tick type width.
6363
#endif
6464
/*-----------------------------------------------------------*/
6565

6666
/* Critical section handling. */
67-
#define portENTER_CRITICAL() \
68-
__asm { pushf } \
69-
__asm { cli } \
67+
#define portENTER_CRITICAL() __asm{ pushf } \
68+
__asm{ cli } \
7069

71-
#define portEXIT_CRITICAL() __asm { popf }
70+
#define portEXIT_CRITICAL() __asm{ popf }
7271

73-
#define portDISABLE_INTERRUPTS() __asm { cli }
72+
#define portDISABLE_INTERRUPTS() __asm{ cli }
7473

75-
#define portENABLE_INTERRUPTS() __asm { sti }
74+
#define portENABLE_INTERRUPTS() __asm{ sti }
7675
/*-----------------------------------------------------------*/
7776

7877
/* Hardware specifics. */
79-
#define portNOP() __asm { nop }
80-
#define portSTACK_GROWTH ( -1 )
81-
#define portSWITCH_INT_NUMBER 0x80
82-
#define portYIELD() __asm { int portSWITCH_INT_NUMBER }
83-
#define portTICK_PERIOD_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ )
84-
#define portBYTE_ALIGNMENT 2
85-
#define portINITIAL_SW ( ( portSTACK_TYPE ) 0x0202 ) /* Start the tasks with interrupts enabled. */
78+
#define portNOP() __asm{ nop }
79+
#define portSTACK_GROWTH ( -1 )
80+
#define portSWITCH_INT_NUMBER 0x80
81+
#define portYIELD() __asm{ int portSWITCH_INT_NUMBER }
82+
#define portTICK_PERIOD_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ )
83+
#define portBYTE_ALIGNMENT 2
84+
#define portINITIAL_SW ( ( portSTACK_TYPE ) 0x0202 ) /* Start the tasks with interrupts enabled. */
8685
/*-----------------------------------------------------------*/
8786

8887
/* Compiler specifics. */
89-
#define portINPUT_BYTE( xAddr ) inp( xAddr )
90-
#define portOUTPUT_BYTE( xAddr, ucValue ) outp( xAddr, ucValue )
91-
#define portINPUT_WORD( xAddr ) inpw( xAddr )
92-
#define portOUTPUT_WORD( xAddr, usValue ) outpw( xAddr, usValue )
88+
#define portINPUT_BYTE( xAddr ) inp( xAddr )
89+
#define portOUTPUT_BYTE( xAddr, ucValue ) outp( xAddr, ucValue )
90+
#define portINPUT_WORD( xAddr ) inpw( xAddr )
91+
#define portOUTPUT_WORD( xAddr, usValue ) outpw( xAddr, usValue )
9392

9493
/*-----------------------------------------------------------*/
9594

9695
/* Task function macros as described on the FreeRTOS.org WEB site. */
97-
#define portTASK_FUNCTION_PROTO( vTaskFunction, vParameters ) void vTaskFunction( void * pvParameters )
98-
#define portTASK_FUNCTION( vTaskFunction, vParameters ) void vTaskFunction( void * pvParameters )
96+
#define portTASK_FUNCTION_PROTO( vTaskFunction, vParameters ) void vTaskFunction( void *pvParameters )
97+
#define portTASK_FUNCTION( vTaskFunction, vParameters ) void vTaskFunction( void *pvParameters )
9998

10099
#endif /* PORTMACRO_H */

0 commit comments

Comments
 (0)