stm32f107_basic: Add support for a simple stm32f107 platform
This platform is a basic waveshare stm32f107 devkit which contains a USART, USB device port, some buttons and some LEDs. Unfortunately not enough to bring up networking, but enough to test building and a simple contiki shell
This commit is contained in:
parent
5c6018f0e2
commit
222f93f023
10 changed files with 557 additions and 0 deletions
38
platform/stm32f107_basic/gqueue.c
Normal file
38
platform/stm32f107_basic/gqueue.c
Normal file
|
@ -0,0 +1,38 @@
|
|||
#include <gqueue.h>
|
||||
|
||||
void
|
||||
queue_enqueue(volatile void *q, const void *elt)
|
||||
{
|
||||
volatile struct generic_queue *gq = q;
|
||||
|
||||
if(gq->len == 0) {
|
||||
gq->head = gq->memory;
|
||||
gq->tail = gq->memory;
|
||||
} else {
|
||||
if(gq->tail == gq->memory + (gq->max_capacity - 1) * gq->item_size)
|
||||
/* FIXME: Should something be done about
|
||||
* queue length? Substact one, maybe?*/
|
||||
gq->tail = gq->memory;
|
||||
else
|
||||
gq->tail = (uint8_t *) gq->tail + gq->item_size;
|
||||
}
|
||||
|
||||
memcpy((void *)gq->tail, elt, gq->item_size);
|
||||
gq->len++;
|
||||
}
|
||||
|
||||
void
|
||||
queue_dequeue(volatile void *q, void *elt)
|
||||
{
|
||||
volatile struct generic_queue *gq = q;
|
||||
|
||||
memcpy(elt, (void *)gq->head, gq->item_size);
|
||||
|
||||
if(gq->head == gq->memory + (gq->max_capacity - 1) * gq->item_size)
|
||||
/* FIXME: Should something be done about
|
||||
* queue length? Substact one, maybe?*/
|
||||
gq->head = gq->memory;
|
||||
else if(gq->len > 1)
|
||||
gq->head = (uint8_t *) gq->head + gq->item_size;
|
||||
gq->len--;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue