docstring
stringlengths 22
576
| signature
stringlengths 9
317
| prompt
stringlengths 57
886
| code
stringlengths 20
1.36k
| repository
stringclasses 49
values | language
stringclasses 2
values | license
stringclasses 9
values | stars
int64 15
21.3k
|
---|---|---|---|---|---|---|---|
/* Returns 0 if we got the following ack, otherwise 1 */ | static int wr_byte(struct ipath_devdata *dd, u8 data) | /* Returns 0 if we got the following ack, otherwise 1 */
static int wr_byte(struct ipath_devdata *dd, u8 data) | {
int bit_cntr;
u8 bit;
for (bit_cntr = 7; bit_cntr >= 0; bit_cntr--) {
bit = (data >> bit_cntr) & 1;
sda_out(dd, bit);
scl_out(dd, i2c_line_high);
scl_out(dd, i2c_line_low);
}
return (!i2c_ackrcv(dd)) ? 1 : 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Write string to C42048A lcd glass alphanumeric field.
This function will write the input string to the alphanumeric field of the lcd glass. */ | static void c42364a_write_alpha_packet(const uint8_t *data) | /* Write string to C42048A lcd glass alphanumeric field.
This function will write the input string to the alphanumeric field of the lcd glass. */
static void c42364a_write_alpha_packet(const uint8_t *data) | {
lcdca_write_packet(LCDCA_TDG_14SEG4COM, FIRST_14SEG_4C, data, \
WIDTH_14SEG_4C, DIR_14SEG_4C);
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* @num_consumers: Number of consumers @consumers: Consumer data; clients are stored here. */ | int regulator_bulk_enable(int num_consumers, struct regulator_bulk_data *consumers) | /* @num_consumers: Number of consumers @consumers: Consumer data; clients are stored here. */
int regulator_bulk_enable(int num_consumers, struct regulator_bulk_data *consumers) | {
int i;
int ret;
for (i = 0; i < num_consumers; i++) {
ret = regulator_enable(consumers[i].consumer);
if (ret != 0)
goto err;
}
return 0;
err:
printk(KERN_ERR "Failed to enable %s: %d\n", consumers[i].supply, ret);
for (--i; i >= 0; --i)
regulator_disable(consumers[i].consumer);
return ret;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Return: 0 on success or a negative error code on failure. */ | int mipi_dsi_dcs_set_pixel_format(struct mipi_dsi_device *dsi, u8 format) | /* Return: 0 on success or a negative error code on failure. */
int mipi_dsi_dcs_set_pixel_format(struct mipi_dsi_device *dsi, u8 format) | {
ssize_t err;
err = mipi_dsi_dcs_write(dsi, MIPI_DCS_SET_PIXEL_FORMAT, &format,
sizeof(format));
if (err < 0)
return err;
return 0;
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Called on completion of any requests the driver itself submitted that need cleaning up. */ | static void s3c_hsotg_complete_oursetup(struct usb_ep *ep, struct usb_request *req) | /* Called on completion of any requests the driver itself submitted that need cleaning up. */
static void s3c_hsotg_complete_oursetup(struct usb_ep *ep, struct usb_request *req) | {
struct s3c_hsotg_ep *hs_ep = our_ep(ep);
struct s3c_hsotg *hsotg = hs_ep->parent;
dev_dbg(hsotg->dev, "%s: ep %p, req %p\n", __func__, ep, req);
s3c_hsotg_ep_free_request(ep, req);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* fc_lport_state() - Return a string which represents the lport's state @lport: The lport whose state is to converted to a string */ | static const char* fc_lport_state(struct fc_lport *lport) | /* fc_lport_state() - Return a string which represents the lport's state @lport: The lport whose state is to converted to a string */
static const char* fc_lport_state(struct fc_lport *lport) | {
const char *cp;
cp = fc_lport_state_names[lport->state];
if (!cp)
cp = "unknown";
return cp;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This is an older interface. It's kept for backward compatibility to the option that doesn't provide association id. */ | SCTP_STATIC int sctp_setsockopt_connectx_old(struct sock *sk, struct sockaddr __user *addrs, int addrs_size) | /* This is an older interface. It's kept for backward compatibility to the option that doesn't provide association id. */
SCTP_STATIC int sctp_setsockopt_connectx_old(struct sock *sk, struct sockaddr __user *addrs, int addrs_size) | {
return __sctp_setsockopt_connectx(sk, addrs, addrs_size, NULL);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* PCD MSP De-Initialization This function freeze the hardware resources used in this example. */ | void HAL_PCD_MspDeInit(PCD_HandleTypeDef *hpcd) | /* PCD MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_PCD_MspDeInit(PCD_HandleTypeDef *hpcd) | {
if(hpcd->Instance==USB_OTG_FS)
{
__HAL_RCC_USB_CLK_DISABLE();
HAL_GPIO_DeInit(GPIOA, USB_OTG_FS_DM_Pin|USB_OTG_FS_DP_Pin);
HAL_NVIC_DisableIRQ(OTG_FS_IRQn);
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Register the handler to extract RSA 2048 SHA 256 guided section. */ | EFI_STATUS EFIAPI DxeRsa2048Sha256GuidedSectionExtractLibConstructor(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable) | /* Register the handler to extract RSA 2048 SHA 256 guided section. */
EFI_STATUS EFIAPI DxeRsa2048Sha256GuidedSectionExtractLibConstructor(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable) | {
return ExtractGuidedSectionRegisterHandlers (
&gEfiCertTypeRsa2048Sha256Guid,
Rsa2048Sha256GuidedSectionGetInfo,
Rsa2048Sha256GuidedSectionHandler
);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Initialize the master TWI.
Function used to initialize master TWI interface that would communicate with simulated EEPROM. */ | static ret_code_t twi_master_init(void) | /* Initialize the master TWI.
Function used to initialize master TWI interface that would communicate with simulated EEPROM. */
static ret_code_t twi_master_init(void) | {
ret_code_t ret;
const nrf_drv_twi_config_t config =
{
.scl = TWI_SCL_M,
.sda = TWI_SDA_M,
.frequency = NRF_TWI_FREQ_400K,
.interrupt_priority = APP_IRQ_PRIORITY_HIGH,
.clear_bus_init = false
};
ret = nrf_drv_twi_init(&m_twi_master, &config, NULL, NULL);
if (NRF_SUCCESS == ret)
{
nrf_drv_twi_enable(&m_twi_master);
}
return ret;
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* About: Purpose Implementation of USBInterfaceRequest class methods. Indicates which interface is targetted by a GET_INTERFACE or SET_INTERFACE request. */ | unsigned char USBInterfaceRequest_GetInterface(const USBGenericRequest *request) | /* About: Purpose Implementation of USBInterfaceRequest class methods. Indicates which interface is targetted by a GET_INTERFACE or SET_INTERFACE request. */
unsigned char USBInterfaceRequest_GetInterface(const USBGenericRequest *request) | {
return (USBGenericRequest_GetIndex(request) & 0xFF);
} | opentx/opentx | C++ | GNU General Public License v2.0 | 2,025 |
/* This API is used to get the fifo watermark interrupt1 data in the register 0x1A bit 1. */ | BMA2x2_RETURN_FUNCTION_TYPE bma2x2_get_intr1_fifo_wm(u8 *intr1_fifo_wm_u8) | /* This API is used to get the fifo watermark interrupt1 data in the register 0x1A bit 1. */
BMA2x2_RETURN_FUNCTION_TYPE bma2x2_get_intr1_fifo_wm(u8 *intr1_fifo_wm_u8) | {
u8 data_u8 = BMA2x2_INIT_VALUE;
BMA2x2_RETURN_FUNCTION_TYPE com_rslt = ERROR;
if (p_bma2x2 == BMA2x2_NULL)
{
return E_BMA2x2_NULL_PTR;
}
else
{
com_rslt = p_bma2x2->BMA2x2_BUS_READ_FUNC
(p_bma2x2->dev_addr,
BMA2x2_ENABLE_INTR1_PAD_FIFO_WM_REG,
&data_u8, BMA2x2_GEN_READ_WRITE_LENGTH);
*intr1_fifo_wm_u8 = BMA2x2_GET_BITSLICE
(data_u8, BMA2x2_ENABLE_INTR1_PAD_FIFO_WM);
}
return com_rslt;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Sets the Smart Card number of retries in transmit and receive. */ | void USART_SetAutoRetryCount(USART_TypeDef *USARTx, uint8_t USART_AutoCount) | /* Sets the Smart Card number of retries in transmit and receive. */
void USART_SetAutoRetryCount(USART_TypeDef *USARTx, uint8_t USART_AutoCount) | {
assert_param(IS_USART_ALL_PERIPH(USARTx));
assert_param(IS_USART_AUTO_RETRY_COUNTER(USART_AutoCount));
USARTx->CR3 &= (uint32_t)~((uint32_t)USART_CR3_SCARCNT);
USARTx->CR3 |= (uint32_t)((uint32_t)USART_AutoCount << 0x11);
} | avem-labs/Avem | C++ | MIT License | 1,752 |
/* vx_pcm_hw_params - hw_params callback for playback and capture */ | static int vx_pcm_hw_params(struct snd_pcm_substream *subs, struct snd_pcm_hw_params *hw_params) | /* vx_pcm_hw_params - hw_params callback for playback and capture */
static int vx_pcm_hw_params(struct snd_pcm_substream *subs, struct snd_pcm_hw_params *hw_params) | {
return snd_pcm_alloc_vmalloc_buffer(subs, params_buffer_bytes(hw_params));
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Retrieve the basic constraints from one X.509 certificate. */ | BOOLEAN EFIAPI X509GetExtendedBasicConstraints(CONST UINT8 *Cert, UINTN CertSize, UINT8 *BasicConstraints, UINTN *BasicConstraintsSize) | /* Retrieve the basic constraints from one X.509 certificate. */
BOOLEAN EFIAPI X509GetExtendedBasicConstraints(CONST UINT8 *Cert, UINTN CertSize, UINT8 *BasicConstraints, UINTN *BasicConstraintsSize) | {
CALL_CRYPTO_SERVICE (X509GetExtendedBasicConstraints, (Cert, CertSize, BasicConstraints, BasicConstraintsSize), FALSE);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Description: Configures MII_BMCR to force speed/duplex to the values in phydev. Assumes that the values are valid. */ | static int genphy_setup_forced(struct phy_device *phydev) | /* Description: Configures MII_BMCR to force speed/duplex to the values in phydev. Assumes that the values are valid. */
static int genphy_setup_forced(struct phy_device *phydev) | {
int err;
int ctl = BMCR_ANRESTART;
phydev->pause = 0;
phydev->asym_pause = 0;
if (phydev->speed == SPEED_1000)
ctl |= BMCR_SPEED1000;
else if (phydev->speed == SPEED_100)
ctl |= BMCR_SPEED100;
if (phydev->duplex == DUPLEX_FULL)
ctl |= BMCR_FULLDPLX;
err = phy_write(phydev, MDIO_DEVAD_NONE, MII_BMCR, ctl);
return err;
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* This function is used to register gpio interrupt. */ | void tls_gpio_isr_register(enum tls_io_name gpio_pin, tls_gpio_irq_callback callback, void *arg) | /* This function is used to register gpio interrupt. */
void tls_gpio_isr_register(enum tls_io_name gpio_pin, tls_gpio_irq_callback callback, void *arg) | {
gpio_context[gpio_pin].callback = callback;
gpio_context[gpio_pin].arg = arg;
} | Nicholas3388/LuaNode | C++ | Other | 1,055 |
/* e1000_shift_in_ee_bits - Shift data bits in from the EEPROM @hw: Struct containing variables accessed by shared code @count: number of bits to shift in */ | static u16 e1000_shift_in_ee_bits(struct e1000_hw *hw, u16 count) | /* e1000_shift_in_ee_bits - Shift data bits in from the EEPROM @hw: Struct containing variables accessed by shared code @count: number of bits to shift in */
static u16 e1000_shift_in_ee_bits(struct e1000_hw *hw, u16 count) | {
u32 eecd;
u32 i;
u16 data;
eecd = er32(EECD);
eecd &= ~(E1000_EECD_DO | E1000_EECD_DI);
data = 0;
for (i = 0; i < count; i++) {
data = data << 1;
e1000_raise_ee_clk(hw, &eecd);
eecd = er32(EECD);
eecd &= ~(E1000_EECD_DI);
if (eecd & E1000_EECD_DO)
data |= 1;
e1000_lower_ee_clk(hw, &eecd);
}
return data;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Write the content of the internal buffer (VDB) to the display */ | void lv_disp_fill(int32_t x1, int32_t y1, int32_t x2, int32_t y2, lv_color_t color) | /* Write the content of the internal buffer (VDB) to the display */
void lv_disp_fill(int32_t x1, int32_t y1, int32_t x2, int32_t y2, lv_color_t color) | {
if(active == NULL) return;
if(active->driver.disp_fill != NULL) active->driver.disp_fill(x1, y1, x2, y2, color);
} | RavenSystem/esp-homekit-devices | C++ | Other | 2,577 |
/* Pop the location stack. LOC must be the current location, i.e. the top of the stack. */ | Location* loc_pop(Location *loc) | /* Pop the location stack. LOC must be the current location, i.e. the top of the stack. */
Location* loc_pop(Location *loc) | {
assert(cur_loc == loc && loc->prev);
cur_loc = loc->prev;
loc->prev = NULL;
return loc;
} | ve3wwg/teensy3_qemu | C++ | Other | 15 |
/* This function won't work with non-blocking fd's. Any of the possibilities with non-bloking fd's is bad: */ | ssize_t qemu_recv_full(int fd, void *buf, size_t count, int flags) | /* This function won't work with non-blocking fd's. Any of the possibilities with non-bloking fd's is bad: */
ssize_t qemu_recv_full(int fd, void *buf, size_t count, int flags) | {
ssize_t ret = 0;
ssize_t total = 0;
while (count) {
ret = qemu_recv(fd, buf, count, flags);
if (ret <= 0) {
if (ret < 0 && errno == EINTR) {
continue;
}
break;
}
count -= ret;
buf += ret;
total += ret;
}
return total;
} | ve3wwg/teensy3_qemu | C++ | Other | 15 |
/* to be used with the resync: fast: ... options */ | static void set_resync(struct WD33C93_hostdata *hd, int mask) | /* to be used with the resync: fast: ... options */
static void set_resync(struct WD33C93_hostdata *hd, int mask) | {
int i;
for (i = 0; i < 8; i++)
if (mask & (1 << i))
hd->sync_stat[i] = SS_UNSET;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Dump the range of CCWs into 'page' buffer and return number of printed chars. */ | static int dasd_eckd_dump_ccw_range(struct ccw1 *from, struct ccw1 *to, char *page) | /* Dump the range of CCWs into 'page' buffer and return number of printed chars. */
static int dasd_eckd_dump_ccw_range(struct ccw1 *from, struct ccw1 *to, char *page) | {
int len, count;
char *datap;
len = 0;
while (from <= to) {
len += sprintf(page + len, KERN_ERR PRINTK_HEADER
" CCW %p: %08X %08X DAT:",
from, ((int *) from)[0], ((int *) from)[1]);
if (from->flags & CCW_FLAG_IDA)
datap = (char *) *((addr_t *) (addr_t) from->cda);
else
datap = (char *) ((addr_t) from->cda);
for (count = 0; count < from->count && count < 32; count++) {
if (count % 8 == 0) len += sprintf(page + len, " ");
if (count % 4 == 0) len += sprintf(page + len, " ");
len += sprintf(page + len, "%02x", datap[count]);
}
len += sprintf(page + len, "\n");
from++;
}
return len;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Reads and returns the current value of SS. This function is only available on IA-32 and x64. */ | UINT16 EFIAPI AsmReadSs(VOID) | /* Reads and returns the current value of SS. This function is only available on IA-32 and x64. */
UINT16 EFIAPI AsmReadSs(VOID) | {
__asm {
xor eax, eax
mov ax, ss
}
} | tianocore/edk2 | C++ | Other | 4,240 |
/* This function prepares the state before issuing the class specific commands. */ | USBH_StatusTypeDef USBH_CDC_Transmit(USBH_HandleTypeDef *phost, uint8_t *pbuff, uint32_t length) | /* This function prepares the state before issuing the class specific commands. */
USBH_StatusTypeDef USBH_CDC_Transmit(USBH_HandleTypeDef *phost, uint8_t *pbuff, uint32_t length) | {
USBH_StatusTypeDef Status = USBH_BUSY;
CDC_HandleTypeDef *CDC_Handle = phost->pActiveClass->pData;
if((CDC_Handle->state == CDC_IDLE_STATE) || (CDC_Handle->state == CDC_TRANSFER_DATA))
{
CDC_Handle->pTxData = pbuff;
CDC_Handle->TxDataLength = length;
CDC_Handle->state = CDC_TRANSFER_DATA;
CDC_Handle->data_tx_state = CDC_SEND_DATA;
Status = USBH_OK;
}
return Status;
} | micropython/micropython | C++ | Other | 18,334 |
/* config synchronous codes unmask in embedded synchronous mode */ | void dci_sync_codes_unmask_config(uint8_t frame_start, uint8_t line_start, uint8_t line_end, uint8_t frame_end) | /* config synchronous codes unmask in embedded synchronous mode */
void dci_sync_codes_unmask_config(uint8_t frame_start, uint8_t line_start, uint8_t line_end, uint8_t frame_end) | {
DCI_SCUMSK = ((uint32_t)frame_start | ((uint32_t)line_start<<8) | ((uint32_t)line_end<<16) | ((uint32_t)frame_end<<24));
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Note that for thread-safety reasons this function can only be called once. */ | void g_set_prgname(const gchar *prgname) | /* Note that for thread-safety reasons this function can only be called once. */
void g_set_prgname(const gchar *prgname) | {
G_LOCK (g_prgname);
g_free (g_prgname);
g_prgname = g_strdup (prgname);
G_UNLOCK (g_prgname);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Frees an input endpoint. May be called when ep hasn't been initialized completely. */ | static void snd_usbmidi_in_endpoint_delete(struct snd_usb_midi_in_endpoint *ep) | /* Frees an input endpoint. May be called when ep hasn't been initialized completely. */
static void snd_usbmidi_in_endpoint_delete(struct snd_usb_midi_in_endpoint *ep) | {
unsigned int i;
for (i = 0; i < INPUT_URBS; ++i)
if (ep->urbs[i])
free_urb_and_buffer(ep->umidi, ep->urbs[i],
ep->urbs[i]->transfer_buffer_length);
kfree(ep);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* The function is used to disable all CAN interrupt. */ | void CAN_Close(CAN_T *tCAN) | /* The function is used to disable all CAN interrupt. */
void CAN_Close(CAN_T *tCAN) | {
CAN_DisableInt(tCAN, (CAN_CON_IE_Msk | CAN_CON_SIE_Msk | CAN_CON_EIE_Msk));
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Read the pad value for a single pin in a GPIO port. */ | unsigned int GPIO_PinInGet(GPIO_Port_TypeDef port, unsigned int pin) | /* Read the pad value for a single pin in a GPIO port. */
unsigned int GPIO_PinInGet(GPIO_Port_TypeDef port, unsigned int pin) | {
EFM_ASSERT(GPIO_PORT_VALID(port) && GPIO_PIN_VALID(pin));
return((unsigned int)((GPIO->P[port].DIN >> pin) & 0x1));
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* Message: IpPortMessage Opcode: 0x0002 Type: CallControl Direction: dev2pbx VarLength: no */ | static void handle_IpPortMessage(ptvcursor_t *cursor, packet_info *pinfo _U_) | /* Message: IpPortMessage Opcode: 0x0002 Type: CallControl Direction: dev2pbx VarLength: no */
static void handle_IpPortMessage(ptvcursor_t *cursor, packet_info *pinfo _U_) | {
ptvcursor_add(cursor, hf_skinny_rtpMediaPort, 4, ENC_LITTLE_ENDIAN);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* We maintain a biased count of active stripes in the bottom 16 bits of bi_phys_segments, and a count of processed stripes in the upper 16 bits */ | static int raid5_bi_phys_segments(struct bio *bio) | /* We maintain a biased count of active stripes in the bottom 16 bits of bi_phys_segments, and a count of processed stripes in the upper 16 bits */
static int raid5_bi_phys_segments(struct bio *bio) | {
return bio->bi_phys_segments & 0xffff;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Overwrite the GCC _sbrk function which check the heap limit related to the stack pointer. In case of freertos this checking will fail. */ | void* _sbrk(uint32_t delta) | /* Overwrite the GCC _sbrk function which check the heap limit related to the stack pointer. In case of freertos this checking will fail. */
void* _sbrk(uint32_t delta) | {
extern char _end;
extern char __HeapLimit;
static char *heap_end;
static char *heap_limit;
char *prev_heap_end;
if (heap_end == 0)
{
heap_end = &_end;
heap_limit = &__HeapLimit;
}
prev_heap_end = heap_end;
if (prev_heap_end + delta > heap_limit)
{
return ((void *)-1L);
}
heap_end += delta;
return ((void *)prev_heap_end);
} | nanoframework/nf-interpreter | C++ | MIT License | 293 |
/* Perform basic hardware initialization at boot.
This needs to be run from the very beginning. So the init priority has to be 0 (zero). */ | static int stm32h7_m4_init(void) | /* Perform basic hardware initialization at boot.
This needs to be run from the very beginning. So the init priority has to be 0 (zero). */
static int stm32h7_m4_init(void) | {
LL_AHB1_GRP1_EnableClock(LL_AHB1_GRP1_PERIPH_ART);
LL_ART_SetBaseAddress(DT_REG_ADDR(DT_CHOSEN(zephyr_flash)));
LL_ART_Enable();
if (!LL_RCC_IsCM4BootForced()) {
LL_AHB4_GRP1_EnableClock(LL_AHB4_GRP1_PERIPH_HSEM);
while ((HSEM->RLR[CFG_HW_ENTRY_STOP_MODE_SEMID] & HSEM_R_LOCK)
!= HSEM_R_LOCK)
;
}
return 0;
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Get the count of items available in the read FIFO. */ | uint32_t EPINonBlockingReadAvail(uint32_t ui32Base) | /* Get the count of items available in the read FIFO. */
uint32_t EPINonBlockingReadAvail(uint32_t ui32Base) | {
ASSERT(ui32Base == EPI0_BASE);
return(HWREG(ui32Base + EPI_O_RFIFOCNT));
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Returns a new, random color wheel index with a minimum distance of 42 from pos. */ | static uint8_t get_random_wheel_index(uint8_t pos) | /* Returns a new, random color wheel index with a minimum distance of 42 from pos. */
static uint8_t get_random_wheel_index(uint8_t pos) | {
uint8_t r = 0;
uint8_t x = 0;
uint8_t y = 0;
uint8_t d = 0;
while(d < 42) {
r = rand() % 360;
x = abs(pos - r);
y = 360 - x;
d = min(x, y);
}
return r;
} | nodemcu/nodemcu-firmware | C++ | MIT License | 7,566 |
/* param handle codec handle. param mclk master clock frequency in HZ. param sampleRate sample rate in HZ. param bitWidth bit width. return kStatus_Success is success, else configure failed. */ | status_t HAL_CODEC_SetFormat(void *handle, uint32_t mclk, uint32_t sampleRate, uint32_t bitWidth) | /* param handle codec handle. param mclk master clock frequency in HZ. param sampleRate sample rate in HZ. param bitWidth bit width. return kStatus_Success is success, else configure failed. */
status_t HAL_CODEC_SetFormat(void *handle, uint32_t mclk, uint32_t sampleRate, uint32_t bitWidth) | {
assert(handle != NULL);
return DA7212_ConfigAudioFormat((da7212_handle_t *)((uint32_t)(((codec_handle_t *)handle)->codecDevHandle)), mclk,
sampleRate, bitWidth);
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* param base Pointer to FLEXIO_I2S_Type structure param mask interrupt source */ | void FLEXIO_I2S_EnableInterrupts(FLEXIO_I2S_Type *base, uint32_t mask) | /* param base Pointer to FLEXIO_I2S_Type structure param mask interrupt source */
void FLEXIO_I2S_EnableInterrupts(FLEXIO_I2S_Type *base, uint32_t mask) | {
if ((mask & (uint32_t)kFLEXIO_I2S_TxDataRegEmptyInterruptEnable) != 0UL)
{
FLEXIO_EnableShifterStatusInterrupts(base->flexioBase, 1UL << base->txShifterIndex);
}
if ((mask & (uint32_t)kFLEXIO_I2S_RxDataRegFullInterruptEnable) != 0UL)
{
FLEXIO_EnableShifterStatusInterrupts(base->flexioBase, 1UL << base->rxShifterIndex);
}
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* If the accounting is turned on for a file in the filesystem pointed to by sb, turn accounting off. */ | void acct_auto_close(struct super_block *sb) | /* If the accounting is turned on for a file in the filesystem pointed to by sb, turn accounting off. */
void acct_auto_close(struct super_block *sb) | {
struct bsd_acct_struct *acct;
spin_lock(&acct_lock);
restart:
list_for_each_entry(acct, &acct_list, list)
if (acct->file && acct->file->f_path.mnt->mnt_sb == sb) {
acct_file_reopen(acct, NULL, NULL);
goto restart;
}
spin_unlock(&acct_lock);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Preempt the current task with a newly woken task if needed: */ | static void check_preempt_tick(struct cfs_rq *cfs_rq, struct sched_entity *curr) | /* Preempt the current task with a newly woken task if needed: */
static void check_preempt_tick(struct cfs_rq *cfs_rq, struct sched_entity *curr) | {
unsigned long ideal_runtime, delta_exec;
ideal_runtime = sched_slice(cfs_rq, curr);
delta_exec = curr->sum_exec_runtime - curr->prev_sum_exec_runtime;
if (delta_exec > ideal_runtime) {
resched_task(rq_of(cfs_rq)->curr);
clear_buddies(cfs_rq, curr);
return;
}
if (!sched_feat(WAKEUP_PREEMPT))
return;
if (delta_exec < sysctl_sched_min_granularity)
return;
if (cfs_rq->nr_running > 1) {
struct sched_entity *se = __pick_next_entity(cfs_rq);
s64 delta = curr->vruntime - se->vruntime;
if (delta > ideal_runtime)
resched_task(rq_of(cfs_rq)->curr);
}
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Routine: pinmux_init Description: Do individual peripheral pinmux configs */ | void pinmux_init(void) | /* Routine: pinmux_init Description: Do individual peripheral pinmux configs */
void pinmux_init(void) | {
pinmux_clear_tristate_input_clamping();
gpio_config_table(e2220_1170_gpio_inits,
ARRAY_SIZE(e2220_1170_gpio_inits));
pinmux_config_pingrp_table(e2220_1170_pingrps,
ARRAY_SIZE(e2220_1170_pingrps));
pinmux_config_drvgrp_table(e2220_1170_drvgrps,
ARRAY_SIZE(e2220_1170_drvgrps));
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* called only when no transfer is active on the bus */ | static int orion_spi_setup_transfer(struct spi_device *spi, struct spi_transfer *t) | /* called only when no transfer is active on the bus */
static int orion_spi_setup_transfer(struct spi_device *spi, struct spi_transfer *t) | {
struct orion_spi *orion_spi;
unsigned int speed = spi->max_speed_hz;
unsigned int bits_per_word = spi->bits_per_word;
int rc;
orion_spi = spi_master_get_devdata(spi->master);
if ((t != NULL) && t->speed_hz)
speed = t->speed_hz;
if ((t != NULL) && t->bits_per_word)
bits_per_word = t->bits_per_word;
rc = orion_spi_baudrate_set(spi, speed);
if (rc)
return rc;
return orion_spi_set_transfer_size(orion_spi, bits_per_word);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This version uses tmpfile(), which constructs a suitable file name behind the scenes. We don't have to use info->temp_name at all; indeed, we can't even find out the actual name of the temp file. */ | jpeg_open_backing_store(j_common_ptr cinfo, backing_store_ptr info, long total_bytes_needed) | /* This version uses tmpfile(), which constructs a suitable file name behind the scenes. We don't have to use info->temp_name at all; indeed, we can't even find out the actual name of the temp file. */
jpeg_open_backing_store(j_common_ptr cinfo, backing_store_ptr info, long total_bytes_needed) | {
if ((info->temp_file = getTempFile()) == NULL)
ERREXITS(cinfo, JERR_TFILE_CREATE, "");
info->read_backing_store = read_backing_store;
info->write_backing_store = write_backing_store;
info->close_backing_store = close_backing_store;
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* Enables or disables the TIMx peripheral Preload register on CCR3. */ | void TIM_OC3PreloadConfig(TIM_TypeDef *TIMx, uint16_t TIM_OCPreload) | /* Enables or disables the TIMx peripheral Preload register on CCR3. */
void TIM_OC3PreloadConfig(TIM_TypeDef *TIMx, uint16_t TIM_OCPreload) | {
uint16_t tmpccmr2 = 0;
assert_param(IS_TIM_LIST3_PERIPH(TIMx));
assert_param(IS_TIM_OCPRELOAD_STATE(TIM_OCPreload));
tmpccmr2 = TIMx->CCMR2;
tmpccmr2 &= (uint16_t)(~TIM_CCMR2_OC3PE);
tmpccmr2 |= TIM_OCPreload;
TIMx->CCMR2 = tmpccmr2;
} | MaJerle/stm32f429 | C++ | null | 2,036 |
/* This is the routine that sends the received data to the kernel AX.25. 'cmd' is the KISS command. For AX.25 data, it is zero. */ | static void sp_bump(struct sixpack *sp, char cmd) | /* This is the routine that sends the received data to the kernel AX.25. 'cmd' is the KISS command. For AX.25 data, it is zero. */
static void sp_bump(struct sixpack *sp, char cmd) | {
struct sk_buff *skb;
int count;
unsigned char *ptr;
count = sp->rcount + 1;
sp->dev->stats.rx_bytes += count;
if ((skb = dev_alloc_skb(count)) == NULL)
goto out_mem;
ptr = skb_put(skb, count);
*ptr++ = cmd;
memcpy(ptr, sp->cooked_buf + 1, count);
skb->protocol = ax25_type_trans(skb, sp->dev);
netif_rx(skb);
sp->dev->stats.rx_packets++;
return;
out_mem:
sp->dev->stats.rx_dropped++;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* If the handler pointer is NULL the current listener (if any) is unregistered. Otherwise the new listener is registered provided there is no existing listener registered. */ | int iop_listen(uint iop_num, uint chan, void(*handler)(struct iop_msg *), const char *devname) | /* If the handler pointer is NULL the current listener (if any) is unregistered. Otherwise the new listener is registered provided there is no existing listener registered. */
int iop_listen(uint iop_num, uint chan, void(*handler)(struct iop_msg *), const char *devname) | {
if ((iop_num >= NUM_IOPS) || !iop_base[iop_num]) return -EINVAL;
if (chan >= NUM_IOP_CHAN) return -EINVAL;
if (iop_listeners[iop_num][chan].handler && handler) return -EINVAL;
iop_listeners[iop_num][chan].devname = devname;
iop_listeners[iop_num][chan].handler = handler;
return 0;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Active the Calibration operation for the selected ADC. */ | uint32_t ADC_GetCalibrationFactor(ADC_TypeDef *ADCx) | /* Active the Calibration operation for the selected ADC. */
uint32_t ADC_GetCalibrationFactor(ADC_TypeDef *ADCx) | {
uint32_t tmpreg = 0, calibrationcounter = 0, calibrationstatus = 0;
assert_param(IS_ADC_ALL_PERIPH(ADCx));
ADCx->CR |= (uint32_t)ADC_CR_ADCAL;
do
{
calibrationstatus = ADCx->CR & ADC_CR_ADCAL;
calibrationcounter++;
}
while ((calibrationcounter != CALIBRATION_TIMEOUT) && (calibrationstatus != 0x00));
if ((uint32_t)(ADCx->CR & ADC_CR_ADCAL) == RESET)
{
tmpreg = ADCx->DR;
ADCx->CR |= (uint32_t)ADC_ISR_ADRDY;
}
else
{
tmpreg = 0x00000000;
}
return tmpreg;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* This function will compare two strings while ignoring differences in case */ | rt_int32_t rt_strcasecmp(const char *a, const char *b) | /* This function will compare two strings while ignoring differences in case */
rt_int32_t rt_strcasecmp(const char *a, const char *b) | {
int ca, cb;
do
{
ca = *a++ & 0xff;
cb = *b++ & 0xff;
if (ca >= 'A' && ca <= 'Z')
ca += 'a' - 'A';
if (cb >= 'A' && cb <= 'Z')
cb += 'a' - 'A';
}
while (ca == cb && ca != '\0');
return ca - cb;
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* Sets the designated bits in a 16/32-bit write-protected data word at the Remote CPU system address */ | uint16_t IPCLiteLtoRSetBits_Protected(uint32_t ulFlag, uint32_t ulAddress, uint32_t ulMask, uint16_t usLength, uint32_t ulStatusFlag) | /* Sets the designated bits in a 16/32-bit write-protected data word at the Remote CPU system address */
uint16_t IPCLiteLtoRSetBits_Protected(uint32_t ulFlag, uint32_t ulAddress, uint32_t ulMask, uint16_t usLength, uint32_t ulStatusFlag) | {
uint16_t returnStatus;
if (IpcRegs.IPCFLG.all & (ulFlag | ulStatusFlag))
{
returnStatus = STATUS_FAIL;
}
else
{
if (usLength == IPC_LENGTH_16_BITS)
{
IpcRegs.IPCSENDCOM = IPC_SET_BITS_16_PROTECTED;
IpcRegs.IPCSENDADDR = ulAddress;
IpcRegs.IPCSENDDATA = ulMask & (0x0000FFFF);
}
else if (usLength == IPC_LENGTH_32_BITS)
{
IpcRegs.IPCSENDCOM = IPC_SET_BITS_32_PROTECTED;
IpcRegs.IPCSENDADDR = ulAddress;
IpcRegs.IPCSENDDATA = ulMask;
}
IpcRegs.IPCSET.all |= (ulFlag | ulStatusFlag);
returnStatus = STATUS_PASS;
}
return returnStatus;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* param base RDC_SEMA42 peripheral base address. param gateNum Gate number to lock. param masterIndex Current processor master index. param domainId Current processor domain ID. */ | void RDC_SEMA42_Lock(RDC_SEMAPHORE_Type *base, uint8_t gateNum, uint8_t masterIndex, uint8_t domainId) | /* param base RDC_SEMA42 peripheral base address. param gateNum Gate number to lock. param masterIndex Current processor master index. param domainId Current processor domain ID. */
void RDC_SEMA42_Lock(RDC_SEMAPHORE_Type *base, uint8_t gateNum, uint8_t masterIndex, uint8_t domainId) | {
while (kStatus_Success != RDC_SEMA42_TryLock(base, gateNum, masterIndex, domainId))
{
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* enable or disable the EXMC NAND ECC function */ | void exmc_nand_ecc_config(uint32_t exmc_nand_bank, ControlStatus newvalue) | /* enable or disable the EXMC NAND ECC function */
void exmc_nand_ecc_config(uint32_t exmc_nand_bank, ControlStatus newvalue) | {
if (ENABLE == newvalue){
EXMC_NPCTL(exmc_nand_bank) |= EXMC_NPCTL_ECCEN;
}else{
EXMC_NPCTL(exmc_nand_bank) &= ~EXMC_NPCTL_ECCEN;
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* This function handles DFSDM MIC2 DMA interrupt request. */ | void AUDIO_DFSDM_DMAx_MIC2_IRQHandler(void) | /* This function handles DFSDM MIC2 DMA interrupt request. */
void AUDIO_DFSDM_DMAx_MIC2_IRQHandler(void) | {
HAL_DMA_IRQHandler(hAudioInDfsdmFilter[POS_VAL(INPUT_DEVICE_DIGITAL_MIC2)].hdmaReg);
} | STMicroelectronics/STM32CubeF4 | C++ | Other | 789 |
/* Although this function is called "stop_tx", it does not actually stop transmission of data. Instead, it tells the QE to not generate an interrupt when the UCC is finished sending characters. */ | static void qe_uart_stop_tx(struct uart_port *port) | /* Although this function is called "stop_tx", it does not actually stop transmission of data. Instead, it tells the QE to not generate an interrupt when the UCC is finished sending characters. */
static void qe_uart_stop_tx(struct uart_port *port) | {
struct uart_qe_port *qe_port =
container_of(port, struct uart_qe_port, port);
clrbits16(&qe_port->uccp->uccm, UCC_UART_UCCE_TX);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* RETURNS: Pointer to new mode on success, NULL on error. */ | struct drm_display_mode* drm_mode_create(struct drm_device *dev) | /* RETURNS: Pointer to new mode on success, NULL on error. */
struct drm_display_mode* drm_mode_create(struct drm_device *dev) | {
struct drm_display_mode *nmode;
nmode = kzalloc(sizeof(struct drm_display_mode), GFP_KERNEL);
if (!nmode)
return NULL;
drm_mode_object_get(dev, &nmode->base, DRM_MODE_OBJECT_MODE);
return nmode;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Set PCNT operational mode.
Notice that this function does not do any configuration. Setting operational mode is normally only required after initialization is done, and if not done as part of initialization. Or if requiring to disable/reenable pulse counter. */ | void PCNT_Enable(PCNT_TypeDef *pcnt, PCNT_Mode_TypeDef mode) | /* Set PCNT operational mode.
Notice that this function does not do any configuration. Setting operational mode is normally only required after initialization is done, and if not done as part of initialization. Or if requiring to disable/reenable pulse counter. */
void PCNT_Enable(PCNT_TypeDef *pcnt, PCNT_Mode_TypeDef mode) | {
uint32_t tmp;
EFM_ASSERT(PCNT_REF_VALID(pcnt));
tmp = pcnt->CTRL & ~_PCNT_CTRL_MODE_MASK;
tmp |= (uint32_t)mode << _PCNT_CTRL_MODE_SHIFT;
PCNT_Sync(pcnt, PCNT_SYNCBUSY_CTRL);
pcnt->CTRL = tmp;
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* Check to see if the page at the given address is guarded or not. */ | BOOLEAN EFIAPI IsMemoryGuarded(IN EFI_PHYSICAL_ADDRESS Address) | /* Check to see if the page at the given address is guarded or not. */
BOOLEAN EFIAPI IsMemoryGuarded(IN EFI_PHYSICAL_ADDRESS Address) | {
return (GetGuardMapBit (Address) == 1);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Like TIFFGetField, but taking a varargs parameter list. This routine is useful for building higher-level interfaces on top of the library. */ | int TIFFVGetField(TIFF *tif, uint32 tag, va_list ap) | /* Like TIFFGetField, but taking a varargs parameter list. This routine is useful for building higher-level interfaces on top of the library. */
int TIFFVGetField(TIFF *tif, uint32 tag, va_list ap) | {
const TIFFField* fip = TIFFFindField(tif, tag, TIFF_ANY);
return (fip && (isPseudoTag(tag) || TIFFFieldSet(tif, fip->field_bit)) ?
(*tif->tif_tagmethods.vgetfield)(tif, tag, ap) : 0);
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* Indicates whether the compare match interrupt (CMPMIE) is enabled. @rmtoll IER CMPMIE LPTIM_IsEnabledIT_CMPM. */ | uint32_t LPTIM_IsEnabledIT_CMPM(LPTIM_Module *LPTIMx) | /* Indicates whether the compare match interrupt (CMPMIE) is enabled. @rmtoll IER CMPMIE LPTIM_IsEnabledIT_CMPM. */
uint32_t LPTIM_IsEnabledIT_CMPM(LPTIM_Module *LPTIMx) | {
return (((READ_BIT(LPTIMx->INTEN, LPTIM_INTEN_CMPMIE) == LPTIM_INTEN_CMPMIE)? 1UL : 0UL));
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* Solve Ax = b, where A is a 2x2 matrix and b is a 2x1 vector. */ | int32_t matsolve_2x2(float *A, float *b, float *x) | /* Solve Ax = b, where A is a 2x2 matrix and b is a 2x1 vector. */
int32_t matsolve_2x2(float *A, float *b, float *x) | {
float det = A[0] * A[3] - A[1] * A[2];
if (det == 0)
return FAILURE;
x[0] = (A[3] * b[0] - A[1] * b[1]) / det;
x[1] = (A[0] * b[1] - A[2] * b[0]) / det;
return SUCCESS;
} | analogdevicesinc/EVAL-ADICUP3029 | C++ | Other | 36 |
/* Modify low 32 bits of Redirection Table entry.
This routine modifies selected portions of the low-order 32 bits of a Redirection Table entry, as indicated by the associate bit mask. */ | static __pinned_func void IoApicRedUpdateLo(unsigned int irq, uint32_t value, uint32_t mask) | /* Modify low 32 bits of Redirection Table entry.
This routine modifies selected portions of the low-order 32 bits of a Redirection Table entry, as indicated by the associate bit mask. */
static __pinned_func void IoApicRedUpdateLo(unsigned int irq, uint32_t value, uint32_t mask) | {
ioApicRedSetLo(irq, (ioApicRedGetLo(irq) & ~mask) | (value & mask));
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Checks whether the specified FSMC interrupt has occurred or not. */ | ITStatus FSMC_GetITStatus(uint32_t FSMC_Bank, uint32_t FSMC_IT) | /* Checks whether the specified FSMC interrupt has occurred or not. */
ITStatus FSMC_GetITStatus(uint32_t FSMC_Bank, uint32_t FSMC_IT) | {
ITStatus bitstatus = RESET;
uint32_t tmpsr = 0x0, itstatus = 0x0, itenable = 0x0;
assert_param(IS_FSMC_IT_BANK(FSMC_Bank));
assert_param(IS_FSMC_GET_IT(FSMC_IT));
if(FSMC_Bank == FSMC_Bank2_NAND)
{
tmpsr = FSMC_Bank2->SR2;
}
else if(FSMC_Bank == FSMC_Bank3_NAND)
{
tmpsr = FSMC_Bank3->SR3;
}
else
{
tmpsr = FSMC_Bank4->SR4;
}
itstatus = tmpsr & FSMC_IT;
itenable = tmpsr & (FSMC_IT >> 3);
if ((itstatus != (uint32_t)RESET) && (itenable != (uint32_t)RESET))
{
bitstatus = SET;
}
else
{
bitstatus = RESET;
}
return bitstatus;
} | gcallipo/RadioDSP-Stm32f103 | C++ | Common Creative - Attribution 3.0 | 51 |
/* This is the Event call back function is triggered in SMM to notify the Library the system is entering runtime phase. */ | EFI_STATUS EFIAPI SmmPerformanceLibExitBootServicesCallback(IN CONST EFI_GUID *Protocol, IN VOID *Interface, IN EFI_HANDLE Handle) | /* This is the Event call back function is triggered in SMM to notify the Library the system is entering runtime phase. */
EFI_STATUS EFIAPI SmmPerformanceLibExitBootServicesCallback(IN CONST EFI_GUID *Protocol, IN VOID *Interface, IN EFI_HANDLE Handle) | {
mPerformanceMeasurementEnabled = FALSE;
return EFI_SUCCESS;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Polarity is determined on the polarity reversal feature being enabled. */ | s32 e1000_check_polarity_ife(struct e1000_hw *hw) | /* Polarity is determined on the polarity reversal feature being enabled. */
s32 e1000_check_polarity_ife(struct e1000_hw *hw) | {
struct e1000_phy_info *phy = &hw->phy;
s32 ret_val;
u16 phy_data, offset, mask;
if (phy->polarity_correction) {
offset = IFE_PHY_EXTENDED_STATUS_CONTROL;
mask = IFE_PESC_POLARITY_REVERSED;
} else {
offset = IFE_PHY_SPECIAL_CONTROL;
mask = IFE_PSC_FORCE_POLARITY;
}
ret_val = e1e_rphy(hw, offset, &phy_data);
if (!ret_val)
phy->cable_polarity = (phy_data & mask)
? e1000_rev_polarity_reversed
: e1000_rev_polarity_normal;
return ret_val;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* @discussion This function sets the solid fill color of an evo object. */ | BOOL ElmSetColor(ElmVecObj evo, uint32_t color) | /* @discussion This function sets the solid fill color of an evo object. */
BOOL ElmSetColor(ElmVecObj evo, uint32_t color) | {
return _set_color(evo, color);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Copy the security bit value to a RAM buffer. */ | static void mem_security_read(void *dst, isp_addr_t src, uint16_t nbytes) | /* Copy the security bit value to a RAM buffer. */
static void mem_security_read(void *dst, isp_addr_t src, uint16_t nbytes) | {
if (nbytes) {
*(U8 *) dst = flash_api_is_security_bit_active();
}
} | memfault/zero-to-main | C++ | null | 200 |
/* Allocate a new ext. data for an object */ | void* lv_obj_allocate_ext_attr(lv_obj_t *obj, uint16_t ext_size) | /* Allocate a new ext. data for an object */
void* lv_obj_allocate_ext_attr(lv_obj_t *obj, uint16_t ext_size) | {
obj->ext_attr = lv_mem_realloc(obj->ext_attr, ext_size);
return (void *)obj->ext_attr;
} | RavenSystem/esp-homekit-devices | C++ | Other | 2,577 |
/* Used for on-stack allocated work items. The caller needs to wait until the wb threads have acked the work before it's safe to continue. */ | static void bdi_wait_on_work_clear(struct bdi_work *work) | /* Used for on-stack allocated work items. The caller needs to wait until the wb threads have acked the work before it's safe to continue. */
static void bdi_wait_on_work_clear(struct bdi_work *work) | {
wait_on_bit(&work->state, WS_USED_B, bdi_sched_wait,
TASK_UNINTERRUPTIBLE);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Initializes the receive and transmit buffers of a message channel. */ | static HRESULT IxxatVciLibFuncCanChannelInitialize(HANDLE hCanChn, UINT16 wRxFifoSize, UINT16 wRxThreshold, UINT16 wTxFifoSize, UINT16 wTxThreshold) | /* Initializes the receive and transmit buffers of a message channel. */
static HRESULT IxxatVciLibFuncCanChannelInitialize(HANDLE hCanChn, UINT16 wRxFifoSize, UINT16 wRxThreshold, UINT16 wTxFifoSize, UINT16 wTxThreshold) | {
HRESULT result = VCI_E_UNEXPECTED;
assert(ixxatVciLibFuncCanChannelInitializePtr != NULL);
assert(ixxatVciDllHandle != NULL);
if ((ixxatVciLibFuncCanChannelInitializePtr != NULL) && (ixxatVciDllHandle != NULL))
{
result = ixxatVciLibFuncCanChannelInitializePtr(hCanChn, wRxFifoSize, wRxThreshold, wTxFifoSize, wTxThreshold);
}
return result;
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* param base Quad Timer peripheral base address param channel Quad Timer channel number param capturePin Pin through which we receive the input signal to trigger the capture param inputPolarity true: invert polarity of the input signal, false: no inversion param reloadOnCapture true: reload the counter when an input capture occurs, false: no reload param captureMode Specifies which edge of the input signal triggers a capture */ | void QTMR_SetupInputCapture(TMR_Type *base, qtmr_channel_selection_t channel, qtmr_input_source_t capturePin, bool inputPolarity, bool reloadOnCapture, qtmr_input_capture_edge_t captureMode) | /* param base Quad Timer peripheral base address param channel Quad Timer channel number param capturePin Pin through which we receive the input signal to trigger the capture param inputPolarity true: invert polarity of the input signal, false: no inversion param reloadOnCapture true: reload the counter when an input capture occurs, false: no reload param captureMode Specifies which edge of the input signal triggers a capture */
void QTMR_SetupInputCapture(TMR_Type *base, qtmr_channel_selection_t channel, qtmr_input_source_t capturePin, bool inputPolarity, bool reloadOnCapture, qtmr_input_capture_edge_t captureMode) | {
uint16_t reg;
reg = base->CHANNEL[channel].CTRL & (uint16_t)(~TMR_CTRL_SCS_MASK);
reg |= TMR_CTRL_SCS(capturePin);
base->CHANNEL[channel].CTRL = reg;
reg = base->CHANNEL[channel].SCTRL &
(uint16_t)(~(TMR_SCTRL_IPS_MASK | TMR_SCTRL_CAPTURE_MODE_MASK | TMR_SCTRL_OEN_MASK));
reg |= (TMR_SCTRL_IPS(inputPolarity) | TMR_SCTRL_CAPTURE_MODE(captureMode));
base->CHANNEL[channel].SCTRL = reg;
if (reloadOnCapture)
{
base->CHANNEL[channel].CSCTRL |= TMR_CSCTRL_ROC_MASK;
}
else
{
base->CHANNEL[channel].CSCTRL &= (uint16_t)(~TMR_CSCTRL_ROC_MASK);
}
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* Shell command that receives a file over the Kermit file transfer protocol and writes it to flash. */ | static int cmd_application_kermit_load_cb(int argc, const char *argv[], void *out_p, void *in_p, void *arg_p, void *call_arg_p) | /* Shell command that receives a file over the Kermit file transfer protocol and writes it to flash. */
static int cmd_application_kermit_load_cb(int argc, const char *argv[], void *out_p, void *in_p, void *arg_p, void *call_arg_p) | {
return (upgrade_kermit_load_file());
} | eerimoq/simba | C++ | Other | 337 |
/* Reads a byte from the I2C receive FIFO. */ | uint32_t I2CFIFODataGet(uint32_t ui32Base) | /* Reads a byte from the I2C receive FIFO. */
uint32_t I2CFIFODataGet(uint32_t ui32Base) | {
ASSERT(_I2CBaseValid(ui32Base));
while(HWREG(ui32Base + I2C_O_FIFOSTATUS) & I2C_FIFOSTATUS_RXFE)
{
}
return(HWREG(ui32Base + I2C_O_FIFODATA));
} | micropython/micropython | C++ | Other | 18,334 |
/* This function returns the channel number that control traffic is being sent on, for legacy channels this is just the channel number, for 40MHZ channels it is the upper or lower 20MHZ sideband depending on the chanspec selected */ | uint8 wf_chspec_ctlchan(chanspec_t chspec) | /* This function returns the channel number that control traffic is being sent on, for legacy channels this is just the channel number, for 40MHZ channels it is the upper or lower 20MHZ sideband depending on the chanspec selected */
uint8 wf_chspec_ctlchan(chanspec_t chspec) | {
uint8 ctl_chan;
if (CHSPEC_CTL_SB(chspec) == WL_CHANSPEC_CTL_SB_NONE) {
return CHSPEC_CHANNEL(chspec);
} else {
ASSERT(CHSPEC_BW(chspec) == WL_CHANSPEC_BW_40);
if (CHSPEC_CTL_SB(chspec) == WL_CHANSPEC_CTL_SB_UPPER) {
ctl_chan = UPPER_20_SB(CHSPEC_CHANNEL(chspec));
} else {
ASSERT(CHSPEC_CTL_SB(chspec) == WL_CHANSPEC_CTL_SB_LOWER);
ctl_chan = LOWER_20_SB(CHSPEC_CHANNEL(chspec));
}
}
return ctl_chan;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Local function to wait for a device interrupt (and clear it) */ | static void Wait4DevInt(U32 dwIntr) | /* Local function to wait for a device interrupt (and clear it) */
static void Wait4DevInt(U32 dwIntr) | {
while ((LPC_USB->USBDevIntSt & dwIntr) != dwIntr);
LPC_USB->USBDevIntClr = dwIntr;
} | ajhc/demo-cortex-m3 | C++ | null | 38 |
/* Returns the number of bytes that are actually in the stored address. */ | size_t rpc_peeraddr(struct rpc_clnt *clnt, struct sockaddr *buf, size_t bufsize) | /* Returns the number of bytes that are actually in the stored address. */
size_t rpc_peeraddr(struct rpc_clnt *clnt, struct sockaddr *buf, size_t bufsize) | {
size_t bytes;
struct rpc_xprt *xprt = clnt->cl_xprt;
bytes = sizeof(xprt->addr);
if (bytes > bufsize)
bytes = bufsize;
memcpy(buf, &clnt->cl_xprt->addr, bytes);
return xprt->addrlen;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Configures the TIMx Internal Trigger as External Clock. */ | void TIM_ConfigInternalTrigToExt(TIM_Module *TIMx, uint16_t TIM_InputTriggerSource) | /* Configures the TIMx Internal Trigger as External Clock. */
void TIM_ConfigInternalTrigToExt(TIM_Module *TIMx, uint16_t TIM_InputTriggerSource) | {
assert_param(IsTimList6Module(TIMx));
assert_param(IsTimInterTrigSel(TIM_InputTriggerSource));
TIM_SelectInputTrig(TIMx, TIM_InputTriggerSource);
TIMx->SMCTRL |= TIM_SLAVE_MODE_EXT1;
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* Find child node given the parent node and the edge character */ | STATIC NODE Child(IN NODE NodeQ, IN UINT8 CharC) | /* Find child node given the parent node and the edge character */
STATIC NODE Child(IN NODE NodeQ, IN UINT8 CharC) | {
NODE NodeR;
NodeR = mNext[HASH (NodeQ, CharC)];
mParent[NIL] = NodeQ;
while (mParent[NodeR] != NodeQ) {
NodeR = mNext[NodeR];
}
return NodeR;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Retrieve the Extended Key Usage from one X.509 certificate. */ | BOOLEAN EFIAPI X509GetExtendedKeyUsage(IN CONST UINT8 *Cert, IN UINTN CertSize, OUT UINT8 *Usage, IN OUT UINTN *UsageSize) | /* Retrieve the Extended Key Usage from one X.509 certificate. */
BOOLEAN EFIAPI X509GetExtendedKeyUsage(IN CONST UINT8 *Cert, IN UINTN CertSize, OUT UINT8 *Usage, IN OUT UINTN *UsageSize) | {
BOOLEAN Status;
Status = X509GetExtensionData (Cert, CertSize, mOidExtKeyUsage, sizeof (mOidExtKeyUsage), Usage, UsageSize);
return Status;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Returns: The new offset into the message that follow on dissections should use as their starting offset */ | static guint32 dissect_cyclic_wt(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint32 size) | /* Returns: The new offset into the message that follow on dissections should use as their starting offset */
static guint32 dissect_cyclic_wt(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint32 size) | {
proto_tree *header_tree;
header_tree = proto_tree_add_subtree(tree, tvb, offset, size, ett_cyclic_rd_wt, NULL, "Cyclic Write Data Block");
proto_tree_add_item(header_tree, hf_cip_cyclic_write_blk, tvb, offset, 1, ENC_LITTLE_ENDIAN);
proto_tree_add_item(header_tree, hf_cip_cyclic_read_blk, tvb, offset + 2, 1, ENC_LITTLE_ENDIAN);
if ( (size - 4) > 0 )
{
proto_tree_add_item(header_tree, hf_cip_cyclic_wrt_data, tvb, offset + 4, size - 4, ENC_NA);
}
return offset + size;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Disable the DMA of the specified SPI port.
The */ | void xSPIDMADisable(unsigned long ulBase, unsigned long ulDmaMode) | /* Disable the DMA of the specified SPI port.
The */
void xSPIDMADisable(unsigned long ulBase, unsigned long ulDmaMode) | {
xASSERT((ulBase == SPI0_BASE) || (ulBase == SPI1_BASE)||
(ulBase == SPI2_BASE)||(ulBase == SPI3_BASE) );
xHWREG(ulBase + SPI_DMACTL) &= ~ulDmaMode;
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Make sure the controller is completely inactive, unable to generate interrupts or do DMA. */ | void uhci_reset_hc(struct pci_dev *pdev, unsigned long base) | /* Make sure the controller is completely inactive, unable to generate interrupts or do DMA. */
void uhci_reset_hc(struct pci_dev *pdev, unsigned long base) | {
pci_write_config_word(pdev, UHCI_USBLEGSUP, UHCI_USBLEGSUP_RWC);
outw(UHCI_USBCMD_HCRESET, base + UHCI_USBCMD);
mb();
udelay(5);
if (inw(base + UHCI_USBCMD) & UHCI_USBCMD_HCRESET)
dev_warn(&pdev->dev, "HCRESET not completed yet!\n");
outw(0, base + UHCI_USBINTR);
outw(0, base + UHCI_USBCMD);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* We get called holding the mru->lock, which we drop and then reacquire. Sparse need special help with this to tell it we know what we are doing. */ | STATIC void _xfs_mru_cache_clear_reap_list(xfs_mru_cache_t *mru) __releases(mru -> lock) __acquires(mru->lock) | /* We get called holding the mru->lock, which we drop and then reacquire. Sparse need special help with this to tell it we know what we are doing. */
STATIC void _xfs_mru_cache_clear_reap_list(xfs_mru_cache_t *mru) __releases(mru -> lock) __acquires(mru->lock) | {
xfs_mru_cache_elem_t *elem, *next;
struct list_head tmp;
INIT_LIST_HEAD(&tmp);
list_for_each_entry_safe(elem, next, &mru->reap_list, list_node) {
radix_tree_delete(&mru->store, elem->key);
list_move(&elem->list_node, &tmp);
}
spin_unlock(&mru->lock);
list_for_each_entry_safe(elem, next, &tmp, list_node) {
list_del_init(&elem->list_node);
mru->free_func(elem->key, elem->value);
kmem_zone_free(xfs_mru_elem_zone, elem);
}
spin_lock(&mru->lock);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Convert an integer from unsigned little-endian encoding to a sequence of 13-bit words in little-endian order. The final "partial" word is returned. */ | static uint32_t le8_to_le13(uint32_t *dst, const unsigned char *src, size_t len) | /* Convert an integer from unsigned little-endian encoding to a sequence of 13-bit words in little-endian order. The final "partial" word is returned. */
static uint32_t le8_to_le13(uint32_t *dst, const unsigned char *src, size_t len) | {
uint32_t acc;
int acc_len;
acc = 0;
acc_len = 0;
while (len -- > 0) {
acc |= (uint32_t)(*src ++) << acc_len;
acc_len += 8;
if (acc_len >= 13) {
*dst ++ = acc & 0x1FFF;
acc >>= 13;
acc_len -= 13;
}
}
return acc;
} | RavenSystem/esp-homekit-devices | C++ | Other | 2,577 |
/* This is the default unload handle for display core drivers. */ | EFI_STATUS EFIAPI UnloadDisplayEngine(IN EFI_HANDLE ImageHandle) | /* This is the default unload handle for display core drivers. */
EFI_STATUS EFIAPI UnloadDisplayEngine(IN EFI_HANDLE ImageHandle) | {
HiiRemovePackages (gHiiHandle);
FreeDisplayStrings ();
if (gHighligthMenuInfo.HLTOpCode != NULL) {
FreePool (gHighligthMenuInfo.HLTOpCode);
}
if (gHighligthMenuInfo.TOSOpCode != NULL) {
FreePool (gHighligthMenuInfo.TOSOpCode);
}
return EFI_SUCCESS;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* configure the delayed sample clock of read data */ | void exmc_sdram_readsample_config(uint32_t delay_cell, uint32_t extra_hclk) | /* configure the delayed sample clock of read data */
void exmc_sdram_readsample_config(uint32_t delay_cell, uint32_t extra_hclk) | {
uint32_t sdrsctl = 0U;
sdrsctl = EXMC_SDRSCTL & (~(EXMC_SDRSCTL_SDSC | EXMC_SDRSCTL_SSCR));
sdrsctl |= (uint32_t)(delay_cell & EXMC_SDRSCTL_SDSC) |
((extra_hclk << SDRSCTL_SSCR_OFFSET) & EXMC_SDRSCTL_SSCR);
EXMC_SDRSCTL = sdrsctl;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* The user Entry Point for module Terminal. The user code starts with this function. */ | EFI_STATUS EFIAPI InitializeTerminal(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable) | /* The user Entry Point for module Terminal. The user code starts with this function. */
EFI_STATUS EFIAPI InitializeTerminal(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable) | {
EFI_STATUS Status;
Status = EfiLibInstallDriverBindingComponentName2 (
ImageHandle,
SystemTable,
&gTerminalDriverBinding,
ImageHandle,
&gTerminalComponentName,
&gTerminalComponentName2
);
ASSERT_EFI_ERROR (Status);
return Status;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* fc_frame_drop() - Dummy frame handler @lport: The local port the frame was received on @fp: The received frame */ | static int fc_frame_drop(struct fc_lport *lport, struct fc_frame *fp) | /* fc_frame_drop() - Dummy frame handler @lport: The local port the frame was received on @fp: The received frame */
static int fc_frame_drop(struct fc_lport *lport, struct fc_frame *fp) | {
fc_frame_free(fp);
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Description: See __splice_from_pipe. This function locks the pipe inode, otherwise it's identical to __splice_from_pipe(). */ | ssize_t splice_from_pipe(struct pipe_inode_info *pipe, struct file *out, loff_t *ppos, size_t len, unsigned int flags, splice_actor *actor) | /* Description: See __splice_from_pipe. This function locks the pipe inode, otherwise it's identical to __splice_from_pipe(). */
ssize_t splice_from_pipe(struct pipe_inode_info *pipe, struct file *out, loff_t *ppos, size_t len, unsigned int flags, splice_actor *actor) | {
ssize_t ret;
struct splice_desc sd = {
.total_len = len,
.flags = flags,
.pos = *ppos,
.u.file = out,
};
pipe_lock(pipe);
ret = __splice_from_pipe(pipe, &sd, actor);
pipe_unlock(pipe);
return ret;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Serach the EMU IO Thunk database for a matching EMU IO Thunk Protocol instance. */ | EMU_IO_THUNK_PROTOCOL* EFIAPI GetIoThunkInstance(IN EFI_GUID *Protocol, IN UINTN Instance) | /* Serach the EMU IO Thunk database for a matching EMU IO Thunk Protocol instance. */
EMU_IO_THUNK_PROTOCOL* EFIAPI GetIoThunkInstance(IN EFI_GUID *Protocol, IN UINTN Instance) | {
EFI_STATUS Status;
EMU_IO_THUNK_PROTOCOL *EmuIoThunk;
for (Status = EFI_SUCCESS, EmuIoThunk = NULL; !EFI_ERROR (Status); ) {
Status = gEmuThunk->GetNextProtocol (FALSE, &EmuIoThunk);
if (EFI_ERROR (Status)) {
break;
}
if (EmuIoThunk->Instance == Instance) {
if (CompareGuid (EmuIoThunk->Protocol, Protocol)) {
return EmuIoThunk;
}
}
}
return NULL;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Start or stop Rx DMA. When stop RX DMA, clear DMA OWM bit. */ | void I2S_RxDmaCmd(I2S_TypeDef *I2Sx, u32 NewState) | /* Start or stop Rx DMA. When stop RX DMA, clear DMA OWM bit. */
void I2S_RxDmaCmd(I2S_TypeDef *I2Sx, u32 NewState) | {
u32 i;
u32 own = 0x00000000;
if (NewState == DISABLE) {
own &= ~BIT_IS_PAGE_OWN;
} else {
own = BIT_IS_PAGE_OWN;
}
for (i = 0; i < 4; i++) {
I2Sx->IS_RX_PAGE_OWN[i] = own;
}
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* Add "d" into crc scope, caculate the new crc value */ | static void h5_crc_update(uint16_t *crc, uint8_t d) | /* Add "d" into crc scope, caculate the new crc value */
static void h5_crc_update(uint16_t *crc, uint8_t d) | {
uint16_t reg = *crc;
reg = (reg >> 4) ^ crc_table[(reg ^ d) & 0x000f];
reg = (reg >> 4) ^ crc_table[(reg ^ (d >> 4)) & 0x000f];
*crc = reg;
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* The described resource region must match a currently busy region. */ | void __release_region(struct resource *parent, resource_size_t start, resource_size_t n) | /* The described resource region must match a currently busy region. */
void __release_region(struct resource *parent, resource_size_t start, resource_size_t n) | {
struct resource **p;
resource_size_t end;
p = &parent->child;
end = start + n - 1;
write_lock(&resource_lock);
for (;;) {
struct resource *res = *p;
if (!res)
break;
if (res->start <= start && res->end >= end) {
if (!(res->flags & IORESOURCE_BUSY)) {
p = &res->child;
continue;
}
if (res->start != start || res->end != end)
break;
*p = res->sibling;
write_unlock(&resource_lock);
kfree(res);
return;
}
p = &res->sibling;
}
write_unlock(&resource_lock);
printk(KERN_WARNING "Trying to free nonexistent resource "
"<%016llx-%016llx>\n", (unsigned long long)start,
(unsigned long long)end);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Perform basic hardware initialization at boot.
This needs to be run from the very beginning. So the init priority has to be 0 (zero). */ | static int stm32wb_init(void) | /* Perform basic hardware initialization at boot.
This needs to be run from the very beginning. So the init priority has to be 0 (zero). */
static int stm32wb_init(void) | {
SystemCoreClock = 4000000;
LL_C2_PWR_SetPowerMode(LL_PWR_MODE_SHUTDOWN);
return 0;
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* param base SAI base pointer param handle SAI eDMA handle pointer. retval valid slot count that application submit. */ | uint32_t SAI_TransferGetValidTransferSlotsEDMA(I2S_Type *base, sai_edma_handle_t *handle) | /* param base SAI base pointer param handle SAI eDMA handle pointer. retval valid slot count that application submit. */
uint32_t SAI_TransferGetValidTransferSlotsEDMA(I2S_Type *base, sai_edma_handle_t *handle) | {
uint32_t validSlot = 0U;
for (uint32_t i = 0U; i < (uint32_t)SAI_XFER_QUEUE_SIZE; i++)
{
if (handle->saiQueue[i].data == NULL)
{
validSlot++;
}
}
return validSlot;
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* Event handler for the USB_DeviceUnattached event. This indicates that a device has been removed from the host, and stops the library USB task management process. */ | void EVENT_USB_Host_DeviceUnattached(void) | /* Event handler for the USB_DeviceUnattached event. This indicates that a device has been removed from the host, and stops the library USB task management process. */
void EVENT_USB_Host_DeviceUnattached(void) | {
puts_P(PSTR(ESC_FG_GREEN "Device Unattached.\r\n" ESC_FG_WHITE));
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
} | prusa3d/Prusa-Firmware-Buddy | C++ | Other | 1,019 |
/* param base XRDC2 peripheral base address. param memSlot The memory slot to operate. param domainId The ID of the domain whose policy will be changed. param policy The access policy to set. */ | void XRDC2_SetMemSlotDomainAccessPolicy(XRDC2_Type *base, xrdc2_mem_slot_t memSlot, uint8_t domainId, xrdc2_access_policy_t policy) | /* param base XRDC2 peripheral base address. param memSlot The memory slot to operate. param domainId The ID of the domain whose policy will be changed. param policy The access policy to set. */
void XRDC2_SetMemSlotDomainAccessPolicy(XRDC2_Type *base, xrdc2_mem_slot_t memSlot, uint8_t domainId, xrdc2_access_policy_t policy) | {
uint32_t reg;
if (domainId < 8U)
{
reg = base->MSCI_MSAC_WK[(uint32_t)memSlot].MSC_MSAC_W0 & ~XRDC2_DXACP_0_7_MASK(domainId);
reg |= XRDC2_DXACP_0_7(domainId, policy);
base->MSCI_MSAC_WK[(uint32_t)memSlot].MSC_MSAC_W0 = reg;
}
else
{
reg = base->MSCI_MSAC_WK[(uint32_t)memSlot].MSC_MSAC_W1 & ~XRDC2_DXACP_8_15_MASK(domainId);
reg |= XRDC2_DXACP_8_15(domainId, policy);
reg &= ~XRDC2_EAL_MASK;
base->MSCI_MSAC_WK[(uint32_t)memSlot].MSC_MSAC_W1 = reg;
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Gets the match register value for the timer, which controls the 'delay' between each tick on the timer. */ | uint16_t sensorpollGetMatch(void) | /* Gets the match register value for the timer, which controls the 'delay' between each tick on the timer. */
uint16_t sensorpollGetMatch(void) | {
return LPC_CT16B1->MR0;
} | microbuilder/LPC11U_LPC13U_CodeBase | C++ | Other | 54 |
/* Set 4 7-bit slave address mask of the specified I2C port.
The */ | void I2CSlaveOwnAddressMaskSet(unsigned long ulBase, unsigned char ucSlaveNum, unsigned char ucSlaveAddrMask) | /* Set 4 7-bit slave address mask of the specified I2C port.
The */
void I2CSlaveOwnAddressMaskSet(unsigned long ulBase, unsigned char ucSlaveNum, unsigned char ucSlaveAddrMask) | {
unsigned long ulTemp[4] = {0x24, 0x28, 0x2C, 0x30};
xASSERT((ulBase == I2C0_BASE) || (ulBase == I2C1_BASE) ||
(ulBase == I2C2_BASE) || (ulBase == I2C3_BASE) ||
(ulBase == I2C4_BASE));
xASSERT((ucSlaveNum == 0) || (ucSlaveNum == 1) ||
(ucSlaveNum == 2) || (ucSlaveNum == 3));
xHWREG(ulBase + ulTemp[ucSlaveNum]) |= (ucSlaveAddrMask << 1);
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* This API reads the data from the given register address. */ | BMA2x2_RETURN_FUNCTION_TYPE bma2x2_read_reg(u8 adr_u8, u8 *data_u8, u8 len_u8) | /* This API reads the data from the given register address. */
BMA2x2_RETURN_FUNCTION_TYPE bma2x2_read_reg(u8 adr_u8, u8 *data_u8, u8 len_u8) | {
BMA2x2_RETURN_FUNCTION_TYPE com_rslt = ERROR;
if (p_bma2x2 == BMA2x2_NULL)
{
return E_BMA2x2_NULL_PTR;
}
else
{
com_rslt = p_bma2x2->BMA2x2_BUS_READ_FUNC
(p_bma2x2->dev_addr, adr_u8, data_u8, len_u8);
}
return com_rslt;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Deselect the chip.
This function deselects the specified chip by driving its CS line high. */ | static void _mx25v_chip_deselect(void) | /* Deselect the chip.
This function deselects the specified chip by driving its CS line high. */
static void _mx25v_chip_deselect(void) | {
port_pin_set_output_level(MX25V_SPI_PIN_CS, true);
} | memfault/zero-to-main | C++ | null | 200 |
/* This routine is the lock version of the API invoked to release a completion-queue event back into the free pool. */ | void lpfc_sli4_cq_event_release(struct lpfc_hba *phba, struct lpfc_cq_event *cq_event) | /* This routine is the lock version of the API invoked to release a completion-queue event back into the free pool. */
void lpfc_sli4_cq_event_release(struct lpfc_hba *phba, struct lpfc_cq_event *cq_event) | {
unsigned long iflags;
spin_lock_irqsave(&phba->hbalock, iflags);
__lpfc_sli4_cq_event_release(phba, cq_event);
spin_unlock_irqrestore(&phba->hbalock, iflags);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
Subsets and Splits