freemyipod r772 - Code Review

Jump to: navigation, search
Repository:freemyipod
Revision:r771‎ | r772 | r773 >
Date:15:04, 11 September 2011
Author:user890104
Status:new
Tags:
Comment:
emCORE: Add rtc_[read|write]_datetime to the USB Monitor API
Modified paths:
  • /emcore/trunk/usb/usb.c (modified) (history)

Diff [purge]

Index: emcore/trunk/usb/usb.c
@@ -88,7 +88,9 @@
8989 DBGACTION_REALLOC,
9090 DBGACTION_REOWNALLOC,
9191 DBGACTION_FREE,
92 - DBGACTION_FREEMONITOR
 92+ DBGACTION_FREEMONITOR,
 93+ DBGACTION_RTCREAD,
 94+ DBGACTION_RTCWRITE,
9395 };
9496
9597 static struct scheduler_thread dbgthread_handle IBSS_ATTR;
@@ -667,6 +669,15 @@
668670 case 57: // FREE MONITOR ALLOCATIONS
669671 if (set_dbgaction(DBGACTION_FREEMONITOR, 0)) break;
670672 break;
 673+#ifdef HAVE_RTC
 674+ case 60: // RTC READ
 675+ if (set_dbgaction(DBGACTION_RTCREAD, 0)) break;
 676+ break;
 677+ case 61: // RTC WRITE
 678+ if (set_dbgaction(DBGACTION_RTCWRITE, 0)) break;
 679+ memcpy(dbgasyncsendbuf, &dbgrecvbuf[1], 7);
 680+ break;
 681+#endif
671682 default:
672683 dbgsendbuf[0] = 2;
673684 size = 16;
@@ -999,6 +1010,18 @@
10001011 dbgasyncsendbuf[1] = (uint32_t)free_all_of_thread(current_thread);
10011012 usb_drv_send_nonblocking(dbgendpoints[1], dbgasyncsendbuf, 16);
10021013 break;
 1014+#ifdef HAVE_RTC
 1015+ case DBGACTION_RTCREAD:
 1016+ dbgasyncsendbuf[0] = 1;
 1017+ rtc_read_datetime((struct rtc_datetime*)(&dbgasyncsendbuf[1]));
 1018+ usb_drv_send_nonblocking(dbgendpoints[1], dbgasyncsendbuf, 16);
 1019+ break;
 1020+ case DBGACTION_RTCWRITE:
 1021+ rtc_write_datetime((const struct rtc_datetime*)(dbgasyncsendbuf));
 1022+ dbgasyncsendbuf[0] = 1;
 1023+ usb_drv_send_nonblocking(dbgendpoints[1], dbgasyncsendbuf, 16);
 1024+ break;
 1025+#endif
10031026 }
10041027 dbgaction = DBGACTION_IDLE;
10051028 }