All.
I've recently added ported my 8051-TinyOS to a new platform, and I
thought I might give SDCC a spin, but unfortunately I'm having some
problems (the platform is a SiLabs c8051F340, but I hardly think that is
the problem). I've used the sdcc-nf 2.8.0 distributed with Ubuntu.

The attached app.c results in a bunch of warnings, but no errors, but
sdcc returns a non zero exit code (at least my makescript says so), so I
suppose something went wrong!?

The warnings give rise to a different question regarding "~". I'm using
~ to turn certain bits of in a register, eg. "myreg |= MYBITMASK;myreg
&= ~MYBITMASK". Is there an other convenient way to do the same that
avoids the integer-promotion that the compiler warns about?

Anyway, the command and errors are:
sdcc -mmcs51 --model-large --no-c-code-in-asm --std-sdcc99 app.c -oapp
build/c8051F340TB/app.c:1221: warning 84: 'auto' variable 'i' may be
used before initialization
build/c8051F340TB/app.c:1610: warning 180: using ~ on bit/bool/unsigned
char variables can give unexpected results due to promotion to int
build/c8051F340TB/app.c:1687: warning 180: using ~ on bit/bool/unsigned
char variables can give unexpected results due to promotion to int
build/c8051F340TB/app.c:1769: warning 85: in function
SchedulerBasicP__TaskBasic__default__runTask unreferenced function
argument : 'id'
build/c8051F340TB/app.c:2002: warning 126: unreachable code
build/c8051F340TB/app.c:2002: warning 126: unreachable code
build/c8051F340TB/app.c:2002: warning 126: unreachable code

-- 
Regards Martin Leopold.
#define MANGLED_NESC_APP_C
#define nx_struct struct
#define nx_union union
#define dbg(mode, format, ...) ((void)0)
#define dbg_clear(mode, format, ...) ((void)0)
#define dbg_active(mode) 0
//# 152 "/usr/lib/gcc/i486-linux-gnu/4.3.2/include/stddef.h" 3
typedef int ptrdiff_t;
//#line 214
typedef unsigned int size_t;
//#line 326
typedef int wchar_t;
//# 8 "/usr/local/lib/ncc/deputy_nodeputy.h"
/*struct __nesc_attr_nonnull {
}  ;*/
//#line 9
/*struct __nesc_attr_bnd {
//#line 9
  void *lo, *hi;
}  ;*/
//#line 10
/*struct __nesc_attr_bnd_nok {
//#line 10
  void *lo, *hi;
}  ;*/
//#line 11
/*struct __nesc_attr_count {
//#line 11
  int n;
}  ;*/
//#line 12
/*struct __nesc_attr_count_nok {
//#line 12
  int n;
}  ;*/
//#line 13
/*struct __nesc_attr_one {
}  ;*/
//#line 14
/*struct __nesc_attr_one_nok {
}  ;*/
//#line 15
/*struct __nesc_attr_dmemset {
//#line 15
  int a1, a2, a3;
}  ;*/
//#line 16
/*struct __nesc_attr_dmemcpy {
//#line 16
  int a1, a2, a3;
}  ;*/
//#line 17
/*struct __nesc_attr_nts {
}  ;*/
//# 47 "/home/leopold/tinyos-2.x-contrib/diku/mcs51/tos/chips/mcs51/keil_stdint.h" 3
typedef signed char int8_t;
typedef short int16_t;



typedef long int32_t;


/*typedef long long int int64_t;*/








typedef unsigned char uint8_t;
typedef unsigned short uint16_t;



typedef unsigned long uint32_t;


/*typedef unsigned long long int uint64_t;*/
//# 42 "/home/leopold/tinyos-2.x-contrib/diku/mcs51/tos/chips/mcs51/stdint.h" 3
typedef signed char int_least8_t;
typedef short int int_least16_t;
typedef long int_least32_t;









typedef unsigned char uint_least8_t;
typedef unsigned short uint_least16_t;
typedef unsigned long uint_least32_t;
//#line 70
typedef signed char int_fast8_t;





typedef int int_fast16_t;
typedef int int_fast32_t;





typedef unsigned char uint_fast8_t;





typedef unsigned int uint_fast16_t;
typedef unsigned int uint_fast32_t;
//#line 105
typedef int intptr_t;


typedef unsigned int uintptr_t;








/*__extension__*/ 
typedef
         float* intmax_t;
      
/*__extension__*/ 
typedef 
         float* uintmax_t;
      
//# 35 "/usr/include/inttypes.h" 3
typedef int __gwchar_t;
//#line 292
//#line 288
typedef struct __nesc_unnamed4242 {


         float* quot;
      

         float* rem;
      
} imaxdiv_t;
//# 385 "/usr/local/lib/ncc/nesc_nx.h"
typedef struct { unsigned char _data[1]; } /*__attribute__((packed))*/ nx_int8_t;typedef int8_t __nesc_nxbase_nx_int8_t  ;
typedef struct { unsigned char _data[2]; } /*__attribute__((packed))*/ nx_int16_t;typedef int16_t __nesc_nxbase_nx_int16_t  ;
typedef struct { unsigned char _data[4]; } /*__attribute__((packed))*/ nx_int32_t;typedef int32_t __nesc_nxbase_nx_int32_t  ;
typedef struct { unsigned char _data[8]; } /*__attribute__((packed))*/ nx_int64_t;/*typedef int64_t __nesc_nxbase_nx_int64_t  ;*/
typedef struct { unsigned char _data[1]; } /*__attribute__((packed))*/ nx_uint8_t;typedef uint8_t __nesc_nxbase_nx_uint8_t  ;
typedef struct { unsigned char _data[2]; } /*__attribute__((packed))*/ nx_uint16_t;typedef uint16_t __nesc_nxbase_nx_uint16_t  ;
typedef struct { unsigned char _data[4]; } /*__attribute__((packed))*/ nx_uint32_t;typedef uint32_t __nesc_nxbase_nx_uint32_t  ;
typedef struct { unsigned char _data[8]; } /*__attribute__((packed))*/ nx_uint64_t;/*typedef uint64_t __nesc_nxbase_nx_uint64_t  ;*/


typedef struct { unsigned char _data[1]; } /*__attribute__((packed))*/ nxle_int8_t;typedef int8_t __nesc_nxbase_nxle_int8_t  ;
typedef struct { unsigned char _data[2]; } /*__attribute__((packed))*/ nxle_int16_t;typedef int16_t __nesc_nxbase_nxle_int16_t  ;
typedef struct { unsigned char _data[4]; } /*__attribute__((packed))*/ nxle_int32_t;typedef int32_t __nesc_nxbase_nxle_int32_t  ;
typedef struct { unsigned char _data[8]; } /*__attribute__((packed))*/ nxle_int64_t;/*typedef int64_t __nesc_nxbase_nxle_int64_t  ;*/
typedef struct { unsigned char _data[1]; } /*__attribute__((packed))*/ nxle_uint8_t;typedef uint8_t __nesc_nxbase_nxle_uint8_t  ;
typedef struct { unsigned char _data[2]; } /*__attribute__((packed))*/ nxle_uint16_t;typedef uint16_t __nesc_nxbase_nxle_uint16_t  ;
typedef struct { unsigned char _data[4]; } /*__attribute__((packed))*/ nxle_uint32_t;typedef uint32_t __nesc_nxbase_nxle_uint32_t  ;
typedef struct { unsigned char _data[8]; } /*__attribute__((packed))*/ nxle_uint64_t;/*typedef uint64_t __nesc_nxbase_nxle_uint64_t  ;*/
//# 20 "/home/leopold/tinyos-2.x-contrib/diku/mcs51/tos/chips/mcs51/string.h"
extern void *memset(void *s, char val, int n);
//# 102 "/usr/include/stdlib.h" 3
//#line 98
typedef struct __nesc_unnamed4243 {

  int quot;
  int rem;
} div_t;







//#line 106
typedef struct __nesc_unnamed4244 {

  long int quot;
  long int rem;
} ldiv_t;
//#line 158
/*__extension__*/ 
//#line 195
/*__extension__*/ 




/*__extension__*/ 








/*__extension__*/ 




/*__extension__*/ 
//#line 349
struct random__data {

  int32_t *fptr;
  int32_t *rptr;
  int32_t *state;
  int rand_type;
  int rand_deg;
  int rand_sep;
  int32_t *end_ptr;
};
//#line 418
struct drand48__data {

  unsigned short int __x[3];
  unsigned short int __old_x[3];
  unsigned short int __c;
  unsigned short int __init;
  
         float* __a;
      
};
//#line 670
typedef int (*__compar_fn_t)(const void *arg_0x402dfbc0, const void *arg_0x402dfd58);
//# 24 "/home/leopold/tinyos-2.x-contrib/diku/common/tos/system/tos.h"
typedef uint8_t bool  ;
enum __nesc_unnamed4245 {
//#line 25
  FALSE = 0, TRUE = 1
};









typedef nx_int8_t nx_bool;






/*struct __nesc_attr_atmostonce {
};*/
//#line 44
/*struct __nesc_attr_atleastonce {
};*/
//#line 45
/*struct __nesc_attr_exactlyonce {
};*/
//# 40 "/scratch/tinyos-2.1.0/tos/types/TinyError.h"
enum __nesc_unnamed4246 {
  SUCCESS = 0, 
  FAIL = 1, 
  ESIZE = 2, 
  ECANCEL = 3, 
  EOFF = 4, 
  EBUSY = 5, 
  EINVAL = 6, 
  ERETRY = 7, 
  ERESERVE = 8, 
  EALREADY = 9, 
  ENOMEM = 10, 
  ENOACK = 11, 
  ELAST = 11
};

typedef uint8_t error_t  ;
//# 43 "/home/leopold/tinyos-2.x-contrib/diku/mcs51/tos/chips/cip51/iocip51.h"
enum __nesc_unnamed4247 {
  cip51_SCON_S0MODE = 0x7, 
  cip51_SCON_MCE0 = 0x5, 
  cip51_SCON_REN0 = 0x4, 
  cip51_SCON_TB80 = 0x3, 
  cip51_SCON_RB80 = 0x2, 
  cip51_SCON_TI0 = 0x1, 
  cip51_SCON_RI0 = 0x0
};





enum __nesc_unnamed4248 {
  CIP51_SPI0CFG_SPIBSY = 0x7, 
  CIP51_SPI0CFG_MSTEN = 0x6, 
  CIP51_SPI0CFG_CKPHA = 0x5, 
  CIP51_SPI0CFG_CKPOL = 0x4, 
  CIP51_SPI0CFG_SLVSEL = 0x3, 
  CIP51_SPI0CFG_NSSIN = 0x2, 
  CIP51_SPI0CFG_SRMT = 0x1, 
  CIP51_SPI0CFG_RXBMT = 0x0
};





enum __nesc_unnamed4249 {
  CIP51_CLKMUL_MULEN = 0x7, 
  CIP51_CLKMUL_MULINT = 0x6, 
  CIP51_CLKMUL_MULRDY = 0x5
};





enum __nesc_unnamed4250 {
  CIP51_IT01CF_IN1PL = 0x7, 
  CIP51_IT01CF_IN0PL = 0x3, 
  CIP51_IT01CF_IN0SL_MASK = 0x7, 
  CIP51_IT01CF_IN1SL_MASK = 0x70
};
//#line 119
__sfr __at (0xA6) P2MDOUT;


__sfr __at (0xA9) CLKSEL;







__sfr __at (0xB2) OSCICN;



__sfr __at (0xB6) FLSCL;


__sfr __at (0xB9) CLKMUL;
//#line 164
__sfr __at (0xD4) P0SKIP;
__sfr __at (0xD5) P1SKIP;
__sfr __at (0xD6) P2SKIP;


__sfr __at (0xD9) PCA0MD;



__sfr __at (0xE1) XBR0;
__sfr __at (0xE2) XBR1;
//# 160 "/home/leopold/tinyos-2.x-contrib/diku/mcs51/tos/chips/mcs51/io8051.h"
__sbit __at (0xAF) EA;
//#line 212
__sbit __at (0xA2) P2_2;
__sbit __at (0xA3) P2_3;
//# 105 "/home/leopold/tinyos-2.x-contrib/diku/mcs51/tos/chips/mcs51/mcs51hardware.h"
typedef uint8_t __nesc_atomic_t;

static   /*inline*/   void __nesc_disable_interrupt();
static   /*inline*/   void __nesc_enable_interrupt();

  /*inline*/   __nesc_atomic_t __nesc_atomic_start(void )  ;





  /*inline*/   void __nesc_atomic_end(__nesc_atomic_t oldSreg)  ;
//# 42 "/home/leopold/tinyos-2.x-contrib/diku/mcs51/tos/chips/mcs51/Timer.h"
typedef uint8_t TMilli;
typedef uint8_t T32khz;
typedef uint8_t TMicro;
//# 32 "/scratch/tinyos-2.1.0/tos/types/Leds.h"
enum __nesc_unnamed4251 {
  LEDS_LED0 = 1 << 0, 
  LEDS_LED1 = 1 << 1, 
  LEDS_LED2 = 1 << 2, 
  LEDS_LED3 = 1 << 3, 
  LEDS_LED4 = 1 << 4, 
  LEDS_LED5 = 1 << 5, 
  LEDS_LED6 = 1 << 6, 
  LEDS_LED7 = 1 << 7
};
//# 51 "/scratch/tinyos-2.1.0/tos/interfaces/Init.nc"
static error_t PlatformP__Init__init(void );
//# 45 "/home/leopold/tinyos-2.x-contrib/diku/mcs51/tos/chips/cip51/pins/Hplcip51IO.nc"
static void Hplcip51IOC__P22__toggle(void );









static void Hplcip51IOC__P22__makePushPull(void );
//#line 43
static void Hplcip51IOC__P22__set(void );
static void Hplcip51IOC__P22__clr(void );
//# 51 "/scratch/tinyos-2.1.0/tos/interfaces/Init.nc"
static error_t Hplcip51IOC__Init__init(void );
//# 45 "/home/leopold/tinyos-2.x-contrib/diku/mcs51/tos/chips/cip51/pins/Hplcip51IO.nc"
static void Hplcip51IOC__P23__toggle(void );









static void Hplcip51IOC__P23__makePushPull(void );
//#line 43
static void Hplcip51IOC__P23__set(void );
static void Hplcip51IOC__P23__clr(void );
//# 51 "/scratch/tinyos-2.1.0/tos/interfaces/Init.nc"
static error_t RealMainP__SoftwareInit__default__init(void );
//# 56 "/scratch/tinyos-2.1.0/tos/interfaces/TaskBasic.nc"
static error_t SchedulerBasicP__TaskBasic__postTask(
//# 45 "/scratch/tinyos-2.1.0/tos/system/SchedulerBasicP.nc"
uint8_t arg_0x40347860);
//# 64 "/scratch/tinyos-2.1.0/tos/interfaces/TaskBasic.nc"
static void SchedulerBasicP__TaskBasic__default__runTask(
//# 45 "/scratch/tinyos-2.1.0/tos/system/SchedulerBasicP.nc"
uint8_t arg_0x40347860);
//# 46 "/scratch/tinyos-2.1.0/tos/interfaces/Scheduler.nc"
static void SchedulerBasicP__Scheduler__init(void );
//#line 61
static void SchedulerBasicP__Scheduler__taskLoop(void );
//#line 54
static bool SchedulerBasicP__Scheduler__runNextTask(void );
//# 59 "/scratch/tinyos-2.1.0/tos/interfaces/McuSleep.nc"
static void McuSleepC__McuSleep__sleep(void );
//# 64 "/scratch/tinyos-2.1.0/tos/interfaces/TaskBasic.nc"
static void BlinkNoTimerTaskC__delay__runTask(void );
//# 49 "/scratch/tinyos-2.1.0/tos/interfaces/Boot.nc"
static void BlinkNoTimerTaskC__Boot__booted(void );
//# 64 "/scratch/tinyos-2.1.0/tos/interfaces/TaskBasic.nc"
static void BlinkNoTimerTaskC__toggle__runTask(void );
//# 51 "/scratch/tinyos-2.1.0/tos/interfaces/Init.nc"
static error_t LedsP__Init__init(void );
//# 56 "/scratch/tinyos-2.1.0/tos/interfaces/Leds.nc"
static void LedsP__Leds__led0Toggle(void );




static void LedsP__Leds__led1On(void );










static void LedsP__Leds__led1Toggle(void );
//#line 89
static void LedsP__Leds__led2Toggle(void );
//#line 45
static void LedsP__Leds__led0On(void );
//#line 78
static void LedsP__Leds__led2On(void );
//# 31 "/scratch/tinyos-2.1.0/tos/interfaces/GeneralIO.nc"
static void /*Hplcip51GeneralIOC.P22_w*/Hplcip51GeneralIOP__18__out__toggle(void );



static void /*Hplcip51GeneralIOC.P22_w*/Hplcip51GeneralIOP__18__out__makeOutput(void );
//#line 29
static void /*Hplcip51GeneralIOC.P22_w*/Hplcip51GeneralIOP__18__out__set(void );
static void /*Hplcip51GeneralIOC.P22_w*/Hplcip51GeneralIOP__18__out__clr(void );
static void /*Hplcip51GeneralIOC.P23_w*/Hplcip51GeneralIOP__19__out__toggle(void );



static void /*Hplcip51GeneralIOC.P23_w*/Hplcip51GeneralIOP__19__out__makeOutput(void );
//#line 29
static void /*Hplcip51GeneralIOC.P23_w*/Hplcip51GeneralIOP__19__out__set(void );
static void /*Hplcip51GeneralIOC.P23_w*/Hplcip51GeneralIOP__19__out__clr(void );
static void /*PlatformLedsC.Led0_rev*/ReverseGPIOP__0__Out__toggle(void );



static void /*PlatformLedsC.Led0_rev*/ReverseGPIOP__0__Out__makeOutput(void );
//#line 29
static void /*PlatformLedsC.Led0_rev*/ReverseGPIOP__0__Out__set(void );
static void /*PlatformLedsC.Led0_rev*/ReverseGPIOP__0__Out__clr(void );
static void /*PlatformLedsC.Led1_rev*/ReverseGPIOP__1__Out__toggle(void );



static void /*PlatformLedsC.Led1_rev*/ReverseGPIOP__1__Out__makeOutput(void );
//#line 29
static void /*PlatformLedsC.Led1_rev*/ReverseGPIOP__1__Out__set(void );
static void /*PlatformLedsC.Led1_rev*/ReverseGPIOP__1__Out__clr(void );
static void /*PlatformLedsC.Led2_rev*/ReverseGPIOP__2__Out__toggle(void );



static void /*PlatformLedsC.Led2_rev*/ReverseGPIOP__2__Out__makeOutput(void );
//#line 29
static void /*PlatformLedsC.Led2_rev*/ReverseGPIOP__2__Out__set(void );
static void /*PlatformLedsC.Led2_rev*/ReverseGPIOP__2__Out__clr(void );
static void /*PlatformLedsC.NoPinC*/NoPinC__0__GeneralIO__toggle(void );



static void /*PlatformLedsC.NoPinC*/NoPinC__0__GeneralIO__makeOutput(void );
//#line 29
static void /*PlatformLedsC.NoPinC*/NoPinC__0__GeneralIO__set(void );
static void /*PlatformLedsC.NoPinC*/NoPinC__0__GeneralIO__clr(void );
//# 51 "/scratch/tinyos-2.1.0/tos/interfaces/Init.nc"
static error_t PlatformP__GPIOInit__init(void );
//#line 51
static error_t PlatformP__LedsInit__init(void );
//# 52 "/home/leopold/tinyos-2.x-contrib/diku/mcs51/tos/platforms/c8051F340TB/PlatformP.nc"
static  /*inline*/  error_t PlatformP__Init__init(void );
//# 131 "/home/leopold/tinyos-2.x-contrib/diku/mcs51/tos/chips/cip51/pins/Hplcip51IOC.nc"
static   /*inline*/   void Hplcip51IOC__P22__set(void );
//#line 131
static   /*inline*/   void Hplcip51IOC__P22__clr(void );
//#line 131
static  /*inline*/  void Hplcip51IOC__P22__toggle(void );
//#line 131
static   /*inline*/   void Hplcip51IOC__P22__makePushPull(void );
static   /*inline*/   void Hplcip51IOC__P23__set(void );
//#line 132
static   /*inline*/   void Hplcip51IOC__P23__clr(void );
//#line 132
static  /*inline*/  void Hplcip51IOC__P23__toggle(void );
//#line 132
static   /*inline*/   void Hplcip51IOC__P23__makePushPull(void );
//#line 163
static  /*inline*/  error_t Hplcip51IOC__Init__init(void );
//# 51 "/scratch/tinyos-2.1.0/tos/interfaces/Init.nc"
static error_t RealMainP__SoftwareInit__init(void );
//# 49 "/scratch/tinyos-2.1.0/tos/interfaces/Boot.nc"
static void RealMainP__Boot__booted(void );
//# 51 "/scratch/tinyos-2.1.0/tos/interfaces/Init.nc"
static error_t RealMainP__PlatformInit__init(void );
//# 46 "/scratch/tinyos-2.1.0/tos/interfaces/Scheduler.nc"
static void RealMainP__Scheduler__init(void );
//#line 61
static void RealMainP__Scheduler__taskLoop(void );
//#line 54
static bool RealMainP__Scheduler__runNextTask(void );
//# 52 "/scratch/tinyos-2.1.0/tos/system/RealMainP.nc"
int main(void )   ;
//#line 94
static  /*inline*/  error_t RealMainP__SoftwareInit__default__init(void );
//# 64 "/scratch/tinyos-2.1.0/tos/interfaces/TaskBasic.nc"
static void SchedulerBasicP__TaskBasic__runTask(
//# 45 "/scratch/tinyos-2.1.0/tos/system/SchedulerBasicP.nc"
uint8_t arg_0x40347860);
//# 59 "/scratch/tinyos-2.1.0/tos/interfaces/McuSleep.nc"
static void SchedulerBasicP__McuSleep__sleep(void );
//# 50 "/scratch/tinyos-2.1.0/tos/system/SchedulerBasicP.nc"
enum SchedulerBasicP____nesc_unnamed4252 {

  SchedulerBasicP__NUM_TASKS = 2U, 
  SchedulerBasicP__NO_TASK = 255
};

uint8_t SchedulerBasicP__m_head;
uint8_t SchedulerBasicP__m_tail;
uint8_t SchedulerBasicP__m_next[SchedulerBasicP__NUM_TASKS];








static   /*inline*/   uint8_t SchedulerBasicP__popTask(void );
//#line 86
static  /*inline*/  bool SchedulerBasicP__isWaiting(uint8_t id);




static  /*inline*/  bool SchedulerBasicP__pushTask(uint8_t id);
//#line 113
static  /*inline*/  void SchedulerBasicP__Scheduler__init(void );









static bool SchedulerBasicP__Scheduler__runNextTask(void );
//#line 138
static  /*inline*/  void SchedulerBasicP__Scheduler__taskLoop(void );
//#line 159
static error_t SchedulerBasicP__TaskBasic__postTask(uint8_t id);




static  /*inline*/  void SchedulerBasicP__TaskBasic__default__runTask(uint8_t id);
//# 50 "/home/leopold/tinyos-2.x-contrib/diku/mcs51/tos/chips/cip51/McuSleepC.nc"
static  /*inline*/  void McuSleepC__McuSleep__sleep(void );
//# 56 "/scratch/tinyos-2.1.0/tos/interfaces/TaskBasic.nc"
static error_t BlinkNoTimerTaskC__delay__postTask(void );
//#line 56
static error_t BlinkNoTimerTaskC__toggle__postTask(void );
//# 56 "/scratch/tinyos-2.1.0/tos/interfaces/Leds.nc"
static void BlinkNoTimerTaskC__Leds__led0Toggle(void );




static void BlinkNoTimerTaskC__Leds__led1On(void );










static void BlinkNoTimerTaskC__Leds__led1Toggle(void );
//#line 89
static void BlinkNoTimerTaskC__Leds__led2Toggle(void );
//#line 45
static void BlinkNoTimerTaskC__Leds__led0On(void );
//#line 78
static void BlinkNoTimerTaskC__Leds__led2On(void );
//# 48 "BlinkNoTimerTaskC.nc"
enum BlinkNoTimerTaskC____nesc_unnamed4253 {
//#line 48
  BlinkNoTimerTaskC__toggle = 0U
};
//#line 48
typedef int BlinkNoTimerTaskC____nesc_sillytask_toggle[BlinkNoTimerTaskC__toggle];
enum BlinkNoTimerTaskC____nesc_unnamed4254 {
//#line 49
  BlinkNoTimerTaskC__delay = 1U
};
//#line 49
typedef int BlinkNoTimerTaskC____nesc_sillytask_delay[BlinkNoTimerTaskC__delay];

static  /*inline*/  void BlinkNoTimerTaskC__Boot__booted(void );







static void BlinkNoTimerTaskC__delay__runTask(void );









static  /*inline*/  void BlinkNoTimerTaskC__toggle__runTask(void );
//# 31 "/scratch/tinyos-2.1.0/tos/interfaces/GeneralIO.nc"
static void LedsP__Led0__toggle(void );



static void LedsP__Led0__makeOutput(void );
//#line 29
static void LedsP__Led0__set(void );
static void LedsP__Led0__clr(void );
static void LedsP__Led1__toggle(void );



static void LedsP__Led1__makeOutput(void );
//#line 29
static void LedsP__Led1__set(void );
static void LedsP__Led1__clr(void );
static void LedsP__Led2__toggle(void );



static void LedsP__Led2__makeOutput(void );
//#line 29
static void LedsP__Led2__set(void );
static void LedsP__Led2__clr(void );
//# 45 "/scratch/tinyos-2.1.0/tos/system/LedsP.nc"
static  /*inline*/  error_t LedsP__Init__init(void );
//#line 63
static  /*inline*/  void LedsP__Leds__led0On(void );









static  /*inline*/  void LedsP__Leds__led0Toggle(void );




static  /*inline*/  void LedsP__Leds__led1On(void );









static  /*inline*/  void LedsP__Leds__led1Toggle(void );




static  /*inline*/  void LedsP__Leds__led2On(void );









static  /*inline*/  void LedsP__Leds__led2Toggle(void );
//# 45 "/home/leopold/tinyos-2.x-contrib/diku/mcs51/tos/chips/cip51/pins/Hplcip51IO.nc"
static void /*Hplcip51GeneralIOC.P22_w*/Hplcip51GeneralIOP__18__in__toggle(void );









static void /*Hplcip51GeneralIOC.P22_w*/Hplcip51GeneralIOP__18__in__makePushPull(void );
//#line 43
static void /*Hplcip51GeneralIOC.P22_w*/Hplcip51GeneralIOP__18__in__set(void );
static void /*Hplcip51GeneralIOC.P22_w*/Hplcip51GeneralIOP__18__in__clr(void );
//# 53 "/home/leopold/tinyos-2.x-contrib/diku/mcs51/tos/chips/cip51/pins/Hplcip51GeneralIOP.nc"
static   /*inline*/   void /*Hplcip51GeneralIOC.P22_w*/Hplcip51GeneralIOP__18__out__set(void );
static   /*inline*/   void /*Hplcip51GeneralIOC.P22_w*/Hplcip51GeneralIOP__18__out__clr(void );
static  /*inline*/  void /*Hplcip51GeneralIOC.P22_w*/Hplcip51GeneralIOP__18__out__toggle(void );










static   /*inline*/   void /*Hplcip51GeneralIOC.P22_w*/Hplcip51GeneralIOP__18__out__makeOutput(void );
//# 45 "/home/leopold/tinyos-2.x-contrib/diku/mcs51/tos/chips/cip51/pins/Hplcip51IO.nc"
static void /*Hplcip51GeneralIOC.P23_w*/Hplcip51GeneralIOP__19__in__toggle(void );









static void /*Hplcip51GeneralIOC.P23_w*/Hplcip51GeneralIOP__19__in__makePushPull(void );
//#line 43
static void /*Hplcip51GeneralIOC.P23_w*/Hplcip51GeneralIOP__19__in__set(void );
static void /*Hplcip51GeneralIOC.P23_w*/Hplcip51GeneralIOP__19__in__clr(void );
//# 53 "/home/leopold/tinyos-2.x-contrib/diku/mcs51/tos/chips/cip51/pins/Hplcip51GeneralIOP.nc"
static   /*inline*/   void /*Hplcip51GeneralIOC.P23_w*/Hplcip51GeneralIOP__19__out__set(void );
static   /*inline*/   void /*Hplcip51GeneralIOC.P23_w*/Hplcip51GeneralIOP__19__out__clr(void );
static  /*inline*/  void /*Hplcip51GeneralIOC.P23_w*/Hplcip51GeneralIOP__19__out__toggle(void );










static   /*inline*/   void /*Hplcip51GeneralIOC.P23_w*/Hplcip51GeneralIOP__19__out__makeOutput(void );
//# 31 "/scratch/tinyos-2.1.0/tos/interfaces/GeneralIO.nc"
static void /*PlatformLedsC.Led0_rev*/ReverseGPIOP__0__In__toggle(void );



static void /*PlatformLedsC.Led0_rev*/ReverseGPIOP__0__In__makeOutput(void );
//#line 29
static void /*PlatformLedsC.Led0_rev*/ReverseGPIOP__0__In__set(void );
static void /*PlatformLedsC.Led0_rev*/ReverseGPIOP__0__In__clr(void );
//# 59 "/home/leopold/tinyos-2.x-contrib/diku/common/lib/ReverseGPIOP.nc"
static   /*inline*/   void /*PlatformLedsC.Led0_rev*/ReverseGPIOP__0__Out__set(void );
//#line 59
static   /*inline*/   void /*PlatformLedsC.Led0_rev*/ReverseGPIOP__0__Out__clr(void );
//#line 59
static  /*inline*/  void /*PlatformLedsC.Led0_rev*/ReverseGPIOP__0__Out__toggle(void );
//#line 59
static   /*inline*/   void /*PlatformLedsC.Led0_rev*/ReverseGPIOP__0__Out__makeOutput(void );
//# 31 "/scratch/tinyos-2.1.0/tos/interfaces/GeneralIO.nc"
static void /*PlatformLedsC.Led1_rev*/ReverseGPIOP__1__In__toggle(void );



static void /*PlatformLedsC.Led1_rev*/ReverseGPIOP__1__In__makeOutput(void );
//#line 29
static void /*PlatformLedsC.Led1_rev*/ReverseGPIOP__1__In__set(void );
static void /*PlatformLedsC.Led1_rev*/ReverseGPIOP__1__In__clr(void );
//# 59 "/home/leopold/tinyos-2.x-contrib/diku/common/lib/ReverseGPIOP.nc"
static   /*inline*/   void /*PlatformLedsC.Led1_rev*/ReverseGPIOP__1__Out__set(void );
//#line 59
static   /*inline*/   void /*PlatformLedsC.Led1_rev*/ReverseGPIOP__1__Out__clr(void );
//#line 59
static  /*inline*/  void /*PlatformLedsC.Led1_rev*/ReverseGPIOP__1__Out__toggle(void );
//#line 59
static   /*inline*/   void /*PlatformLedsC.Led1_rev*/ReverseGPIOP__1__Out__makeOutput(void );
//# 31 "/scratch/tinyos-2.1.0/tos/interfaces/GeneralIO.nc"
static void /*PlatformLedsC.Led2_rev*/ReverseGPIOP__2__In__toggle(void );



static void /*PlatformLedsC.Led2_rev*/ReverseGPIOP__2__In__makeOutput(void );
//#line 29
static void /*PlatformLedsC.Led2_rev*/ReverseGPIOP__2__In__set(void );
static void /*PlatformLedsC.Led2_rev*/ReverseGPIOP__2__In__clr(void );
//# 59 "/home/leopold/tinyos-2.x-contrib/diku/common/lib/ReverseGPIOP.nc"
static   /*inline*/   void /*PlatformLedsC.Led2_rev*/ReverseGPIOP__2__Out__set(void );
//#line 59
static   /*inline*/   void /*PlatformLedsC.Led2_rev*/ReverseGPIOP__2__Out__clr(void );
//#line 59
static  /*inline*/  void /*PlatformLedsC.Led2_rev*/ReverseGPIOP__2__Out__toggle(void );
//#line 59
static   /*inline*/   void /*PlatformLedsC.Led2_rev*/ReverseGPIOP__2__Out__makeOutput(void );
//# 23 "/scratch/tinyos-2.1.0/tos/system/NoPinC.nc"
static  /*inline*/  void /*PlatformLedsC.NoPinC*/NoPinC__0__GeneralIO__set(void );
static  /*inline*/  void /*PlatformLedsC.NoPinC*/NoPinC__0__GeneralIO__clr(void );
static  /*inline*/  void /*PlatformLedsC.NoPinC*/NoPinC__0__GeneralIO__toggle(void );

static  /*inline*/  void /*PlatformLedsC.NoPinC*/NoPinC__0__GeneralIO__makeOutput(void );
//# 110 "/home/leopold/tinyos-2.x-contrib/diku/mcs51/tos/chips/mcs51/mcs51hardware.h"
  /*inline*/    __nesc_atomic_t __nesc_atomic_start(void )
//#line 110
{
  __nesc_atomic_t tmp = EA;

//#line 112
  EA = 0;
  return tmp;
}

  /*inline*/    void __nesc_atomic_end(__nesc_atomic_t oldSreg)
//#line 116
{
  EA = oldSreg;
}

//# 113 "/scratch/tinyos-2.1.0/tos/system/SchedulerBasicP.nc"
static  /*inline*/  void SchedulerBasicP__Scheduler__init(void )
{
  /* atomic removed: atomic calls only */
  {
    memset((void *)SchedulerBasicP__m_next, SchedulerBasicP__NO_TASK, sizeof SchedulerBasicP__m_next);
    SchedulerBasicP__m_head = SchedulerBasicP__NO_TASK;
    SchedulerBasicP__m_tail = SchedulerBasicP__NO_TASK;
  }
}

//# 46 "/scratch/tinyos-2.1.0/tos/interfaces/Scheduler.nc"
 /*inline*/  static void RealMainP__Scheduler__init(void ){
//#line 46
  SchedulerBasicP__Scheduler__init();
//#line 46
}
//#line 46
//# 24 "/scratch/tinyos-2.1.0/tos/system/NoPinC.nc"
static  /*inline*/  void /*PlatformLedsC.NoPinC*/NoPinC__0__GeneralIO__clr(void )
//#line 24
{
}

//# 30 "/scratch/tinyos-2.1.0/tos/interfaces/GeneralIO.nc"
 /*inline*/  static void /*PlatformLedsC.Led2_rev*/ReverseGPIOP__2__In__clr(void ){
//#line 30
  /*PlatformLedsC.NoPinC*/NoPinC__0__GeneralIO__clr();
//#line 30
}
//#line 30
//# 59 "/home/leopold/tinyos-2.x-contrib/diku/common/lib/ReverseGPIOP.nc"
static   /*inline*/   void /*PlatformLedsC.Led2_rev*/ReverseGPIOP__2__Out__set(void )
//#line 59
{
//#line 59
  /*PlatformLedsC.Led2_rev*/ReverseGPIOP__2__In__clr();
}

//# 29 "/scratch/tinyos-2.1.0/tos/interfaces/GeneralIO.nc"
 /*inline*/  static void LedsP__Led2__set(void ){
//#line 29
  /*PlatformLedsC.Led2_rev*/ReverseGPIOP__2__Out__set();
//#line 29
}
//#line 29
//# 132 "/home/leopold/tinyos-2.x-contrib/diku/mcs51/tos/chips/cip51/pins/Hplcip51IOC.nc"
static   /*inline*/   void Hplcip51IOC__P23__clr(void )
//#line 132
{
//#line 132
  P2_3 = 0;
}

//# 44 "/home/leopold/tinyos-2.x-contrib/diku/mcs51/tos/chips/cip51/pins/Hplcip51IO.nc"
 /*inline*/  static void /*Hplcip51GeneralIOC.P23_w*/Hplcip51GeneralIOP__19__in__clr(void ){
//#line 44
  Hplcip51IOC__P23__clr();
//#line 44
}
//#line 44
//# 54 "/home/leopold/tinyos-2.x-contrib/diku/mcs51/tos/chips/cip51/pins/Hplcip51GeneralIOP.nc"
static   /*inline*/   void /*Hplcip51GeneralIOC.P23_w*/Hplcip51GeneralIOP__19__out__clr(void )
//#line 54
{
//#line 54
  /*Hplcip51GeneralIOC.P23_w*/Hplcip51GeneralIOP__19__in__clr();
}

//# 30 "/scratch/tinyos-2.1.0/tos/interfaces/GeneralIO.nc"
 /*inline*/  static void /*PlatformLedsC.Led1_rev*/ReverseGPIOP__1__In__clr(void ){
//#line 30
  /*Hplcip51GeneralIOC.P23_w*/Hplcip51GeneralIOP__19__out__clr();
//#line 30
}
//#line 30
//# 59 "/home/leopold/tinyos-2.x-contrib/diku/common/lib/ReverseGPIOP.nc"
static   /*inline*/   void /*PlatformLedsC.Led1_rev*/ReverseGPIOP__1__Out__set(void )
//#line 59
{
//#line 59
  /*PlatformLedsC.Led1_rev*/ReverseGPIOP__1__In__clr();
}

//# 29 "/scratch/tinyos-2.1.0/tos/interfaces/GeneralIO.nc"
 /*inline*/  static void LedsP__Led1__set(void ){
//#line 29
  /*PlatformLedsC.Led1_rev*/ReverseGPIOP__1__Out__set();
//#line 29
}
//#line 29
//# 131 "/home/leopold/tinyos-2.x-contrib/diku/mcs51/tos/chips/cip51/pins/Hplcip51IOC.nc"
static   /*inline*/   void Hplcip51IOC__P22__clr(void )
//#line 131
{
//#line 131
  P2_2 = 0;
}

//# 44 "/home/leopold/tinyos-2.x-contrib/diku/mcs51/tos/chips/cip51/pins/Hplcip51IO.nc"
 /*inline*/  static void /*Hplcip51GeneralIOC.P22_w*/Hplcip51GeneralIOP__18__in__clr(void ){
//#line 44
  Hplcip51IOC__P22__clr();
//#line 44
}
//#line 44
//# 54 "/home/leopold/tinyos-2.x-contrib/diku/mcs51/tos/chips/cip51/pins/Hplcip51GeneralIOP.nc"
static   /*inline*/   void /*Hplcip51GeneralIOC.P22_w*/Hplcip51GeneralIOP__18__out__clr(void )
//#line 54
{
//#line 54
  /*Hplcip51GeneralIOC.P22_w*/Hplcip51GeneralIOP__18__in__clr();
}

//# 30 "/scratch/tinyos-2.1.0/tos/interfaces/GeneralIO.nc"
 /*inline*/  static void /*PlatformLedsC.Led0_rev*/ReverseGPIOP__0__In__clr(void ){
//#line 30
  /*Hplcip51GeneralIOC.P22_w*/Hplcip51GeneralIOP__18__out__clr();
//#line 30
}
//#line 30
//# 59 "/home/leopold/tinyos-2.x-contrib/diku/common/lib/ReverseGPIOP.nc"
static   /*inline*/   void /*PlatformLedsC.Led0_rev*/ReverseGPIOP__0__Out__set(void )
//#line 59
{
//#line 59
  /*PlatformLedsC.Led0_rev*/ReverseGPIOP__0__In__clr();
}

//# 29 "/scratch/tinyos-2.1.0/tos/interfaces/GeneralIO.nc"
 /*inline*/  static void LedsP__Led0__set(void ){
//#line 29
  /*PlatformLedsC.Led0_rev*/ReverseGPIOP__0__Out__set();
//#line 29
}
//#line 29
//# 27 "/scratch/tinyos-2.1.0/tos/system/NoPinC.nc"
static  /*inline*/  void /*PlatformLedsC.NoPinC*/NoPinC__0__GeneralIO__makeOutput(void )
//#line 27
{
}

//# 35 "/scratch/tinyos-2.1.0/tos/interfaces/GeneralIO.nc"
 /*inline*/  static void /*PlatformLedsC.Led2_rev*/ReverseGPIOP__2__In__makeOutput(void ){
//#line 35
  /*PlatformLedsC.NoPinC*/NoPinC__0__GeneralIO__makeOutput();
//#line 35
}
//#line 35
//# 59 "/home/leopold/tinyos-2.x-contrib/diku/common/lib/ReverseGPIOP.nc"
static   /*inline*/   void /*PlatformLedsC.Led2_rev*/ReverseGPIOP__2__Out__makeOutput(void )
//#line 59
{
//#line 59
  /*PlatformLedsC.Led2_rev*/ReverseGPIOP__2__In__makeOutput();
}

//# 35 "/scratch/tinyos-2.1.0/tos/interfaces/GeneralIO.nc"
 /*inline*/  static void LedsP__Led2__makeOutput(void ){
//#line 35
  /*PlatformLedsC.Led2_rev*/ReverseGPIOP__2__Out__makeOutput();
//#line 35
}
//#line 35
//# 132 "/home/leopold/tinyos-2.x-contrib/diku/mcs51/tos/chips/cip51/pins/Hplcip51IOC.nc"
static   /*inline*/   void Hplcip51IOC__P23__makePushPull(void )
//#line 132
{
//#line 132
  P2MDOUT |= 1 << 3;
}

//# 55 "/home/leopold/tinyos-2.x-contrib/diku/mcs51/tos/chips/cip51/pins/Hplcip51IO.nc"
 /*inline*/  static void /*Hplcip51GeneralIOC.P23_w*/Hplcip51GeneralIOP__19__in__makePushPull(void ){
//#line 55
  Hplcip51IOC__P23__makePushPull();
//#line 55
}
//#line 55
//# 66 "/home/leopold/tinyos-2.x-contrib/diku/mcs51/tos/chips/cip51/pins/Hplcip51GeneralIOP.nc"
static   /*inline*/   void /*Hplcip51GeneralIOC.P23_w*/Hplcip51GeneralIOP__19__out__makeOutput(void )
//#line 66
{
  /*Hplcip51GeneralIOC.P23_w*/Hplcip51GeneralIOP__19__in__makePushPull();
}

//# 35 "/scratch/tinyos-2.1.0/tos/interfaces/GeneralIO.nc"
 /*inline*/  static void /*PlatformLedsC.Led1_rev*/ReverseGPIOP__1__In__makeOutput(void ){
//#line 35
  /*Hplcip51GeneralIOC.P23_w*/Hplcip51GeneralIOP__19__out__makeOutput();
//#line 35
}
//#line 35
//# 59 "/home/leopold/tinyos-2.x-contrib/diku/common/lib/ReverseGPIOP.nc"
static   /*inline*/   void /*PlatformLedsC.Led1_rev*/ReverseGPIOP__1__Out__makeOutput(void )
//#line 59
{
//#line 59
  /*PlatformLedsC.Led1_rev*/ReverseGPIOP__1__In__makeOutput();
}

//# 35 "/scratch/tinyos-2.1.0/tos/interfaces/GeneralIO.nc"
 /*inline*/  static void LedsP__Led1__makeOutput(void ){
//#line 35
  /*PlatformLedsC.Led1_rev*/ReverseGPIOP__1__Out__makeOutput();
//#line 35
}
//#line 35
//# 131 "/home/leopold/tinyos-2.x-contrib/diku/mcs51/tos/chips/cip51/pins/Hplcip51IOC.nc"
static   /*inline*/   void Hplcip51IOC__P22__makePushPull(void )
//#line 131
{
//#line 131
  P2MDOUT |= 1 << 2;
}

//# 55 "/home/leopold/tinyos-2.x-contrib/diku/mcs51/tos/chips/cip51/pins/Hplcip51IO.nc"
 /*inline*/  static void /*Hplcip51GeneralIOC.P22_w*/Hplcip51GeneralIOP__18__in__makePushPull(void ){
//#line 55
  Hplcip51IOC__P22__makePushPull();
//#line 55
}
//#line 55
//# 66 "/home/leopold/tinyos-2.x-contrib/diku/mcs51/tos/chips/cip51/pins/Hplcip51GeneralIOP.nc"
static   /*inline*/   void /*Hplcip51GeneralIOC.P22_w*/Hplcip51GeneralIOP__18__out__makeOutput(void )
//#line 66
{
  /*Hplcip51GeneralIOC.P22_w*/Hplcip51GeneralIOP__18__in__makePushPull();
}

//# 35 "/scratch/tinyos-2.1.0/tos/interfaces/GeneralIO.nc"
 /*inline*/  static void /*PlatformLedsC.Led0_rev*/ReverseGPIOP__0__In__makeOutput(void ){
//#line 35
  /*Hplcip51GeneralIOC.P22_w*/Hplcip51GeneralIOP__18__out__makeOutput();
//#line 35
}
//#line 35
//# 59 "/home/leopold/tinyos-2.x-contrib/diku/common/lib/ReverseGPIOP.nc"
static   /*inline*/   void /*PlatformLedsC.Led0_rev*/ReverseGPIOP__0__Out__makeOutput(void )
//#line 59
{
//#line 59
  /*PlatformLedsC.Led0_rev*/ReverseGPIOP__0__In__makeOutput();
}

//# 35 "/scratch/tinyos-2.1.0/tos/interfaces/GeneralIO.nc"
 /*inline*/  static void LedsP__Led0__makeOutput(void ){
//#line 35
  /*PlatformLedsC.Led0_rev*/ReverseGPIOP__0__Out__makeOutput();
//#line 35
}
//#line 35
//# 45 "/scratch/tinyos-2.1.0/tos/system/LedsP.nc"
static  /*inline*/  error_t LedsP__Init__init(void )
//#line 45
{
  /* atomic removed: atomic calls only */
//#line 46
  {
    ;
    LedsP__Led0__makeOutput();
    LedsP__Led1__makeOutput();
    LedsP__Led2__makeOutput();
    LedsP__Led0__set();
    LedsP__Led1__set();
    LedsP__Led2__set();
  }
  return SUCCESS;
}

//# 51 "/scratch/tinyos-2.1.0/tos/interfaces/Init.nc"
 /*inline*/  static error_t PlatformP__LedsInit__init(void ){
//#line 51
  unsigned char result;
//#line 51

//#line 51
  result = LedsP__Init__init();
//#line 51

//#line 51
  return result;
//#line 51
}
//#line 51
//# 163 "/home/leopold/tinyos-2.x-contrib/diku/mcs51/tos/chips/cip51/pins/Hplcip51IOC.nc"
static  /*inline*/  error_t Hplcip51IOC__Init__init(void )
//#line 163
{
//#line 183
  return SUCCESS;
}

//# 51 "/scratch/tinyos-2.1.0/tos/interfaces/Init.nc"
 /*inline*/  static error_t PlatformP__GPIOInit__init(void ){
//#line 51
  unsigned char result;
//#line 51

//#line 51
  result = Hplcip51IOC__Init__init();
//#line 51

//#line 51
  return result;
//#line 51
}
//#line 51
//# 52 "/home/leopold/tinyos-2.x-contrib/diku/mcs51/tos/platforms/c8051F340TB/PlatformP.nc"
static  /*inline*/  error_t PlatformP__Init__init(void )
//#line 52
{
  uint16_t i;


  PCA0MD &= ~0x40;




  OSCICN = 0x83;





  CLKMUL = 0;
  CLKMUL |= 1 << CIP51_CLKMUL_MULEN;
  while (i < 500) {
      i++;
    }
  CLKMUL |= 1 << CIP51_CLKMUL_MULINT;
  while (i < 500) {
      i++;
    }
  while (!(CLKMUL & (1 << CIP51_CLKMUL_MULRDY))) {
    }



  FLSCL |= 0x10;
  CLKSEL = 0x03;
//#line 114
  PlatformP__GPIOInit__init();
  PlatformP__LedsInit__init();

  P0SKIP = 0xC0;
  P1SKIP = 0x03;
  P2SKIP = 0x04;

  XBR0 = 0x07;
  XBR1 = 0x40;


  EA = 1;

  return SUCCESS;
}

//# 51 "/scratch/tinyos-2.1.0/tos/interfaces/Init.nc"
 /*inline*/  static error_t RealMainP__PlatformInit__init(void ){
//#line 51
  unsigned char result;
//#line 51

//#line 51
  result = PlatformP__Init__init();
//#line 51

//#line 51
  return result;
//#line 51
}
//#line 51
//# 54 "/scratch/tinyos-2.1.0/tos/interfaces/Scheduler.nc"
 /*inline*/  static bool RealMainP__Scheduler__runNextTask(void ){
//#line 54
  unsigned char result;
//#line 54

//#line 54
  result = SchedulerBasicP__Scheduler__runNextTask();
//#line 54

//#line 54
  return result;
//#line 54
}
//#line 54
//# 56 "/scratch/tinyos-2.1.0/tos/interfaces/TaskBasic.nc"
 /*inline*/  static error_t BlinkNoTimerTaskC__toggle__postTask(void ){
//#line 56
  unsigned char result;
//#line 56

//#line 56
  result = SchedulerBasicP__TaskBasic__postTask(BlinkNoTimerTaskC__toggle);
//#line 56

//#line 56
  return result;
//#line 56
}
//#line 56
//# 86 "/scratch/tinyos-2.1.0/tos/system/SchedulerBasicP.nc"
static  /*inline*/  bool SchedulerBasicP__isWaiting(uint8_t id)
{
  return SchedulerBasicP__m_next[id] != SchedulerBasicP__NO_TASK || SchedulerBasicP__m_tail == id;
}

static  /*inline*/  bool SchedulerBasicP__pushTask(uint8_t id)
{
  if (!SchedulerBasicP__isWaiting(id)) 
    {
      if (SchedulerBasicP__m_head == SchedulerBasicP__NO_TASK) 
        {
          SchedulerBasicP__m_head = id;
          SchedulerBasicP__m_tail = id;
        }
      else 
        {
          SchedulerBasicP__m_next[SchedulerBasicP__m_tail] = id;
          SchedulerBasicP__m_tail = id;
        }
      return TRUE;
    }
  else 
    {
      return FALSE;
    }
}

//# 94 "/scratch/tinyos-2.1.0/tos/system/RealMainP.nc"
static  /*inline*/  error_t RealMainP__SoftwareInit__default__init(void )
//#line 94
{
//#line 94
  return SUCCESS;
}

//# 51 "/scratch/tinyos-2.1.0/tos/interfaces/Init.nc"
 /*inline*/  static error_t RealMainP__SoftwareInit__init(void ){
//#line 51
  unsigned char result;
//#line 51

//#line 51
  result = RealMainP__SoftwareInit__default__init();
//#line 51

//#line 51
  return result;
//#line 51
}
//#line 51
//# 56 "/scratch/tinyos-2.1.0/tos/interfaces/TaskBasic.nc"
 /*inline*/  static error_t BlinkNoTimerTaskC__delay__postTask(void ){
//#line 56
  unsigned char result;
//#line 56

//#line 56
  result = SchedulerBasicP__TaskBasic__postTask(BlinkNoTimerTaskC__delay);
//#line 56

//#line 56
  return result;
//#line 56
}
//#line 56
//# 23 "/scratch/tinyos-2.1.0/tos/system/NoPinC.nc"
static  /*inline*/  void /*PlatformLedsC.NoPinC*/NoPinC__0__GeneralIO__set(void )
//#line 23
{
}

//# 29 "/scratch/tinyos-2.1.0/tos/interfaces/GeneralIO.nc"
 /*inline*/  static void /*PlatformLedsC.Led2_rev*/ReverseGPIOP__2__In__set(void ){
//#line 29
  /*PlatformLedsC.NoPinC*/NoPinC__0__GeneralIO__set();
//#line 29
}
//#line 29
//# 59 "/home/leopold/tinyos-2.x-contrib/diku/common/lib/ReverseGPIOP.nc"
static   /*inline*/   void /*PlatformLedsC.Led2_rev*/ReverseGPIOP__2__Out__clr(void )
//#line 59
{
//#line 59
  /*PlatformLedsC.Led2_rev*/ReverseGPIOP__2__In__set();
}

//# 30 "/scratch/tinyos-2.1.0/tos/interfaces/GeneralIO.nc"
 /*inline*/  static void LedsP__Led2__clr(void ){
//#line 30
  /*PlatformLedsC.Led2_rev*/ReverseGPIOP__2__Out__clr();
//#line 30
}
//#line 30
//# 93 "/scratch/tinyos-2.1.0/tos/system/LedsP.nc"
static  /*inline*/  void LedsP__Leds__led2On(void )
//#line 93
{
  LedsP__Led2__clr();
  ;
//#line 95
  ;
}

//# 78 "/scratch/tinyos-2.1.0/tos/interfaces/Leds.nc"
 /*inline*/  static void BlinkNoTimerTaskC__Leds__led2On(void ){
//#line 78
  LedsP__Leds__led2On();
//#line 78
}
//#line 78
//# 132 "/home/leopold/tinyos-2.x-contrib/diku/mcs51/tos/chips/cip51/pins/Hplcip51IOC.nc"
static   /*inline*/   void Hplcip51IOC__P23__set(void )
//#line 132
{
//#line 132
  P2_3 = 1;
}

//# 43 "/home/leopold/tinyos-2.x-contrib/diku/mcs51/tos/chips/cip51/pins/Hplcip51IO.nc"
 /*inline*/  static void /*Hplcip51GeneralIOC.P23_w*/Hplcip51GeneralIOP__19__in__set(void ){
//#line 43
  Hplcip51IOC__P23__set();
//#line 43
}
//#line 43
//# 53 "/home/leopold/tinyos-2.x-contrib/diku/mcs51/tos/chips/cip51/pins/Hplcip51GeneralIOP.nc"
static   /*inline*/   void /*Hplcip51GeneralIOC.P23_w*/Hplcip51GeneralIOP__19__out__set(void )
//#line 53
{
//#line 53
  /*Hplcip51GeneralIOC.P23_w*/Hplcip51GeneralIOP__19__in__set();
}

//# 29 "/scratch/tinyos-2.1.0/tos/interfaces/GeneralIO.nc"
 /*inline*/  static void /*PlatformLedsC.Led1_rev*/ReverseGPIOP__1__In__set(void ){
//#line 29
  /*Hplcip51GeneralIOC.P23_w*/Hplcip51GeneralIOP__19__out__set();
//#line 29
}
//#line 29
//# 59 "/home/leopold/tinyos-2.x-contrib/diku/common/lib/ReverseGPIOP.nc"
static   /*inline*/   void /*PlatformLedsC.Led1_rev*/ReverseGPIOP__1__Out__clr(void )
//#line 59
{
//#line 59
  /*PlatformLedsC.Led1_rev*/ReverseGPIOP__1__In__set();
}

//# 30 "/scratch/tinyos-2.1.0/tos/interfaces/GeneralIO.nc"
 /*inline*/  static void LedsP__Led1__clr(void ){
//#line 30
  /*PlatformLedsC.Led1_rev*/ReverseGPIOP__1__Out__clr();
//#line 30
}
//#line 30
//# 78 "/scratch/tinyos-2.1.0/tos/system/LedsP.nc"
static  /*inline*/  void LedsP__Leds__led1On(void )
//#line 78
{
  LedsP__Led1__clr();
  ;
//#line 80
  ;
}

//# 61 "/scratch/tinyos-2.1.0/tos/interfaces/Leds.nc"
 /*inline*/  static void BlinkNoTimerTaskC__Leds__led1On(void ){
//#line 61
  LedsP__Leds__led1On();
//#line 61
}
//#line 61
//# 131 "/home/leopold/tinyos-2.x-contrib/diku/mcs51/tos/chips/cip51/pins/Hplcip51IOC.nc"
static   /*inline*/   void Hplcip51IOC__P22__set(void )
//#line 131
{
//#line 131
  P2_2 = 1;
}

//# 43 "/home/leopold/tinyos-2.x-contrib/diku/mcs51/tos/chips/cip51/pins/Hplcip51IO.nc"
 /*inline*/  static void /*Hplcip51GeneralIOC.P22_w*/Hplcip51GeneralIOP__18__in__set(void ){
//#line 43
  Hplcip51IOC__P22__set();
//#line 43
}
//#line 43
//# 53 "/home/leopold/tinyos-2.x-contrib/diku/mcs51/tos/chips/cip51/pins/Hplcip51GeneralIOP.nc"
static   /*inline*/   void /*Hplcip51GeneralIOC.P22_w*/Hplcip51GeneralIOP__18__out__set(void )
//#line 53
{
//#line 53
  /*Hplcip51GeneralIOC.P22_w*/Hplcip51GeneralIOP__18__in__set();
}

//# 29 "/scratch/tinyos-2.1.0/tos/interfaces/GeneralIO.nc"
 /*inline*/  static void /*PlatformLedsC.Led0_rev*/ReverseGPIOP__0__In__set(void ){
//#line 29
  /*Hplcip51GeneralIOC.P22_w*/Hplcip51GeneralIOP__18__out__set();
//#line 29
}
//#line 29
//# 59 "/home/leopold/tinyos-2.x-contrib/diku/common/lib/ReverseGPIOP.nc"
static   /*inline*/   void /*PlatformLedsC.Led0_rev*/ReverseGPIOP__0__Out__clr(void )
//#line 59
{
//#line 59
  /*PlatformLedsC.Led0_rev*/ReverseGPIOP__0__In__set();
}

//# 30 "/scratch/tinyos-2.1.0/tos/interfaces/GeneralIO.nc"
 /*inline*/  static void LedsP__Led0__clr(void ){
//#line 30
  /*PlatformLedsC.Led0_rev*/ReverseGPIOP__0__Out__clr();
//#line 30
}
//#line 30
//# 63 "/scratch/tinyos-2.1.0/tos/system/LedsP.nc"
static  /*inline*/  void LedsP__Leds__led0On(void )
//#line 63
{
  LedsP__Led0__clr();
  ;
//#line 65
  ;
}

//# 45 "/scratch/tinyos-2.1.0/tos/interfaces/Leds.nc"
 /*inline*/  static void BlinkNoTimerTaskC__Leds__led0On(void ){
//#line 45
  LedsP__Leds__led0On();
//#line 45
}
//#line 45
//# 51 "BlinkNoTimerTaskC.nc"
static  /*inline*/  void BlinkNoTimerTaskC__Boot__booted(void )
//#line 51
{
  BlinkNoTimerTaskC__Leds__led0On();
  BlinkNoTimerTaskC__Leds__led1On();
  BlinkNoTimerTaskC__Leds__led2On();

  BlinkNoTimerTaskC__delay__postTask();
}

//# 49 "/scratch/tinyos-2.1.0/tos/interfaces/Boot.nc"
 /*inline*/  static void RealMainP__Boot__booted(void ){
//#line 49
  BlinkNoTimerTaskC__Boot__booted();
//#line 49
}
//#line 49
//# 25 "/scratch/tinyos-2.1.0/tos/system/NoPinC.nc"
static  /*inline*/  void /*PlatformLedsC.NoPinC*/NoPinC__0__GeneralIO__toggle(void )
//#line 25
{
}

//# 31 "/scratch/tinyos-2.1.0/tos/interfaces/GeneralIO.nc"
 /*inline*/  static void /*PlatformLedsC.Led2_rev*/ReverseGPIOP__2__In__toggle(void ){
//#line 31
  /*PlatformLedsC.NoPinC*/NoPinC__0__GeneralIO__toggle();
//#line 31
}
//#line 31
//# 59 "/home/leopold/tinyos-2.x-contrib/diku/common/lib/ReverseGPIOP.nc"
static  /*inline*/  void /*PlatformLedsC.Led2_rev*/ReverseGPIOP__2__Out__toggle(void )
//#line 59
{
//#line 59
  { __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
//#line 59
    {
//#line 59
      /*PlatformLedsC.Led2_rev*/ReverseGPIOP__2__In__toggle();
    }
//#line 60
    __nesc_atomic_end(__nesc_atomic); }
}

//# 31 "/scratch/tinyos-2.1.0/tos/interfaces/GeneralIO.nc"
 /*inline*/  static void LedsP__Led2__toggle(void ){
//#line 31
  /*PlatformLedsC.Led2_rev*/ReverseGPIOP__2__Out__toggle();
//#line 31
}
//#line 31
//# 103 "/scratch/tinyos-2.1.0/tos/system/LedsP.nc"
static  /*inline*/  void LedsP__Leds__led2Toggle(void )
//#line 103
{
  LedsP__Led2__toggle();
  ;
//#line 105
  ;
}

//# 89 "/scratch/tinyos-2.1.0/tos/interfaces/Leds.nc"
 /*inline*/  static void BlinkNoTimerTaskC__Leds__led2Toggle(void ){
//#line 89
  LedsP__Leds__led2Toggle();
//#line 89
}
//#line 89
//# 132 "/home/leopold/tinyos-2.x-contrib/diku/mcs51/tos/chips/cip51/pins/Hplcip51IOC.nc"
static  /*inline*/  void Hplcip51IOC__P23__toggle(void )
//#line 132
{
  /* atomic removed: atomic calls only */
//#line 132
  {
//#line 132
    P2_3 = ~P2_3;
  }
}

//# 45 "/home/leopold/tinyos-2.x-contrib/diku/mcs51/tos/chips/cip51/pins/Hplcip51IO.nc"
 /*inline*/  static void /*Hplcip51GeneralIOC.P23_w*/Hplcip51GeneralIOP__19__in__toggle(void ){
//#line 45
  Hplcip51IOC__P23__toggle();
//#line 45
}
//#line 45
//# 55 "/home/leopold/tinyos-2.x-contrib/diku/mcs51/tos/chips/cip51/pins/Hplcip51GeneralIOP.nc"
static  /*inline*/  void /*Hplcip51GeneralIOC.P23_w*/Hplcip51GeneralIOP__19__out__toggle(void )
//#line 55
{
  /* atomic removed: atomic calls only */
//#line 55
  {
//#line 55
    /*Hplcip51GeneralIOC.P23_w*/Hplcip51GeneralIOP__19__in__toggle();
  }
}

//# 31 "/scratch/tinyos-2.1.0/tos/interfaces/GeneralIO.nc"
 /*inline*/  static void /*PlatformLedsC.Led1_rev*/ReverseGPIOP__1__In__toggle(void ){
//#line 31
  /*Hplcip51GeneralIOC.P23_w*/Hplcip51GeneralIOP__19__out__toggle();
//#line 31
}
//#line 31
//# 59 "/home/leopold/tinyos-2.x-contrib/diku/common/lib/ReverseGPIOP.nc"
static  /*inline*/  void /*PlatformLedsC.Led1_rev*/ReverseGPIOP__1__Out__toggle(void )
//#line 59
{
//#line 59
  { __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
//#line 59
    {
//#line 59
      /*PlatformLedsC.Led1_rev*/ReverseGPIOP__1__In__toggle();
    }
//#line 60
    __nesc_atomic_end(__nesc_atomic); }
}

//# 31 "/scratch/tinyos-2.1.0/tos/interfaces/GeneralIO.nc"
 /*inline*/  static void LedsP__Led1__toggle(void ){
//#line 31
  /*PlatformLedsC.Led1_rev*/ReverseGPIOP__1__Out__toggle();
//#line 31
}
//#line 31
//# 88 "/scratch/tinyos-2.1.0/tos/system/LedsP.nc"
static  /*inline*/  void LedsP__Leds__led1Toggle(void )
//#line 88
{
  LedsP__Led1__toggle();
  ;
//#line 90
  ;
}

//# 72 "/scratch/tinyos-2.1.0/tos/interfaces/Leds.nc"
 /*inline*/  static void BlinkNoTimerTaskC__Leds__led1Toggle(void ){
//#line 72
  LedsP__Leds__led1Toggle();
//#line 72
}
//#line 72
//# 131 "/home/leopold/tinyos-2.x-contrib/diku/mcs51/tos/chips/cip51/pins/Hplcip51IOC.nc"
static  /*inline*/  void Hplcip51IOC__P22__toggle(void )
//#line 131
{
  /* atomic removed: atomic calls only */
//#line 131
  {
//#line 131
    P2_2 = ~P2_2;
  }
}

//# 45 "/home/leopold/tinyos-2.x-contrib/diku/mcs51/tos/chips/cip51/pins/Hplcip51IO.nc"
 /*inline*/  static void /*Hplcip51GeneralIOC.P22_w*/Hplcip51GeneralIOP__18__in__toggle(void ){
//#line 45
  Hplcip51IOC__P22__toggle();
//#line 45
}
//#line 45
//# 55 "/home/leopold/tinyos-2.x-contrib/diku/mcs51/tos/chips/cip51/pins/Hplcip51GeneralIOP.nc"
static  /*inline*/  void /*Hplcip51GeneralIOC.P22_w*/Hplcip51GeneralIOP__18__out__toggle(void )
//#line 55
{
  /* atomic removed: atomic calls only */
//#line 55
  {
//#line 55
    /*Hplcip51GeneralIOC.P22_w*/Hplcip51GeneralIOP__18__in__toggle();
  }
}

//# 31 "/scratch/tinyos-2.1.0/tos/interfaces/GeneralIO.nc"
 /*inline*/  static void /*PlatformLedsC.Led0_rev*/ReverseGPIOP__0__In__toggle(void ){
//#line 31
  /*Hplcip51GeneralIOC.P22_w*/Hplcip51GeneralIOP__18__out__toggle();
//#line 31
}
//#line 31
//# 59 "/home/leopold/tinyos-2.x-contrib/diku/common/lib/ReverseGPIOP.nc"
static  /*inline*/  void /*PlatformLedsC.Led0_rev*/ReverseGPIOP__0__Out__toggle(void )
//#line 59
{
//#line 59
  { __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
//#line 59
    {
//#line 59
      /*PlatformLedsC.Led0_rev*/ReverseGPIOP__0__In__toggle();
    }
//#line 60
    __nesc_atomic_end(__nesc_atomic); }
}

//# 31 "/scratch/tinyos-2.1.0/tos/interfaces/GeneralIO.nc"
 /*inline*/  static void LedsP__Led0__toggle(void ){
//#line 31
  /*PlatformLedsC.Led0_rev*/ReverseGPIOP__0__Out__toggle();
//#line 31
}
//#line 31
//# 73 "/scratch/tinyos-2.1.0/tos/system/LedsP.nc"
static  /*inline*/  void LedsP__Leds__led0Toggle(void )
//#line 73
{
  LedsP__Led0__toggle();
  ;
//#line 75
  ;
}

//# 56 "/scratch/tinyos-2.1.0/tos/interfaces/Leds.nc"
 /*inline*/  static void BlinkNoTimerTaskC__Leds__led0Toggle(void ){
//#line 56
  LedsP__Leds__led0Toggle();
//#line 56
}
//#line 56
//# 69 "BlinkNoTimerTaskC.nc"
static  /*inline*/  void BlinkNoTimerTaskC__toggle__runTask(void )
//#line 69
{

  BlinkNoTimerTaskC__Leds__led0Toggle();
  BlinkNoTimerTaskC__Leds__led1Toggle();
  BlinkNoTimerTaskC__Leds__led2Toggle();
}

//# 164 "/scratch/tinyos-2.1.0/tos/system/SchedulerBasicP.nc"
static  /*inline*/  void SchedulerBasicP__TaskBasic__default__runTask(uint8_t id)
{
}

//# 64 "/scratch/tinyos-2.1.0/tos/interfaces/TaskBasic.nc"
 /*inline*/  static void SchedulerBasicP__TaskBasic__runTask(uint8_t arg_0x40347860){
//#line 64
  switch (arg_0x40347860) {
//#line 64
    case BlinkNoTimerTaskC__toggle:
//#line 64
      BlinkNoTimerTaskC__toggle__runTask();
//#line 64
      break;
//#line 64
    case BlinkNoTimerTaskC__delay:
//#line 64
      BlinkNoTimerTaskC__delay__runTask();
//#line 64
      break;
//#line 64
    default:
//#line 64
      SchedulerBasicP__TaskBasic__default__runTask(arg_0x40347860);
//#line 64
      break;
//#line 64
    }
//#line 64
}
//#line 64
//# 107 "/home/leopold/tinyos-2.x-contrib/diku/mcs51/tos/chips/mcs51/mcs51hardware.h"
static   /*inline*/   void __nesc_disable_interrupt()
//#line 107
{
//#line 107
  EA = 0;
}

//#line 108
static   /*inline*/   void __nesc_enable_interrupt()
//#line 108
{
//#line 108
  EA = 1;
}

//# 50 "/home/leopold/tinyos-2.x-contrib/diku/mcs51/tos/chips/cip51/McuSleepC.nc"
static  /*inline*/  void McuSleepC__McuSleep__sleep(void )
//#line 50
{

  __nesc_enable_interrupt();
  {
//#line 53
    uint8_t q = 0;

//#line 54
    while (q < 10) {
        q++;
      }
  }


  __nesc_disable_interrupt();
}

//# 59 "/scratch/tinyos-2.1.0/tos/interfaces/McuSleep.nc"
 /*inline*/  static void SchedulerBasicP__McuSleep__sleep(void ){
//#line 59
  McuSleepC__McuSleep__sleep();
//#line 59
}
//#line 59
//# 67 "/scratch/tinyos-2.1.0/tos/system/SchedulerBasicP.nc"
static   /*inline*/   uint8_t SchedulerBasicP__popTask(void )
{
  if (SchedulerBasicP__m_head != SchedulerBasicP__NO_TASK) 
    {
      uint8_t id = SchedulerBasicP__m_head;

//#line 72
      SchedulerBasicP__m_head = SchedulerBasicP__m_next[SchedulerBasicP__m_head];
      if (SchedulerBasicP__m_head == SchedulerBasicP__NO_TASK) 
        {
          SchedulerBasicP__m_tail = SchedulerBasicP__NO_TASK;
        }
      SchedulerBasicP__m_next[id] = SchedulerBasicP__NO_TASK;
      return id;
    }
  else 
    {
      return SchedulerBasicP__NO_TASK;
    }
}

//#line 138
static  /*inline*/  void SchedulerBasicP__Scheduler__taskLoop(void )
{
  for (; ; ) 
    {
      uint8_t nextTask;

      { __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
        {
          while ((nextTask = SchedulerBasicP__popTask()) == SchedulerBasicP__NO_TASK) 
            {
              SchedulerBasicP__McuSleep__sleep();
            }
        }
//#line 150
        __nesc_atomic_end(__nesc_atomic); }
      SchedulerBasicP__TaskBasic__runTask(nextTask);
    }
}

//# 61 "/scratch/tinyos-2.1.0/tos/interfaces/Scheduler.nc"
 /*inline*/  static void RealMainP__Scheduler__taskLoop(void ){
//#line 61
  SchedulerBasicP__Scheduler__taskLoop();
//#line 61
}
//#line 61
//# 52 "/scratch/tinyos-2.1.0/tos/system/RealMainP.nc"
  int main(void )
//#line 52
{
  { __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
    {





      {
      }
//#line 60
      ;

      RealMainP__Scheduler__init();





      RealMainP__PlatformInit__init();
      while (RealMainP__Scheduler__runNextTask()) ;





      RealMainP__SoftwareInit__init();
      while (RealMainP__Scheduler__runNextTask()) ;
    }
//#line 77
    __nesc_atomic_end(__nesc_atomic); }


  __nesc_enable_interrupt();

  RealMainP__Boot__booted();


  RealMainP__Scheduler__taskLoop();




  return -1;
}

//# 123 "/scratch/tinyos-2.1.0/tos/system/SchedulerBasicP.nc"
static bool SchedulerBasicP__Scheduler__runNextTask(void )
{
  uint8_t nextTask;

  /* atomic removed: atomic calls only */
//#line 127
  {
    nextTask = SchedulerBasicP__popTask();
    if (nextTask == SchedulerBasicP__NO_TASK) 
      {
        {
          unsigned char __nesc_temp = 
//#line 131
          FALSE;

//#line 131
          return __nesc_temp;
        }
      }
  }
//#line 134
  SchedulerBasicP__TaskBasic__runTask(nextTask);
  return TRUE;
}

//# 59 "BlinkNoTimerTaskC.nc"
static void BlinkNoTimerTaskC__delay__runTask(void )
//#line 59
{
  uint16_t i;
//#line 60
  uint16_t j;

  for (i = 0; i < 0x1FFU; i++) {
      for (j = 0; j < 0xA0; j++) {
        }
    }
  BlinkNoTimerTaskC__toggle__postTask();
  BlinkNoTimerTaskC__delay__postTask();
}

//# 159 "/scratch/tinyos-2.1.0/tos/system/SchedulerBasicP.nc"
static error_t SchedulerBasicP__TaskBasic__postTask(uint8_t id)
{
  { __nesc_atomic_t __nesc_atomic = __nesc_atomic_start();
//#line 161
    {
//#line 161
      {
        unsigned char __nesc_temp = 
//#line 161
        SchedulerBasicP__pushTask(id) ? SUCCESS : EBUSY;

        {
//#line 161
          __nesc_atomic_end(__nesc_atomic); 
//#line 161
          return __nesc_temp;
        }
      }
    }
//#line 164
    __nesc_atomic_end(__nesc_atomic); }
}

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Sdcc-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to