no-OS
max149x6-base.h
Go to the documentation of this file.
1 /***************************************************************************/
34 #ifndef _MAX149X6_H
35 #define _MAX149X6_H
36 
37 #include <stdint.h>
38 #include <stdbool.h>
39 #include "no_os_gpio.h"
40 #include "no_os_spi.h"
41 #include "no_os_util.h"
42 
43 /* Common Frame Size */
44 #define MAX149X6_FRAME_SIZE 2
45 
46 /* Common Registers */
47 #define MAX149X6_CHIP_ADDR_MASK NO_OS_GENMASK(7, 6)
48 #define MAX149X6_ADDR_MASK NO_OS_GENMASK(4, 1)
49 #define MAX149X6_RW_MASK NO_OS_BIT(0)
50 
55  uint32_t chip_address;
61  bool crc_en;
62 };
63 
67 struct max149x6_desc {
68  uint32_t chip_address;
74  uint8_t buff[MAX149X6_FRAME_SIZE + 1];
75  bool crc_en;
76 };
77 
79 int max149x6_reg_write(struct max149x6_desc *, uint32_t, uint32_t);
80 
82 int max149x6_reg_read(struct max149x6_desc *, uint32_t, uint32_t *);
83 
85 int max149x6_reg_update(struct max149x6_desc *, uint32_t, uint32_t, uint32_t);
86 
87 #endif
max149x6_desc::ready_gpio
struct no_os_gpio_desc * ready_gpio
Definition: max149x6-base.h:72
no_os_alloc.h
no_os_gpio_init_param
Structure holding the parameters for GPIO initialization.
Definition: no_os_gpio.h:79
max149x6_reg_read
int max149x6_reg_read(struct max149x6_desc *desc, uint32_t addr, uint32_t *val)
Read the value of a device register.
Definition: max149x6-base.c:126
max149x6_desc::chip_address
uint32_t chip_address
Definition: max149x6-base.h:68
max149x6_reg_write
int max149x6_reg_write(struct max149x6_desc *, uint32_t, uint32_t)
Write the value of a device register.
Definition: max149x6-base.c:98
max149x6_reg_read
int max149x6_reg_read(struct max149x6_desc *, uint32_t, uint32_t *)
Read the value of a device register.
Definition: max149x6-base.c:126
max149x6-base.h
Header file of MAX149X6 Base Driver.
max149x6_desc
Device descriptor for MAX149X6.
Definition: max149x6-base.h:67
no_os_spi.h
Header file of SPI Interface.
MAX149X6_FRAME_SIZE
#define MAX149X6_FRAME_SIZE
Definition: max149x6-base.h:44
no_os_spi_msg
Definition: no_os_spi.h:100
max149x6_init_param::fault_gpio_param
struct no_os_gpio_init_param * fault_gpio_param
Definition: max149x6-base.h:58
max149x6_init_param::crc_en
bool crc_en
Definition: max149x6-base.h:61
max149x6_reg_update
int max149x6_reg_update(struct max149x6_desc *desc, uint32_t addr, uint32_t mask, uint32_t val)
Update the value of a device register (read/write sequence).
Definition: max149x6-base.c:172
max149x6_desc::crc_en
bool crc_en
Definition: max149x6-base.h:75
max149x6_desc::synch_gpio
struct no_os_gpio_desc * synch_gpio
Definition: max149x6-base.h:73
no_os_spi_msg::tx_buff
uint8_t * tx_buff
Definition: no_os_spi.h:102
max149x6_init_param::comm_param
struct no_os_spi_init_param * comm_param
Definition: max149x6-base.h:56
max149x6_desc::en_gpio
struct no_os_gpio_desc * en_gpio
Definition: max149x6-base.h:70
no_os_field_prep
uint32_t no_os_field_prep(uint32_t mask, uint32_t val)
max149x6_reg_write
int max149x6_reg_write(struct max149x6_desc *desc, uint32_t addr, uint32_t val)
Write the value of a device register.
Definition: max149x6-base.c:98
MAX149X6_RW_MASK
#define MAX149X6_RW_MASK
Definition: max149x6-base.h:49
max149x6_init_param::synch_gpio_param
struct no_os_gpio_init_param * synch_gpio_param
Definition: max149x6-base.h:60
no_os_spi_desc
Structure holding SPI descriptor.
Definition: no_os_spi.h:192
max149x6_init_param::ready_gpio_param
struct no_os_gpio_init_param * ready_gpio_param
Definition: max149x6-base.h:59
no_os_gpio_desc
Structure holding the GPIO descriptor.
Definition: no_os_gpio.h:96
max149x6_init_param::en_gpio_param
struct no_os_gpio_init_param * en_gpio_param
Definition: max149x6-base.h:57
no_os_spi_transfer
int32_t no_os_spi_transfer(struct no_os_spi_desc *desc, struct no_os_spi_msg *msgs, uint32_t len)
Iterate over head list and send all spi messages.
Definition: no_os_spi.c:185
no_os_spi_msg::bytes_number
uint32_t bytes_number
Definition: no_os_spi.h:106
max149x6_reg_update
int max149x6_reg_update(struct max149x6_desc *, uint32_t, uint32_t, uint32_t)
Update the value of a device register (read/write sequence).
Definition: max149x6-base.c:172
max149x6_desc::buff
uint8_t buff[MAX149X6_FRAME_SIZE+1]
Definition: max149x6-base.h:74
MAX149X6_CHIP_ADDR_MASK
#define MAX149X6_CHIP_ADDR_MASK
Definition: max149x6-base.h:47
max149x6_init_param::chip_address
uint32_t chip_address
Definition: max149x6-base.h:55
MAX149X6_ADDR_MASK
#define MAX149X6_ADDR_MASK
Definition: max149x6-base.h:48
max149x6_desc::fault_gpio
struct no_os_gpio_desc * fault_gpio
Definition: max149x6-base.h:71
max149x6_desc::comm_desc
struct no_os_spi_desc * comm_desc
Definition: max149x6-base.h:69
no_os_gpio.h
Header file of GPIO Interface.
max149x6_init_param
Initialization parameter for the MAX149X6 device.
Definition: max149x6-base.h:54
no_os_util.h
Header file of utility functions.
errno.h
Error macro definition for ARM Compiler.
no_os_spi_init_param
Structure holding the parameters for SPI initialization.
Definition: no_os_spi.h:140