Changeset 7e0bd6e in rtems


Ignore:
Timestamp:
May 27, 2009, 2:21:29 PM (10 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, master
Children:
72fe607
Parents:
3fb3de1
Message:

2009-05-27 Sebastian Huber <sebastian.huber@…>

  • tod.h, tod.c: Update for new RTC driver interface.
Location:
c/src/lib/libbsp/shared
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/shared/ChangeLog

    r3fb3de1 r7e0bd6e  
     12009-05-27      Sebastian Huber <sebastian.huber@embedded-brains.de>
     2
     3        * tod.h, tod.c: Update for new RTC driver interface.
     4
    152009-05-18      Joel Sherrill <joel.sherrill@OARcorp.com>
    26
  • c/src/lib/libbsp/shared/tod.c

    r3fb3de1 r7e0bd6e  
    1010
    1111#include <rtems.h>
     12#include <rtems/rtc.h>
     13#include <rtems/libio.h>
     14
    1215#include <libchip/rtc.h>
    1316
     
    3538)
    3639{
    37   rtems_device_minor_number  minor;
    38   rtems_status_code          status;
     40  rtems_device_minor_number minor;
     41  rtems_status_code status;
    3942
    4043  for (minor=0; minor < RTC_Count ; minor++) {
     
    6669   */
    6770
    68   status = rtems_io_register_name( "/dev/rtc", major, RTC_Minor );
     71  status = rtems_io_register_name( RTC_DEVICE_NAME, major, RTC_Minor );
    6972  if (status != RTEMS_SUCCESSFUL) {
    7073    rtems_fatal_error_occurred(status);
     
    105108}
    106109
     110rtems_device_driver rtc_read(
     111  rtems_device_major_number  major,
     112  rtems_device_minor_number  minor,
     113  void *arg
     114)
     115{
     116  int rv = 0;
     117  rtems_libio_rw_args_t *rw = arg;
     118  rtems_time_of_day *tod = (rtems_time_of_day *) rw->buffer;
     119
     120  rw->offset = 0;
     121  rw->bytes_moved = 0;
     122
     123  if (!RTC_Present) {
     124    return RTEMS_NOT_CONFIGURED;
     125  }
     126
     127  if (rw->count != sizeof( rtems_time_of_day)) {
     128    return RTEMS_INVALID_SIZE;
     129  }
     130
     131  rv = RTC_Table [RTC_Minor].pDeviceFns->deviceGetTime(
     132    RTC_Minor,
     133    tod
     134  );
     135  if (rv != 0) {
     136    return RTEMS_IO_ERROR;
     137  }
     138
     139  rw->bytes_moved = rw->count;
     140
     141  return RTEMS_SUCCESSFUL;
     142}
     143
     144rtems_device_driver rtc_write(
     145  rtems_device_major_number  major,
     146  rtems_device_minor_number  minor,
     147  void *arg
     148)
     149{
     150  int rv = 0;
     151  rtems_libio_rw_args_t *rw = arg;
     152  const rtems_time_of_day *tod = (const rtems_time_of_day *) rw->buffer;
     153
     154  rw->offset = 0;
     155  rw->bytes_moved = 0;
     156
     157  if (!RTC_Present) {
     158    return RTEMS_NOT_CONFIGURED;
     159  }
     160
     161  if (rw->count != sizeof( rtems_time_of_day)) {
     162    return RTEMS_INVALID_SIZE;
     163  }
     164
     165  rv = RTC_Table [RTC_Minor].pDeviceFns->deviceSetTime(
     166    RTC_Minor,
     167    tod
     168  );
     169  if (rv != 0) {
     170    return RTEMS_IO_ERROR;
     171  }
     172
     173  rw->bytes_moved = rw->count;
     174
     175  return RTEMS_SUCCESSFUL;
     176}
     177
     178rtems_device_driver rtc_open(
     179  rtems_device_major_number major,
     180  rtems_device_minor_number minor,
     181  void *arg
     182)
     183{
     184  return RTEMS_SUCCESSFUL;
     185}
     186
     187rtems_device_driver rtc_close(
     188  rtems_device_major_number major,
     189  rtems_device_minor_number minor,
     190  void *arg
     191)
     192{
     193  return RTEMS_SUCCESSFUL;
     194}
     195
     196rtems_device_driver rtc_control(
     197  rtems_device_major_number major,
     198  rtems_device_minor_number minor,
     199  void *arg
     200)
     201{
     202  return RTEMS_NOT_IMPLEMENTED;
     203}
     204
    107205/*PAGE
    108206 *
     
    187285 */
    188286int setRealTime(
    189   rtems_time_of_day *tod
     287  const rtems_time_of_day *tod
    190288)
    191289{
  • c/src/lib/libbsp/shared/tod.h

    r3fb3de1 r7e0bd6e  
    2626
    2727int setRealTime(
    28   rtems_time_of_day *tod
     28  const rtems_time_of_day *tod
    2929);
    3030
     
    4141 */
    4242
    43 void setRealTimeToRTEMS();
     43void setRealTimeToRTEMS(void);
    4444
    4545/*
     
    4747 */
    4848
    49 void setRealTimeFromRTEMS();
     49void setRealTimeFromRTEMS(void);
    5050
    5151/*
     
    5454 */
    5555
    56 int checkRealTime();
     56int checkRealTime(void);
    5757
    5858#ifdef __cplusplus
Note: See TracChangeset for help on using the changeset viewer.