本文整理匯總了C++中GET_BITFIELD函數的典型用法代碼示例。如果您正苦於以下問題:C++ GET_BITFIELD函數的具體用法?C++ GET_BITFIELD怎麽用?C++ GET_BITFIELD使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了GET_BITFIELD函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: boot_IspiGetData
// =============================================================================
// boot_IspiGetData
// -----------------------------------------------------------------------------
/// Get one datum.
///
/// This functions gets one element of 32 bits from the ISPI Rx Fifo.
/// If the Fifo was empty at the time #boot_IspiGetData() is called, 0
/// is returned and \c recData is untainted. Otherwise one datum is get
/// from the Fifo and 1 is returned
///
/// @param recData Pointer to store the received datum.
/// @return Returns the number of received data (1 or 0, if the Fifo is empty).
// =============================================================================
PUBLIC UINT32 boot_IspiGetData(UINT32* recData)
{
UINT32 nbAvailable;
// Enter critical section.
UINT32 status = hwp_sysIrq->SC;
nbAvailable = GET_BITFIELD(hwp_spi3->status, SPI_RX_LEVEL);
if (nbAvailable > 0)
{
*recData = hwp_spi3->rxtx_buffer;
// Exit critical section.
hwp_sysIrq->SC = status;
return 1;
}
else
{
// Exit critical section.
hwp_sysIrq->SC = status;
return 0;
}
}
示例2: b_get
static PyObject *
b_get(void *ptr, Py_ssize_t size)
{
signed char val = *(signed char *)ptr;
GET_BITFIELD(val, size);
return PyInt_FromLong(val);
}
示例3: boot_IspiRxFifoLevel
// =============================================================================
// boot_IspiRxFifoLevel
// -----------------------------------------------------------------------------
/// Get data quantity in the Spi Rx FIFO.
///
/// @return The number of 32 bits data items in the Rx FIFO.
// =============================================================================
PUBLIC UINT8 boot_IspiRxFifoLevel(VOID)
{
UINT8 rxLevel;
// Get level
rxLevel = GET_BITFIELD(hwp_spi3->status, SPI_RX_LEVEL);
return rxLevel;
}
示例4: boot_UartMonitorGet
// =============================================================================
// boot_UartMonitorGet
// -----------------------------------------------------------------------------
/// Read some bytes and actualizes the checksum.
/// @param data Array where read bytes will be stored
/// @param size Number of bytes to receive.
/// @param checksum Pointer to the value to XOR the read byte to calculate
/// the checksum.
// =============================================================================
PROTECTED BOOT_UM_ERR_T boot_UartMonitorGet(UINT8* data, UINT32 size, UINT8* checksum)
{
UINT32 i;
UINT32 offset = 0;
UINT32 startTime;
BOOL onTime = TRUE;
for (i=0; i<size; i++)
{
startTime = hwp_timer->HWTimer_CurVal;
if (startTime > 0x80000000)
{
offset = 0x80000000;
}
while ((GET_BITFIELD(hwp_uart->status, UART_RX_FIFO_LEVEL) == 0)
&& (onTime = ((hwp_timer->HWTimer_CurVal+offset) < (startTime + offset + BOOT_UART_MONITOR_RX_TIME_OUT))));
if (!onTime)
{
return BOOT_UM_ERR_RX_FAILED;
}
data[i] = hwp_uart->rxtx_buffer;
*checksum ^= data[i];
}
return BOOT_UM_ERR_NO;
}
示例5: B_get
static PyObject *
B_get(void *ptr, Py_ssize_t size)
{
unsigned char val = *(unsigned char *)ptr;
GET_BITFIELD(val, size);
return PyLong_FromLong(val);
}
示例6: boot_UartMonitorSend
// =============================================================================
// boot_UartMonitorSend
// -----------------------------------------------------------------------------
/// Basic sending function. Done on polling, check
/// TX fifo availability and wait for room if needed.
///
/// @param data Data to send
/// @param length Number of byte to send.
/// @param checksum Pointer to the UINT8 holding the CRC of the frame
/// this transmitting is as part of.
/// @return #BOOT_UM_ERR_NO or #BOOT_UM_ERR_RESOURCE_TIMEOUT;
// =============================================================================
PROTECTED BOOT_UM_ERR_T boot_UartMonitorSend(UINT8* data, UINT32 length, UINT8* checksum)
{
UINT32 i;
UINT32 offset = 0;
UINT32 startTime;
BOOL onTime = TRUE;
for (i=0 ; i<length ; i++)
{
startTime = hwp_timer->HWTimer_CurVal;
if (startTime > 0x80000000)
{
offset = 0x80000000;
}
// Place in the TX Fifo ?
while ((GET_BITFIELD(hwp_uart->status, UART_TX_FIFO_SPACE) == 0)
&& (onTime = (hwp_timer->HWTimer_CurVal+offset < startTime + offset + BOOT_UART_MONITOR_TX_TIME_OUT)));
if (!onTime)
{
return BOOT_UM_ERR_TX_FAILED;
}
hwp_uart->rxtx_buffer = data[i];
*checksum ^= data[i];
}
return BOOT_UM_ERR_NO;
}
示例7: boot_IspiSendData
// =============================================================================
// boot_IspiSendData
// -----------------------------------------------------------------------------
/// Send one data.
/// This functions sends one data frame.
/// The number returned is the number of data frames actually sent.
///
/// @param csId The CS to use to send the data. This cs must be activated before
/// sending data.
/// @param data Frame of data to send.
/// @param read \c TRUE if the response of the device to this sent data is
/// expected to be read later and thus will be put in the read Fifo.
/// @return 1 if the data was sent, 0 otherwise.
// =============================================================================
PUBLIC UINT32 boot_IspiSendData(BOOT_ISPI_CS_T csId, UINT32 data, BOOL read)
{
UINT32 freeRoom;
// Clear data upper bit to only keep the data frame.
UINT32 reg = data & ~(SPI_CS_MASK | SPI_READ_ENA_MASK);
// Add CS and read mode bit
reg |= SPI_CS(csId) | (read?SPI_READ_ENA:0);
// Enter critical section.
UINT32 status = hwp_sysIrq->SC;
// Check FIFO availability.
freeRoom = GET_BITFIELD(hwp_spi3->status, SPI_TX_SPACE);
if (freeRoom > 0)
{
// Write data.
hwp_spi3->rxtx_buffer = reg;
// Exit critical section.
hwp_sysIrq->SC = status;
return 1;
}
else
{
// Exit critical section.
hwp_sysIrq->SC = status;
return 0;
}
}
示例8: Q_get
static PyObject *
Q_get(void *ptr, Py_ssize_t size)
{
unsigned PY_LONG_LONG val;
memcpy(&val, ptr, sizeof(val));
GET_BITFIELD(val, size);
return PyLong_FromUnsignedLongLong(val);
}
示例9: i_get
static PyObject *
i_get(void *ptr, Py_ssize_t size)
{
int val;
memcpy(&val, ptr, sizeof(val));
GET_BITFIELD(val, size);
return PyInt_FromLong(val);
}
示例10: H_get
static PyObject *
H_get(void *ptr, Py_ssize_t size)
{
unsigned short val;
memcpy(&val, ptr, sizeof(val));
GET_BITFIELD(val, size);
return PyLong_FromLong(val);
}
示例11: l_get
static PyObject *
l_get(void *ptr, Py_ssize_t size)
{
long val;
memcpy(&val, ptr, sizeof(val));
GET_BITFIELD(val, size);
return PyLong_FromLong(val);
}
示例12: q_get_sw
static PyObject *
q_get_sw(void *ptr, Py_ssize_t size)
{
PY_LONG_LONG val;
memcpy(&val, ptr, sizeof(val));
val = SWAP_8(val);
GET_BITFIELD(val, size);
return PyLong_FromLongLong(val);
}
示例13: l_get_sw
static PyObject *
l_get_sw(void *ptr, Py_ssize_t size)
{
long val;
memcpy(&val, ptr, sizeof(val));
val = SWAP_LONG(val);
GET_BITFIELD(val, size);
return PyInt_FromLong(val);
}
示例14: boot_IspiTxFifoAvail
// =============================================================================
// boot_IspiTxFifoAvail
// -----------------------------------------------------------------------------
/// Get available data spaces in the Spi Tx FIFO.
/// This function returns the available space in the Tx FIFO, as a number
/// of 32 bits data that can be filled into it.
///
/// @return The size of the available space in the Tx FIFO. (In Fifo elements.)
// =============================================================================
PUBLIC UINT8 boot_IspiTxFifoAvail(VOID)
{
UINT8 freeRoom;
// Get avail level.
freeRoom = GET_BITFIELD(hwp_spi3->status, SPI_TX_SPACE);
return freeRoom;
}
示例15: L_get_sw
static PyObject *
L_get_sw(void *ptr, Py_ssize_t size)
{
unsigned long val;
memcpy(&val, ptr, sizeof(val));
val = SWAP_LONG(val);
GET_BITFIELD(val, size);
return PyLong_FromUnsignedLong(val);
}