no-OS
platform.h
Go to the documentation of this file.
1 /***************************************************************************/
33 #ifndef __PLATFORM_H__
34 #define __PLATFORM_H__
35 
36 /******************************************************************************/
37 /***************************** Include Files **********************************/
38 /******************************************************************************/
39 #include "ade7913.h"
40 #include "no_os_uart.h"
41 #include "no_os_pwm.h"
42 #include "no_os_delay.h"
43 #include "no_os_gpio.h"
44 #include "no_os_spi.h"
45 #include "no_os_print_log.h"
46 #include "no_os_units.h"
47 #include "no_os_util.h"
48 #include "no_os_error.h"
49 #include "maxim_uart.h"
50 #include "maxim_gpio.h"
51 #include "maxim_uart_stdio.h"
52 #include "maxim_pwm.h"
53 #include "maxim_spi.h"
54 #include "maxim_irq.h"
55 
56 /******************************************************************************/
57 /********************** Macros and Constants Definitions **********************/
58 /******************************************************************************/
59 
60 /* Configuration for AD-APARD32690-SL */
61 // Port and pin for user LED
62 #define GPIO_LED_PORT 2
63 #define GPIO_LED_PIN 1
64 #define GPIO_OPS &max_gpio_ops
65 #define GPIO_EXTRA &ade9153_gpio_extra_ip
66 // Data ready pin
67 #define GPIO_RDY_PORT 2
68 #define GPIO_RDY_PIN 10
69 // SPI config
70 #define SPI_DEVICE_ID 1
71 #define SPI_BAUDRATE 1000000
72 #define SPI_CS0 0
73 #define SPI_CS1 1
74 #define SPI_CS2 2
75 #define SPI_SLAVE_NUM 3
76 // UART config
77 #define UART_DEV_ID 0
78 #define UART_BAUD 115200
79 // IRQ config
80 #define GPIO_IRQ_OPS &max_gpio_irq_ops
81 #define GPIO_CTRL_IRQ_ID 0
82 #define GPIO_IRQ_EXTRA &ade7913_gpio_extra_ip
83 #define NVIC_GPIO_IRQ GPIO2_IRQn
84 
85 /******************************************************************************/
86 /************************ Functions Declarations ******************************/
87 /******************************************************************************/
88 
89 // Init NVIC
91 
92 #endif /* __PLATFORM_H__ */
ade7913_spi_ip0
struct no_os_spi_init_param ade7913_spi_ip0
Definition: platform.c:90
ade7913_spi_extra_ip
struct max_spi_init_param ade7913_spi_extra_ip
Definition: platform.c:51
no_os_gpio_init_param
Structure holding the parameters for GPIO initialization.
Definition: no_os_gpio.h:79
ade7913_gpio_rdy_ip
struct no_os_gpio_init_param ade7913_gpio_rdy_ip
Definition: platform.c:81
GPIO_RDY_PIN
#define GPIO_RDY_PIN
Definition: platform.h:68
no_os_spi.h
Header file of SPI Interface.
NO_OS_UART_STOP_1_BIT
@ NO_OS_UART_STOP_1_BIT
Definition: no_os_uart.h:94
no_os_units.h
Header file of Units.
no_os_gpio_get_value
int32_t no_os_gpio_get_value(struct no_os_gpio_desc *desc, uint8_t *value)
Get the value of the specified GPIO.
Definition: no_os_gpio.c:221
pr_err
#define pr_err(fmt, args...)
Definition: no_os_print_log.h:88
SPI_SS_POL_LOW
@ SPI_SS_POL_LOW
Definition: maxim_spi.h:49
no_os_delay.h
Header file of Delay functions.
no_os_gpio_init_param::port
int32_t port
Definition: no_os_gpio.h:81
NO_OS_GPIO_HIGH
@ NO_OS_GPIO_HIGH
Definition: no_os_gpio.h:117
no_os_print_log.h
Print messages helpers.
platform.h
Defines platform data to be used by ADE7913 example project.
NO_OS_PULL_NONE
@ NO_OS_PULL_NONE
Definition: no_os_gpio.h:66
GPIO_LED_PORT
#define GPIO_LED_PORT
Definition: platform.h:62
NO_OS_SPI_MODE_3
@ NO_OS_SPI_MODE_3
Definition: no_os_spi.h:67
NO_OS_GPIO_LOW
@ NO_OS_GPIO_LOW
Definition: no_os_gpio.h:115
no_os_spi_init_param::device_id
uint32_t device_id
Definition: no_os_spi.h:142
max_uart_init_param::flow
enum max_uart_flow_ctrl flow
Definition: maxim_uart.h:56
no_os_irq_set_priority
int32_t no_os_irq_set_priority(struct no_os_irq_ctrl_desc *desc, uint32_t irq_id, uint32_t priority_level)
Set the priority for an interrupt.
Definition: no_os_irq.c:216
SPI_CS2
#define SPI_CS2
Definition: platform.h:74
no_os_error.h
Error codes definition.
max_uart_extra_ip
struct max_uart_init_param max_uart_extra_ip
Definition: platform.c:43
platform.h
Defines common data to be used by ADE9000 example project.
init_nvic
int init_nvic(struct no_os_irq_ctrl_desc *ade7913_nvic_desc)
Init NVIC.
Definition: platform.c:138
ade7913_gpio_extra_ip
struct max_gpio_init_param ade7913_gpio_extra_ip
Definition: platform.c:57
max_spi_init_param
Maxim specific SPI initialization parameters.
Definition: maxim_spi.h:53
ade7913_nvic_desc
struct no_os_irq_ctrl_desc * ade7913_nvic_desc
Definition: main.c:54
gpio_led1_ip
struct no_os_gpio_init_param gpio_led1_ip
Definition: platform.c:72
ade9000_spi_extra_ip
struct max_spi_init_param ade9000_spi_extra_ip
Definition: platform.c:51
max_irq_ops
const struct no_os_irq_platform_ops max_irq_ops
maxim specific IRQ platform ops structure
Definition: maxim_irq.c:657
SPI_BAUDRATE
#define SPI_BAUDRATE
Definition: parameters.h:73
no_os_irq_init_param::platform_ops
const struct no_os_irq_platform_ops * platform_ops
Definition: no_os_irq.h:111
max_spi_ops
const struct no_os_spi_platform_ops max_spi_ops
maxim platform specific SPI platform ops structure
Definition: maxim_spi.c:795
no_os_irq_ctrl_init
int32_t no_os_irq_ctrl_init(struct no_os_irq_ctrl_desc **desc, const struct no_os_irq_init_param *param)
Initialize the IRQ interrupts.
Definition: no_os_irq.c:45
interface_toggle_led
int interface_toggle_led(struct no_os_gpio_desc *gpio_led_desc)
Toggle Led.
Definition: platform.c:100
max_uart_init_param
Aditional UART config parameters.
Definition: maxim_uart.h:55
UART_FLOW_DIS
@ UART_FLOW_DIS
Definition: maxim_uart.h:47
GPIO_RDY_PORT
#define GPIO_RDY_PORT
Definition: platform.h:67
max_gpio_ops
const struct no_os_gpio_platform_ops max_gpio_ops
maxim platform specific GPIO platform ops structure
Definition: maxim_gpio.c:320
no_os_gpio_desc
Structure holding the GPIO descriptor.
Definition: no_os_gpio.h:96
ade7913.h
Header file of ADE7913 Driver.
max_gpio_init_param::vssel
mxc_gpio_vssel_t vssel
Definition: maxim_gpio.h:57
max_uart_ops
const struct no_os_uart_platform_ops max_uart_ops
Maxim platform specific UART platform ops structure.
Definition: maxim_uart.c:475
UART_BAUD
#define UART_BAUD
Definition: platform.h:78
max_gpio_init_param
GPIO platform specific init parameters.
Definition: maxim_gpio.h:55
max_spi_init_param::num_slaves
uint32_t num_slaves
Definition: maxim_spi.h:54
ade7913_gpio_irq_ip
struct no_os_irq_init_param ade7913_gpio_irq_ip
Definition: platform.c:122
SPI_CS1
#define SPI_CS1
Definition: platform.h:73
no_os_pwm.h
Header file of PWM Interface.
SPI_SLAVE_NUM
#define SPI_SLAVE_NUM
Definition: platform.h:75
ade9000_spi_ip
struct no_os_spi_init_param ade9000_spi_ip
Definition: platform.c:81
SPI_CS
#define SPI_CS
Definition: parameters.h:70
GPIO_LED_PIN
#define GPIO_LED_PIN
Definition: platform.h:63
NO_OS_SPI_BIT_ORDER_MSB_FIRST
@ NO_OS_SPI_BIT_ORDER_MSB_FIRST
Definition: no_os_spi.h:76
UART_DEV_ID
#define UART_DEV_ID
Definition: platform.h:77
ade9000_gpio_extra_ip
struct max_gpio_init_param ade9000_gpio_extra_ip
Definition: platform.c:57
no_os_uart_init_param
Structure holding the parameters for UART initialization.
Definition: no_os_uart.h:110
SPI_DEVICE_ID
#define SPI_DEVICE_ID
Definition: parameters.h:69
gpio_extra
struct max_gpio_init_param gpio_extra
Definition: platform.c:47
no_os_gpio_set_value
int32_t no_os_gpio_set_value(struct no_os_gpio_desc *desc, uint8_t value)
Set the value of the specified GPIO.
Definition: no_os_gpio.c:197
no_os_irq_init_param
Structure holding the initial parameters for Interrupt Request.
Definition: no_os_irq.h:107
NO_OS_UART_PAR_NO
@ NO_OS_UART_PAR_NO
Definition: no_os_uart.h:77
SPI_CS0
#define SPI_CS0
Definition: platform.h:72
no_os_irq_ctrl_remove
int32_t no_os_irq_ctrl_remove(struct no_os_irq_ctrl_desc *desc)
Free the resources allocated by no_os_irq_ctrl_init().
Definition: no_os_irq.c:71
no_os_uart_init_param::device_id
uint8_t device_id
Definition: no_os_uart.h:112
GPIO_CTRL_IRQ_ID
#define GPIO_CTRL_IRQ_ID
Definition: parameters.h:84
ade7913_spi_ip2
struct no_os_spi_init_param ade7913_spi_ip2
Definition: platform.c:112
NO_OS_PULL_UP
@ NO_OS_PULL_UP
Definition: no_os_gpio.h:68
no_os_irq_enable
int32_t no_os_irq_enable(struct no_os_irq_ctrl_desc *desc, uint32_t irq_id)
Enable specific interrupt.
Definition: no_os_irq.c:181
no_os_gpio.h
Header file of GPIO Interface.
uart_ip
struct no_os_uart_init_param uart_ip
Definition: platform.c:61
ade7913_spi_ip1
struct no_os_spi_init_param ade7913_spi_ip1
Definition: platform.c:101
no_os_uart.h
Header file of UART interface.
no_os_util.h
Header file of utility functions.
NO_OS_SPI_MODE_0
@ NO_OS_SPI_MODE_0
Definition: no_os_spi.h:61
no_os_irq_ctrl_desc
Definition: no_os_irq.h:123
GPIO_IRQ_EXTRA
#define GPIO_IRQ_EXTRA
Definition: parameters.h:85
NO_OS_UART_CS_8
@ NO_OS_UART_CS_8
Definition: no_os_uart.h:66
GPIO_IRQ_OPS
#define GPIO_IRQ_OPS
Definition: parameters.h:83
no_os_spi_init_param
Structure holding the parameters for SPI initialization.
Definition: no_os_spi.h:140
init_nvic
int init_nvic(struct no_os_irq_ctrl_desc *ade7913_nvic_desc)
Init NVIC.
Definition: platform.c:138