/* Setup the external reset length. The length is asserted during a time of pow(2, powl+1) Slow Clock(32KHz). The duration is between 60us and 2s.  */
void RSTC_SetExtResetLength(AT91PS_RSTC rstc, unsigned char powl)
/* Setup the external reset length. The length is asserted during a time of pow(2, powl+1) Slow Clock(32KHz). The duration is between 60us and 2s.  */
void RSTC_SetExtResetLength(AT91PS_RSTC rstc, unsigned char powl)
{
    unsigned int rmr = READ_RSTC(rstc, RSTC_RMR);
    rmr &= ~(AT91C_RSTC_KEY | AT91C_RSTC_ERSTL);
    rmr |=  (powl << 8) & AT91C_RSTC_ERSTL;
    WRITE_RSTC(rstc, RSTC_RMR, rmr | RSTC_KEY_PASSWORD);
}