
/* Generated by fzmparser version 1.14 --- DO NOT EDIT! */

/* Uses following resources: */
/* [9 events, 5+1 states, 1 inputs, 5 outputs, 7 match regs, 0 capture regs] */

#include "sct_fsm.h"


void sct_fsm_init (void)
{

/* MATCH/CAPTURE registers */
LPC_SCT->REGMODE_L = 0x0000;         /* L: 6x MATCH, 0x CAPTURE, 10 unused */
LPC_SCT->REGMODE_H = 0x0000;             /* H: 1x MATCH, 0x CAPTURE, 15 unused */
LPC_SCT->MATCH_L[0] = yellow_on_time;
LPC_SCT->MATCHREL_L[0] = yellow_on_time;
LPC_SCT->MATCH_H[0] = pedestrianCross_time;
LPC_SCT->MATCHREL_H[0] = pedestrianCross_time;
LPC_SCT->MATCH_L[1] = red_off_time;
LPC_SCT->MATCHREL_L[1] = red_off_time;
LPC_SCT->MATCH_L[2] = yellow_off_time;
LPC_SCT->MATCHREL_L[2] = yellow_off_time;
LPC_SCT->MATCH_L[3] = pedestrian_walk_time;
LPC_SCT->MATCHREL_L[3] = pedestrian_walk_time;
LPC_SCT->MATCH_L[4] = red_on_time;
LPC_SCT->MATCHREL_L[4] = red_on_time;
LPC_SCT->MATCH_L[5] = pedestrian_stop_time;
LPC_SCT->MATCHREL_L[5] = pedestrian_stop_time;

/* OUTPUT registers */
LPC_SCT->OUT[10].SET = 0x00000008;        /* GREEN_N */
LPC_SCT->OUT[10].CLR = 0x000000E6;
LPC_SCT->OUT[13].SET = 0x00000010;        /* BLUE_N */
LPC_SCT->OUT[13].CLR = 0x00000100;
LPC_SCT->OUT[14].SET = 0x00000020;        /* RED_N */
LPC_SCT->OUT[14].CLR = 0x0000014A;
LPC_SCT->OUT[8].SET = 0x00000084;        /* REQUEST */
LPC_SCT->OUT[8].CLR = 0x00000010;
LPC_SCT->OUT[11].SET = 0x00000001;        /* AUTO_CROSS */
LPC_SCT->OUT[11].CLR = 0x00000020;
  /* Unused outputs must not be affected by any event */
LPC_SCT->OUT[0].SET = 0;
LPC_SCT->OUT[0].CLR = 0;
LPC_SCT->OUT[1].SET = 0;
LPC_SCT->OUT[1].CLR = 0;
LPC_SCT->OUT[2].SET = 0;
LPC_SCT->OUT[2].CLR = 0;
LPC_SCT->OUT[3].SET = 0;
LPC_SCT->OUT[3].CLR = 0;
LPC_SCT->OUT[4].SET = 0;
LPC_SCT->OUT[4].CLR = 0;
LPC_SCT->OUT[5].SET = 0;
LPC_SCT->OUT[5].CLR = 0;
LPC_SCT->OUT[6].SET = 0;
LPC_SCT->OUT[6].CLR = 0;
LPC_SCT->OUT[7].SET = 0;
LPC_SCT->OUT[7].CLR = 0;
LPC_SCT->OUT[9].SET = 0;
LPC_SCT->OUT[9].CLR = 0;
LPC_SCT->OUT[12].SET = 0;
LPC_SCT->OUT[12].CLR = 0;
LPC_SCT->OUT[15].SET = 0;
LPC_SCT->OUT[15].CLR = 0;
LPC_SCT->OUTPUT = (LPC_SCT->OUTPUT & ~0x00000D00) | 0x00006000;

/* Conflict resolution register */

/* EVENT registers */
LPC_SCT->EVENT[0].CTRL = 0x00005010;     /* H: --> state H_ENTRY */
LPC_SCT->EVENT[0].STATE = 0x00000001;
LPC_SCT->EVENT[1].CTRL = 0x0000D000;     /* L: --> state YELLOW_ON_State */
LPC_SCT->EVENT[1].STATE = 0x00000008;
LPC_SCT->EVENT[2].CTRL = 0x0001E6E0;     /* L: --> state GREEN_ON_state */
LPC_SCT->EVENT[2].STATE = 0x00000001;
LPC_SCT->EVENT[3].CTRL = 0x00027E24;     /* L: --> state RED_ON_State */
LPC_SCT->EVENT[3].STATE = 0x00000002;
LPC_SCT->EVENT[4].CTRL = 0x00025005;     /* L: --> state RED_ON_State */
LPC_SCT->EVENT[4].STATE = 0x00000004;
LPC_SCT->EVENT[5].CTRL = 0x00007222;     /* L: --> state L_ENTRY */
LPC_SCT->EVENT[5].STATE = 0x00000002;
LPC_SCT->EVENT[6].CTRL = 0x0000F221;     /* L: --> state YELLOW_ON_State */
LPC_SCT->EVENT[6].STATE = 0x00000010;
LPC_SCT->EVENT[7].CTRL = 0x0001E400;     /* L: --> state GREEN_ON_state */
LPC_SCT->EVENT[7].STATE = 0x00000001;
LPC_SCT->EVENT[8].CTRL = 0x00017E23;     /* L: --> state WALK_State */
LPC_SCT->EVENT[8].STATE = 0x00000010;
  /* Unused events must not have any effect */
LPC_SCT->EVENT[9].STATE = 0;
LPC_SCT->EVENT[10].STATE = 0;
LPC_SCT->EVENT[11].STATE = 0;
LPC_SCT->EVENT[12].STATE = 0;
LPC_SCT->EVENT[13].STATE = 0;
LPC_SCT->EVENT[14].STATE = 0;
LPC_SCT->EVENT[15].STATE = 0;

/* STATE registers */
LPC_SCT->STATE_L = 0;
LPC_SCT->STATE_H = 0;

/* state names assignment: */
  /* State L 0: L_ENTRY */
  /* State L 1: YELLOW_ON_State */
  /* State L 2: WALK_State */
  /* State L 3: GREEN_ON_state */
  /* State L 4: RED_ON_State */
  /* State H 0: H_ENTRY */

/* CORE registers */
LPC_SCT->START_L = 0x0000;
LPC_SCT->STOP_L =  0x0000;
LPC_SCT->HALT_L =  0x0000;
LPC_SCT->LIMIT_L = 0x01FE;
LPC_SCT->START_H = 0x0020;
LPC_SCT->STOP_H =  0x0001;
LPC_SCT->HALT_H =  0x0000;
LPC_SCT->LIMIT_H = 0x0020;
LPC_SCT->EVEN =    0x00000004;
LPC_SCT->DMA0REQUEST = 0x00000000;
LPC_SCT->DMA1REQUEST = 0x00000000;

}
