FreeCalypso > hg > fc-magnetite
changeset 667:36df58db1640
AT@LPG and AT@PWL implemented in aci2
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Thu, 28 May 2020 01:47:28 +0000 |
parents | 711b1c6c4e72 |
children | 4011858168a1 |
files | src/aci2/aci/aci_cmh.h src/aci2/aci/ati_cmd.c src/aci2/aci/ati_fcmisc.c |
diffstat | 3 files changed, 90 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/aci2/aci/aci_cmh.h Wed May 27 23:19:42 2020 +0000 +++ b/src/aci2/aci/aci_cmh.h Thu May 28 01:47:28 2020 +0000 @@ -498,6 +498,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 */ } T_ACI_AT_CMD;
--- a/src/aci2/aci/ati_cmd.c Wed May 27 23:19:42 2020 +0000 +++ b/src/aci2/aci/ati_cmd.c Thu May 28 01:47:28 2020 +0000 @@ -704,6 +704,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[] = { @@ -1118,6 +1126,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,0,0,0,0,0} };
--- a/src/aci2/aci/ati_fcmisc.c Wed May 27 23:19:42 2020 +0000 +++ b/src/aci2/aci/ati_fcmisc.c Thu May 28 01:47:28 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 */