System Installation
96M4321o User’s Manual
3-13
Set_CFG(0x07, 0x07); /* Select logic device 07*/
Set_CFG(0xF1, 0x0d); /* GP11 -> ~GP15 */
d = Get_CFG(0xF1);
/* get GPIO Port 1 data */
d = d & 0xF0;
if (d != 0xd0 )
{
printf("\nGP11 -> GP15 test fail !!!\n\n");
Set_CFG(0xF0, 0xff); /* GPIO Port 1 is input */
exit(1);
}
Set_CFG(0x07, 0x07); /* Select logic device 07*/
Set_CFG(0xF1, 0x0b); /* GP12 -> ~GP16 */
d = Get_CFG(0xF1);
/* get GPIO Port 1 data */
d = d & 0xF0;
if (d != 0xb0 )
{
printf("\nGP12 -> GP16 test fail !!!\n\n");
Set_CFG(0xF0, 0xff); /* GPIO Port 1 is input */
exit(1);
}
Set_CFG(0x07, 0x07); /* Select logic device 07*/
Set_CFG(0xF1, 0x07); /* GP13 -> ~GP17 */
d = Get_CFG(0xF1);
/* get GPIO Port 1 data */
d = d & 0xF0;
if (d != 0x70 )
{
printf("\nGP13 -> GP17 test fail !!!\n\n");
Set_CFG(0xF0, 0xff); /* GPIO Port 1 is input */
exit(1);
}
/* IO test loop 2 */
/* Set GPIO Port 1 Enable */
Set_CFG(0x07, 0x07); /* Select logic device 07*/
Set_CFG(0x30, 0x01); /* Enable GPIO Port 1 */
Set_CFG(0xF0, 0x0F); /* GPIO Port 1 B7-4 is output, B3-0 is input */