123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- #include "compiler.h"
- #include "common.h"
- #include "io.h"
- #include "console.h"
- #include "esplink.h"
- struct esplink_head __esplink_head esplink_head;
- uint32_t __esplink esplink[(65536 - sizeof(struct esplink_head)) >> 2];
- IRQHANDLER(esp,0)
- {
- uint32_t irqstatus = ESP_CPU_IRQ;
- ESP_CPU_IRQ_CLR = irqstatus;
- if (irqstatus & (1 << EL_DIRQ_UNDERRUN)) {
- con_printf("[ESP] ESP link memory underrun!!\n");
- ESP_SPI_IRQ = (0x10 << EL_UIRQ_READY); /* Block writes, reinitialize! */
- }
- if (irqstatus & (1 << EL_DIRQ_HELLO)) {
- con_printf("[ESP] Got hello, sending ready...\n");
- /* Hello, are you there? Yes, I'm here, and you can write data now */
- ESP_SPI_IRQ_SET = (0x10 << EL_UIRQ_READY)|(0x10 << EL_UIRQ_WREN);
- }
- }
- void esp_init(void)
- {
- static char __dram_data esp_signature[] = "Hej tomtebuggar slå i glasen!";
- ESP_CPU_IRQ = 0;
- ESP_SPI_IRQ = 0;
- memset(&esplink_head, 0, sizeof esplink_head);
-
- esplink_head.hlen = sizeof esplink_head;
- esplink_head.board.cfg = SYS_BOARDCFG;
- esplink_head.signature = esp_signature;
- esplink_head.signature_len = sizeof esp_signature - 1;
- esplink_head.magic = ESPLINK_HEAD_MAGIC;
- ESP_SPI_IRQ = (0x10 << EL_UIRQ_READY);
- unmask_irq(ESP_IRQ);
- }
|