FreeCalypso > hg > fc-magnetite
diff src/g23m-aci/aci/ati_fcmisc.c @ 668:4011858168a1
AT@LPG and AT@PWL implemented in aci3
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Thu, 28 May 2020 02:13:50 +0000 |
parents | cf1cfe12a54a |
children | def882d1b354 |
line wrap: on
line diff
--- a/src/g23m-aci/aci/ati_fcmisc.c Thu May 28 01:47:28 2020 +0000 +++ b/src/g23m-aci/aci/ati_fcmisc.c Thu May 28 02:13:50 2020 +0000 @@ -57,6 +57,8 @@ #endif /*FF_ATI_BAT*/ #include "main/sys_types.h" +#include "fc-target.h" +#include "armio.h" extern SYS_UWORD8 SIM_allow_speed_enhancement; @@ -94,4 +96,73 @@ return (ATI_CMPL); } +#ifdef TARGET_HAS_LPG +/* AT@LPG - program LPG output */ +GLOBAL T_ATI_RSLT atAtLPG ( char *cl, UBYTE srcId ) +{ + unsigned glob, period = 0, ontime = 0; + + TRACE_FUNCTION("atAtLPG()"); + + cl = parse(cl, "Ddd", &glob, &period, &ontime); + if (!cl) + return (ATI_FAIL); + if (glob > 3 || period > 7 || ontime > 7) + return (ATI_FAIL); + *(volatile SYS_UWORD8 *)0xFFFE7801 = 0x01; + *(volatile SYS_UWORD8 *)0xFFFE7800 = + (glob << 6) | (ontime << 3) | period; + return (ATI_CMPL); +} + +GLOBAL T_ATI_RSLT queatAtLPG (char *cl, UBYTE srcId) +{ + char *me="@LPG: "; + SYS_UWORD8 regval; + unsigned glob, period, ontime; + + TRACE_FUNCTION("queatAtLPG()"); + + regval = *(volatile SYS_UWORD8 *)0xFFFE7800; + glob = (regval >> 6) & 3; + ontime = (regval >> 3) & 7; + period = regval & 7; + sprintf(g_sa, "%s%u,%u,%u", me, glob, period, ontime); + io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); + return (ATI_CMPL); +} +#endif /* TARGET_HAS_LPG */ + +#ifdef TARGET_HAS_PWL +/* AT@PWL - program PWL output */ +GLOBAL T_ATI_RSLT atAtPWL ( char *cl, UBYTE srcId ) +{ + unsigned level; + + TRACE_FUNCTION("atAtPWL()"); + + cl = parse(cl, "D", &level); + if (!cl) + return (ATI_FAIL); + if (level > 255) + return (ATI_FAIL); + *(volatile SYS_UWORD8 *)0xFFFE8000 = level; + *(volatile SYS_UWORD8 *)0xFFFE8001 = 0x01; + return (ATI_CMPL); +} + +GLOBAL T_ATI_RSLT queatAtPWL (char *cl, UBYTE srcId) +{ + char *me="@PWL: "; + SYS_UWORD8 regval; + + TRACE_FUNCTION("queatAtPWL()"); + + regval = *(volatile SYS_UWORD8 *)0xFFFE8000; + sprintf(g_sa, "%s%u", me, regval); + io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); + return (ATI_CMPL); +} +#endif /* TARGET_HAS_PWL */ + #endif /* ATI_FCMISC_C */