1.1 --- a/pkg/landfall-examples/hw_info/common.h Mon Nov 13 01:18:52 2023 +0100
1.2 +++ b/pkg/landfall-examples/hw_info/common.h Mon Nov 13 01:20:09 2023 +0100
1.3 @@ -182,7 +182,7 @@
1.4
1.5 void spi_release_control(void *channel);
1.6
1.7 -void spi_send_gpio(void *channel, uint32_t bytes, const uint8_t data[]);
1.8 +void spi_send(void *channel, uint32_t bytes, const uint8_t data[]);
1.9
1.10 void spi_send_units(void *channel, uint32_t bytes, const uint8_t data[],
1.11 uint8_t unit_size, uint8_t char_size);
2.1 --- a/pkg/landfall-examples/hw_info/hw_info.c Mon Nov 13 01:18:52 2023 +0100
2.2 +++ b/pkg/landfall-examples/hw_info/hw_info.c Mon Nov 13 01:20:09 2023 +0100
2.3 @@ -1083,7 +1083,7 @@
2.4 spi_release_control(channel);
2.5 }
2.6
2.7 -static void spi_send_data_gpio(void)
2.8 +static void spi_send_data(void)
2.9 {
2.10 void *channel = get_channel(num_spi_channels, spi_channels, NULL);
2.11 int bytes;
2.12 @@ -1098,7 +1098,7 @@
2.13 bytes++;
2.14 }
2.15
2.16 - spi_send_gpio(channel, bytes, buffer);
2.17 + spi_send(channel, bytes, buffer);
2.18 }
2.19
2.20 static void spi_send_data_units(void)
2.21 @@ -1287,7 +1287,7 @@
2.22 else if (!strcmp(token, "g") || !strcmp(token, "gpio") || !strcmp(token, "gpio-channel"))
2.23 new_spi_channel_gpio(gpio);
2.24 else if (!strcmp(token, "s") || !strcmp(token, "send"))
2.25 - spi_send_data_gpio();
2.26 + spi_send_data();
2.27 else if (!strcmp(token, "S") || !strcmp(token, "send-units"))
2.28 spi_send_data_units();
2.29 else if (!strcmp(token, "t") || !strcmp(token, "transfer"))
3.1 --- a/pkg/landfall-examples/hw_info/jz4780.c Mon Nov 13 01:18:52 2023 +0100
3.2 +++ b/pkg/landfall-examples/hw_info/jz4780.c Mon Nov 13 01:20:09 2023 +0100
3.3 @@ -352,9 +352,11 @@
3.4 void *enable_chip, int enable_pin,
3.5 void *control_chip, int control_pin)
3.6 {
3.7 - return spi_gpio_get_channel(frequency, clock_chip, clock_pin, data_chip,
3.8 - data_pin, enable_chip, enable_pin, control_chip,
3.9 - control_pin);
3.10 + void *ch = spi_gpio_get_channel(frequency, clock_chip, clock_pin, data_chip,
3.11 + data_pin, enable_chip, enable_pin, control_chip,
3.12 + control_pin);
3.13 +
3.14 + return spi_hybrid_get_channel(ch, control_chip, control_pin, -1);
3.15 }
3.16
3.17 void spi_acquire_control(void *channel, int level)
3.18 @@ -367,15 +369,15 @@
3.19 spi_hybrid_release_control(channel);
3.20 }
3.21
3.22 -void spi_send_gpio(void *channel, uint32_t bytes, const uint8_t data[])
3.23 +void spi_send(void *channel, uint32_t bytes, const uint8_t data[])
3.24 {
3.25 - spi_gpio_send(channel, bytes, data);
3.26 + spi_hybrid_send(channel, bytes, data);
3.27 }
3.28
3.29 void spi_send_units(void *channel, uint32_t bytes, const uint8_t data[],
3.30 uint8_t unit_size, uint8_t char_size)
3.31 {
3.32 - jz4780_spi_send_units(channel, bytes, data, unit_size, char_size);
3.33 + spi_hybrid_send_units(channel, bytes, data, unit_size, char_size);
3.34 }
3.35
3.36 uint32_t spi_transfer(void *channel, l4re_dma_space_dma_addr_t paddr,
4.1 --- a/pkg/landfall-examples/hw_info/x1600.c Mon Nov 13 01:18:52 2023 +0100
4.2 +++ b/pkg/landfall-examples/hw_info/x1600.c Mon Nov 13 01:20:09 2023 +0100
4.3 @@ -25,7 +25,8 @@
4.4 #include <l4/devices/gpio-x1600.h>
4.5 #include <l4/devices/i2c-x1600.h>
4.6 #include <l4/devices/spi-gpio.h>
4.7 -// #include <l4/devices/spi-hybrid.h>
4.8 +#include <l4/devices/spi-hybrid.h>
4.9 +#include <l4/devices/spi-jz4780.h>
4.10 #include "common.h"
4.11
4.12
4.13 @@ -326,18 +327,15 @@
4.14
4.15 void *spi_init(l4_addr_t spi_start, l4_addr_t start, l4_addr_t end, void *cpm)
4.16 {
4.17 - (void) spi_start; (void) start; (void) end; (void) cpm;
4.18 - return NULL;
4.19 + return jz4780_spi_init(spi_start, start, end, cpm);
4.20 }
4.21
4.22 void *spi_get_channel(void *spi, uint8_t num, void *channel, uint64_t frequency,
4.23 void *control_chip, int control_pin, int control_alt_func)
4.24 {
4.25 - /* NOTE: Initialisation of a hybrid channel to be supported. */
4.26 + void *ch = jz4780_spi_get_channel(spi, num, channel, frequency);
4.27
4.28 - (void) spi; (void) num; (void) channel; (void) frequency;
4.29 - (void) control_chip; (void) control_pin; (void) control_alt_func;
4.30 - return NULL;
4.31 + return spi_hybrid_get_channel(ch, control_chip, control_pin, control_alt_func);
4.32 }
4.33
4.34 void *spi_get_channel_gpio(uint64_t frequency,
4.35 @@ -346,52 +344,44 @@
4.36 void *enable_chip, int enable_pin,
4.37 void *control_chip, int control_pin)
4.38 {
4.39 - return spi_gpio_get_channel(frequency, clock_chip, clock_pin, data_chip,
4.40 - data_pin, enable_chip, enable_pin, control_chip,
4.41 - control_pin);
4.42 + void *ch = spi_gpio_get_channel(frequency, clock_chip, clock_pin, data_chip,
4.43 + data_pin, enable_chip, enable_pin, control_chip,
4.44 + control_pin);
4.45 +
4.46 + return spi_hybrid_get_channel(ch, control_chip, control_pin, -1);
4.47 }
4.48
4.49 void spi_acquire_control(void *channel, int level)
4.50 {
4.51 - /* NOTE: Not yet supported. */
4.52 -
4.53 - (void) channel; (void) level;
4.54 - // spi_hybrid_acquire_control(channel, level);
4.55 + spi_hybrid_acquire_control(channel, level);
4.56 }
4.57
4.58 void spi_release_control(void *channel)
4.59 {
4.60 - /* NOTE: Not yet supported. */
4.61 -
4.62 - (void) channel;
4.63 - // spi_hybrid_release_control(channel);
4.64 + spi_hybrid_release_control(channel);
4.65 }
4.66
4.67 -void spi_send_gpio(void *channel, uint32_t bytes, const uint8_t data[])
4.68 +void spi_send(void *channel, uint32_t bytes, const uint8_t data[])
4.69 {
4.70 - spi_gpio_send(channel, bytes, data);
4.71 + spi_hybrid_send(channel, bytes, data);
4.72 }
4.73
4.74 void spi_send_units(void *channel, uint32_t bytes, const uint8_t data[], uint8_t unit_size,
4.75 uint8_t char_size)
4.76 {
4.77 - /* NOTE: Not yet supported. */
4.78 -
4.79 - (void) channel; (void) bytes; (void) data; (void) unit_size; (void) char_size;
4.80 - // x1600_spi_send_units(channel, bytes, data, unit_size, char_size);
4.81 + spi_hybrid_send_units(channel, bytes, data, unit_size, char_size);
4.82 }
4.83
4.84 uint32_t spi_transfer(void *channel, l4re_dma_space_dma_addr_t paddr,
4.85 uint32_t count, uint8_t unit_size, uint8_t char_size,
4.86 l4_addr_t desc_vaddr, l4re_dma_space_dma_addr_t desc_paddr)
4.87 {
4.88 - /* NOTE: Not yet supported. */
4.89 + /* Transfer is not supported by the common interface. */
4.90
4.91 - (void) channel; (void) paddr; (void) count; (void) unit_size; (void) char_size;
4.92 - (void) desc_vaddr; (void) desc_paddr;
4.93 - // return x1600_spi_transfer(channel, paddr, count, unit_size, char_size,
4.94 - // desc_vaddr, desc_paddr);
4.95 - return 0;
4.96 + void *ch = spi_hybrid_get_raw_channel(channel);
4.97 +
4.98 + return jz4780_spi_transfer_descriptor(ch, paddr, count, unit_size, char_size,
4.99 + desc_vaddr, desc_paddr);
4.100 }
4.101
4.102