fw_mem.c 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. // Copyright 2021 IOsetting <iosetting(at)outlook.com>
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. #include "fw_mem.h"
  15. void MEM_SelectWorkRegGroup(MEM_WorkRegGroup_t WorkRegGroup)
  16. {
  17. RS0 = WorkRegGroup & 0x01;
  18. RS1 = (WorkRegGroup >> 1) & 0x01;
  19. }
  20. void MEM_SetOnchipExtRAM(HAL_State_t HAL_State)
  21. {
  22. AUXR = AUXR & ~(0x01 << 1) | (HAL_State << 1);
  23. }
  24. #if (__CONF_MCU_TYPE == 3 )
  25. void MEM_ReadChipID(uint8_t *buff)
  26. {
  27. uint8_t i;
  28. P_SW2 = 0x80;
  29. for (i = 0; i < 32; i++)
  30. {
  31. *(buff + i) = MEM_ReadXDATA(CHIPIDxx + i);
  32. }
  33. P_SW2 = 0x00;
  34. }
  35. #endif