This header contains declarations of device-specific information. More...
Go to the source code of this file.
Macros | |
#define | CALCULATE_UART_NCO_(baudrate, peripheral_clock) |
A helper macro to calculate NCO values. More... | |
#define | CALCULATE_UART_NCO(baudrate, peripheral_clock) |
#define | CALCULATE_UART_TX_FIFO_CPU_CYCLES(baud_rate_, cpu_freq_, fifo_depth_) ((cpu_freq_)*10 * (fifo_depth_) / (baud_rate_)) |
Helper macro to calculate the time it takes to transmit the entire UART TX FIFO in CPU cycles. More... | |
#define | CALCULATE_AST_CHECK_POLL_CPU_CYCLES(cpu_freq_) ((cpu_freq_)*100 / 1000000) |
Helper macro to calculate the maximum duration of the AST initialization check poll in CPU cycles. More... | |
Typedefs | |
typedef enum device_type | device_type_t |
A device_type_t represents a particular device type for which device-specific symbols are available. | |
Enumerations | |
enum | device_type { kDeviceSimDV = 0 , kDeviceSimVerilator = 1 , kDeviceFpgaCw310 = 2 , kDeviceFpgaCw305 = 3 , kDeviceFpgaCw340 = 4 , kDeviceSilicon = 5 } |
A device_type_t represents a particular device type for which device-specific symbols are available. More... | |
Functions | |
OT_WARN_UNUSED_RESULT uint64_t | to_cpu_cycles (uint64_t usec) |
A platform-specific function to convert microseconds to cpu cycles. More... | |
void | device_fpga_version_print (void) |
Prints the FPGA version. More... | |
Variables | |
const device_type_t | kDeviceType |
Indicates the device that this program has been linked for. More... | |
const uint64_t | kClockFreqCpuHz |
The CPU clock frequency of the device, in hertz. More... | |
const uint64_t | kClockFreqPeripheralHz |
The peripheral clock frequency of the device, in hertz. More... | |
const uint64_t | kClockFreqHiSpeedPeripheralHz |
The high-speed peripheral clock frequency of the device, in hertz. More... | |
const uint64_t | kClockFreqUsbHz |
The USB clock frequency of the device, in hertz. More... | |
const uint64_t | kClockFreqAonHz |
The always on clock frequency of the device, in hertz. More... | |
const uint64_t | kUartBaudrate |
The baudrate of the UART peripheral (if such a thing is present). | |
const uint32_t | kUartNCOValue |
The pre-calculated UART NCO value based on the Baudrate and Peripheral clock. | |
const uint32_t | kUartBaud115K |
Additional pre-calculated UART NCO values. More... | |
const uint32_t | kUartBaud230K |
const uint32_t | kUartBaud460K |
const uint32_t | kUartBaud921K |
const uint32_t | kUartBaud1M33 |
const uint32_t | kUartBaud1M50 |
const uint32_t | kUartTxFifoCpuCycles |
The time it takes to transmit the entire UART TX fifo in CPU cycles. | |
const uint32_t | kAstCheckPollCpuCycles |
Maximum duration of the AST initialization check poll in CPU cycles. More... | |
const uintptr_t | kDeviceTestStatusAddress |
An address to write to report test status. More... | |
const uintptr_t | kDeviceLogBypassUartAddress |
An address to write use for UART logging bypass. More... | |
This header contains declarations of device-specific information.
This header contains "device-specific" declarations, i.e., information that all devices are known to provide, but which is specific to the particular choice of platform, which can range from a software simulation, like Verilator or a DV testbench, to real harware, like an FPGA or ASIC.
Definitions for these symbols can be found in other files in this directory, which should be linked in depending on which platform an executable is intended for.
Definition in file device.h.
#define CALCULATE_AST_CHECK_POLL_CPU_CYCLES | ( | cpu_freq_ | ) | ((cpu_freq_)*100 / 1000000) |
#define CALCULATE_UART_NCO | ( | baudrate, | |
peripheral_clock | |||
) |
#define CALCULATE_UART_NCO_ | ( | baudrate, | |
peripheral_clock | |||
) |
A helper macro to calculate NCO values.
NOTE: the left shift value is dependent on the UART hardware. The NCO width is 16 bits and the NCO calculates a 16x oversampling clock. If uart baud rate is 1.5Mbps and IO is 24Mhz, NCO is 0x10000, which is over the NCO width, use NCO = 0xffff for this case since the error is tolerable. Refer to #4263
#define CALCULATE_UART_TX_FIFO_CPU_CYCLES | ( | baud_rate_, | |
cpu_freq_, | |||
fifo_depth_ | |||
) | ((cpu_freq_)*10 * (fifo_depth_) / (baud_rate_)) |
enum device_type |
A device_type_t
represents a particular device type for which device-specific symbols are available.
void device_fpga_version_print | ( | void | ) |
Prints the FPGA version.
This function is a NOP unless we are building for an FPGA.
Definition at line 61 of file device_fpga_cw305.c.
OT_WARN_UNUSED_RESULT uint64_t to_cpu_cycles | ( | uint64_t | usec | ) |
A platform-specific function to convert microseconds to cpu cycles.
This is primarily used for spin waits that use the cpu cycle counters. For platforms with clock periods slower than 1 us this will round up.
Definition at line 25 of file device_fpga_cw305.c.
|
extern |
Maximum duration of the AST initialization check poll in CPU cycles.
This number depends on kClockFreqCpuHz
and the resulting duration must be 100us.
Definition at line 54 of file device_fpga_cw305.c.
|
extern |
The always on clock frequency of the device, in hertz.
This is the operating clock used by the always on timer, power manager and other peripherals that continue to operate after the device is in sleep state.
Definition at line 31 of file device_fpga_cw305.c.
|
extern |
The CPU clock frequency of the device, in hertz.
This is the operating clock for the main processing host.
Definition at line 23 of file device_fpga_cw305.c.
|
extern |
The high-speed peripheral clock frequency of the device, in hertz.
This is the operating clock used by the spi host
Definition at line 27 of file device_fpga_cw310.c.
|
extern |
The peripheral clock frequency of the device, in hertz.
This is the operating clock used by timers, uarts, other peripheral interfaces.
Definition at line 27 of file device_fpga_cw305.c.
|
extern |
The USB clock frequency of the device, in hertz.
This is the operating clock used by the USB phy interface and USB's software interface.
Definition at line 29 of file device_fpga_cw305.c.
|
extern |
An address to write use for UART logging bypass.
If this is zero, there is no address to write to bypass UART logging.
Definition at line 59 of file device_fpga_cw305.c.
|
extern |
An address to write to report test status.
If this is zero, there is no address to write to report test status.
Depending on the simulation environment and the value written to this address, the simulation may stop.
Definition at line 57 of file device_fpga_cw305.c.
|
extern |
Indicates the device that this program has been linked for.
This can be used, for example, for conditioning an operation on the precise device type.
Indicates the device that this program has been linked for.
Definition at line 19 of file device_fpga_cw305.c.
|
extern |
Additional pre-calculated UART NCO values.
If the pre-calculated value is zero, then the corresponding baudrate is not supported.
Definition at line 38 of file device_fpga_cw305.c.