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 |
|---|---|---|---|---|---|---|---|
/* uzlib_inflate does a stream inflate on an RFC 1951 encoded data stream. It uses three application-specific CBs passed in the call to do the work: */ | uint8_t get_byte(void) | /* uzlib_inflate does a stream inflate on an RFC 1951 encoded data stream. It uses three application-specific CBs passed in the call to do the work: */
uint8_t get_byte(void) | {
int remaining = in->len - in->bytesRead;
int wanted = remaining >= READ_BLOCKSIZE ? READ_BLOCKSIZE : remaining;
if (fread(in->block, 1, wanted, in->fin) != wanted)
UZLIB_THROW(UZLIB_DATA_ERROR);
in->bytesRead += wanted;
in->inPtr = in->block;
in->left = wanted-1;
}
retu... | nodemcu/nodemcu-firmware | C++ | MIT License | 7,566 |
/* Utility function to set the handler for a specific interrupt. */ | void CORE_SetNvicRamTableHandler(IRQn_Type irqN, void *handler) | /* Utility function to set the handler for a specific interrupt. */
void CORE_SetNvicRamTableHandler(IRQn_Type irqN, void *handler) | {
EFM_ASSERT(((int)irqN >= -16) && ((int)irqN < EXT_IRQ_COUNT));
((uint32_t*)SCB->VTOR)[(int)irqN + 16] = (uint32_t)((uint32_t*)handler);
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* if_usb_free - free tx/rx urb, skb and rx buffer */ | static void if_usb_free(struct if_usb_card *cardp) | /* if_usb_free - free tx/rx urb, skb and rx buffer */
static void if_usb_free(struct if_usb_card *cardp) | {
usb_kill_urb(cardp->tx_urb);
usb_kill_urb(cardp->rx_urb);
usb_kill_urb(cardp->cmd_urb);
usb_free_urb(cardp->tx_urb);
cardp->tx_urb = NULL;
usb_free_urb(cardp->rx_urb);
cardp->rx_urb = NULL;
usb_free_urb(cardp->cmd_urb);
cardp->cmd_urb = NULL;
kfree(cardp->ep_out_buf);
cardp->ep_out_buf = NULL;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This routine can be used from both task and interrupt context. */ | atomic_val_t rhino_atomic_clear(atomic_t *target) | /* This routine can be used from both task and interrupt context. */
atomic_val_t rhino_atomic_clear(atomic_t *target) | {
CPSR_ALLOC();
atomic_val_t old_value;
RHINO_CPU_INTRPT_DISABLE();
old_value = *target;
*target = 0;
RHINO_CPU_INTRPT_ENABLE();
return old_value;
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* Disable the voltage comparator interrupt status bits.
AM_HAL_VCOMP_INT_OUTHI AM_HAL_VCOMP_INT_OUTLO */ | void am_hal_vcomp_int_disable(uint32_t ui32Interrupt) | /* Disable the voltage comparator interrupt status bits.
AM_HAL_VCOMP_INT_OUTHI AM_HAL_VCOMP_INT_OUTLO */
void am_hal_vcomp_int_disable(uint32_t ui32Interrupt) | {
AM_REG(VCOMP, INTEN) &= ~ui32Interrupt;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* regs_query_register_name() returns the name of a register from its offset in struct pt_regs. If the @offset is invalid, this returns NULL; */ | const char* regs_query_register_name(unsigned int offset) | /* regs_query_register_name() returns the name of a register from its offset in struct pt_regs. If the @offset is invalid, this returns NULL; */
const char* regs_query_register_name(unsigned int offset) | {
const struct pt_regs_offset *roff;
for (roff = regoffset_table; roff->name != NULL; roff++)
if (roff->offset == offset)
return roff->name;
return NULL;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* v9fs_unregister_trans - unregister a 9p transport @m: the transport to remove */ | void v9fs_unregister_trans(struct p9_trans_module *m) | /* v9fs_unregister_trans - unregister a 9p transport @m: the transport to remove */
void v9fs_unregister_trans(struct p9_trans_module *m) | {
spin_lock(&v9fs_trans_lock);
list_del_init(&m->list);
spin_unlock(&v9fs_trans_lock);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Mask off any voltages we don't support and select the lowest voltage */ | u32 mmc_select_voltage(struct mmc_host *host, u32 ocr) | /* Mask off any voltages we don't support and select the lowest voltage */
u32 mmc_select_voltage(struct mmc_host *host, u32 ocr) | {
int bit;
ocr &= host->ocr_avail;
bit = ffs(ocr);
if (bit) {
bit -= 1;
ocr &= 3 << bit;
host->ios.vdd = bit;
mmc_set_ios(host);
} else {
pr_warning("%s: host doesn't support card's voltages\n",
mmc_hostname(host));
ocr = 0;
}
return ocr;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* atl1c_wait_until_idle - wait up to AT_HW_MAX_IDLE_DELAY reads of the idle status register until the device is actually idle */ | static u32 atl1c_wait_until_idle(struct atl1c_hw *hw) | /* atl1c_wait_until_idle - wait up to AT_HW_MAX_IDLE_DELAY reads of the idle status register until the device is actually idle */
static u32 atl1c_wait_until_idle(struct atl1c_hw *hw) | {
int timeout;
u32 data;
for (timeout = 0; timeout < AT_HW_MAX_IDLE_DELAY; timeout++) {
AT_READ_REG(hw, REG_IDLE_STATUS, &data);
if ((data & IDLE_STATUS_MASK) == 0)
return 0;
msleep(1);
}
return data;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Switches blocks by programming the current one and initializing the next. */ | static tFlashBlockInfo * FlashSwitchBlock(tFlashBlockInfo *block, blt_addr base_addr) | /* Switches blocks by programming the current one and initializing the next. */
static tFlashBlockInfo * FlashSwitchBlock(tFlashBlockInfo *block, blt_addr base_addr) | {
tFlashBlockInfo * result = BLT_NULL;
if (block == &bootBlockInfo)
{
block = &blockInfo;
result = block;
}
else if (base_addr == flashLayout[0].sector_start)
{
block = &bootBlockInfo;
base_addr = flashLayout[0].sector_start;
result = block;
}
else
{
if (FlashWriteBlock(block) ... | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* Determines if the system environment state supports a capsule update. */ | EFI_STATUS EFIAPI CheckSystemEnvironment(OUT BOOLEAN *Good) | /* Determines if the system environment state supports a capsule update. */
EFI_STATUS EFIAPI CheckSystemEnvironment(OUT BOOLEAN *Good) | {
*Good = TRUE;
return EFI_SUCCESS;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Set or clear the multicast filter for this adaptor. */ | static void set_multicast_list(struct net_device *dev) | /* Set or clear the multicast filter for this adaptor. */
static void set_multicast_list(struct net_device *dev) | {
struct de4x5_private *lp = netdev_priv(dev);
u_long iobase = dev->base_addr;
if (lp->state == OPEN) {
if (dev->flags & IFF_PROMISC) {
u32 omr;
omr = inl(DE4X5_OMR);
omr |= OMR_PR;
outl(omr, DE4X5_OMR);
} else {
SetMulticastFilter(dev);
load_packet(dev, lp->setup_frame, TD_I... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This is an example demonstrating the flash lock bits feature. */ | static void flash_protect_example(void) | /* This is an example demonstrating the flash lock bits feature. */
static void flash_protect_example(void) | {
printf("\r\nFlash protection example...\n\r");
flashcalw_lock_page_region(NVRAM_PAGE_NUMBER, true);
flashcalw_memset((void *)NVRAM_PAGE_ADDRESS, 0x0, 8, FLASH_PAGE_SIZE,
true);
if (flashcalw_is_lock_error()) {
printf("Flash lock operation succeeded.\n\r");
}
flashcalw_lock_page_region(NVRAM_PAGE_NUMBER, fa... | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* param base LPUART peripheral base address. param handle LPUART handle pointer. param count Receive bytes count. retval kStatus_NoTransferInProgress No receive in progress. retval kStatus_InvalidArgument Parameter is invalid. retval kStatus_Success Get successfully through the parameter */ | status_t LPUART_TransferGetReceiveCountEDMA(LPUART_Type *base, lpuart_edma_handle_t *handle, uint32_t *count) | /* param base LPUART peripheral base address. param handle LPUART handle pointer. param count Receive bytes count. retval kStatus_NoTransferInProgress No receive in progress. retval kStatus_InvalidArgument Parameter is invalid. retval kStatus_Success Get successfully through the parameter */
status_t LPUART_TransferGe... | {
assert(handle);
assert(handle->rxEdmaHandle);
assert(count);
(void) base;
if (kLPUART_RxIdle == handle->rxState)
{
return kStatus_NoTransferInProgress;
}
*count = handle->rxDataSizeAll -
(uint32_t)handle->nbytes *
EDMA_GetRemainingMajorLoopCount(ha... | nanoframework/nf-interpreter | C++ | MIT License | 293 |
/* adds a WiFi header conversion record
Note that this function is documented in the main component header file, IxEthDB.h. */ | IX_ETH_DB_PUBLIC IxEthDBStatus ixEthDBWiFiAccessPointEntryAdd(IxEthDBPortId portID, IxEthDBMacAddr *macAddr, IxEthDBMacAddr *gatewayMacAddr) | /* adds a WiFi header conversion record
Note that this function is documented in the main component header file, IxEthDB.h. */
IX_ETH_DB_PUBLIC IxEthDBStatus ixEthDBWiFiAccessPointEntryAdd(IxEthDBPortId portID, IxEthDBMacAddr *macAddr, IxEthDBMacAddr *gatewayMacAddr) | {
IX_ETH_DB_CHECK_REFERENCE(gatewayMacAddr);
return ixEthDBWiFiEntryAdd(portID, macAddr, gatewayMacAddr);
} | EmcraftSystems/u-boot | C++ | Other | 181 |
/* sh_wdt_stop - Stop the Watchdog Stops the watchdog. */ | static void sh_wdt_stop(void) | /* sh_wdt_stop - Stop the Watchdog Stops the watchdog. */
static void sh_wdt_stop(void) | {
__u8 csr;
unsigned long flags;
spin_lock_irqsave(&shwdt_lock, flags);
del_timer(&timer);
csr = sh_wdt_read_csr();
csr &= ~WTCSR_TME;
sh_wdt_write_csr(csr);
spin_unlock_irqrestore(&shwdt_lock, flags);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* De-Initializes the low level portion of the device driver. */ | USBD_StatusTypeDef USBD_LL_DeInit(USBD_HandleTypeDef *pdev) | /* De-Initializes the low level portion of the device driver. */
USBD_StatusTypeDef USBD_LL_DeInit(USBD_HandleTypeDef *pdev) | {
HAL_StatusTypeDef hal_status = HAL_OK;
USBD_StatusTypeDef usb_status = USBD_OK;
hal_status = HAL_PCD_DeInit(pdev->pData);
usb_status = USBD_Get_USB_Status(hal_status);
return usb_status;
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* sunxi_lcd_gpio_set_value @screen_id: The index of screen. @io_index: the index of gpio @value: value of gpio to be set */ | s32 sunxi_lcd_gpio_set_value(u32 screen_id, u32 io_index, u32 value) | /* sunxi_lcd_gpio_set_value @screen_id: The index of screen. @io_index: the index of gpio @value: value of gpio to be set */
s32 sunxi_lcd_gpio_set_value(u32 screen_id, u32 io_index, u32 value) | {
if (g_lcd_drv.src_ops.sunxi_lcd_gpio_set_value)
return g_lcd_drv.src_ops.sunxi_lcd_gpio_set_value(screen_id,
io_index,
value);
return -1;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Called by transport drivers to initialize the transport independent portion of the transport instance. */ | void svc_xprt_init(struct svc_xprt_class *xcl, struct svc_xprt *xprt, struct svc_serv *serv) | /* Called by transport drivers to initialize the transport independent portion of the transport instance. */
void svc_xprt_init(struct svc_xprt_class *xcl, struct svc_xprt *xprt, struct svc_serv *serv) | {
memset(xprt, 0, sizeof(*xprt));
xprt->xpt_class = xcl;
xprt->xpt_ops = xcl->xcl_ops;
kref_init(&xprt->xpt_ref);
xprt->xpt_server = serv;
INIT_LIST_HEAD(&xprt->xpt_list);
INIT_LIST_HEAD(&xprt->xpt_ready);
INIT_LIST_HEAD(&xprt->xpt_deferred);
mutex_init(&xprt->xpt_mutex);
spin_lock_init(&xprt->xpt_lock);
set... | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Enables or disables the UART's Smart Card mode. */ | void UART_SmartCardCmd(UART_TypeDef *uart, FunctionalState state) | /* Enables or disables the UART's Smart Card mode. */
void UART_SmartCardCmd(UART_TypeDef *uart, FunctionalState state) | {
MODIFY_REG(uart->SCR, UART_SCR_SCEN, state << UART_SCR_SCEN_Pos);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* For this, we merely clean up all the nonpermanent memory pools. Note that temp files (virtual arrays) are not allowed to belong to the permanent pool, so we will be able to close all temp files here. Closing a data source or destination, if necessary, is the application's responsibility. */ | jpeg_abort(j_common_ptr cinfo) | /* For this, we merely clean up all the nonpermanent memory pools. Note that temp files (virtual arrays) are not allowed to belong to the permanent pool, so we will be able to close all temp files here. Closing a data source or destination, if necessary, is the application's responsibility. */
jpeg_abort(j_common_ptr ... | {
int pool;
if (cinfo->mem == NULL)
return;
for (pool = JPOOL_NUMPOOLS - 1; pool > JPOOL_PERMANENT; pool--) {
(*cinfo->mem->free_pool) (cinfo, pool);
}
if (cinfo->is_decompressor) {
cinfo->global_state = DSTATE_START;
((j_decompress_ptr)cinfo)->marker_list = NULL;
... | nanoframework/nf-interpreter | C++ | MIT License | 293 |
/* Compare two conversation keys for an exact match. (Parameter types are gconstpointer for GHashTable compatibility.) */ | static gboolean conversation_equal(gconstpointer key1, gconstpointer key2) | /* Compare two conversation keys for an exact match. (Parameter types are gconstpointer for GHashTable compatibility.) */
static gboolean conversation_equal(gconstpointer key1, gconstpointer key2) | {
const conv_key_t *ck1 = (const conv_key_t *)key1;
const conv_key_t *ck2 = (const conv_key_t *)key2;
if (ck1->conv_id == ck2->conv_id)
{
if (ck1->port1 == ck2->port1 &&
ck1->port2 == ck2->port2 &&
addresses_equal(&ck1->addr1, &ck2->addr1) &&
addresses_equal(&... | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Converts a text device path node to Floppy device path structure. */ | EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextFloppy(IN CHAR16 *TextDeviceNode) | /* Converts a text device path node to Floppy device path structure. */
EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextFloppy(IN CHAR16 *TextDeviceNode) | {
return ConvertFromTextAcpi (TextDeviceNode, 0x0604);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Returns 1 if true, 0 if false and -1 in case of error -1 in case of error */ | int xmlDictOwns(xmlDictPtr dict, const xmlChar *str) | /* Returns 1 if true, 0 if false and -1 in case of error -1 in case of error */
int xmlDictOwns(xmlDictPtr dict, const xmlChar *str) | {
if ((str >= &pool->array[0]) && (str <= pool->free))
return(1);
pool = pool->next;
}
if (dict->subdict)
return(xmlDictOwns(dict->subdict, str));
return(0);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Read/Modify/Write a byte in the framebuffer.
This function will read the byte from the framebuffer and do a mask operation on the byte according to the pixel operation selected by the color argument and the pixel mask provided. */ | void gfx_mono_framebuffer_mask_byte(gfx_coord_t page, gfx_coord_t column, gfx_mono_color_t pixel_mask, gfx_mono_color_t color) | /* Read/Modify/Write a byte in the framebuffer.
This function will read the byte from the framebuffer and do a mask operation on the byte according to the pixel operation selected by the color argument and the pixel mask provided. */
void gfx_mono_framebuffer_mask_byte(gfx_coord_t page, gfx_coord_t column, gfx_mono_co... | {
gfx_mono_color_t temp;
temp = gfx_mono_get_byte(page, column);
switch (color) {
case GFX_PIXEL_SET:
temp |= pixel_mask;
break;
case GFX_PIXEL_CLR:
temp &= ~pixel_mask;
break;
case GFX_PIXEL_XOR:
temp ^= pixel_mask;
break;
}
gfx_mono_put_byte(page, column, temp);
} | memfault/zero-to-main | C++ | null | 200 |
/* Add a Deferred Procedure Call to the end of the DPC queue. */ | EFI_STATUS EFIAPI QueueDpc(IN EFI_TPL DpcTpl, IN EFI_DPC_PROCEDURE DpcProcedure, IN VOID *DpcContext OPTIONAL) | /* Add a Deferred Procedure Call to the end of the DPC queue. */
EFI_STATUS EFIAPI QueueDpc(IN EFI_TPL DpcTpl, IN EFI_DPC_PROCEDURE DpcProcedure, IN VOID *DpcContext OPTIONAL) | {
return mDpc->QueueDpc (mDpc, DpcTpl, DpcProcedure, DpcContext);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* CRC MSP De-Initialization This function freeze the hardware resources used in this example: */ | void HAL_CRC_MspDeInit(CRC_HandleTypeDef *hcrc) | /* CRC MSP De-Initialization This function freeze the hardware resources used in this example: */
void HAL_CRC_MspDeInit(CRC_HandleTypeDef *hcrc) | {
__HAL_RCC_CRC_CLK_DISABLE();
} | STMicroelectronics/STM32CubeF4 | C++ | Other | 789 |
/* Initialize ROM API for a given operation.
Inits the ROM API based on the options provided by the application in the second argument. Every call to rom_init() should be paired with a call to rom_deinit(). */ | status_t kb_init(kb_session_ref_t **session, const kb_options_t *options) | /* Initialize ROM API for a given operation.
Inits the ROM API based on the options provided by the application in the second argument. Every call to rom_init() should be paired with a call to rom_deinit(). */
status_t kb_init(kb_session_ref_t **session, const kb_options_t *options) | {
assert(BOOTLOADER_API_TREE_POINTER);
return BOOTLOADER_API_TREE_POINTER->kbApi->kb_init_function(session, options);
} | ARMmbed/DAPLink | C++ | Apache License 2.0 | 2,140 |
/* Write data into transmit FIFO to send data out. */ | uint32_t SCUART_Write(SC_T *sc, uint8_t pu8TxBuf[], uint32_t u32WriteBytes) | /* Write data into transmit FIFO to send data out. */
uint32_t SCUART_Write(SC_T *sc, uint8_t pu8TxBuf[], uint32_t u32WriteBytes) | {
uint32_t u32Count;
uint32_t u32Delay = (SystemCoreClock / SCUART_GetClock(sc)) * sc->ETUCTL * 12, i;
g_SCUART_i32ErrCode = 0;
for (u32Count = 0UL; u32Count != u32WriteBytes; u32Count++)
{
i = 0;
while (SCUART_GET_TX_FULL(sc))
{
if (i++ > u32Delay)
{
... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* This function sets memory shared bit for the memory region specified by BaseAddress and NumPages from the current page table context. */ | RETURN_STATUS EFIAPI MemEncryptTdxClearPageSharedBit(IN PHYSICAL_ADDRESS Cr3BaseAddress, IN PHYSICAL_ADDRESS BaseAddress, IN UINTN NumPages) | /* This function sets memory shared bit for the memory region specified by BaseAddress and NumPages from the current page table context. */
RETURN_STATUS EFIAPI MemEncryptTdxClearPageSharedBit(IN PHYSICAL_ADDRESS Cr3BaseAddress, IN PHYSICAL_ADDRESS BaseAddress, IN UINTN NumPages) | {
return SetMemorySharedOrPrivate (
Cr3BaseAddress,
BaseAddress,
EFI_PAGES_TO_SIZE (NumPages),
ClearSharedBit
);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* This function will add a function to a configuration. */ | rt_err_t rt_usbd_config_add_function(uconfig_t cfg, ufunction_t func) | /* This function will add a function to a configuration. */
rt_err_t rt_usbd_config_add_function(uconfig_t cfg, ufunction_t func) | {
LOG_D("rt_usbd_config_add_function");
RT_ASSERT(cfg != RT_NULL);
RT_ASSERT(func != RT_NULL);
rt_list_insert_before(&cfg->func_list, &func->list);
return RT_EOK;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Send notifications to all registered drivers that a new controller was added. */ | void i2o_driver_notify_controller_add_all(struct i2o_controller *c) | /* Send notifications to all registered drivers that a new controller was added. */
void i2o_driver_notify_controller_add_all(struct i2o_controller *c) | {
int i;
struct i2o_driver *drv;
for (i = 0; i < i2o_max_drivers; i++) {
drv = i2o_drivers[i];
if (drv)
i2o_driver_notify_controller_add(drv, c);
}
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Prune the dcache to remove unused children of the parent dentry. */ | void shrink_dcache_parent(struct dentry *parent) | /* Prune the dcache to remove unused children of the parent dentry. */
void shrink_dcache_parent(struct dentry *parent) | {
struct super_block *sb = parent->d_sb;
int found;
while ((found = select_parent(parent)) != 0)
__shrink_dcache_sb(sb, &found, 0);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* The caller must ascertain NAPI is not already running. */ | static int handle_responses(struct adapter *adap, struct sge_rspq *q) | /* The caller must ascertain NAPI is not already running. */
static int handle_responses(struct adapter *adap, struct sge_rspq *q) | {
struct sge_qset *qs = rspq_to_qset(q);
struct rsp_desc *r = &q->desc[q->cidx];
if (!is_new_response(r, q))
return -1;
if (is_pure_response(r) && process_pure_responses(adap, qs, r) == 0) {
t3_write_reg(adap, A_SG_GTS, V_RSPQ(q->cntxt_id) |
V_NEWTIMER(q->holdoff_tmr) | V_NEWINDEX(q->cidx));
return 0;... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Open a file and copy its content to a buffer. */ | uint32_t Storage_CheckBitmapFile(const char *BmpName, uint32_t *FileLen) | /* Open a file and copy its content to a buffer. */
uint32_t Storage_CheckBitmapFile(const char *BmpName, uint32_t *FileLen) | {
if (f_mount(0, &fs))
{
return 1;
}
if (f_open (&F, BmpName, FA_READ))
{
return 2;
}
f_read (&F, sector, 6, &BytesRead);
if (Buffercmp((uint8_t *)SlidesCheck, (uint8_t *) sector, 2) != 0)
{
return 3;
}
return 0;
} | STMicroelectronics/STM32CubeF4 | C++ | Other | 789 |
/* Brief This function handles USART1 Instance interrupt request. Param None Retval None */ | void USART1_IRQHandler(void) | /* Brief This function handles USART1 Instance interrupt request. Param None Retval None */
void USART1_IRQHandler(void) | {
if(LL_USART_IsActiveFlag_RXNE(USART1) && LL_USART_IsEnabledIT_RXNE(USART1))
{
USART_CharReception_Callback();
}
if(LL_USART_IsEnabledIT_TXE(USART1) && LL_USART_IsActiveFlag_TXE(USART1))
{
USART_TXEmpty_Callback();
}
if(LL_USART_IsEnabledIT_TC(USART1) && LL_USART_IsActiveFlag_TC(USART1))
{
... | STMicroelectronics/STM32CubeF4 | C++ | Other | 789 |
/* Checks whether the specified SPI interrupt has occurred or not. */ | ITStatus SPI_GetITStatus(SPI_TypeDef *SPIx, uint8_t SPI_IT) | /* Checks whether the specified SPI interrupt has occurred or not. */
ITStatus SPI_GetITStatus(SPI_TypeDef *SPIx, uint8_t SPI_IT) | {
ITStatus bitstatus = RESET;
assert_param(IS_SPI_ALL_PERIPH(SPIx));
assert_param(IS_SPI_GET_IT(SPI_IT));
if ((SPIx->INTSTAT & SPI_IT) != (uint16_t)RESET)
{
bitstatus = SET;
}
else
{
bitstatus = RESET;
}
return bitstatus;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* grab the button mapping string from a mapping string */ | static char* SDL_PrivateGetControllerMappingFromMappingString(const char *pMapping) | /* grab the button mapping string from a mapping string */
static char* SDL_PrivateGetControllerMappingFromMappingString(const char *pMapping) | {
const char *pFirstComma, *pSecondComma;
pFirstComma = SDL_strchr(pMapping, ',');
if (!pFirstComma)
return NULL;
pSecondComma = SDL_strchr(pFirstComma + 1, ',');
if (!pSecondComma)
return NULL;
return SDL_strdup(pSecondComma + 1);
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* Check whether the register-backing store is already on the signal stack. */ | static int rbs_on_sig_stack(unsigned long bsp) | /* Check whether the register-backing store is already on the signal stack. */
static int rbs_on_sig_stack(unsigned long bsp) | {
return (bsp - current->sas_ss_sp < current->sas_ss_size);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Set the inital register states for the tca642x gpio expander */ | int tca642x_set_inital_state(uchar chip, struct tca642x_bank_info init_data[]) | /* Set the inital register states for the tca642x gpio expander */
int tca642x_set_inital_state(uchar chip, struct tca642x_bank_info init_data[]) | {
int i, ret;
uint8_t config_reg;
uint8_t polarity_reg;
uint8_t output_reg;
for (i = 0; i < 3; i++) {
config_reg = tca642x_regs[i].configuration_reg;
ret = tca642x_reg_write(chip, config_reg, 0xff,
init_data[i].configuration_reg);
polarity_reg = tca642x_regs[i].polarity_reg;
ret = tca642x_reg_write(chi... | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Handle all cases, even when flags == H_PROGRAMMATIC or op == env_op_delete. */ | static int on_serialno(const char *name, const char *value, enum env_op op, int flags) | /* Handle all cases, even when flags == H_PROGRAMMATIC or op == env_op_delete. */
static int on_serialno(const char *name, const char *value, enum env_op op, int flags) | {
g_dnl_set_serialnumber((char *)value);
return 0;
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Returns the width & height in pixels that a string will occupy on the screen if drawn using LCDD_DrawString. */ | void LCDD_GetStringSize(const char *pString, unsigned int *pWidth, unsigned int *pHeight) | /* Returns the width & height in pixels that a string will occupy on the screen if drawn using LCDD_DrawString. */
void LCDD_GetStringSize(const char *pString, unsigned int *pWidth, unsigned int *pHeight) | {
unsigned int width = 0;
unsigned int height = gFont.height;
while (*pString != 0) {
if (*pString == '\n') {
height += gFont.height + 2;
}
else {
width += gFont.width + 2;
}
pString++;
}
if (width > 0) width -= 2;
if (pWidth) *pWid... | apopple/Pandaboard-FreeRTOS | C++ | null | 25 |
/* Managed stall event of IN/OUT packet on control endpoint. */ | static void udd_ctrl_stall_data(void) | /* Managed stall event of IN/OUT packet on control endpoint. */
static void udd_ctrl_stall_data(void) | {
udd_ep_control_state = UDD_EPCTRL_STALL_REQ;
udd_enable_stall_handshake(0);
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* Check if the QED_F_NEED_CHECK bit should be set during allocating write */ | static bool qed_should_set_need_check(BDRVQEDState *s) | /* Check if the QED_F_NEED_CHECK bit should be set during allocating write */
static bool qed_should_set_need_check(BDRVQEDState *s) | {
if (s->bs->backing_hd) {
return false;
}
return !(s->header.features & QED_F_NEED_CHECK);
} | ve3wwg/teensy3_qemu | C++ | Other | 15 |
/* Enables or disables the TIMx peripheral Preload register on CCR1. */ | void TIM_OC1PreloadConfig(TIM_TypeDef *TIMx, uint16_t TIM_OCPreload) | /* Enables or disables the TIMx peripheral Preload register on CCR1. */
void TIM_OC1PreloadConfig(TIM_TypeDef *TIMx, uint16_t TIM_OCPreload) | {
uint16_t tmpccmr1 = 0;
assert_param(IS_TIM_123458_PERIPH(TIMx));
assert_param(IS_TIM_OCPRELOAD_STATE(TIM_OCPreload));
tmpccmr1 = TIMx->CCMR1;
tmpccmr1 &= CCMR_OC13PE_Reset;
tmpccmr1 |= TIM_OCPreload;
TIMx->CCMR1 = tmpccmr1;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Number of DMC internal banks to be open at any time;. */ | void DMC_ConfigOpenBank(DMC_BANK_NUMBER_T num) | /* Number of DMC internal banks to be open at any time;. */
void DMC_ConfigOpenBank(DMC_BANK_NUMBER_T num) | {
DMC->CTRL1_B.BANKNUMCFG = num;
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* Get security properties.
Get security properties for the given link. This is useful to know if the link is encrypted, bonded or authenticated */ | ADI_BLER_RESULT adi_radio_GetLinkSecurityProperties(const uint16_t nConnHandle, uint8_t *const pProperties) | /* Get security properties.
Get security properties for the given link. This is useful to know if the link is encrypted, bonded or authenticated */
ADI_BLER_RESULT adi_radio_GetLinkSecurityProperties(const uint16_t nConnHandle, uint8_t *const pProperties) | {
ADI_BLER_RESULT bleResult;
ADI_BLE_LOGEVENT(LOGID_CMD_BLESMP_GET_LINK_SECURITY_INFO);
ADI_BLE_RADIO_CMD_START(CMD_BLESMP_GET_LINK_SECURITY_INFO);
ASSERT(pProperties != NULL);
memcpy(&pBLERadio->cmdPkt[ADI_RADIO_CMD_HEADER_LEN], &nConnHandle, 2u);
bleResult = bler_process_cmd(CMD_BLESMP_GET_LIN... | analogdevicesinc/EVAL-ADICUP3029 | C++ | Other | 36 |
/* This subroutine adds the data at next_in/avail_in to the output history without performing any output. The output buffer must be "caught up"; i.e. no pending output but this should always be the case. The state must be waiting on the start of a block (i.e. mode == TYPE or HEAD). On exit, the output will also be caug... | int zlib_inflateIncomp(z_stream *z) | /* This subroutine adds the data at next_in/avail_in to the output history without performing any output. The output buffer must be "caught up"; i.e. no pending output but this should always be the case. The state must be waiting on the start of a block (i.e. mode == TYPE or HEAD). On exit, the output will also be caug... | {
struct inflate_state *state = (struct inflate_state *)z->state;
Byte *saved_no = z->next_out;
uInt saved_ao = z->avail_out;
if (state->mode != TYPE && state->mode != HEAD)
return Z_DATA_ERROR;
z->avail_out = 0;
z->next_out = (unsigned char*)z->next_in + z->avail_in;
zlib_updatewindow(z, z... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Free all address entries of a link tuple */ | static void release_link_tuple_addresses(iib_link_set_entry_t *ls_entry) | /* Free all address entries of a link tuple */
static void release_link_tuple_addresses(iib_link_set_entry_t *ls_entry) | {
nhdp_free_addr_list(ls_entry->address_list_head);
ls_entry->address_list_head = NULL;
} | labapart/polymcu | C++ | null | 201 |
/* Configure GPIO interrupt.
Notice that any pending interrupt for the selected pin is cleared by this function. */ | void GPIO_IntConfig(GPIO_Port_TypeDef port, unsigned int pin, bool risingEdge, bool fallingEdge, bool enable) | /* Configure GPIO interrupt.
Notice that any pending interrupt for the selected pin is cleared by this function. */
void GPIO_IntConfig(GPIO_Port_TypeDef port, unsigned int pin, bool risingEdge, bool fallingEdge, bool enable) | {
uint32_t tmp;
EFM_ASSERT(GPIO_PORT_VALID(port) && GPIO_PIN_VALID(pin));
if (pin < 8)
{
GPIO->EXTIPSELL = (GPIO->EXTIPSELL & ~(0xF << (4 * pin))) |
(port << (4 * pin));
}
else
{
tmp = pin - 8;
GPIO->EXTIPSELH = (GPIO->EXTIPSELH & ~(0xF << (4 * tmp))) |
... | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* NOTE: the ordering of these function calls is important! We have to stop the PHY and remove the schedule item before we can set the state to standby and set the current state machine pointer to NULL. */ | static void ble_ll_conn_halt(void) | /* NOTE: the ordering of these function calls is important! We have to stop the PHY and remove the schedule item before we can set the state to standby and set the current state machine pointer to NULL. */
static void ble_ll_conn_halt(void) | {
ble_phy_disable();
ble_ll_state_set(BLE_LL_STATE_STANDBY);
g_ble_ll_conn_cur_sm = NULL;
} | arendst/Tasmota | C++ | GNU General Public License v3.0 | 21,318 |
/* Rport is deleted, waiting for firmware response to delete. */ | static void bfa_rport_sm_deleting(struct bfa_rport_s *rp, enum bfa_rport_event event) | /* Rport is deleted, waiting for firmware response to delete. */
static void bfa_rport_sm_deleting(struct bfa_rport_s *rp, enum bfa_rport_event event) | {
bfa_trc(rp->bfa, rp->rport_tag);
bfa_trc(rp->bfa, event);
switch (event) {
case BFA_RPORT_SM_FWRSP:
bfa_stats(rp, sm_del_fwrsp);
bfa_sm_set_state(rp, bfa_rport_sm_uninit);
bfa_rport_free(rp);
break;
case BFA_RPORT_SM_HWFAIL:
bfa_stats(rp, sm_del_hwf);
bfa_sm_set_state(rp, bfa_rport_sm_uninit);
bfa_... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Checks whether the Tamper Pin Event flag is set or not. */ | FlagStatus BKP_GetFlagStatus(void) | /* Checks whether the Tamper Pin Event flag is set or not. */
FlagStatus BKP_GetFlagStatus(void) | {
return (FlagStatus)(*(__IO uint32_t *) CSR_TEF_BB);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* dsp need to remap addresses for some addr. static struct vaddr_range_t addr_mapping = { {0x10000000, 0x1fffffff, 0x30000000}, {0x30000000, 0x3fffffff, 0x10000000}, }; */ | static ptrdiff_t xlate_dsp2mpu(ptrdiff_t a) | /* dsp need to remap addresses for some addr. static struct vaddr_range_t addr_mapping = { {0x10000000, 0x1fffffff, 0x30000000}, {0x30000000, 0x3fffffff, 0x10000000}, }; */
static ptrdiff_t xlate_dsp2mpu(ptrdiff_t a) | {
const ptrdiff_t BANKSIZE = 0x08000u;
const ptrdiff_t CELLBASE = 0x10000u;
const ptrdiff_t CELLSIZE = 16;
const ptrdiff_t cellbank = (a - CELLBASE) / BANKSIZE;
const ptrdiff_t cellrow = (a - CELLBASE) % BANKSIZE / CELLSIZE;
const unsigned cellpos = (a % CELLSIZE);
if (a < CELLBASE)
return a;
return CELLBASE ... | ua1arn/hftrx | C++ | null | 69 |
/* If this ocfs2_xattr_header covers more than one hash value, find a place where the hash value changes. Try to find the most even split. The most common case is that all entries have different hash values, and the first check we make will find a place to split. */ | static int ocfs2_xattr_find_divide_pos(struct ocfs2_xattr_header *xh) | /* If this ocfs2_xattr_header covers more than one hash value, find a place where the hash value changes. Try to find the most even split. The most common case is that all entries have different hash values, and the first check we make will find a place to split. */
static int ocfs2_xattr_find_divide_pos(struct ocfs2_... | {
struct ocfs2_xattr_entry *entries = xh->xh_entries;
int count = le16_to_cpu(xh->xh_count);
int delta, middle = count / 2;
for (delta = 0; delta < middle; delta++) {
if (cmp_xe(&entries[middle - delta - 1],
&entries[middle - delta]))
return middle - delta;
if ((middle + delta + 1) == count)
continu... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This function is called if a device is physically removed from the system or if the driver module is being unloaded. It frees any resources allocated to the device. */ | static int __devexit xps2_of_remove(struct of_device *of_dev) | /* This function is called if a device is physically removed from the system or if the driver module is being unloaded. It frees any resources allocated to the device. */
static int __devexit xps2_of_remove(struct of_device *of_dev) | {
struct device *dev = &of_dev->dev;
struct xps2data *drvdata = dev_get_drvdata(dev);
struct resource r_mem;
serio_unregister_port(&drvdata->serio);
iounmap(drvdata->base_address);
if (of_address_to_resource(of_dev->node, 0, &r_mem))
dev_err(dev, "invalid address\n");
else
release_mem_region(r_mem.start, r_m... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Clean up the dynamic opcode at label and form specified by both LabelId. */ | VOID CleanUpPage(IN UINT16 LabelId, IN BMM_CALLBACK_DATA *CallbackData) | /* Clean up the dynamic opcode at label and form specified by both LabelId. */
VOID CleanUpPage(IN UINT16 LabelId, IN BMM_CALLBACK_DATA *CallbackData) | {
RefreshUpdateData ();
mStartLabel->Number = LabelId;
HiiUpdateForm (
CallbackData->BmmHiiHandle,
&mBootMaintGuid,
LabelId,
mStartOpCodeHandle,
mEndOpCodeHandle
);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Timer 1 Interrupt handler. This function is startup code handler entry. */ | void TIMER1IntHandler(void) | /* Timer 1 Interrupt handler. This function is startup code handler entry. */
void TIMER1IntHandler(void) | {
if( g_pfnTimerHandlerCallbacks[1] != 0 )
{
g_pfnTimerHandlerCallbacks[1](0, 0, 0, 0);
}
else
{
while(1);
}
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Attempt to add a callback to a set. */ | static Ecode_t addCallback(TEMPDRV_CallbackSet_t *set, int8_t temp, TEMPDRV_Callback_t callback) | /* Attempt to add a callback to a set. */
static Ecode_t addCallback(TEMPDRV_CallbackSet_t *set, int8_t temp, TEMPDRV_Callback_t callback) | {
int8_t index = findCallbackSpace(set);
if (index < 0)
{
return ECODE_EMDRV_TEMPDRV_NO_SPACE;
}
set[index].temp = convertToEmu(temp);
set[index].callback = callback;
updateInterrupts();
return ECODE_EMDRV_TEMPDRV_OK;
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* Modified by the GLib Team and others 1997-2000. See the AUTHORS file for a list of people on the GLib Team. See the ChangeLog files for a list of changes. These files are distributed with GLib at */ | G_MODULE_EXPORT void gplugin_a_func(void) | /* Modified by the GLib Team and others 1997-2000. See the AUTHORS file for a list of people on the GLib Team. See the ChangeLog files for a list of changes. These files are distributed with GLib at */
G_MODULE_EXPORT void gplugin_a_func(void) | {
gplugin_a_state = "Hello world";
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Deinitializes the ADCx peripheral registers to their default reset values. */ | void ADC_DeInit(ADC_TypeDef *ADCx) | /* Deinitializes the ADCx peripheral registers to their default reset values. */
void ADC_DeInit(ADC_TypeDef *ADCx) | {
assert_param(IS_ADC_ALL_PERIPH(ADCx));
if((ADCx == ADC1) || (ADCx == ADC2))
{
RCC_AHBPeriphResetCmd(RCC_AHBPeriph_ADC12, ENABLE);
RCC_AHBPeriphResetCmd(RCC_AHBPeriph_ADC12, DISABLE);
}
else if((ADCx == ADC3) || (ADCx == ADC4))
{
RCC_AHBPeriphResetCmd(RCC_AHBPeriph_ADC34, ENABLE);
RCC_AHBPe... | ajhc/demo-cortex-m3 | C++ | null | 38 |
/* ADC Set conversion operation mode.
There are some operation modes, common for entire stm32 branch. In the text the braces are describing result to single trigger event. The trigger event is described by character T in the description. The ADC is configured to convert list of inputs . In Grouped modes, there is used... | void adc_set_operation_mode(uint32_t adc, enum adc_opmode opmode) | /* ADC Set conversion operation mode.
There are some operation modes, common for entire stm32 branch. In the text the braces are describing result to single trigger event. The trigger event is described by character T in the description. The ADC is configured to convert list of inputs . In Grouped modes, there is used... | {
switch (opmode) {
case ADC_MODE_SEQUENTIAL:
ADC_CFGR1(adc) &= ~ADC_CFGR1_CONT;
ADC_CFGR1(adc) |= ADC_CFGR1_DISCEN;
break;
case ADC_MODE_SCAN:
ADC_CFGR1(adc) &= ~(ADC_CFGR1_CONT | ADC_CFGR1_DISCEN);
break;
case ADC_MODE_SCAN_INFINITE:
ADC_CFGR1(adc) &= ~ADC_CFGR1_DISCEN;
ADC_CFGR1(adc) |= ADC_CFGR1_C... | insane-adding-machines/unicore-mx | C++ | GNU General Public License v3.0 | 50 |
/* To clear the chip sleep but keep the chip sleep. */ | NMI_API sint8 hif_chip_sleep_sc(void) | /* To clear the chip sleep but keep the chip sleep. */
NMI_API sint8 hif_chip_sleep_sc(void) | {
if(gstrHifCxt.u8ChipSleep >= 1)
{
gstrHifCxt.u8ChipSleep--;
}
return M2M_SUCCESS;
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* Entries may not be inserted to @hash_table, nor may @hash_table be destroyed by code executed from @hash_callback. The relevant functions will halt in these cases. */ | void _cairo_hash_table_foreach(cairo_hash_table_t *hash_table, cairo_hash_callback_func_t hash_callback, void *closure) | /* Entries may not be inserted to @hash_table, nor may @hash_table be destroyed by code executed from @hash_callback. The relevant functions will halt in these cases. */
void _cairo_hash_table_foreach(cairo_hash_table_t *hash_table, cairo_hash_callback_func_t hash_callback, void *closure) | {
unsigned long i;
cairo_hash_entry_t *entry;
++hash_table->iterating;
for (i = 0; i < *hash_table->table_size; i++) {
entry = hash_table->entries[i];
if (ENTRY_IS_LIVE(entry))
hash_callback (entry, closure);
}
if (--hash_table->iterating == 0) {
_cairo_hash_table_manage (hash_table);
... | xboot/xboot | C++ | MIT License | 779 |
/* Sets the radio in continuous wave transmission mode. */ | void RadioSetTxContinuousWave(uint32_t freq, int8_t power, uint16_t time) | /* Sets the radio in continuous wave transmission mode. */
void RadioSetTxContinuousWave(uint32_t freq, int8_t power, uint16_t time) | {
uint32_t timeout = ( uint32_t )time * 1000;
SX126xSetRfFrequency( freq );
SX126xSetRfTxPower( power );
SX126xSetTxContinuousWave( );
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* Message: CreateConferenceResMessage Opcode: 0x0035 Type: IntraCCM Direction: pbx2pbx VarLength: no */ | static void handle_CreateConferenceResMessage(ptvcursor_t *cursor, packet_info *pinfo _U_) | /* Message: CreateConferenceResMessage Opcode: 0x0035 Type: IntraCCM Direction: pbx2pbx VarLength: no */
static void handle_CreateConferenceResMessage(ptvcursor_t *cursor, packet_info *pinfo _U_) | {
guint32 dataLength = 0;
ptvcursor_add(cursor, hf_skinny_conferenceID, 4, ENC_LITTLE_ENDIAN);
ptvcursor_add(cursor, hf_skinny_result, 4, ENC_LITTLE_ENDIAN);
dataLength = tvb_get_letohl(ptvcursor_tvbuff(cursor), ptvcursor_current_offset(cursor));
ptvcursor_add(cursor, hf_skinny_dataLength, 4, ENC_LITTLE_ENDIA... | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Detach the URB from active list Usage: backend to remove a URB from active list. */ | static void detach_from_active(usbd_device *dev, usbd_urb *item) | /* Detach the URB from active list Usage: backend to remove a URB from active list. */
static void detach_from_active(usbd_device *dev, usbd_urb *item) | {
usbd_urb *urb = dev->urbs.active.head, *prev = NULL;
while (urb != NULL) {
if (urb != item) {
prev = urb;
urb = urb->next;
continue;
}
queue_item_detach(&dev->urbs.active, prev, urb);
free_ep_from_urb(dev, urb);
return;
}
LOGF_LN("WARNING: Found not find URB %"PRIu64" in active list to detach i... | insane-adding-machines/unicore-mx | C++ | GNU General Public License v3.0 | 50 |
/* This function handles External line 2 interrupt request. */ | void EXTI9_5_IRQHandler(void) | /* This function handles External line 2 interrupt request. */
void EXTI9_5_IRQHandler(void) | {
HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_8);
} | STMicroelectronics/STM32CubeF4 | C++ | Other | 789 |
/* Close the low-level part of the STRIP channel. Easy! */ | static int strip_close_low(struct net_device *dev) | /* Close the low-level part of the STRIP channel. Easy! */
static int strip_close_low(struct net_device *dev) | {
struct strip *strip_info = netdev_priv(dev);
if (strip_info->tty == NULL)
return -EBUSY;
clear_bit(TTY_DO_WRITE_WAKEUP, &strip_info->tty->flags);
netif_stop_queue(dev);
kfree(strip_info->rx_buff);
strip_info->rx_buff = NULL;
kfree(strip_info->sx_buff);
strip_info->sx_buff = NULL;
kfree(strip_info->tx_buff)... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Checks whether the specified RCC interrupt has occurred or not. */ | ITStatus RCC_GetITStatus(uint8_t RCC_IT) | /* Checks whether the specified RCC interrupt has occurred or not. */
ITStatus RCC_GetITStatus(uint8_t RCC_IT) | {
ITStatus bitstatus = RESET;
assert_param(IS_RCC_GET_IT(RCC_IT));
if ((RCC->CIR & RCC_IT) != (uint32_t)RESET)
{
bitstatus = SET;
}
else
{
bitstatus = RESET;
}
return bitstatus;
} | apopple/Pandaboard-FreeRTOS | C++ | null | 25 |
/* Resets the SPI module.
This function will reset the SPI module to its power on default values and disable it. */ | void spi_reset(struct spi_module *const module) | /* Resets the SPI module.
This function will reset the SPI module to its power on default values and disable it. */
void spi_reset(struct spi_module *const module) | {
Spi *const spi_module = (module->hw);
spi_disable(module);
if(spi_module == (void *)SPI0) {
system_peripheral_reset(PERIPHERAL_SPI0_CORE);
system_peripheral_reset(PERIPHERAL_SPI0_IF);
} else if (spi_module == (void *)SPI1) {
system_peripheral_reset(PERIPHERAL_SPI1_CORE);
system_peripheral_reset(PERIPHERAL... | memfault/zero-to-main | C++ | null | 200 |
/* igb_clean_all_tx_rings - Free Tx Buffers for all queues @adapter: board private structure */ | static void igb_clean_all_tx_rings(struct igb_adapter *) | /* igb_clean_all_tx_rings - Free Tx Buffers for all queues @adapter: board private structure */
static void igb_clean_all_tx_rings(struct igb_adapter *) | {
int i;
for (i = 0; i < adapter->num_tx_queues; i++)
igb_clean_tx_ring(&adapter->tx_ring[i]);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Get the current normalized channelValue for a channel. */ | uint32_t CAPSENSE_getNormalizedVal(uint8_t channel) | /* Get the current normalized channelValue for a channel. */
uint32_t CAPSENSE_getNormalizedVal(uint8_t channel) | {
uint32_t max = channelMaxValues[channel];
return (channelValues[channel] << 8) / max;
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* Suspend a DMA transfer.
This function will request to suspend the transfer of the DMA resource. The channel is kept enabled, can receive transfer triggers (the transfer pending bit will be set), but will be removed from the arbitration scheme. The channel operation can be resumed by calling */ | void dma_suspend_job(struct dma_resource *resource) | /* Suspend a DMA transfer.
This function will request to suspend the transfer of the DMA resource. The channel is kept enabled, can receive transfer triggers (the transfer pending bit will be set), but will be removed from the arbitration scheme. The channel operation can be resumed by calling */
void dma_suspend_job... | {
Assert(resource);
Assert(resource->channel_id != DMA_INVALID_CHANNEL);
system_interrupt_enter_critical_section();
DMAC->CHID.reg = DMAC_CHID_ID(resource->channel_id);
DMAC->CHCTRLB.reg |= DMAC_CHCTRLB_CMD_SUSPEND;
system_interrupt_leave_critical_section();
} | memfault/zero-to-main | C++ | null | 200 |
/* Put active references to @sd and its parent. This function is noop if @sd is NULL. */ | void sysfs_put_active_two(struct sysfs_dirent *sd) | /* Put active references to @sd and its parent. This function is noop if @sd is NULL. */
void sysfs_put_active_two(struct sysfs_dirent *sd) | {
if (sd) {
sysfs_put_active(sd);
sysfs_put_active(sd->s_parent);
}
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Prepare to and run C code.
This routine prepares for the execution of and runs C code. */ | void z_prep_c(void) | /* Prepare to and run C code.
This routine prepares for the execution of and runs C code. */
void z_prep_c(void) | {
z_bss_zero();
interrupt_init();
z_cstart();
CODE_UNREACHABLE;
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Check if the error is a "real" error that we should return. */ | static int err_block_err(int ret) | /* Check if the error is a "real" error that we should return. */
static int err_block_err(int ret) | {
if (ret && ret != -ENOSPC && ret != -ENODATA && ret != -EAGAIN)
return 1;
return 0;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* This API writes the config stream data in memory using burst mode. */ | static uint16_t stream_transfer_write(const uint8_t *stream_data, uint16_t index, struct bma4_dev *dev) | /* This API writes the config stream data in memory using burst mode. */
static uint16_t stream_transfer_write(const uint8_t *stream_data, uint16_t index, struct bma4_dev *dev) | {
uint16_t rslt = 0;
uint8_t asic_msb = (uint8_t)((index / 2) >> 4);
uint8_t asic_lsb = ((index / 2) & 0x0F);
rslt |= bma4_write_regs(BMA4_RESERVED_REG_5B_ADDR, &asic_lsb, 1, dev);
if (rslt == BMA4_OK) {
rslt |= bma4_write_regs(BMA4_RESERVED_REG_5C_ADDR, &asic_msb, 1, dev);
if (rslt ... | arendst/Tasmota | C++ | GNU General Public License v3.0 | 21,318 |
/* ks_set_grpaddr - set multicast information @ks : The chip information */ | static void ks_set_grpaddr(struct ks_net *ks) | /* ks_set_grpaddr - set multicast information @ks : The chip information */
static void ks_set_grpaddr(struct ks_net *ks) | {
u8 i;
u32 index, position, value;
memset(ks->mcast_bits, 0, sizeof(u8) * HW_MCAST_SIZE);
for (i = 0; i < ks->mcast_lst_size; i++) {
position = (ether_gen_crc(6, ks->mcast_lst[i]) >> 26) & 0x3f;
index = position >> 3;
value = 1 << (position & 7);
ks->mcast_bits[index] |= (u8)value;
}
for (i = 0; i < HW_... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Convert UINT16 data to big-endian for aligned with the FDT blob */ | UINT16 EFIAPI CpuToFdt16(IN UINT16 Value) | /* Convert UINT16 data to big-endian for aligned with the FDT blob */
UINT16 EFIAPI CpuToFdt16(IN UINT16 Value) | {
return cpu_to_fdt16 (Value);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Turn the Scroll-Lock LED on when the tty is stopped */ | static void con_stop(struct tty_struct *tty) | /* Turn the Scroll-Lock LED on when the tty is stopped */
static void con_stop(struct tty_struct *tty) | {
int console_num;
if (!tty)
return;
console_num = tty->index;
if (!vc_cons_allocated(console_num))
return;
set_vc_kbd_led(kbd_table + console_num, VC_SCROLLOCK);
set_leds();
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Set the destination repeat size of the specified dma channel. */ | en_result_t Dma_DisableDestinationRload(en_dma_channel_t enCh) | /* Set the destination repeat size of the specified dma channel. */
en_result_t Dma_DisableDestinationRload(en_dma_channel_t enCh) | {
ASSERT(IS_VALID_CH(enCh));
if(!IS_VALID_CH(enCh))
{
return ErrorInvalidParameter;
}
if(enCh == DmaCh0)
{
M0P_DMAC ->CONFB0_f.RD = 0;
}
else{
M0P_DMAC ->CONFB1_f.RD = 0; }
return Ok;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Clear the status of the specified ADC flag. */ | void ADC_ClearStatus(CM_ADC_TypeDef *ADCx, uint8_t u8Flag) | /* Clear the status of the specified ADC flag. */
void ADC_ClearStatus(CM_ADC_TypeDef *ADCx, uint8_t u8Flag) | {
DDL_ASSERT(IS_ADC_UNIT(ADCx));
DDL_ASSERT(IS_ADC_FLAG(u8Flag));
WRITE_REG8(ADCx->ISCLRR, u8Flag);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* This function returns %0 on success and a negative error code on failure. */ | int ubifs_recover_inl_heads(const struct ubifs_info *c, void *sbuf) | /* This function returns %0 on success and a negative error code on failure. */
int ubifs_recover_inl_heads(const struct ubifs_info *c, void *sbuf) | {
int err;
ubifs_assert(!(c->vfs_sb->s_flags & MS_RDONLY) || c->remounting_rw);
dbg_rcvry("checking index head at %d:%d", c->ihead_lnum, c->ihead_offs);
err = recover_head(c, c->ihead_lnum, c->ihead_offs, sbuf);
if (err)
return err;
dbg_rcvry("checking LPT head at %d:%d", c->nhead_lnum, c->nhead_offs);
err = r... | EmcraftSystems/u-boot | C++ | Other | 181 |
/* @dev: The Linux PCI device structure for the device to map @slot: The slot number for this device on */ | int __init octeon_pci_pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) | /* @dev: The Linux PCI device structure for the device to map @slot: The slot number for this device on */
int __init octeon_pci_pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) | {
int irq_num;
const char *interrupts;
int dev_num;
interrupts = octeon_get_pci_interrupts();
dev_num = dev->devfn >> 3;
if (dev_num < strlen(interrupts))
irq_num = ((interrupts[dev_num] - 'A' + pin - 1) & 3) +
OCTEON_IRQ_PCI_INT0;
else
irq_num = ((slot + pin - 3) & 3) + OCTEON_IRQ_PCI_INT0;
return irq_n... | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Retrieve the number of logical processor in the platform and the number of those logical processors that are enabled on this boot. */ | EFI_STATUS MpServicesUnitTestGetNumberOfProcessors(IN MP_SERVICES MpServices, OUT UINTN *NumberOfProcessors, OUT UINTN *NumberOfEnabledProcessors) | /* Retrieve the number of logical processor in the platform and the number of those logical processors that are enabled on this boot. */
EFI_STATUS MpServicesUnitTestGetNumberOfProcessors(IN MP_SERVICES MpServices, OUT UINTN *NumberOfProcessors, OUT UINTN *NumberOfEnabledProcessors) | {
return MpServices.Protocol->GetNumberOfProcessors (MpServices.Protocol, NumberOfProcessors, NumberOfEnabledProcessors);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* This internal API interleaves the register address between the register data buffer for burst write operation. */ | static void interleave_reg_addr(const uint8_t *reg_addr, uint8_t *temp_buff, const uint8_t *reg_data, uint8_t len) | /* This internal API interleaves the register address between the register data buffer for burst write operation. */
static void interleave_reg_addr(const uint8_t *reg_addr, uint8_t *temp_buff, const uint8_t *reg_data, uint8_t len) | {
uint8_t index;
for (index = 1; index < len; index++)
{
temp_buff[(index * 2) - 1] = reg_addr[index];
temp_buff[index * 2] = reg_data[index];
}
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* Note the ordering to try to avoid load (and address generation) latencies. */ | static void __memcpy_aligned_up(unsigned long d, unsigned long s, long n) | /* Note the ordering to try to avoid load (and address generation) latencies. */
static void __memcpy_aligned_up(unsigned long d, unsigned long s, long n) | {
ALIGN_DEST_TO8_UP(d,s,n);
n -= 8;
while (n >= 0) {
unsigned long tmp;
__asm__("ldq %0,%1":"=r" (tmp):"m" (*(unsigned long *) s));
n -= 8;
s += 8;
*(unsigned long *) d = tmp;
d += 8;
}
n += 8;
DO_REST_ALIGNED_UP(d,s,n);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Enables or disables the USART's 8x oversampling mode. */ | void USART_OverSampling8Cmd(USART_TypeDef *USARTx, FunctionalState NewState) | /* Enables or disables the USART's 8x oversampling mode. */
void USART_OverSampling8Cmd(USART_TypeDef *USARTx, FunctionalState NewState) | {
assert_param(IS_USART_ALL_PERIPH(USARTx));
assert_param(IS_FUNCTIONAL_STATE(NewState));
if (NewState != DISABLE)
{
USARTx->CR1 |= USART_CR1_OVER8;
}
else
{
USARTx->CR1 &= (uint16_t)~((uint16_t)USART_CR1_OVER8);
}
} | MaJerle/stm32f429 | C++ | null | 2,036 |
/* Tells whether the Flash Ready interrupt is enabled. */ | bool flashcalw_is_ready_int_enabled(void) | /* Tells whether the Flash Ready interrupt is enabled. */
bool flashcalw_is_ready_int_enabled(void) | {
return ((HFLASHC->FLASHCALW_FCR & FLASHCALW_FCR_FRDY) != 0);
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* File: ima_crypto.c Calculates md5/sha1 file hash, template hash, boot-aggreate hash */ | static int init_desc(struct hash_desc *desc) | /* File: ima_crypto.c Calculates md5/sha1 file hash, template hash, boot-aggreate hash */
static int init_desc(struct hash_desc *desc) | {
int rc;
desc->tfm = crypto_alloc_hash(ima_hash, 0, CRYPTO_ALG_ASYNC);
if (IS_ERR(desc->tfm)) {
pr_info("failed to load %s transform: %ld\n",
ima_hash, PTR_ERR(desc->tfm));
rc = PTR_ERR(desc->tfm);
return rc;
}
desc->flags = 0;
rc = crypto_hash_init(desc);
if (rc)
crypto_free_hash(desc->tfm);
return... | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Sets one of the two options of inserting read wait interval. */ | void SDIO_EnableSdioReadWaitMode(uint32_t SDIO_ReadWaitMode) | /* Sets one of the two options of inserting read wait interval. */
void SDIO_EnableSdioReadWaitMode(uint32_t SDIO_ReadWaitMode) | {
assert_param(IS_SDIO_RDWAIT_MODE(SDIO_ReadWaitMode));
*(__IO uint32_t*)DCTRL_RWMOD_BB = SDIO_ReadWaitMode;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Returns the all unmasked interrupt status after reading the DmaStatus register. */ | u32 synopGMAC_get_interrupt_type(synopGMACdevice *gmacdev) | /* Returns the all unmasked interrupt status after reading the DmaStatus register. */
u32 synopGMAC_get_interrupt_type(synopGMACdevice *gmacdev) | {
u32 data;
u32 interrupts = 0;
data = synopGMACReadReg(gmacdev->DmaBase, DmaStatus);
synopGMACWriteReg(gmacdev->DmaBase, DmaStatus, data);
plat_delay(DEFAULT_LOOP_VARIABLE);
if (data & DmaIntErrorMask) interrupts |= synopGMACDmaError;
if (data & DmaIntRxNormMask) interrupts |= synopGM... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* save predictors for later macroblocks and increase macroblock address */ | int ff_cavs_next_mb(AVSContext *h) | /* save predictors for later macroblocks and increase macroblock address */
int ff_cavs_next_mb(AVSContext *h) | {
h->flags = B_AVAIL|C_AVAIL;
h->pred_mode_Y[3] = h->pred_mode_Y[6] = NOT_AVAIL;
for(i=0;i<=20;i+=4)
h->mv[i] = ff_cavs_un_mv;
h->mbx = 0;
h->mby++;
h->cy = h->picture.data[0] + h->mby*16*h->l_stride;
h->cu = h->picture.data[1] + h->mby*8*h->c_stride;
... | DC-SWAT/DreamShell | C++ | null | 404 |
/* Note that this is called to free MRs created by ipath_get_dma_mr() or ipath_reg_user_mr(). */ | int ipath_dereg_mr(struct ib_mr *ibmr) | /* Note that this is called to free MRs created by ipath_get_dma_mr() or ipath_reg_user_mr(). */
int ipath_dereg_mr(struct ib_mr *ibmr) | {
struct ipath_mr *mr = to_imr(ibmr);
int i;
ipath_free_lkey(&to_idev(ibmr->device)->lk_table, ibmr->lkey);
i = mr->mr.mapsz;
while (i) {
i--;
kfree(mr->mr.map[i]);
}
if (mr->umem)
ib_umem_release(mr->umem);
kfree(mr);
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Convert the Simba inet ip address to a lwip ip address. */ | static void inet_ip_to_lwip_ip(ip_addr_t *dst_p, const struct inet_ip_addr_t *src_p) | /* Convert the Simba inet ip address to a lwip ip address. */
static void inet_ip_to_lwip_ip(ip_addr_t *dst_p, const struct inet_ip_addr_t *src_p) | {
dst_p->addr = src_p->number;
} | eerimoq/simba | C++ | Other | 337 |
/* read index from FLT packet into stream 0 av_index */ | static void gxf_read_index(AVFormatContext *s, int pkt_len) | /* read index from FLT packet into stream 0 av_index */
static void gxf_read_index(AVFormatContext *s, int pkt_len) | {
av_log(s, AV_LOG_ERROR, "too many index entries %u (%x)\n", map_cnt, map_cnt);
map_cnt = 1000;
}
if (pkt_len < 4 * map_cnt) {
av_log(s, AV_LOG_ERROR, "invalid index length\n");
url_fskip(pb, pkt_len);
return;
}
pkt_len -= 4 * map_cnt;
av_add_index_entry(st, ... | DC-SWAT/DreamShell | C++ | null | 404 |
/* We cannot merge two vmas if they have differently assigned (non-NULL) anon_vmas, nor if same anon_vma is assigned but offsets incompatible. */ | static int can_vma_merge_after(struct vm_area_struct *vma, unsigned long vm_flags, struct anon_vma *anon_vma, struct file *file, pgoff_t vm_pgoff) | /* We cannot merge two vmas if they have differently assigned (non-NULL) anon_vmas, nor if same anon_vma is assigned but offsets incompatible. */
static int can_vma_merge_after(struct vm_area_struct *vma, unsigned long vm_flags, struct anon_vma *anon_vma, struct file *file, pgoff_t vm_pgoff) | {
if (is_mergeable_vma(vma, file, vm_flags) &&
is_mergeable_anon_vma(anon_vma, vma->anon_vma)) {
pgoff_t vm_pglen;
vm_pglen = (vma->vm_end - vma->vm_start) >> PAGE_SHIFT;
if (vma->vm_pgoff + vm_pglen == vm_pgoff)
return 1;
}
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* If caller provides count pointer, number of items in array is stored there. In case of error, NULL is returned and no memory is allocated. */ | char** envlist_to_environ(const envlist_t *envlist, size_t *count) | /* If caller provides count pointer, number of items in array is stored there. In case of error, NULL is returned and no memory is allocated. */
char** envlist_to_environ(const envlist_t *envlist, size_t *count) | {
struct envlist_entry *entry;
char **env, **penv;
penv = env = malloc((envlist->el_count + 1) * sizeof (char *));
if (env == NULL)
return (NULL);
for (entry = envlist->el_entries.lh_first; entry != NULL;
entry = entry->ev_link.le_next) {
*(penv++) = strdup(entry->ev_var);
}
*penv = NULL;
if (count != ... | ve3wwg/teensy3_qemu | C++ | Other | 15 |
/* fi An instance of a channel statemachine. event The event, just happened. arg Generic pointer, casted from channel * upon call. */ | static void ctcm_chx_stopped(fsm_instance *fi, int event, void *arg) | /* fi An instance of a channel statemachine. event The event, just happened. arg Generic pointer, casted from channel * upon call. */
static void ctcm_chx_stopped(fsm_instance *fi, int event, void *arg) | {
ctcm_chx_cleanup(fi, CTC_STATE_STOPPED, arg);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.