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 "ade7880.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 // UART init params
61 extern struct no_os_uart_init_param uart_ip;
62 // GPIO LED init params
64 // GPIO PSM0 init params
66 // GPIO PSM1 init params
68 // GPIO Reset init params
70 // SPI init params
72 
73 /* Configuration for AD-APARD32690-SL */
74 // Port and Pin for user LED
75 #define GPIO_LED_PORT 2
76 #define GPIO_LED_PIN 1
77 // Port and Pin for PSM0
78 #define GPIO_PSM0_PORT 2
79 #define GPIO_PSM0_PIN 7
80 // Port and Pin for PSM1
81 #define GPIO_PSM1_PORT 2
82 #define GPIO_PSM1_PIN 8
83 // Port and Pin for Reset
84 #define GPIO_RESET_PORT 2
85 #define GPIO_RESET_PIN 9
86 
87 #define GPIO_OPS &max_gpio_ops
88 #define GPIO_EXTRA &ade7880_gpio_extra_ip
89 // SPI config
90 #define SPI_DEVICE_ID 1
91 #define SPI_BAUDRATE 1000000
92 #define SPI_CS 0
93 #define SPI_SLAVE_NUM 1
94 // UART config
95 #define UART_DEV_ID 0
96 #define UART_BAUD 115200
97 
98 #define RESET_TIME 500
99 // Read data interval in ms
100 #define READ_INTERVAL 3000
101 
102 #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
GPIO_PSM1_PIN
#define GPIO_PSM1_PIN
Definition: platform.h:82
platform.h
Defines common data to be used by ADE7880 example project.
no_os_gpio_init_param
Structure holding the parameters for GPIO initialization.
Definition: no_os_gpio.h:79
ade9078_spi_ip
struct no_os_spi_init_param ade9078_spi_ip
Definition: platform.c:105
ade7913_gpio_rdy_ip
struct no_os_gpio_init_param ade7913_gpio_rdy_ip
Definition: platform.c:81
max_uart_extra_ip
struct max_uart_init_param max_uart_extra_ip
Definition: platform.c:43
gpio_reset_ip
struct no_os_gpio_init_param gpio_reset_ip
Definition: platform.c:95
GPIO_RDY_PIN
#define GPIO_RDY_PIN
Definition: platform.h:68
gpio_psm0_ip
struct no_os_gpio_init_param gpio_psm0_ip
Definition: platform.c:77
gpio_led1_ip
struct no_os_gpio_init_param gpio_led1_ip
Definition: platform.c: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
gpio_psm1_ip
struct no_os_gpio_init_param gpio_psm1_ip
Definition: platform.c:86
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
ade9078_spi_extra_ip
struct max_spi_init_param ade9078_spi_extra_ip
Definition: platform.c:51
GPIO_LED_PORT
#define GPIO_LED_PORT
Definition: platform.h:75
SPI_SS_POL_LOW
@ SPI_SS_POL_LOW
Definition: maxim_spi.h:49
no_os_delay.h
Header file of Delay functions.
GPIO_PSM0_PIN
#define GPIO_PSM0_PIN
Definition: platform.h:79
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
UART_BAUD
#define UART_BAUD
Definition: platform.h:96
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
GPIO_PSM1_PORT
#define GPIO_PSM1_PORT
Definition: platform.h:81
uart_ip
struct no_os_uart_init_param uart_ip
Definition: platform.c:57
gpio_led1_ip
struct no_os_gpio_init_param gpio_led1_ip
Definition: platform.c:68
GPIO_RESET_PORT
#define GPIO_RESET_PORT
Definition: parameters.h:67
max_uart_init_param::flow
enum max_uart_flow_ctrl flow
Definition: maxim_uart.h:56
SPI_SLAVE_NUM
#define SPI_SLAVE_NUM
Definition: platform.h:93
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
platform.h
Defines common data to be used by ADE9078 example project.
SPI_CS2
#define SPI_CS2
Definition: platform.h:74
no_os_error.h
Error codes definition.
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
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
ade7880.h
Header file of ADE7880 Driver.
gpio_reset_ip
struct no_os_gpio_init_param gpio_reset_ip
Definition: platform.c:95
SPI_BAUDRATE
#define SPI_BAUDRATE
Definition: parameters.h:73
ade7880_spi_ip
struct no_os_spi_init_param ade7880_spi_ip
Definition: platform.c:104
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
GPIO_LED_PIN
#define GPIO_LED_PIN
Definition: platform.h:76
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
interface_toggle_led
int interface_toggle_led(struct no_os_gpio_desc *gpio_led_desc)
Toggle Led.
Definition: platform.c:123
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
max_gpio_init_param
GPIO platform specific init parameters.
Definition: maxim_gpio.h:55
gpio_extra
struct max_gpio_init_param gpio_extra
Definition: platform.c:47
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.
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_psm0_ip
struct no_os_gpio_init_param gpio_psm0_ip
Definition: platform.c:77
NO_OS_SPI_BIT_ORDER_MSB_FIRST
@ NO_OS_SPI_BIT_ORDER_MSB_FIRST
Definition: no_os_spi.h:76
ade7880_spi_ip
struct no_os_spi_init_param ade7880_spi_ip
Definition: platform.c:104
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
uart_ip
struct no_os_uart_init_param uart_ip
Definition: common_data.c:52
SPI_DEVICE_ID
#define SPI_DEVICE_ID
Definition: parameters.h:69
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_PSM0_PORT
#define GPIO_PSM0_PORT
Definition: platform.h:78
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_DEV_ID
#define UART_DEV_ID
Definition: platform.h:95
ade7913_spi_ip1
struct no_os_spi_init_param ade7913_spi_ip1
Definition: platform.c:101
ade7880_spi_extra_ip
struct max_spi_init_param ade7880_spi_extra_ip
Definition: platform.c:51
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
gpio_psm1_ip
struct no_os_gpio_init_param gpio_psm1_ip
Definition: platform.c:86
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
GPIO_RESET_PIN
#define GPIO_RESET_PIN
Definition: platform.h:85