Changeset 48704cde in rtems


Ignore:
Timestamp:
Jun 20, 2016, 9:17:57 PM (3 years ago)
Author:
Mudit Jain <spark1729@…>
Branches:
master
Children:
68565b0
Parents:
aa30e2c
git-author:
Mudit Jain <spark1729@…> (06/20/16 21:17:57)
git-committer:
Pavel Pisa <pisa@…> (06/28/16 13:44:58)
Message:

arm/raspberrypi: Adding functionalities to Mailbox RPi

Added functions for retrieving firmware revision,
board model and board revision.

Location:
c/src/lib/libbsp/arm/raspberrypi
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/arm/raspberrypi/include/vc.h

    raa30e2c r48704cde  
    136136int
    137137bcm2835_mailbox_get_vc_memory(bcm2835_get_vc_memory_entries* _entries);
     138
     139typedef struct
     140{
     141  uint32_t fw_rev;
     142} bcm2835_mailbox_get_fw_rev_entries;
     143
     144int
     145bcm2835_mailbox_get_firmware_revision(bcm2835_mailbox_get_fw_rev_entries* _entries);
     146
     147typedef struct
     148{
     149  uint32_t spec;
     150} bcm2835_get_board_spec_entries;
     151
     152int
     153bcm2835_mailbox_get_board_model(bcm2835_get_board_spec_entries* _entries);
     154
     155int
     156bcm2835_mailbox_get_board_revision(bcm2835_get_board_spec_entries* _entries);
    138157/** @} */
    139158
  • c/src/lib/libbsp/arm/raspberrypi/misc/vc.c

    raa30e2c r48704cde  
    291291  return 0;
    292292}
     293
     294int
     295bcm2835_mailbox_get_firmware_revision(bcm2835_mailbox_get_fw_rev_entries* _entries)
     296{
     297  struct{
     298    bcm2835_mbox_buf_hdr hdr;
     299    bcm2835_mbox_tag_get_fw_rev get_fw_rev;
     300    uint32_t end_tag;
     301  }buffer BCM2835_MBOX_BUF_ALIGN_ATTRIBUTE;
     302  BCM2835_MBOX_INIT_BUF(&buffer);
     303  BCM2835_MBOX_INIT_TAG_NO_REQ(&buffer.get_fw_rev,
     304    BCM2835_MAILBOX_TAG_FIRMWARE_REVISION);
     305  bcm2835_mailbox_buffer_flush_and_invalidate(&buffer, sizeof(&buffer));
     306  if (bcm2835_mailbox_send_read_buffer(&buffer))
     307    return -1;
     308  _entries->fw_rev = buffer.get_fw_rev.body.resp.rev;
     309  if( !bcm2835_mailbox_buffer_suceeded(&buffer.hdr) )
     310    return -2;
     311  return 0;
     312}
     313
     314int
     315bcm2835_mailbox_get_board_model(bcm2835_get_board_spec_entries* _entries)
     316{
     317  struct{
     318    bcm2835_mbox_buf_hdr hdr;
     319    bcm2835_mbox_tag_get_board_spec get_board_model;
     320    uint32_t end_tag;
     321  }buffer BCM2835_MBOX_BUF_ALIGN_ATTRIBUTE;
     322  BCM2835_MBOX_INIT_BUF(&buffer);
     323  BCM2835_MBOX_INIT_TAG_NO_REQ(&buffer.get_board_model,
     324    BCM2835_MAILBOX_TAG_GET_BOARD_MODEL);
     325  bcm2835_mailbox_buffer_flush_and_invalidate(&buffer, sizeof(&buffer));
     326  if (bcm2835_mailbox_send_read_buffer(&buffer))
     327    return -1;
     328  _entries->spec = buffer.get_board_model.body.resp.spec;
     329  if( !bcm2835_mailbox_buffer_suceeded(&buffer.hdr) )
     330    return -2;
     331  return 0;
     332}
     333
     334int
     335bcm2835_mailbox_get_board_revision(bcm2835_get_board_spec_entries* _entries)
     336{
     337  struct{
     338    bcm2835_mbox_buf_hdr hdr;
     339    bcm2835_mbox_tag_get_board_spec get_board_revision;
     340    uint32_t end_tag;
     341  }buffer BCM2835_MBOX_BUF_ALIGN_ATTRIBUTE;
     342  BCM2835_MBOX_INIT_BUF(&buffer);
     343  BCM2835_MBOX_INIT_TAG_NO_REQ(&buffer.get_board_revision,
     344    BCM2835_MAILBOX_TAG_GET_BOARD_VERSION);
     345  bcm2835_mailbox_buffer_flush_and_invalidate(&buffer, sizeof(&buffer));
     346  if (bcm2835_mailbox_send_read_buffer(&buffer))
     347    return -1;
     348  _entries->spec = buffer.get_board_revision.body.resp.spec;
     349  if( !bcm2835_mailbox_buffer_suceeded(&buffer.hdr) )
     350    return -2;
     351  return 0;
     352}
  • c/src/lib/libbsp/arm/raspberrypi/misc/vc_defines.h

    raa30e2c r48704cde  
    136136/* Video Core */
    137137#define BCM2835_MAILBOX_TAG_FIRMWARE_REVISION   0x00000001
     138typedef struct {
     139  bcm2835_mbox_tag_hdr tag_hdr;
     140  union {
     141    struct {
     142    } req;
     143    struct {
     144      uint32_t rev;
     145    } resp;
     146  } body;
     147} bcm2835_mbox_tag_get_fw_rev;
    138148
    139149/* Hardware */
    140150#define BCM2835_MAILBOX_TAG_GET_BOARD_MODEL     0x00010001
    141151#define BCM2835_MAILBOX_TAG_GET_BOARD_VERSION   0x00010002
     152typedef struct {
     153  bcm2835_mbox_tag_hdr tag_hdr;
     154  union {
     155    struct {
     156    } req;
     157    struct {
     158      uint32_t spec;
     159    } resp;
     160  } body;
     161} bcm2835_mbox_tag_get_board_spec;
    142162
    143163#if (BSP_IS_RPI2 == 1)
Note: See TracChangeset for help on using the changeset viewer.