Three phase sequence reversal detection using aruino uno

Hello,
I am trying to detect phase sequence of three phase power using arduino. I have three phase digital pulses to the input of the arduino board. The base is to determine the reference point and measure the rising time of the other remaining 2 phases pulses.
How do I set the reference point i.e when phase at pin when start to rise?
How do I determine when the second phase pulse starts to rise?
How do I know when phase reversal has occurred?
Please help.

Samvil:
How do I set the reference point i.e when phase at pin when start to rise?

IDE -> file/examples/digital/stateChangeDetection

In truth the first five demos are essential knowledge.

Samvil:
How do I determine when the second phase pulse starts to rise?

Make a timestamp copy of millis() on first phase rise and one on second phase rise then subtract.

Samvil:
How do I know when phase reversal has occurred?

Search the web for 'quadrature encoder'. The waveforms from an encoder are very similar to your 3-phase signals. Do a quadrature decode on each pair of phases.

You are going to need some signal conditioning as the Arduino can’t work with negative voltages . If you used small transformers plus three comparitors set to some fixed voltage all you need to do is look at the order the 3 comparitors trip to see whether a phase is reversed (and coming up in the wrong sequence).
Use one phase ( any one, say blue) as the reference , then all you need to know is if , say the yellow or red phase comes next .

I have three phase digital pulses to the input of the arduino board.

Where do these pulses come from? What is their voltage and polarity?