@ -0,0 +1,19 @@ | |||||
#include "vram.h" | |||||
#include <string.h> | |||||
#include "sdk/video.h" | |||||
mem_xfer_t mem_xfer_queue[MAX_XFERS]; | |||||
uint8_t mem_xfer_queue_size; | |||||
void vram_init(void) { mem_xfer_queue_size = 0; } | |||||
void vram_update(void) { | |||||
mem_xfer_t *xfer = &mem_xfer_queue[0]; | |||||
for (uint8_t i = 0; i < mem_xfer_queue_size; i++) { | |||||
vram_memcpy((uint16_t)xfer->dest, (void *)xfer->source, xfer->size); | |||||
xfer++; | |||||
} | |||||
mem_xfer_queue_size = 0; | |||||
} |
@ -0,0 +1,35 @@ | |||||
#ifndef IS_VRAM_H_ | |||||
#define IS_VRAM_H_ | |||||
#include <stdint.h> | |||||
#define MAX_XFERS 5 | |||||
typedef struct { | |||||
uint8_t *dest; | |||||
const uint8_t *source; | |||||
uint8_t size; | |||||
} mem_xfer_t; | |||||
extern mem_xfer_t mem_xfer_queue[MAX_XFERS]; | |||||
extern uint8_t mem_xfer_queue_size; | |||||
/** | |||||
* @brief Initialize VRAM engine | |||||
*/ | |||||
void vram_init(void); | |||||
/** | |||||
* @brief Process VRAM memory transfers | |||||
*/ | |||||
void vram_update(void); | |||||
#define vram_enqueue_mem_xfer(_dest, _source, _size) \ | |||||
do { \ | |||||
mem_xfer_t *node = &mem_xfer_queue[mem_xfer_queue_size++]; \ | |||||
node->dest = (_dest); \ | |||||
node->source = (_source); \ | |||||
node->size = (_size); \ | |||||
} while (0) | |||||
#endif |