Changeset 37d0dd4 in mainline
- Timestamp:
- 2021-06-24T08:32:54Z (3 years ago)
- Branches:
- master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 65ec18d
- Parents:
- a977e37 (diff), 1b7b7af (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - git-author:
- Maurizio Lombardi <mlombard@…> (2021-06-24 08:32:54)
- git-committer:
- GitHub <noreply@…> (2021-06-24 08:32:54)
- Location:
- kernel
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/arm32/src/mach/raspberrypi/raspberrypi.c
ra977e37 r37d0dd4 174 174 { 175 175 #ifdef CONFIG_FB 176 uint32_t width, height; 176 177 fb_properties_t prop; 177 if (bcm2835_fb_init(&prop)) { 178 179 if (!bcm2835_mbox_get_fb_size(&width, &height)) { 180 printf("mbox: could not get the framebuffer size\n"); 181 width = 640; 182 height = 480; 183 } 184 if (bcm2835_fb_init(&prop, width, height)) { 178 185 outdev_t *fb_dev = fb_init(&prop); 179 186 if (fb_dev) -
kernel/genarch/include/genarch/drivers/bcm2835/mbox.h
ra977e37 r37d0dd4 68 68 69 69 enum { 70 MBOX_TAG_GET_PHYS_W_H = 0x00040003, 71 MBOX_TAG_SET_PHYS_W_H = 0x00048003, 72 MBOX_TAG_GET_VIRT_W_H = 0x00040004, 73 MBOX_TAG_SET_VIRT_W_G = 0x00048004 74 }; 75 76 enum { 70 77 MBOX_PROP_CODE_REQ = 0x00000000, 71 78 MBOX_PROP_CODE_RESP_OK = 0x80000000, … … 122 129 123 130 typedef struct { 131 mbox_prop_buf_hdr_t buf_hdr; 132 mbox_tag_hdr_t tag_hdr; 133 struct { 134 uint32_t width; 135 uint32_t height; 136 } body; 137 uint32_t zero; 138 } mbox_getfbsize_buf_t; 139 140 typedef struct { 124 141 ioport32_t width; 125 142 ioport32_t height; … … 135 152 136 153 extern bool bcm2835_prop_get_memory(uint32_t *base, uint32_t *size); 137 extern bool bcm2835_fb_init(fb_properties_t *prop); 154 extern bool bcm2835_fb_init(fb_properties_t *prop, uint32_t width, uint32_t heigth); 155 extern bool bcm2835_mbox_get_fb_size(uint32_t *h, uint32_t *w); 138 156 139 157 #endif -
kernel/genarch/src/drivers/bcm2835/mbox.c
ra977e37 r37d0dd4 86 86 } 87 87 88 bool bcm2835_fb_init(fb_properties_t *prop )88 bool bcm2835_fb_init(fb_properties_t *prop, uint32_t width, uint32_t height) 89 89 { 90 90 bcm2835_mbox_t *fb_mbox; … … 95 95 KM_NATURAL_ALIGNMENT, PAGE_NOT_CACHEABLE); 96 96 97 fb_desc->width = 640;98 fb_desc->height = 480;97 fb_desc->width = width; 98 fb_desc->height = height; 99 99 fb_desc->virt_width = fb_desc->width; 100 100 fb_desc->virt_height = fb_desc->height; … … 128 128 } 129 129 130 bool bcm2835_mbox_get_fb_size(uint32_t *w, uint32_t *h) 131 { 132 bool r; 133 MBOX_BUFF_ALLOC(msg, mbox_getfbsize_buf_t); 134 bcm2835_mbox_t *mbox; 135 136 mbox = (void *) km_map(BCM2835_MBOX0_ADDR, sizeof(bcm2835_mbox_t), 137 KM_NATURAL_ALIGNMENT, PAGE_NOT_CACHEABLE); 138 assert(mbox); 139 140 msg->buf_hdr.size = sizeof(mbox_getfbsize_buf_t); 141 msg->buf_hdr.code = MBOX_PROP_CODE_REQ; 142 msg->tag_hdr.tag_id = MBOX_TAG_GET_PHYS_W_H; 143 msg->tag_hdr.buf_size = sizeof(msg->body); 144 msg->tag_hdr.val_len = 0; 145 msg->zero = 0; 146 147 mbox_write(mbox, 148 MBOX_CHAN_PROP_A2V, KA2VCA((uint32_t)msg)); 149 mbox_read(mbox, MBOX_CHAN_PROP_A2V); 150 151 r = msg->buf_hdr.code == MBOX_PROP_CODE_RESP_OK; 152 if (r) { 153 *h = msg->body.height; 154 *w = msg->body.width; 155 } 156 157 km_unmap((uintptr_t) mbox, sizeof(bcm2835_mbox_t)); 158 return r; 159 } 160 130 161 /** 131 162 * @}
Note:
See TracChangeset
for help on using the changeset viewer.