no-OS
flash_extra.h
Go to the documentation of this file.
1 /***************************************************************************/
40 #ifndef PLATFORM_INCLUDE_FLASH_EXTRA_H_
41 #define PLATFORM_INCLUDE_FLASH_EXTRA_H_
42 
43 #define ADUCM3029_FLASH_SIZE_BYTES (0x40000u)
44 
45 #define FLASH_PAGE_SIZE_BYTES 2048
46 #define FLASH_PAGE_SIZE_WORDS 512
47 #define FLASH_PAGE_ADDR_SHIFT 11
48 
49 #define FLASH_PAGE_START_ADDRESS_MASK 0x7FF
50 #define FLASH_OFFSET_IN_PAGE(x) (((x) & FLASH_PAGE_START_ADDRESS_MASK) / 4)
51 #define FLASH_ADDRESS_PAGE_START(x) ((x) & ~FLASH_PAGE_START_ADDRESS_MASK)
52 
53 #endif /* PLATFORM_INCLUDE_FLASH_EXTRA_H_ */
BIT
#define BIT(x)
Definition: util.h:51
timer_init
int32_t timer_init(struct timer_desc **desc, struct timer_init_param *param)
Initialize a instance of a timer.
Definition: timer.c:111
aducm_rtc_desc
Structure holding ADuCM3029 specific RTC descriptor.
Definition: rtc_extra.h:80
spi_desc::max_speed_hz
uint32_t max_speed_hz
Definition: spi.h:136
aducm_irq_ctrl_desc::enabled
uint32_t enabled
Definition: irq_extra.h:167
aducm_device_desc::master_mode
enum master_mode master_mode
Definition: spi_extra.h:83
ADUCM_EXTERNAL_INT2_ID
@ ADUCM_EXTERNAL_INT2_ID
Definition: irq_extra.h:77
FLASH_PAGE_SIZE_BYTES
#define FLASH_PAGE_SIZE_BYTES
Definition: flash_extra.h:45
spi_desc::chip_select
uint8_t chip_select
Definition: spi.h:138
FLASH_ADDRESS_PAGE_START
#define FLASH_ADDRESS_PAGE_START(x)
Definition: flash_extra.h:51
aducm_device_desc::cs
uint8_t cs
Definition: spi_extra.h:79
spi_desc
Structure holding SPI descriptor.
Definition: spi.h:132
irq_ctrl_desc
Definition: irq.h:97
irq_ctrl_desc::extra
void * extra
Definition: irq.h:103
NB_SPI_DEVICES
#define NB_SPI_DEVICES
Definition: aducm3029_spi.c:50
rtc_desc
Structure holding RTC descriptor.
Definition: rtc.h:57
aducm3029_spi_remove
int32_t aducm3029_spi_remove(struct spi_desc *desc)
Free the resources allocated by spi_init().
Definition: aducm3029_spi.c:194
aducm_spi_init_param::continuous_mode
bool continuous_mode
Definition: spi_extra.h:97
timer_init_param
Structure holding the parameters for timer initialization.
Definition: timer.h:72
irq_config::rtc_conf
struct rtc_irq_config * rtc_conf
Definition: irq_extra.h:150
spi.h
Header file of SPI Interface.
aducm_device_desc::buffer
uint8_t buffer[ADI_SPI_MEMORY_SIZE]
Definition: spi_extra.h:71
timer_start
int32_t timer_start(struct timer_desc *desc)
Enable counting in the timer instance.
Definition: timer.c:200
spi_init_param::extra
void * extra
Definition: spi.h:125
spi_platform_ops
Structure holding SPI function pointers that point to the platform specific function.
Definition: spi.h:153
aducm_irq_ops
const struct irq_platform_ops aducm_irq_ops
Aducm3029 platform specific IRQ platform ops structure.
Definition: aducm3029_irq.c:468
aducm_spi_desc
SPI specific descriptor for the ADuCM3029. The structure is available in the extra parameter from spi...
Definition: spi_extra.h:117
callback_desc::ctx
void * ctx
Definition: irq.h:119
spi_init_param::max_speed_hz
uint32_t max_speed_hz
Definition: spi.h:116
rtc_extra.h
Header file of RTC driver for ADuCM302x.
flash_dev::page_size
uint32_t page_size
Definition: flash.h:63
FLASH_OFFSET_IN_PAGE
#define FLASH_OFFSET_IN_PAGE(x)
Definition: flash_extra.h:50
FLASH_PAGE_ADDR_SHIFT
#define FLASH_PAGE_ADDR_SHIFT
Definition: flash_extra.h:47
device
Definition: ad9361_util.h:75
flash_extra.h
Header file of the flash driver for ADuCM302x.
aducm_spi_init_param
Configuration structure sent in the extra parameter from spi_init_param.
Definition: spi_extra.h:93
flash_dev::id
uint8_t id
Definition: flash.h:59
SPI_CPHA
#define SPI_CPHA
Definition: spi.h:53
mdelay
void mdelay(uint32_t msecs)
Wait until msecs milliseconds passed.
Definition: delay.c:129
SPI_CPOL
#define SPI_CPOL
Definition: spi.h:54
rtc_desc::extra
void * extra
Definition: rtc.h:65
gpio_desc
struct gpio_desc gpio_desc
flash_dev
Flash controller device structure.
Definition: flash.h:57
callback_desc::config
void * config
Definition: irq.h:121
aducm_irq_ctrl_desc::callback_configured
bool callback_configured[NB_INTERRUPTS]
Definition: irq_extra.h:163
spi_desc
struct spi_desc spi_desc
irq_enable
int32_t irq_enable(struct irq_ctrl_desc *desc, uint32_t irq_id)
Enable specific interrupt.
Definition: irq.c:139
aducm3029_irq_enable
int32_t aducm3029_irq_enable(struct irq_ctrl_desc *desc, uint32_t irq_id)
Enable the interrupt.
Definition: aducm3029_irq.c:391
spi_extra.h
ADuCM302x specific header for SPI driver.
spi_desc::device_id
uint32_t device_id
Definition: spi.h:134
flash_read
int32_t flash_read(struct flash_dev *dev, uint32_t flash_addr, uint32_t *array, uint32_t size)
Definition: flash.c:287
irq_config::uart_conf
struct uart_desc * uart_conf
Definition: irq_extra.h:146
MAX_CS_NUMBER
#define MAX_CS_NUMBER
Definition: aducm3029_spi.c:51
uart.h
Header file of UART interface.
aducm_device_desc::spi_handle
ADI_SPI_HANDLE spi_handle
Definition: spi_extra.h:73
aducm3029_irq_ctrl_init
int32_t aducm3029_irq_ctrl_init(struct irq_ctrl_desc **desc, const struct irq_init_param *param)
Initialized the controller for the ADuCM3029 external interrupts.
Definition: aducm3029_irq.c:101
spi_desc::mode
enum spi_mode mode
Definition: spi.h:140
aducm_irq_ctrl_desc::irq_memory
uint8_t irq_memory[ADI_XINT_MEMORY_SIZE]
Definition: irq_extra.h:165
ADUCM_GPIO_B_INT_ID
@ ADUCM_GPIO_B_INT_ID
Definition: irq_extra.h:87
aducm_spi_desc::dev
struct aducm_device_desc * dev
Definition: spi_extra.h:121
MASTER
@ MASTER
Definition: spi_extra.h:62
gpio_desc::number
int32_t number
Definition: gpio.h:86
ADUCM3029_FLASH_SIZE_BYTES
#define ADUCM3029_FLASH_SIZE_BYTES
Definition: flash_extra.h:43
aducm_device_desc::bitrate
uint32_t bitrate
Definition: spi_extra.h:77
adicup_flash_dev::instance
ADI_FEE_HANDLE instance
Definition: flash.c:63
spi_init_param
Structure holding the parameters for SPI initialization.
Definition: spi.h:112
aducm3029_irq_disable
int32_t aducm3029_irq_disable(struct irq_ctrl_desc *desc, uint32_t irq_id)
Disable the interrupt.
Definition: aducm3029_irq.c:433
flash_clear_page
int32_t flash_clear_page(struct flash_dev *dev, int32_t page_no)
Definition: flash.c:158
timer.h
Timer control module header.
flash_init_param
Flash controller initialization structure.
Definition: flash.h:72
flash_dev::flash_size
uint32_t flash_size
Definition: flash.h:61
uart_extra.h
Header file of UART driver for ADuCM302x.
aducm_spi_init_param::dma
bool dma
Definition: spi_extra.h:104
flash_remove
int32_t flash_remove(struct flash_dev *dev)
Definition: flash.c:130
error.h
Error codes definition.
spi_platform_ops::init
int32_t(* init)(struct spi_desc **, const struct spi_init_param *)
Definition: spi.h:155
spi_init_param::mode
enum spi_mode mode
Definition: spi.h:120
callback_desc
Structure describing a callback to be registered.
Definition: irq.h:110
irq_platform_ops
Structure holding IRQ function pointers that point to the platform specific function.
Definition: irq.h:129
irq_id
irq_id
Interrupts IDs supported by the irq driver.
Definition: irq_extra.h:71
ADUCM_RTC_INT_ID
@ ADUCM_RTC_INT_ID
Definition: irq_extra.h:83
aducm3029_irq_global_enable
int32_t aducm3029_irq_global_enable(struct irq_ctrl_desc *desc)
Enable all previously enabled interrupts by irq_enable().
Definition: aducm3029_irq.c:327
aducm3029_irq_ctrl_remove
int32_t aducm3029_irq_ctrl_remove(struct irq_ctrl_desc *desc)
Free the resources allocated by irq_ctrl_init()
Definition: aducm3029_irq.c:134
callback_desc::callback
void(* callback)(void *ctx, uint32_t event, void *extra)
Definition: irq.h:117
flash_init
int32_t flash_init(struct flash_dev **device, struct flash_init_param *init_param)
Definition: flash.c:83
delay.h
Header file of Delay functions.
rtc_irq_config::rtc_handler
struct rtc_desc * rtc_handler
Definition: irq_extra.h:113
ADUCM_GPIO_A_INT_ID
@ ADUCM_GPIO_A_INT_ID
Definition: irq_extra.h:85
gpio_desc
Structure holding the GPIO descriptor.
Definition: gpio.h:84
timer_stop
int32_t timer_stop(struct timer_desc *desc)
Stop counting the timer instance.
Definition: timer.c:226
rtc_irq_config::active_interrupts
uint32_t active_interrupts
Definition: irq_extra.h:115
ADUCM_UART_INT_ID
@ ADUCM_UART_INT_ID
Definition: irq_extra.h:81
uart_desc::callback
void(* callback)(void *callback_ctx, uint32_t event, void *extra)
Definition: uart.h:126
aducm_spi_init_param::master_mode
enum master_mode master_mode
Definition: spi_extra.h:95
rtc_irq_config
RTC interrupt configuration routine.
Definition: irq_extra.h:111
aducm3029_irq_unregister
int32_t aducm3029_irq_unregister(struct irq_ctrl_desc *desc, uint32_t irq_id)
Unregister IRQ handling function for the specified irq_id.
Definition: aducm3029_irq.c:256
irq.h
Header file of IRQ interface.
uart_desc
Stucture holding the UART descriptor.
Definition: uart.h:120
FLASH_PAGE_SIZE_WORDS
#define FLASH_PAGE_SIZE_WORDS
Definition: flash_extra.h:46
irq_platform_ops::init
int32_t(* init)(struct irq_ctrl_desc **desc, const struct irq_init_param *param)
Definition: irq.h:131
gpio_irq_config
GPIO group interrupt configuration routine.
Definition: irq_extra.h:133
gpio.h
Header file of GPIO Interface.
ADUCM_EXTERNAL_INT1_ID
@ ADUCM_EXTERNAL_INT1_ID
Definition: irq_extra.h:75
flash_dev::extra
void * extra
Definition: flash.h:65
aducm3029_irq_global_disable
int32_t aducm3029_irq_global_disable(struct irq_ctrl_desc *desc)
Disable all external interrupts.
Definition: aducm3029_irq.c:354
NULL
#define NULL
Definition: wrapper.h:64
irq_mode
irq_mode
Trigger condition for the external interrupt.
Definition: irq_extra.h:94
aducm_spi_init_param::half_duplex
bool half_duplex
Definition: spi_extra.h:99
flash_write_page
int32_t flash_write_page(struct flash_dev *dev, int32_t page_no, uint32_t *data)
Definition: flash.c:185
aducm3029_spi_write_and_read
int32_t aducm3029_spi_write_and_read(struct spi_desc *desc, uint8_t *data, uint16_t bytes_number)
Write and read data to/from SPI. If bytes number is 0 the function will return failure.
Definition: aducm3029_spi.c:225
SUCCESS
#define SUCCESS
Definition: error.h:52
init_param
struct ad7616_init_param init_param
Definition: ad7616_sdz.c:96
irq_init_param::irq_ctrl_id
uint32_t irq_ctrl_id
Definition: irq.h:86
flash_write
int32_t flash_write(struct flash_dev *dev, uint32_t flash_addr, uint32_t *array, uint32_t array_size)
Definition: flash.c:257
aducm3029_irq_register_callback
int32_t aducm3029_irq_register_callback(struct irq_ctrl_desc *desc, uint32_t irq_id, struct callback_desc *callback_desc)
Registers a IRQ callback function to irq controller.
Definition: aducm3029_irq.c:164
timer_counter_set
int32_t timer_counter_set(struct timer_desc *desc, uint32_t new_val)
Set a new value for the timer.
Definition: timer.c:307
irq_config::xint_conf
enum irq_mode xint_conf
Definition: irq_extra.h:148
ADUCM_EXTERNAL_INT0_ID
@ ADUCM_EXTERNAL_INT0_ID
Definition: irq_extra.h:73
aducm_device_desc::ref_instances
uint32_t ref_instances
Definition: spi_extra.h:75
timer_counter_get
int32_t timer_counter_get(struct timer_desc *desc, uint32_t *counter)
Get the value the timer is at.
Definition: timer.c:254
max
#define max(x, y)
Definition: util.h:68
aducm_device_desc
Structure describing the physical SPI devices.
Definition: spi_extra.h:69
aducm_device_desc::mode
enum spi_mode mode
Definition: spi_extra.h:81
NB_INTERRUPTS
#define NB_INTERRUPTS
Definition: irq_extra.h:57
gpio_irq_config::mode
enum gpio_irq_mode mode
Definition: irq_extra.h:137
rtc.h
Header of the RTC interface.
adicup_flash_dev
Aducm3029 flash controller handler.
Definition: flash.c:61
spi_init_param::chip_select
uint8_t chip_select
Definition: spi.h:118
spi_desc::extra
void * extra
Definition: spi.h:145
irq_unregister
int32_t irq_unregister(struct irq_ctrl_desc *desc, uint32_t irq_id)
Unregisters a generic IRQ handling function.
Definition: irq.c:94
irq_config::gpio_conf
struct gpio_irq_config * gpio_conf
Definition: irq_extra.h:152
timer_init_param::id
uint16_t id
Definition: timer.h:74
adicup_flash_dev::temp_ptr
uint32_t temp_ptr[FLASH_PAGE_SIZE_WORDS]
Definition: flash.c:68
BASE_XINT_NB
#define BASE_XINT_NB
Definition: aducm3029_irq.c:61
NB_EXT_INTERRUPTS
#define NB_EXT_INTERRUPTS
Definition: aducm3029_irq.c:64
aducm_rtc_desc::instance
void * instance
Definition: rtc_extra.h:82
aducm_spi_desc::aducm_conf
struct aducm_spi_init_param aducm_conf
Definition: spi_extra.h:119
aducm_irq_ctrl_desc
Stores specific platform parameters.
Definition: irq_extra.h:159
aducm_spi_ops
const struct spi_platform_ops aducm_spi_ops
ADuCM3029 platform specific SPI platform ops structure.
Definition: aducm3029_spi.c:285
spi_init_param::device_id
uint32_t device_id
Definition: spi.h:114
udelay
void udelay(uint32_t usecs)
Wait until usecs microseconds passed.
Definition: delay.c:117
irq_disable
int32_t irq_disable(struct irq_ctrl_desc *desc, uint32_t irq_id)
Disable specific interrupt.
Definition: irq.c:150
gpio_irq_config::gpio_handler
struct gpio_desc * gpio_handler
Definition: irq_extra.h:135
util.h
Implementation of utility functions.
adicup_flash_dev::dfp_memory
uint8_t dfp_memory[ADI_FEE_MEMORY_SIZE]
Definition: flash.c:65
FAILURE
#define FAILURE
Definition: error.h:56
ADUCM_EXTERNAL_INT3_ID
@ ADUCM_EXTERNAL_INT3_ID
Definition: irq_extra.h:79
aducm_irq_ctrl_desc::conf
union irq_config conf[NB_INTERRUPTS]
Definition: irq_extra.h:161
aducm3029_spi_init
int32_t aducm3029_spi_init(struct spi_desc **desc, const struct spi_init_param *param)
Initialize the SPI communication peripheral.
Definition: aducm3029_spi.c:124
aducm_device_desc::continuous_mode
bool continuous_mode
Definition: spi_extra.h:85
uart_desc::callback_ctx
void * callback_ctx
Definition: uart.h:129
flash.h
Header file for flash controller driver.
timer_desc
Structure holding timer descriptor.
Definition: timer.h:57
irq_extra.h
Header file of IRQ driver for ADuCM302x.
irq_init_param
Structure holding the initial parameters for Interrupt Request.
Definition: irq.h:84