FreeCalypso > hg > fc-magnetite
changeset 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 | 36df58db1640 |
children | 227d37a968ec |
files | src/g23m-aci/aci/aci_cmh.h src/g23m-aci/aci/ati_cmd.c src/g23m-aci/aci/ati_fcmisc.c |
diffstat | 3 files changed, 90 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/g23m-aci/aci/aci_cmh.h Thu May 28 01:47:28 2020 +0000 +++ b/src/g23m-aci/aci/aci_cmh.h Thu May 28 02:13:50 2020 +0000 @@ -544,6 +544,10 @@ AT_CMD_AT_CHG, AT_CMD_P_VBAT, AT_CMD_AT_SPENH, + AT_CMD_AT_LPG, + AT_CMD_AT_PWL, + AT_CMD_IOR, + AT_CMD_IOW, /* terminator */ AT_CMD_MAX, /* maximum command id */ AT_CMD_BIGGEST = 0x0000ffff /* To avoid the lint warning 650 */
--- a/src/g23m-aci/aci/ati_cmd.c Thu May 28 01:47:28 2020 +0000 +++ b/src/g23m-aci/aci/ati_cmd.c Thu May 28 02:13:50 2020 +0000 @@ -772,6 +772,14 @@ EXTERN T_ATI_RSLT atPercentVBAT (char *cl, UBYTE srcId); EXTERN T_ATI_RSLT atAtSPENH (char *cl, UBYTE srcId); EXTERN T_ATI_RSLT queatAtSPENH (char *cl, UBYTE srcId); +#ifdef TARGET_HAS_LPG +EXTERN T_ATI_RSLT atAtLPG (char *cl, UBYTE srcId); +EXTERN T_ATI_RSLT queatAtLPG (char *cl, UBYTE srcId); +#endif +#ifdef TARGET_HAS_PWL +EXTERN T_ATI_RSLT atAtPWL (char *cl, UBYTE srcId); +EXTERN T_ATI_RSLT queatAtPWL (char *cl, UBYTE srcId); +#endif LOCAL const ATCommand_bas cmds_bas[] = { @@ -1237,6 +1245,13 @@ {"%VBAT", AT_CMD_P_VBAT, atPercentVBAT, 0, 0, 0}, {"@SPENH", AT_CMD_AT_SPENH, atAtSPENH, test_gen, queatAtSPENH, "%s: (0,1),(0,1)"}, +#ifdef TARGET_HAS_LPG + {"@LPG", AT_CMD_AT_LPG, atAtLPG, test_gen, queatAtLPG, + "%s: (0-3),(0-7),(0-7)"}, +#endif +#ifdef TARGET_HAS_PWL + {"@PWL", AT_CMD_AT_PWL, atAtPWL, test_gen, queatAtPWL, "%s: (0-255)"}, +#endif /* terminator */ {NULL,AT_CMD_NONE,NULL,NULL,NULL,NULL} };
--- 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 */