/* Initialize EIM controller. 
Only setup the data port size and enable the chip select. */
uint32_t eim_init(uint32_t cs, uint32_t dsz, uint32_t mum, uint32_t aus)
/* Initialize EIM controller. 
Only setup the data port size and enable the chip select. */
uint32_t eim_init(uint32_t cs, uint32_t dsz, uint32_t mum, uint32_t aus)
{
    if (cs >= EIM_NUM_CS) {
        printf("Invalid chip select.\n");
        return FALSE;
    }
    if ((dsz > REG_CSCFG_MAX_DSZ) || (dsz < REG_CSCFG_MIN_DSZ)) {
        printf("Invalid data port size.\n");
        return FALSE;
    }
    HW_EIM_CS_REGS[cs].GCR1.B.DSZ = dsz;
    HW_EIM_CS_REGS[cs].GCR1.B.MUM = mum;
    HW_EIM_CS_REGS[cs].GCR1.B.AUS = aus;
    HW_EIM_CS_REGS[cs].GCR1.B.CSEN = 1;
    eim_iomux_config();
    return TRUE;
}