Changeset 44186b01 in mainline
- Timestamp:
- 2013-04-06T16:39:00Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 3deb0155
- Parents:
- f22f679
- Location:
- kernel/genarch
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/genarch/include/genarch/drivers/bcm2835/mbox.h
rf22f679 r44186b01 84 84 #define MBOX_ADDR_ALIGN 16 85 85 86 #define ALLOC_PROP_BUFFER(name,type) \87 char _tmp[sizeof(type) + MBOX_ADDR_ALIGN] = { 0 };\88 type *name = (type *)ALIGN_UP((uint 32_t)_tmp, MBOX_ADDR_ALIGN);86 #define MBOX_BUFF_ALLOC(name, type) \ 87 char tmp_ ## name[sizeof(type) + MBOX_ADDR_ALIGN] = { 0 }; \ 88 type *name = (type *)ALIGN_UP((uintptr_t)tmp_ ## name, MBOX_ADDR_ALIGN); 89 89 90 90 typedef struct { -
kernel/genarch/src/drivers/bcm2835/mbox.c
rf22f679 r44186b01 35 35 36 36 #include <mm/km.h> 37 #include <mm/slab.h>38 37 #include <typedefs.h> 39 38 #include <genarch/drivers/bcm2835/mbox.h> … … 60 59 { 61 60 bool ret; 62 ALLOC_PROP_BUFFER(req, mbox_getmem_buf_t);61 MBOX_BUFF_ALLOC(req, mbox_getmem_buf_t); 63 62 64 63 req->buf_hdr.size = sizeof(mbox_getmem_buf_t); … … 88 87 { 89 88 bcm2835_mbox_t *fb_mbox; 90 bcm2835_fb_desc_t *fb_desc;91 void *fb_desc_buf;92 89 bool ret = false; 93 94 fb_desc_buf = malloc(sizeof(bcm2835_fb_desc_t) + MBOX_ADDR_ALIGN, 0); 95 if (!fb_desc_buf) 96 return false; 90 MBOX_BUFF_ALLOC(fb_desc, bcm2835_fb_desc_t); 97 91 98 92 fb_mbox = (void *) km_map(BCM2835_MBOX0_ADDR, sizeof(bcm2835_mbox_t), 99 93 PAGE_NOT_CACHEABLE); 100 fb_desc = (bcm2835_fb_desc_t *) ALIGN_UP((uintptr_t)fb_desc_buf,101 MBOX_ADDR_ALIGN);102 94 103 95 fb_desc->width = 640; … … 131 123 out: 132 124 km_unmap((uintptr_t)fb_mbox, sizeof(bcm2835_mbox_t)); 133 free(fb_desc_buf);134 125 return ret; 135 126 }
Note:
See TracChangeset
for help on using the changeset viewer.