12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- #include "compiler.h"
- #include "common.h"
- #include "io.h"
- #include "console.h"
- #include "esplink.h"
- struct dram_io_head __dram_io_head dram_io_head;
- uint32_t __dram_io dram_io[(65536 - sizeof(struct dram_io_head)) >> 2];
- IRQHANDLER(esp,0)
- {
- uint32_t irqstatus = ESP_CPU_IRQ;
- ESP_CPU_IRQ_CLR = irqstatus;
- if (irqstatus & (1 << RV_IRQ_UNDERRUN)) {
- con_printf("[ESP] ESP link memory underrun!!\n");
- }
- if (irqstatus & (1 << RV_IRQ_HELLO)) {
- con_printf("[ESP] Got hello, sending ready...\n");
- /* Hello, are you there? Yes, I'm here... */
- ESP_SPI_IRQ_SET = 1 << ESP_IRQ_READY;
- }
- }
- void esp_init(void)
- {
- static char __dram_data esp_signature[] = "Hej tomtebuggar slå i glasen!";
- dram_io_head.magic = 0;
- dram_io_head.hlen = sizeof dram_io_head;
- dram_io_head.dptr = dram_io;
- dram_io_head.dlen = sizeof dram_io;
- dram_io_head.board.cfg = SYS_BOARDCFG;
- dram_io_head.signature = esp_signature;
- dram_io_head.signature_len = sizeof esp_signature - 1;
- memset(&dram_io_head.resv, 0, sizeof dram_io_head.resv);
- dram_io_head.magic = DRAM_IO_MAGIC;
- ESP_SPI_IRQ_SET = 1 << ESP_IRQ_READY;
- unmask_irq(ESP_IRQ);
- }
|