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
/* DAC960_Failure prints a standardized error message, and then returns false. */
static bool DAC960_Failure(DAC960_Controller_T *Controller, unsigned char *ErrorMessage)
/* DAC960_Failure prints a standardized error message, and then returns false. */ static bool DAC960_Failure(DAC960_Controller_T *Controller, unsigned char *ErrorMessage)
{ DAC960_Error("While configuring DAC960 PCI RAID Controller at\n", Controller); if (Controller->IO_Address == 0) DAC960_Error("PCI Bus %d Device %d Function %d I/O Address N/A " "PCI Address 0x%X\n", Controller, Controller->Bus, Controller->Device, Controller->Function, Controller->PCI_Address...
robutest/uclinux
C++
GPL-2.0
60
/* Restore SMS registers that need to be Restored after off mode. */
void omap2_sms_restore_context(void)
/* Restore SMS registers that need to be Restored after off mode. */ void omap2_sms_restore_context(void)
{ sms_write_reg(sms_context.sms_sysconfig, SMS_SYSCONFIG); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* This is a helper function for 'ubifs_recover_leb()' which drops the last group of nodes of the scanned LEB. */
static void drop_last_group(struct ubifs_scan_leb *sleb, int *offs)
/* This is a helper function for 'ubifs_recover_leb()' which drops the last group of nodes of the scanned LEB. */ static void drop_last_group(struct ubifs_scan_leb *sleb, int *offs)
{ while (!list_empty(&sleb->nodes)) { struct ubifs_scan_node *snod; struct ubifs_ch *ch; snod = list_entry(sleb->nodes.prev, struct ubifs_scan_node, list); ch = snod->node; if (ch->group_type != UBIFS_IN_NODE_GROUP) break; dbg_rcvry("dropping grouped node at %d:%d", sleb->lnum, snod->offs); ...
4ms/stm32mp1-baremetal
C++
Other
137
/* The architecture is expected to provide a vmemmap_populate() function to instantiate the mapping. Allocate a block of memory to be used to back the virtual memory map or to back the page tables that are used to create the mapping. Uses the main allocators if they are available, else bootmem. */
static void* __init_refok __earlyonly_bootmem_alloc(int node, unsigned long size, unsigned long align, unsigned long goal)
/* The architecture is expected to provide a vmemmap_populate() function to instantiate the mapping. Allocate a block of memory to be used to back the virtual memory map or to back the page tables that are used to create the mapping. Uses the main allocators if they are available, else bootmem. */ static void* __init_...
{ return __alloc_bootmem_node(NODE_DATA(node), size, align, goal); }
robutest/uclinux
C++
GPL-2.0
60
/* This function wraps EFI_PEI_PCI_CFG2_PPI.Write() service. It writes the PCI configuration register specified by Address with the value specified by Data. The width of data is specified by Width. Data is returned. */
UINT32 PeiPciLibPciCfg2WriteWorker(IN UINTN Address, IN EFI_PEI_PCI_CFG_PPI_WIDTH Width, IN UINT32 Data)
/* This function wraps EFI_PEI_PCI_CFG2_PPI.Write() service. It writes the PCI configuration register specified by Address with the value specified by Data. The width of data is specified by Width. Data is returned. */ UINT32 PeiPciLibPciCfg2WriteWorker(IN UINTN Address, IN EFI_PEI_PCI_CFG_PPI_WIDTH Width, IN UINT32 Da...
{ EFI_STATUS Status; CONST EFI_PEI_PCI_CFG2_PPI *PciCfg2Ppi; UINT64 PciCfg2Address; Status = PeiServicesLocatePpi (&gEfiPciCfg2PpiGuid, 0, NULL, (VOID **)&PciCfg2Ppi); ASSERT_EFI_ERROR (Status); ASSERT (PciCfg2Ppi != NULL); PciCfg2Address = PCI_TO_PCICFG2_ADDRESS (Ad...
tianocore/edk2
C++
Other
4,240
/* Returns the total number of overruns in the ring buffer (all CPU entries) */
unsigned long ring_buffer_overruns(struct ring_buffer *buffer)
/* Returns the total number of overruns in the ring buffer (all CPU entries) */ unsigned long ring_buffer_overruns(struct ring_buffer *buffer)
{ struct ring_buffer_per_cpu *cpu_buffer; unsigned long overruns = 0; int cpu; for_each_buffer_cpu(buffer, cpu) { cpu_buffer = buffer->buffers[cpu]; overruns += local_read(&cpu_buffer->overrun); } return overruns; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* The first 40 bytes of the packet (the IP and TCP headers) are read from the uip_buf buffer, and the following bytes (the application data) are read from the uip_appdata buffer. */
void slipdev_send(void)
/* The first 40 bytes of the packet (the IP and TCP headers) are read from the uip_buf buffer, and the following bytes (the application data) are read from the uip_appdata buffer. */ void slipdev_send(void)
{ u16_t i; u8_t *ptr; u8_t c; slipdev_char_put(SLIP_END); ptr = uip_buf; for(i = 0; i < uip_len; ++i) { if(i == 40) { ptr = (u8_t *)uip_appdata; } c = *ptr++; switch(c) { case SLIP_END: slipdev_char_put(SLIP_ESC); slipdev_char_put(SLIP_ESC_END); break; case SL...
apopple/Pandaboard-FreeRTOS
C++
null
25
/* Returns the version of the EBC virtual machine. */
UINT64 GetVmVersion(VOID)
/* Returns the version of the EBC virtual machine. */ UINT64 GetVmVersion(VOID)
{ return (UINT64)(((VM_MAJOR_VERSION & 0xFFFF) << 16) | ((VM_MINOR_VERSION & 0xFFFF))); }
tianocore/edk2
C++
Other
4,240
/* ufshcd_enable_run_stop_reg - Enable run-stop registers, When run-stop registers are set to 1, it indicates the host controller that it can process the requests */
static void ufshcd_enable_run_stop_reg(struct ufs_hba *hba)
/* ufshcd_enable_run_stop_reg - Enable run-stop registers, When run-stop registers are set to 1, it indicates the host controller that it can process the requests */ static void ufshcd_enable_run_stop_reg(struct ufs_hba *hba)
{ ufshcd_writel(hba, UTP_TASK_REQ_LIST_RUN_STOP_BIT, REG_UTP_TASK_REQ_LIST_RUN_STOP); ufshcd_writel(hba, UTP_TRANSFER_REQ_LIST_RUN_STOP_BIT, REG_UTP_TRANSFER_REQ_LIST_RUN_STOP); }
4ms/stm32mp1-baremetal
C++
Other
137
/* This function comes into picture only if Receive side is being handled through polling (called NAPI in linux). It mostly does what the normal Rx interrupt handler does in terms of descriptor and packet processing but not in an interrupt context. Also it will process a specified number of packets at most in one itera...
static int vxge_poll_msix(struct napi_struct *napi, int budget)
/* This function comes into picture only if Receive side is being handled through polling (called NAPI in linux). It mostly does what the normal Rx interrupt handler does in terms of descriptor and packet processing but not in an interrupt context. Also it will process a specified number of packets at most in one itera...
{ struct vxge_ring *ring = container_of(napi, struct vxge_ring, napi); int budget_org = budget; ring->budget = budget; vxge_hw_vpath_poll_rx(ring->handle); if (ring->pkts_processed < budget_org) { napi_complete(napi); vxge_hw_channel_msix_unmask( (struct __vxge_hw_channel *)ring->handle, ring->rx_vec...
robutest/uclinux
C++
GPL-2.0
60
/* If this destination server is overloaded and there is a less loaded server, then return true. */
static int is_overloaded(struct ip_vs_dest *dest, struct ip_vs_service *svc)
/* If this destination server is overloaded and there is a less loaded server, then return true. */ static int is_overloaded(struct ip_vs_dest *dest, struct ip_vs_service *svc)
{ if (atomic_read(&dest->activeconns) > atomic_read(&dest->weight)) { struct ip_vs_dest *d; list_for_each_entry(d, &svc->destinations, n_list) { if (atomic_read(&d->activeconns)*2 < atomic_read(&d->weight)) { return 1; } } } return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Initializes the HRTIMx timer in basic one pulse mode. */
void HRTIM_SimpleOnePulse_Init(HRTIM_TypeDef *HRTIMx, uint32_t TimerIdx, HRTIM_BaseInitTypeDef *HRTIM_BaseInitStruct)
/* Initializes the HRTIMx timer in basic one pulse mode. */ void HRTIM_SimpleOnePulse_Init(HRTIM_TypeDef *HRTIMx, uint32_t TimerIdx, HRTIM_BaseInitTypeDef *HRTIM_BaseInitStruct)
{ assert_param(IS_HRTIM_TIMERINDEX(TimerIdx)); assert_param(IS_HRTIM_MODE(HRTIM_BaseInitStruct->Mode)); HRTIM_TimingUnitBase_Config(HRTIMx, TimerIdx, HRTIM_BaseInitStruct); }
remotemcu/remcu-chip-sdks
C++
null
436
/* Set the modem control timer to fire immediately. */
static void sa1100_enable_ms(struct uart_port *port)
/* Set the modem control timer to fire immediately. */ static void sa1100_enable_ms(struct uart_port *port)
{ struct sa1100_port *sport = (struct sa1100_port *)port; mod_timer(&sport->timer, jiffies); }
robutest/uclinux
C++
GPL-2.0
60
/* Utility functions used for various comparisons/cleanups in tree */
static gint rlc_simple_key_cmp(gconstpointer b_ptr, gconstpointer a_ptr, gpointer ignore _U_)
/* Utility functions used for various comparisons/cleanups in tree */ static gint rlc_simple_key_cmp(gconstpointer b_ptr, gconstpointer a_ptr, gpointer ignore _U_)
{ return -1; } return GPOINTER_TO_INT(a_ptr) < GPOINTER_TO_INT(b_ptr); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* This function compares two ASCII strings in case sensitive/insensitive way. */
BOOLEAN StringCmp(IN UINT8 *Source1, IN UINT8 *Source2, IN UINTN Size, IN BOOLEAN CaseSensitive)
/* This function compares two ASCII strings in case sensitive/insensitive way. */ BOOLEAN StringCmp(IN UINT8 *Source1, IN UINT8 *Source2, IN UINTN Size, IN BOOLEAN CaseSensitive)
{ UINTN Index; UINT8 Dif; for (Index = 0; Index < Size; Index++) { if (Source1[Index] == Source2[Index]) { continue; } if (!CaseSensitive) { Dif = (UINT8)((Source1[Index] > Source2[Index]) ? (Source1[Index] - Source2[Index]) : (Source2[Index] - Source1[Index])); if (Dif == ('a' - '...
tianocore/edk2
C++
Other
4,240
/* Set the current count value to desired value. Sets the value of the counter to the specified value. */
enum status_code rtc_count_set_count(struct rtc_module *const module, const uint32_t count_value)
/* Set the current count value to desired value. Sets the value of the counter to the specified value. */ enum status_code rtc_count_set_count(struct rtc_module *const module, const uint32_t count_value)
{ Assert(module); Assert(module->hw); Rtc *const rtc_module = module->hw; while (rtc_count_is_syncing(module)) { } switch(module->mode){ case RTC_COUNT_MODE_32BIT: rtc_module->MODE0.COUNT.reg = count_value; break; case RTC_COUNT_MODE_16BIT: if(count_value > 0xffff){ return STATUS_ERR_INVALID_ARG;...
memfault/zero-to-main
C++
null
200
/* This function will resume all suspended threads in the IPC object list, including the suspended list of IPC object, and private list of mailbox etc. */
rt_inline rt_err_t _ipc_list_resume_all(rt_list_t *list)
/* This function will resume all suspended threads in the IPC object list, including the suspended list of IPC object, and private list of mailbox etc. */ rt_inline rt_err_t _ipc_list_resume_all(rt_list_t *list)
{ struct rt_thread *thread; register rt_ubase_t temp; while (!rt_list_isempty(list)) { temp = rt_hw_interrupt_disable(); thread = rt_list_entry(list->next, struct rt_thread, tlist); thread->error = -RT_ERROR; rt_thread_resume(thread); rt_hw_interrupt_enable(temp);...
pikasTech/PikaPython
C++
MIT License
1,403
/* Set HCLK clock source and HCLK clock divider. */
void CLK_SetHCLK(uint32_t u32ClkSrc, uint32_t u32ClkDiv)
/* Set HCLK clock source and HCLK clock divider. */ void CLK_SetHCLK(uint32_t u32ClkSrc, uint32_t u32ClkDiv)
{ uint32_t u32HIRCSTB; u32HIRCSTB = CLK->STATUS & CLK_STATUS_HIRCSTB_Msk; CLK->PWRCTL |= CLK_PWRCTL_HIRCEN_Msk; CLK_WaitClockReady(CLK_STATUS_HIRCSTB_Msk); CLK->CLKSEL0 = (CLK->CLKSEL0 & (~CLK_CLKSEL0_HCLKSEL_Msk)) | CLK_CLKSEL0_HCLKSEL_HIRC; CLK->CLKDIV0 = (CLK->CLKDIV0 & (~CLK_CLKDIV0_HCLKDIV_...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* If PcdMaximumUnicodeStringLength is not zero, and String contains more than PcdMaximumUnicodeStringLength Unicode characters, not including the Null-terminator, then ASSERT(). */
UINTN EFIAPI StrHexToUintn(IN CONST CHAR16 *String)
/* If PcdMaximumUnicodeStringLength is not zero, and String contains more than PcdMaximumUnicodeStringLength Unicode characters, not including the Null-terminator, then ASSERT(). */ UINTN EFIAPI StrHexToUintn(IN CONST CHAR16 *String)
{ UINTN Result; if (RETURN_ERROR (StrHexToUintnS (String, (CHAR16 **)NULL, &Result))) { return MAX_UINTN; } return Result; }
tianocore/edk2
C++
Other
4,240
/* grant one or more locks (readlocks are allowed to jump the queue if the first lock in the queue is itself a readlock) */
static void afs_grant_locks(struct afs_vnode *vnode, struct file_lock *fl)
/* grant one or more locks (readlocks are allowed to jump the queue if the first lock in the queue is itself a readlock) */ static void afs_grant_locks(struct afs_vnode *vnode, struct file_lock *fl)
{ struct file_lock *p, *_p; list_move_tail(&fl->fl_u.afs.link, &vnode->granted_locks); if (fl->fl_type == F_RDLCK) { list_for_each_entry_safe(p, _p, &vnode->pending_locks, fl_u.afs.link) { if (p->fl_type == F_RDLCK) { p->fl_u.afs.state = AFS_LOCK_GRANTED; list_move_tail(&p->fl_u.afs.link, ...
robutest/uclinux
C++
GPL-2.0
60
/* param base Pointer to the FlexIO simulated peripheral type. param handle Pointer to the handler for FlexIO simulated peripheral. param isr FlexIO simulated peripheral interrupt handler. retval kStatus_Success Successfully create the handle. retval kStatus_OutOfRange The FlexIO type/handle/ISR table out of range. */
status_t FLEXIO_RegisterHandleIRQ(void *base, void *handle, flexio_isr_t isr)
/* param base Pointer to the FlexIO simulated peripheral type. param handle Pointer to the handler for FlexIO simulated peripheral. param isr FlexIO simulated peripheral interrupt handler. retval kStatus_Success Successfully create the handle. retval kStatus_OutOfRange The FlexIO type/handle/ISR table out of range. */...
{ assert(base); assert(handle); assert(isr); uint8_t index = 0; for (index = 0; index < FLEXIO_HANDLE_COUNT; index++) { if (s_flexioHandle[index] == NULL) { s_flexioType[index] = base; s_flexioHandle[index] = handle; s_flexioIsr[index] = i...
ARMmbed/DAPLink
C++
Apache License 2.0
2,140
/* Reset ADC peripheral registers to their default reset values. */
void ADC_Reset(void)
/* Reset ADC peripheral registers to their default reset values. */ void ADC_Reset(void)
{ RCM_EnableAPB2PeriphReset(RCM_APB2_PERIPH_ADC); RCM_DisableAPB2PeriphReset(RCM_APB2_PERIPH_ADC); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Enable time stamp snapshot for IPV6 frames. When enabled, time stamp snapshot is taken for IPV6 frames Reserved when "Advanced Time Stamp" is not selected */
void synopGMAC_TS_IPV6_enable(synopGMACdevice *gmacdev)
/* Enable time stamp snapshot for IPV6 frames. When enabled, time stamp snapshot is taken for IPV6 frames Reserved when "Advanced Time Stamp" is not selected */ void synopGMAC_TS_IPV6_enable(synopGMACdevice *gmacdev)
{ synopGMACSetBits(gmacdev->MacBase, GmacTSControl, GmacTSIPV6ENA); return; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Sends one data frame through a SSC peripheral. If another frame is currently being sent, this function waits for the previous transfer to complete. */
void SSC_Write(AT91S_SSC *ssc, unsigned int frame)
/* Sends one data frame through a SSC peripheral. If another frame is currently being sent, this function waits for the previous transfer to complete. */ void SSC_Write(AT91S_SSC *ssc, unsigned int frame)
{ while ((ssc->SSC_SR & AT91C_SSC_TXRDY) == 0); ssc->SSC_THR = frame; }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* Get CNTP_CVAL This function returns the value of the 64 bits PL1 Physical Timer CompareValue Register (CNTP_CVAL). return CNTP_CVAL Register value */
static rt_uint64_t __get_cntp_cval(void)
/* Get CNTP_CVAL This function returns the value of the 64 bits PL1 Physical Timer CompareValue Register (CNTP_CVAL). return CNTP_CVAL Register value */ static rt_uint64_t __get_cntp_cval(void)
{ rt_uint64_t result; __get_cp64(15, 2, result, 14); return result; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Enter deep power down mode. The DP instruction is for setting the device on the minimizing the power consumption. */
enum status_code mx25v_enter_deep_powerdown(void)
/* Enter deep power down mode. The DP instruction is for setting the device on the minimizing the power consumption. */ enum status_code mx25v_enter_deep_powerdown(void)
{ enum status_code status; uint8_t tx_buf[1] = {MX25V_CMD_DP}; _mx25v_chip_select(); status = spi_write_buffer_wait(&_mx25v_spi, tx_buf, 1); if (status != STATUS_OK) { return STATUS_ERR_IO; } _mx25v_chip_deselect(); return STATUS_OK; }
memfault/zero-to-main
C++
null
200
/* @part_name: Named partition to lookup @dev_desc: Pointer to returned blk_desc pointer @part_info: Pointer to returned disk_partition_t @response: Pointer to fastboot response buffer */
int fastboot_mmc_get_part_info(const char *part_name, struct blk_desc **dev_desc, disk_partition_t *part_info, char *response)
/* @part_name: Named partition to lookup @dev_desc: Pointer to returned blk_desc pointer @part_info: Pointer to returned disk_partition_t @response: Pointer to fastboot response buffer */ int fastboot_mmc_get_part_info(const char *part_name, struct blk_desc **dev_desc, disk_partition_t *part_info, char *response)
{ int r; *dev_desc = blk_get_dev("mmc", CONFIG_FASTBOOT_FLASH_MMC_DEV); if (!*dev_desc) { fastboot_fail("block device not found", response); return -ENOENT; } if (!part_name || !strcmp(part_name, "")) { fastboot_fail("partition not given", response); return -ENOENT; } r = part_get_info_by_name_or_alias(*...
4ms/stm32mp1-baremetal
C++
Other
137
/* Feed the tape device CCW queue with requests supplied in a list. */
static int tapeblock_start_request(struct tape_device *device, struct request *req)
/* Feed the tape device CCW queue with requests supplied in a list. */ static int tapeblock_start_request(struct tape_device *device, struct request *req)
{ struct tape_request * ccw_req; int rc; DBF_LH(6, "tapeblock_start_request(%p, %p)\n", device, req); ccw_req = device->discipline->bread(device, req); if (IS_ERR(ccw_req)) { DBF_EVENT(1, "TBLOCK: bread failed\n"); blk_end_request_all(req, -EIO); return PTR_ERR(ccw_req); } ccw_req->callback = __tapeblock...
robutest/uclinux
C++
GPL-2.0
60
/* Disable the spic device by calling its _DIS method */
static int sony_pic_disable(struct acpi_device *device)
/* Disable the spic device by calling its _DIS method */ static int sony_pic_disable(struct acpi_device *device)
{ acpi_status ret = acpi_evaluate_object(device->handle, "_DIS", NULL, NULL); if (ACPI_FAILURE(ret) && ret != AE_NOT_FOUND) return -ENXIO; dprintk("Device disabled\n"); return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* returns the address of the next descriptor, or NULL if not available. */
static struct gelic_descr* gelic_card_get_next_tx_descr(struct gelic_card *card)
/* returns the address of the next descriptor, or NULL if not available. */ static struct gelic_descr* gelic_card_get_next_tx_descr(struct gelic_card *card)
{ if (!card->tx_chain.head) return NULL; if (card->tx_chain.tail != card->tx_chain.head->next && gelic_descr_get_status(card->tx_chain.head) == GELIC_DESCR_DMA_NOT_IN_USE) return card->tx_chain.head; else return NULL; }
robutest/uclinux
C++
GPL-2.0
60
/* Delete a string from HII Package List by given HiiHandle. */
EFI_STATUS HiiDeleteString(IN EFI_STRING_ID StringId, IN EFI_HII_HANDLE HiiHandle)
/* Delete a string from HII Package List by given HiiHandle. */ EFI_STATUS HiiDeleteString(IN EFI_STRING_ID StringId, IN EFI_HII_HANDLE HiiHandle)
{ CHAR16 NullChar; if (StringId == 0x00) { return EFI_INVALID_PARAMETER; } NullChar = CHAR_NULL; HiiSetString (HiiHandle, StringId, &NullChar, NULL); return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* Enables or disables the TIMx peripheral Preload register on CCR2. */
void TIM_OC2PreloadConfig(TIM_TypeDef *TIMx, uint16_t TIM_OCPreload)
/* Enables or disables the TIMx peripheral Preload register on CCR2. */ void TIM_OC2PreloadConfig(TIM_TypeDef *TIMx, uint16_t TIM_OCPreload)
{ uint32_t tmpccmr1 = 0; assert_param(IS_TIM_LIST2_PERIPH(TIMx)); assert_param(IS_TIM_OCPRELOAD_STATE(TIM_OCPreload)); tmpccmr1 = TIMx->CCMR1; tmpccmr1 &= (uint32_t)(~TIM_CCMR1_OC2PE); tmpccmr1 |= (uint32_t)(TIM_OCPreload << 8); TIMx->CCMR1 = tmpccmr1; }
ajhc/demo-cortex-m3
C++
null
38
/* Waits for a FLASH operation to complete or a TIMEOUT to occur. */
FLASH_Status FLASH_WaitForLastOperation(uint32_t Timeout)
/* Waits for a FLASH operation to complete or a TIMEOUT to occur. */ FLASH_Status FLASH_WaitForLastOperation(uint32_t Timeout)
{ FLASH_Status status = FLASH_COMPLETE; status = FLASH_GetStatus(); while((status == FLASH_BUSY) && (Timeout != 0x00)) { status = FLASH_GetStatus(); Timeout--; } if(Timeout == 0x00 ) { status = FLASH_TIMEOUT; } return status; }
ajhc/demo-cortex-m3
C++
null
38
/* Disable Break. Disables the break function of an advanced timer. */
void timer_disable_break(uint32_t timer_peripheral)
/* Disable Break. Disables the break function of an advanced timer. */ void timer_disable_break(uint32_t timer_peripheral)
{ TIM_BDTR(timer_peripheral) &= ~TIM_BDTR_BKE; }
libopencm3/libopencm3
C++
GNU General Public License v3.0
2,931
/* Output: void, but we will add to proto tree. */
static void dissect_lsp_mt_id(tvbuff_t *tvb, proto_tree *tree, int offset)
/* Output: void, but we will add to proto tree. */ static void dissect_lsp_mt_id(tvbuff_t *tvb, proto_tree *tree, int offset)
{ proto_tree_add_item(tree, hf_isis_lsp_mt_id_reserved, tvb, offset, 2, ENC_BIG_ENDIAN); proto_tree_add_item(tree, hf_isis_lsp_mt_id, tvb, offset, 2, ENC_BIG_ENDIAN); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* @handle handle of the loaded image @systable system table */
static int setup(const efi_handle_t img_handle, const struct efi_system_table *systable)
/* @handle handle of the loaded image @systable system table */ static int setup(const efi_handle_t img_handle, const struct efi_system_table *systable)
{ boottime = systable->boottime; runtime = systable->runtime; return EFI_ST_SUCCESS; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Registers an interrupt handler for the watchdog timer interrupt. */
void WatchdogIntRegister(uint32_t ui32Base, void(*pfnHandler)(void))
/* Registers an interrupt handler for the watchdog timer interrupt. */ void WatchdogIntRegister(uint32_t ui32Base, void(*pfnHandler)(void))
{ ASSERT((ui32Base == WATCHDOG0_BASE) || (ui32Base == WATCHDOG1_BASE)); IntRegister(INT_WATCHDOG_TM4C123, pfnHandler); IntEnable(INT_WATCHDOG_TM4C123); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Returns: A string containing the encoding, this string is owned by GLib and must not be freed. */
const gchar* g_io_channel_get_encoding(GIOChannel *channel)
/* Returns: A string containing the encoding, this string is owned by GLib and must not be freed. */ const gchar* g_io_channel_get_encoding(GIOChannel *channel)
{ g_return_val_if_fail (channel != NULL, NULL); return channel->encoding; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* This function clear fault brake interrupt of selected source. */
void EPWM_ClearFaultBrakeIntFlag(EPWM_T *epwm, uint32_t u32BrakeSource)
/* This function clear fault brake interrupt of selected source. */ void EPWM_ClearFaultBrakeIntFlag(EPWM_T *epwm, uint32_t u32BrakeSource)
{ (epwm)->INTSTS1 = (0x3fUL << u32BrakeSource); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This is the replacement for newlib's _REENT_INIT_PTR and __sinit. The problem with __sinit is that it allocates three FILE structures (stdin, stdout, stderr). Having individual standard streams for each task is a bit too much on a small embedded system. So we point streams to the streams of the global struct _reent,...
void IRAM_ATTR esp_reent_init(struct _reent *r)
/* This is the replacement for newlib's _REENT_INIT_PTR and __sinit. The problem with __sinit is that it allocates three FILE structures (stdin, stdout, stderr). Having individual standard streams for each task is a bit too much on a small embedded system. So we point streams to the streams of the global struct _reent,...
{ memset(r, 0, sizeof(*r)); r->_stdout = _GLOBAL_REENT->_stdout; r->_stderr = _GLOBAL_REENT->_stderr; r->_stdin = _GLOBAL_REENT->_stdin; r->__cleanup = &_cleanup_r; r->__sdidinit = 1; r->__sglue._next = NULL; r->__sglue._niobs = 0; r->__sglue._iobs = NULL; r->_current_locale = "...
retro-esp32/RetroESP32
C++
Creative Commons Attribution Share Alike 4.0 International
581
/* This FILTER_FUNCTION checks if a handle corresponds to a Virtio serial device at the EFI_PCI_IO_PROTOCOL level. */
STATIC BOOLEAN EFIAPI IsVirtioPciSerial(IN EFI_HANDLE Handle, IN CONST CHAR16 *ReportText)
/* This FILTER_FUNCTION checks if a handle corresponds to a Virtio serial device at the EFI_PCI_IO_PROTOCOL level. */ STATIC BOOLEAN EFIAPI IsVirtioPciSerial(IN EFI_HANDLE Handle, IN CONST CHAR16 *ReportText)
{ return IsVirtioPci (Handle, ReportText, VIRTIO_SUBSYSTEM_CONSOLE); }
tianocore/edk2
C++
Other
4,240
/* Note: This is in section 7.3.1 and 7.5.3.1 of the IEEE 802.15.4-2006 document. */
static int fake_assoc_req(struct net_device *dev, struct ieee802154_addr *addr, u8 channel, u8 page, u8 cap)
/* Note: This is in section 7.3.1 and 7.5.3.1 of the IEEE 802.15.4-2006 document. */ static int fake_assoc_req(struct net_device *dev, struct ieee802154_addr *addr, u8 channel, u8 page, u8 cap)
{ struct wpan_phy *phy = fake_to_phy(dev); mutex_lock(&phy->pib_lock); phy->current_channel = channel; phy->current_page = page; mutex_unlock(&phy->pib_lock); return ieee802154_nl_assoc_confirm(dev, fake_get_short_addr(dev), IEEE802154_SUCCESS); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Scsi_Host_template SCSI host template Scsi_Host template entry, returns BFAD PCI info. */
static const char* bfad_im_info(struct Scsi_Host *shost)
/* Scsi_Host_template SCSI host template Scsi_Host template entry, returns BFAD PCI info. */ static const char* bfad_im_info(struct Scsi_Host *shost)
{ static char bfa_buf[256]; struct bfad_im_port_s *im_port = (struct bfad_im_port_s *) shost->hostdata[0]; struct bfa_ioc_attr_s ioc_attr; struct bfad_s *bfad = im_port->bfad; memset(&ioc_attr, 0, sizeof(ioc_attr)); bfa_get_attr(&bfad->bfa, &ioc_attr); memset(bfa_buf, 0, sizeof(bfa_buf)); snprin...
robutest/uclinux
C++
GPL-2.0
60
/* This function cleans up the ld_queue of DMA channel. */
static void sh_dmae_chan_ld_cleanup(struct sh_dmae_chan *sh_chan, bool all)
/* This function cleans up the ld_queue of DMA channel. */ static void sh_dmae_chan_ld_cleanup(struct sh_dmae_chan *sh_chan, bool all)
{ while (__ld_cleanup(sh_chan, all)) ; }
robutest/uclinux
C++
GPL-2.0
60
/* Function for fetching length of file to be programmed. Master initially transmits 4 bytes - which is the length of the the data to be programmed to the device. */
static uint32_t get_length(void)
/* Function for fetching length of file to be programmed. Master initially transmits 4 bytes - which is the length of the the data to be programmed to the device. */ static uint32_t get_length(void)
{ uint8_t read_buffer[4]; uint32_t len = 0; while (spi_read_buffer_wait(&slave, read_buffer, 4, dummy) != STATUS_OK); MSB0W(len) = read_buffer[0]; MSB1W(len) = read_buffer[1]; MSB2W(len) = read_buffer[2]; MSB3W(len) = read_buffer[3]; return len; }
memfault/zero-to-main
C++
null
200
/* This function handles WAKE UP TIMER interrupt request. */
void RTC_IRQHandler(void)
/* This function handles WAKE UP TIMER interrupt request. */ void RTC_IRQHandler(void)
{ HAL_RTCEx_WakeUpTimerIRQHandler(&hRTC_Handle); }
eclipse-threadx/getting-started
C++
Other
310
/* Software reset. Restore the default values in user registers.. */
int32_t iis2mdc_reset_get(stmdev_ctx_t *ctx, uint8_t *val)
/* Software reset. Restore the default values in user registers.. */ int32_t iis2mdc_reset_get(stmdev_ctx_t *ctx, uint8_t *val)
{ iis2mdc_cfg_reg_a_t reg; int32_t ret; ret = iis2mdc_read_reg(ctx, IIS2MDC_CFG_REG_A, (uint8_t *) &reg, 1); *val = reg.soft_rst; return ret; }
eclipse-threadx/getting-started
C++
Other
310
/* Return: 0 on success or a negative error code on failure. */
int mipi_dsi_dcs_enter_sleep_mode(struct mipi_dsi_device *dsi)
/* Return: 0 on success or a negative error code on failure. */ int mipi_dsi_dcs_enter_sleep_mode(struct mipi_dsi_device *dsi)
{ ssize_t err; err = mipi_dsi_dcs_write(dsi, MIPI_DCS_ENTER_SLEEP_MODE, NULL, 0); if (err < 0) return err; return 0; }
4ms/stm32mp1-baremetal
C++
Other
137
/* return the current TPL, copied from the EDKII glue lib. */
EFI_TPL UsbGetCurrentTpl(VOID)
/* return the current TPL, copied from the EDKII glue lib. */ EFI_TPL UsbGetCurrentTpl(VOID)
{ EFI_TPL Tpl; Tpl = gBS->RaiseTPL (TPL_HIGH_LEVEL); gBS->RestoreTPL (Tpl); return Tpl; }
tianocore/edk2
C++
Other
4,240
/* Returns maximum memory read request in bytes or appropriate error value. */
int pcie_get_readrq(struct pci_dev *dev)
/* Returns maximum memory read request in bytes or appropriate error value. */ int pcie_get_readrq(struct pci_dev *dev)
{ int ret, cap; u16 ctl; cap = pci_pcie_cap(dev); if (!cap) return -EINVAL; ret = pci_read_config_word(dev, cap + PCI_EXP_DEVCTL, &ctl); if (!ret) ret = 128 << ((ctl & PCI_EXP_DEVCTL_READRQ) >> 12); return ret; }
robutest/uclinux
C++
GPL-2.0
60
/* Note the CreateTime, LastAccessTime and ModificationTime fields in EFI_FILE_INFO are full zero as FV2 protocol has no corresponding info to fill. */
EFI_STATUS FvFsGetFileInfo(IN FV_FILESYSTEM_FILE_INFO *FvFileInfo, IN OUT UINTN *BufferSize, OUT EFI_FILE_INFO *FileInfo)
/* Note the CreateTime, LastAccessTime and ModificationTime fields in EFI_FILE_INFO are full zero as FV2 protocol has no corresponding info to fill. */ EFI_STATUS FvFsGetFileInfo(IN FV_FILESYSTEM_FILE_INFO *FvFileInfo, IN OUT UINTN *BufferSize, OUT EFI_FILE_INFO *FileInfo)
{ UINTN InfoSize; InfoSize = (UINTN)FvFileInfo->FileInfo.Size; if (*BufferSize < InfoSize) { *BufferSize = InfoSize; return EFI_BUFFER_TOO_SMALL; } CopyMem (FileInfo, &FvFileInfo->FileInfo, InfoSize); *BufferSize = InfoSize; return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* IRQ Host operations xilinx_intc_xlate - translate virq# from device tree interrupts property */
static int xilinx_intc_xlate(struct irq_host *h, struct device_node *ct, const u32 *intspec, unsigned int intsize, irq_hw_number_t *out_hwirq, unsigned int *out_flags)
/* IRQ Host operations xilinx_intc_xlate - translate virq# from device tree interrupts property */ static int xilinx_intc_xlate(struct irq_host *h, struct device_node *ct, const u32 *intspec, unsigned int intsize, irq_hw_number_t *out_hwirq, unsigned int *out_flags)
{ if ((intsize < 2) || (intspec[0] >= XILINX_INTC_MAXIRQS)) return -EINVAL; xilinx_intc_typetable[intspec[0]] = xilinx_intc_map_senses[intspec[1]]; *out_hwirq = intspec[0]; *out_flags = xilinx_intc_map_senses[intspec[1]]; return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Reads and returns the current value of DR5. This function is only available on IA-32 and x64. This returns a 32-bit value on IA-32 and a 64-bit value on x64. */
UINTN EFIAPI AsmReadDr5(VOID)
/* Reads and returns the current value of DR5. This function is only available on IA-32 and x64. This returns a 32-bit value on IA-32 and a 64-bit value on x64. */ UINTN EFIAPI AsmReadDr5(VOID)
{ __asm { _emit 0x0f _emit 0x21 _emit 0xe8 } }
tianocore/edk2
C++
Other
4,240
/* If the conversion results in an overflow or an underflow condition, then Result is set to UINT64_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */
RETURN_STATUS EFIAPI SafeIntnToUint64(IN INTN Operand, OUT UINT64 *Result)
/* If the conversion results in an overflow or an underflow condition, then Result is set to UINT64_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */ RETURN_STATUS EFIAPI SafeIntnToUint64(IN INTN Operand, OUT UINT64 *Result)
{ RETURN_STATUS Status; if (Result == NULL) { return RETURN_INVALID_PARAMETER; } if (Operand >= 0) { *Result = (UINT64)Operand; Status = RETURN_SUCCESS; } else { *Result = UINT64_ERROR; Status = RETURN_BUFFER_TOO_SMALL; } return Status; }
tianocore/edk2
C++
Other
4,240
/* interpret the weird netbios "name". Return the name type, or -1 if we run past the end of the buffer */
static int name_interpret(netdissect_options *ndo, const u_char *in, const u_char *maxbuf, char *out)
/* interpret the weird netbios "name". Return the name type, or -1 if we run past the end of the buffer */ static int name_interpret(netdissect_options *ndo, const u_char *in, const u_char *maxbuf, char *out)
{ int ret; int len; if (in >= maxbuf) return(-1); ND_TCHECK2(*in, 1); len = (*in++) / 2; *out=0; if (len > 30 || len < 1) return(0); while (len--) { ND_TCHECK2(*in, 2); if (in + 1 >= maxbuf) return(-1); if (in[0] < 'A' || in[0] > 'P' || in[1] < 'A' || in[1] > 'P') { *out =...
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Main function. Execution starts here. Support and FAQ: visit */
int main(void)
/* Main function. Execution starts here. Support and FAQ: visit */ int main(void)
{ ccp_write_io((uint8_t*)&PMIC.CTRL, PMIC_IVSEL_bm | PMIC_LOLVLEN_bm | PMIC_MEDLVLEN_bm | PMIC_HILVLEN_bm); sysclk_init(); cpu_irq_enable(); udc_start(); while (true) { } }
remotemcu/remcu-chip-sdks
C++
null
436
/* This function will return the internal Vref setting for the given channel, byte_lane. */
uint32_t get_vref(uint8_t channel, uint8_t byte_lane)
/* This function will return the internal Vref setting for the given channel, byte_lane. */ uint32_t get_vref(uint8_t channel, uint8_t byte_lane)
{ uint8_t j; uint32_t ret_val = sizeof(vref_codes) / 2; uint32_t reg = (byte_lane & 0x1) ? B1VREFCTL : B0VREFCTL; uint32_t temp; ENTERFN(); temp = msg_port_alt_read(DDRPHY, reg + channel * DDRIODQ_CH_OFFSET + (byte_lane >> 1) * DDRIODQ_BL_OFFSET); temp >>= 2; temp &= 0x3f; for (j = 0; j < sizeof(vref_codes);...
4ms/stm32mp1-baremetal
C++
Other
137
/* Command response callback function for sd_ble_gap_rssi_get BLE command. Callback for decoding the output parameters and the command response return code. */
static uint32_t gap_rssi_get_rsp_dec(const uint8_t *p_buffer, uint16_t length)
/* Command response callback function for sd_ble_gap_rssi_get BLE command. Callback for decoding the output parameters and the command response return code. */ static uint32_t gap_rssi_get_rsp_dec(const uint8_t *p_buffer, uint16_t length)
{ uint32_t result_code = 0; const uint32_t err_code = ble_gap_rssi_get_rsp_dec(p_buffer, length, (int8_t *) mp_out_params[0], &result_code); APP_E...
labapart/polymcu
C++
null
201
/* Release page resources associated with a write request after it has completed. */
void nfs_clear_request(struct nfs_page *req)
/* Release page resources associated with a write request after it has completed. */ void nfs_clear_request(struct nfs_page *req)
{ struct page *page = req->wb_page; if (page != NULL) { page_cache_release(page); req->wb_page = NULL; } }
robutest/uclinux
C++
GPL-2.0
60
/* Called by nand_init_chip to initialize the board specific functions */
int board_nand_init(struct nand_chip *nand)
/* Called by nand_init_chip to initialize the board specific functions */ int board_nand_init(struct nand_chip *nand)
{ struct misc_regs *const misc_regs_p = (struct misc_regs *)CONFIG_SPEAR_MISCBASE; if (!(readl(&misc_regs_p->auto_cfg_reg) & MISC_NANDDIS)) return spear_nand_init(nand); return -1; }
EmcraftSystems/u-boot
C++
Other
181
/* Informs the Policy Engine that a message was successfully sent. */
void pe_message_sent(const struct device *dev)
/* Informs the Policy Engine that a message was successfully sent. */ void pe_message_sent(const struct device *dev)
{ struct usbc_port_data *data = dev->data; struct policy_engine *pe = data->pe; atomic_set_bit(pe->flags, PE_FLAGS_TX_COMPLETE); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* This function forces any delayed work to be queued and run. */
static int run_delayed_work(struct delayed_work *dwork)
/* This function forces any delayed work to be queued and run. */ static int run_delayed_work(struct delayed_work *dwork)
{ int ret; ret = cancel_delayed_work(dwork); if (ret) { schedule_delayed_work(dwork, 0); flush_scheduled_work(); } return ret; }
robutest/uclinux
C++
GPL-2.0
60
/* See mss_uart.h for details of how to use this function. */
void MSS_UART_disable_tx_time_guard(mss_uart_instance_t *this_uart)
/* See mss_uart.h for details of how to use this function. */ void MSS_UART_disable_tx_time_guard(mss_uart_instance_t *this_uart)
{ ASSERT((this_uart == &g_mss_uart0) || (this_uart == &g_mss_uart1)); if((this_uart == &g_mss_uart0) || (this_uart == &g_mss_uart1)) { clear_bit_reg8(&this_uart->hw_reg->MM0,ETTG); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Output: void, will modify proto_tree if not null. */
static void dissect_lsp_ip_authentication_clv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, int id_length _U_, int length)
/* Output: void, will modify proto_tree if not null. */ static void dissect_lsp_ip_authentication_clv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, int id_length _U_, int length)
{ if ( length != 0 ) { proto_tree_add_item(tree, hf_isis_lsp_ip_authentication, tvb, offset, length, ENC_ASCII|ENC_NA); } }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* An abort indicates that the current memory access cannot be completed, which occurs during a data access. */
void rt_hw_trap_dabt(struct rt_hw_register *regs)
/* An abort indicates that the current memory access cannot be completed, which occurs during a data access. */ void rt_hw_trap_dabt(struct rt_hw_register *regs)
{ rt_hw_show_register(regs); rt_kprintf("data abort\n"); rt_hw_cpu_shutdown(); }
armink/FreeModbus_Slave-Master-RTT-STM32
C++
Other
1,477
/* Sets the HID Out Report (the report coming in from the USB host to the LPC1343). */
void usbHIDSetOutReport(uint8_t dst[], uint32_t length)
/* Sets the HID Out Report (the report coming in from the USB host to the LPC1343). */ void usbHIDSetOutReport(uint8_t dst[], uint32_t length)
{ uint8_t PCOutReportData = dst[0]; if (PCOutReportData & (1<<0)) { gpioSetValue (CFG_LED_PORT, CFG_LED_PIN, 0); } else { gpioSetValue (CFG_LED_PORT, CFG_LED_PIN, 1); } }
microbuilder/LPC1343CodeBase
C++
Other
73
/* Set the 'pervious node pointer' of a node */
static void node_set_prev(lv_ll_t *ll_p, lv_ll_node_t *act, lv_ll_node_t *prev)
/* Set the 'pervious node pointer' of a node */ static void node_set_prev(lv_ll_t *ll_p, lv_ll_node_t *act, lv_ll_node_t *prev)
{ if(act == NULL) return; uint32_t node_p_size = sizeof(lv_ll_node_t *); if(prev) memcpy(act + LL_PREV_P_OFFSET(ll_p), &prev, node_p_size); else memset(act + LL_PREV_P_OFFSET(ll_p), 0, node_p_size); }
RavenSystem/esp-homekit-devices
C++
Other
2,577
/* Load a receive DMA channel with a base address and ring length */
static void mace_load_rxdma_base(struct net_device *dev, int set)
/* Load a receive DMA channel with a base address and ring length */ static void mace_load_rxdma_base(struct net_device *dev, int set)
{ struct mace_data *mp = netdev_priv(dev); psc_write_word(PSC_ENETRD_CMD + set, 0x0100); psc_write_long(PSC_ENETRD_ADDR + set, (u32) mp->rx_ring_phys); psc_write_long(PSC_ENETRD_LEN + set, N_RX_RING); psc_write_word(PSC_ENETRD_CMD + set, 0x9800); mp->rx_tail = 0; }
robutest/uclinux
C++
GPL-2.0
60
/* This function reads some important data from the IOMMU PCI space and initializes the driver data structure with it. It reads the hardware capabilities and the first/last device entries */
static void __init init_iommu_from_pci(struct amd_iommu *iommu)
/* This function reads some important data from the IOMMU PCI space and initializes the driver data structure with it. It reads the hardware capabilities and the first/last device entries */ static void __init init_iommu_from_pci(struct amd_iommu *iommu)
{ int cap_ptr = iommu->cap_ptr; u32 range, misc; pci_read_config_dword(iommu->dev, cap_ptr + MMIO_CAP_HDR_OFFSET, &iommu->cap); pci_read_config_dword(iommu->dev, cap_ptr + MMIO_RANGE_OFFSET, &range); pci_read_config_dword(iommu->dev, cap_ptr + MMIO_MISC_OFFSET, &misc); iommu->first_devi...
EmcraftSystems/linux-emcraft
C++
Other
266
/* Tx has completed, mark the buffers that were assigned to the Tx descriptors as free again. */
void MSS_MAC_FreeTxBuffers(void)
/* Tx has completed, mark the buffers that were assigned to the Tx descriptors as free again. */ void MSS_MAC_FreeTxBuffers(void)
{ if( g_mss_mac.tx_descriptors[ 0 ].buffer_1 != ( uint32_t ) NULL ) { if( ( ( (g_mss_mac.tx_descriptors[ 0 ].descriptor_0) & TDES0_OWN) == 0 ) && ( ( (g_mss_mac.tx_descriptors[ 1 ].descriptor_0) & TDES0_OWN) == 0 ) ) { configASSERT( g_mss_mac.tx_descriptors[ 0 ].buffer_1 == g_mss_mac.tx_descriptors[ 1 ].buffer...
apopple/Pandaboard-FreeRTOS
C++
null
25
/* If the inode is not in cache, get_new_inode_fast() is called to allocate a new inode and this is returned locked, hashed, and with the I_NEW flag set. The file system gets to fill it in before unlocking it via unlock_new_inode(). */
struct inode* iget_locked(struct super_block *sb, unsigned long ino)
/* If the inode is not in cache, get_new_inode_fast() is called to allocate a new inode and this is returned locked, hashed, and with the I_NEW flag set. The file system gets to fill it in before unlocking it via unlock_new_inode(). */ struct inode* iget_locked(struct super_block *sb, unsigned long ino)
{ struct hlist_head *head = inode_hashtable + hash(sb, ino); struct inode *inode; inode = ifind_fast(sb, head, ino); if (inode) return inode; return get_new_inode_fast(sb, head, ino); }
robutest/uclinux
C++
GPL-2.0
60
/* Toggles the LED at a fixed time interval. */
void LedToggle(void)
/* Toggles the LED at a fixed time interval. */ void LedToggle(void)
{ static unsigned char led_toggle_state = 0; static unsigned long timer_counter_last = 0; unsigned long timer_counter_now; timer_counter_now = TimerGet(); if ( (timer_counter_now - timer_counter_last) < LED_TOGGLE_MS) { return; } if (led_toggle_state == 0) { led_toggle_state = 1; XMC_GPIO_...
feaser/openblt
C++
GNU General Public License v3.0
601
/* Stops the TIMER hall sensor interface in interrupt mode. */
void ald_timer_hall_sensor_stop_by_it(ald_timer_handle_t *hperh)
/* Stops the TIMER hall sensor interface in interrupt mode. */ void ald_timer_hall_sensor_stop_by_it(ald_timer_handle_t *hperh)
{ assert_param(IS_TIMER_XOR_INSTANCE(hperh->perh)); timer_ccx_channel_cmd(hperh->perh, ALD_TIMER_CHANNEL_1, DISABLE); ald_timer_interrupt_config(hperh, ALD_TIMER_IT_CC1, DISABLE); ALD_TIMER_DISABLE(hperh); return; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* set_board_revision() - set detailed board type in gd->board_type. Should be called when resources (e.g. regulators) are available so ADC can be used to detect the specific revision of a board. */
void set_board_revision(void)
/* set_board_revision() - set detailed board type in gd->board_type. Should be called when resources (e.g. regulators) are available so ADC can be used to detect the specific revision of a board. */ void set_board_revision(void)
{ if (board_is_odroidxu3()) gd->board_type = odroid_get_board_type(); }
4ms/stm32mp1-baremetal
C++
Other
137
/* Registers an interrupt handler for the I2C module. */
void I2CIntRegister(unsigned long ulBase, void(*pfnHandler)(void))
/* Registers an interrupt handler for the I2C module. */ void I2CIntRegister(unsigned long ulBase, void(*pfnHandler)(void))
{ unsigned long ulInt; ASSERT((ulBase == I2C0_MASTER_BASE) || (ulBase == I2C1_MASTER_BASE)); ulInt = (ulBase == I2C0_MASTER_BASE) ? INT_I2C0 : INT_I2C1; IntRegister(ulInt, pfnHandler); IntEnable(ulInt); }
watterott/WebRadio
C++
null
71
/* Sensing chain FIFO stop values memorization at threshold level.. */
int32_t lsm6dsl_fifo_stop_on_wtm_get(stmdev_ctx_t *ctx, uint8_t *val)
/* Sensing chain FIFO stop values memorization at threshold level.. */ int32_t lsm6dsl_fifo_stop_on_wtm_get(stmdev_ctx_t *ctx, uint8_t *val)
{ lsm6dsl_fifo_ctrl4_t fifo_ctrl4; int32_t ret; ret = lsm6dsl_read_reg(ctx, LSM6DSL_FIFO_CTRL4, (uint8_t*)&fifo_ctrl4, 1); *val = fifo_ctrl4.stop_on_fth; return ret; }
eclipse-threadx/getting-started
C++
Other
310
/* Detects whether the Smartcard is present or not. */
uint8_t SC_Detect(void)
/* Detects whether the Smartcard is present or not. */ uint8_t SC_Detect(void)
{ uint8_t PIN_State = 0U; return PIN_State; }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* Basically, we start a IAP query, and then go to sleep. When the query return, irnet_getvalue_confirm will wake us up, and we can examine the result of the query... Note that in some case, the query fail even before we go to sleep, creating some races... */
static int irnet_find_lsap_sel(irnet_socket *self)
/* Basically, we start a IAP query, and then go to sleep. When the query return, irnet_getvalue_confirm will wake us up, and we can examine the result of the query... Note that in some case, the query fail even before we go to sleep, creating some races... */ static int irnet_find_lsap_sel(irnet_socket *self)
{ DENTER(IRDA_SR_TRACE, "(self=0x%p)\n", self); DABORT(self->iriap, -EBUSY, IRDA_SR_ERROR, "busy with a previous query.\n"); self->iriap = iriap_open(LSAP_ANY, IAS_CLIENT, self, irnet_getvalue_confirm); self->errno = -EHOSTUNREACH; iriap_getvaluebyclass_request(self->iriap, self->rsaddr, self->daddr, ...
EmcraftSystems/linux-emcraft
C++
Other
266
/* Configures the TIMx Output Compare 3 Fast feature. */
void TIM_OC3FastConfig(TIM_TypeDef *TIMx, uint16_t TIM_OCFast)
/* Configures the TIMx Output Compare 3 Fast feature. */ void TIM_OC3FastConfig(TIM_TypeDef *TIMx, uint16_t TIM_OCFast)
{ uint16_t tmpccmr2 = 0; assert_param(IS_TIM_LIST3_PERIPH(TIMx)); assert_param(IS_TIM_OCFAST_STATE(TIM_OCFast)); tmpccmr2 = TIMx->CCMR2; tmpccmr2 &= (uint16_t)~((uint16_t)TIM_CCMR2_OC3FE); tmpccmr2 |= TIM_OCFast; TIMx->CCMR2 = tmpccmr2; }
gcallipo/RadioDSP-Stm32f103
C++
Common Creative - Attribution 3.0
51
/* Initialize the stmpe1600 and configure the needed hardware resources. */
void stmpe1600_Init(uint16_t DeviceAddr)
/* Initialize the stmpe1600 and configure the needed hardware resources. */ void stmpe1600_Init(uint16_t DeviceAddr)
{ uint8_t instance; uint8_t empty; instance = stmpe1600_GetInstance(DeviceAddr); if(instance == 0xFF) { empty = stmpe1600_GetInstance(0); if(empty < STMPE1600_MAX_INSTANCE) { stmpe1600[empty] = DeviceAddr; IOE_Init(); stmpe1600_Reset(DeviceAddr); } } }
eclipse-threadx/getting-started
C++
Other
310
/* Disable Snapshot for Event messages. When disabled, snapshot is taken for all messages except Announce, Management and Signaling. Reserved when "Advanced Time Stamp" is not selected */
void synopGMAC_TS_event_disable(synopGMACdevice *gmacdev)
/* Disable Snapshot for Event messages. When disabled, snapshot is taken for all messages except Announce, Management and Signaling. Reserved when "Advanced Time Stamp" is not selected */ void synopGMAC_TS_event_disable(synopGMACdevice *gmacdev)
{ synopGMACClearBits(gmacdev->MacBase, GmacTSControl, GmacTSEVNTENA); return; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This function handles TIM1 Break and TIM9 interrupts request. */
void TIM1_BRK_TIM9_IRQHandler(void)
/* This function handles TIM1 Break and TIM9 interrupts request. */ void TIM1_BRK_TIM9_IRQHandler(void)
{ if (TIM_GetITStatus(TIM9, TIM_IT_CC1) != RESET) { TIM_ClearITPendingBit(TIM9, TIM_IT_CC1 ); capture = TIM_GetCapture1(TIM9); TIM_SetCompare1(TIM9, capture + CCR1Val ); } if (TIM_GetITStatus(TIM9, TIM_IT_CC2) != RESET) { TIM_ClearITPendingBit(TIM9, TIM_IT_CC2); capture = TIM_GetCapture2(T...
remotemcu/remcu-chip-sdks
C++
null
436
/* Construction function for DMARMB instruction. This function fills the program buffer with the constructed instruction. */
int XDmaPs_Instr_DMARMB(char *DmaProg)
/* Construction function for DMARMB instruction. This function fills the program buffer with the constructed instruction. */ int XDmaPs_Instr_DMARMB(char *DmaProg)
{ *DmaProg = 0x12; return 1; }
ua1arn/hftrx
C++
null
69
/* This is to be used in cases where the base 'struct flex_array' has been statically allocated and should not be free. */
void flex_array_free_parts(struct flex_array *fa)
/* This is to be used in cases where the base 'struct flex_array' has been statically allocated and should not be free. */ void flex_array_free_parts(struct flex_array *fa)
{ int part_nr; if (elements_fit_in_base(fa)) return; for (part_nr = 0; part_nr < FLEX_ARRAY_NR_BASE_PTRS; part_nr++) kfree(fa->parts[part_nr]); }
robutest/uclinux
C++
GPL-2.0
60
/* If 64-bit I/O port operations are not supported, then ASSERT(). */
UINT64 EFIAPI S3IoAndThenOr64(IN UINTN Port, IN UINT64 AndData, IN UINT64 OrData)
/* If 64-bit I/O port operations are not supported, then ASSERT(). */ UINT64 EFIAPI S3IoAndThenOr64(IN UINTN Port, IN UINT64 AndData, IN UINT64 OrData)
{ return InternalSaveIoWrite64ValueToBootScript (Port, IoAndThenOr64 (Port, AndData, OrData)); }
tianocore/edk2
C++
Other
4,240
/* readonly controls the readonly status of a dasd */
static ssize_t dasd_ro_show(struct device *dev, struct device_attribute *attr, char *buf)
/* readonly controls the readonly status of a dasd */ static ssize_t dasd_ro_show(struct device *dev, struct device_attribute *attr, char *buf)
{ struct dasd_devmap *devmap; int ro_flag; devmap = dasd_find_busid(dev_name(dev)); if (!IS_ERR(devmap)) ro_flag = (devmap->features & DASD_FEATURE_READONLY) != 0; else ro_flag = (DASD_FEATURE_DEFAULT & DASD_FEATURE_READONLY) != 0; return snprintf(buf, PAGE_SIZE, ro_flag ? "1\n" : "0\n"); }
robutest/uclinux
C++
GPL-2.0
60
/* Reads the port error status CSR for the master port to determine if the port has an active link. Returns PORT_N_ERR_STS_PORT_OK if the master port is active or %0 if it is inactive. */
static int rio_mport_is_active(struct rio_mport *port)
/* Reads the port error status CSR for the master port to determine if the port has an active link. Returns PORT_N_ERR_STS_PORT_OK if the master port is active or %0 if it is inactive. */ static int rio_mport_is_active(struct rio_mport *port)
{ u32 result = 0; u32 ext_ftr_ptr; int *entry = rio_mport_phys_table; do { if ((ext_ftr_ptr = rio_mport_get_feature(port, 1, 0, 0, *entry))) break; } while (*++entry >= 0); if (ext_ftr_ptr) rio_local_read_config_32(port, ext_ftr_ptr + RIO_PORT_N_ERR_STS_CSR(port->index), &result); ...
robutest/uclinux
C++
GPL-2.0
60
/* Set an interface alternate setting. The function is used to set an interface alternate setting. */
usb_status_t USB_DeviceSetInterface(usb_device_handle handle, uint8_t interface, uint8_t alternateSetting)
/* Set an interface alternate setting. The function is used to set an interface alternate setting. */ usb_status_t USB_DeviceSetInterface(usb_device_handle handle, uint8_t interface, uint8_t alternateSetting)
{ g_interface[interface] = alternateSetting; return USB_DeviceCallback(handle, kUSB_DeviceEventSetInterface, &interface); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Format a bunch of data from a tvbuff as bytes, returning a pointer to the string with the formatted data. */
gchar* tvb_bytes_to_str(wmem_allocator_t *allocator, tvbuff_t *tvb, const gint offset, const gint len)
/* Format a bunch of data from a tvbuff as bytes, returning a pointer to the string with the formatted data. */ gchar* tvb_bytes_to_str(wmem_allocator_t *allocator, tvbuff_t *tvb, const gint offset, const gint len)
{ return bytes_to_str(allocator, ensure_contiguous(tvb, offset, len), len); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Clear the overflow condition on the ADC sample sequence. */
void xADCOverflowClear(unsigned long ulBase)
/* Clear the overflow condition on the ADC sample sequence. */ void xADCOverflowClear(unsigned long ulBase)
{ unsigned long i; unsigned long ulOverRunChannels; volatile unsigned long ulDump; xASSERT(ulBase == ADC0_BASE); ulOverRunChannels = (xHWREG(ulBase + ADC_SR) & ADC_SR_OVERRUN_M) >> ADC_SR_OVERRUN_S; for(i = 0; i < 8; i++) { if(ulOverRunChannels & (1 << i)) ...
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* NOTE! unlike strncmp, affs_match returns 1 for success, 0 for failure. */
static int affs_match(struct dentry *dentry, const u8 *name2, toupper_t toupper)
/* NOTE! unlike strncmp, affs_match returns 1 for success, 0 for failure. */ static int affs_match(struct dentry *dentry, const u8 *name2, toupper_t toupper)
{ const u8 *name = dentry->d_name.name; int len = dentry->d_name.len; if (len >= 30) { if (*name2 < 30) return 0; len = 30; } else if (len != *name2) return 0; for (name2++; len > 0; len--) if (toupper(*name++) != toupper(*name2++)) return 0; return 1; }
robutest/uclinux
C++
GPL-2.0
60
/* Disables interrupt coming from the given (unique) source (AT91C_ID_xxx). */
void IRQ_DisableIT(unsigned int source)
/* Disables interrupt coming from the given (unique) source (AT91C_ID_xxx). */ void IRQ_DisableIT(unsigned int source)
{ NVIC_DisableIRQ((IRQn_Type)source); }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* param base IRTC peripheral base address param datetime Pointer to a structure where the date and time details are stored. */
void IRTC_SetDaylightTime(RTC_Type *base, const irtc_daylight_time_t *datetime)
/* param base IRTC peripheral base address param datetime Pointer to a structure where the date and time details are stored. */ void IRTC_SetDaylightTime(RTC_Type *base, const irtc_daylight_time_t *datetime)
{ assert(NULL != datetime); base->CTRL &= ~(uint16_t)RTC_CTRL_DST_EN_MASK; base->DST_MONTH = RTC_DST_MONTH_DST_START_MONTH(datetime->startMonth) | RTC_DST_MONTH_DST_END_MONTH(datetime->endMonth); base->DST_DAY = RTC_DST_DAY_DST_START_DAY(datetime->startDay) | RTC_DST_DAY_DST_END_DAY(datetime->en...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Resets the PHY using the serial gigabit media independent interface. */
static s32 igb_phy_hw_reset_sgmii_82575(struct e1000_hw *)
/* Resets the PHY using the serial gigabit media independent interface. */ static s32 igb_phy_hw_reset_sgmii_82575(struct e1000_hw *)
{ s32 ret_val; hw_dbg("Soft resetting SGMII attached PHY...\n"); ret_val = hw->phy.ops.write_reg(hw, 0x1B, 0x8084); if (ret_val) goto out; ret_val = igb_phy_sw_reset(hw); out: return ret_val; }
robutest/uclinux
C++
GPL-2.0
60
/* Directory block splitting, compacting Create map of hash values, offsets, and sizes, stored at end of block. Returns number of entries mapped. */
static int dx_make_map(struct ext3_dir_entry_2 *de, unsigned blocksize, struct dx_hash_info *hinfo, struct dx_map_entry *map_tail)
/* Directory block splitting, compacting Create map of hash values, offsets, and sizes, stored at end of block. Returns number of entries mapped. */ static int dx_make_map(struct ext3_dir_entry_2 *de, unsigned blocksize, struct dx_hash_info *hinfo, struct dx_map_entry *map_tail)
{ int count = 0; char *base = (char *) de; struct dx_hash_info h = *hinfo; while ((char *) de < base + blocksize) { if (de->name_len && de->inode) { ext3fs_dirhash(de->name, de->name_len, &h); map_tail--; map_tail->hash = h.hash; map_tail->offs = (u16) ((char *) de - base); map_tail->size = le16_t...
robutest/uclinux
C++
GPL-2.0
60
/* offset(s, n, ) -> index where n-th character counting from position 'i' starts; 0 means character at 'i'. */
static int byteoffset(lua_State *L)
/* offset(s, n, ) -> index where n-th character counting from position 'i' starts; 0 means character at 'i'. */ static int byteoffset(lua_State *L)
{ while (posi > 0 && iscont(s + posi)) posi--; } else { if (iscont(s + posi)) return luaL_error(L, "initial position is a continuation byte"); if (n < 0) { while (n < 0 && posi > 0) { do { posi--; } while (posi > 0 && iscont(s + posi)); n++; } ...
Nicholas3388/LuaNode
C++
Other
1,055
/* Writes the data to PHY register at the offset using the serial gigabit media independent interface. */
static s32 igb_write_phy_reg_sgmii_82575(struct e1000_hw *, u32, u16)
/* Writes the data to PHY register at the offset using the serial gigabit media independent interface. */ static s32 igb_write_phy_reg_sgmii_82575(struct e1000_hw *, u32, u16)
{ s32 ret_val = -E1000_ERR_PARAM; if (offset > E1000_MAX_SGMII_PHY_REG_ADDR) { hw_dbg("PHY Address %d is out of range\n", offset); goto out; } ret_val = hw->phy.ops.acquire(hw); if (ret_val) goto out; ret_val = igb_write_phy_reg_i2c(hw, offset, data); hw->phy.ops.release(hw); out: return ret_val; }
robutest/uclinux
C++
GPL-2.0
60
/* Create an 802.3 client. Note there can be only one 802.3 client */
struct datalink_proto* make_8023_client(void)
/* Create an 802.3 client. Note there can be only one 802.3 client */ struct datalink_proto* make_8023_client(void)
{ struct datalink_proto *proto = kmalloc(sizeof(*proto), GFP_ATOMIC); if (proto) { proto->header_length = 0; proto->request = p8023_request; } return proto; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Returns 1 if one or more PIO of the given Pin are configured to output a high level (even if they are not output). To get the actual value of the pin, use PIO_Get() instead. */
unsigned char PIO_GetOutputDataStatus(const Pin *pin)
/* Returns 1 if one or more PIO of the given Pin are configured to output a high level (even if they are not output). To get the actual value of the pin, use PIO_Get() instead. */ unsigned char PIO_GetOutputDataStatus(const Pin *pin)
{ if ((pin->pio->PIO_ODSR & pin->mask) == 0) { return 0; } else { return 1; } }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* EXTINT Ch.8 as BSP Key row 0 callback function. */
static void BSP_KEY_ROW0_IrqCallback(void)
/* EXTINT Ch.8 as BSP Key row 0 callback function. */ static void BSP_KEY_ROW0_IrqCallback(void)
{ uint8_t u8Idx = (uint8_t)KEYSCAN_GetKeyoutIdx(); if (SET == EXTINT_GetExtIntStatus(BSP_KEYIN_PORT_PIN[0].ch)) { for (;;) { if (PIN_RESET == GPIO_ReadInputPins(BSP_KEYIN_PORT_PIN[0].port, BSP_KEYIN_PORT_PIN[0].pin)) { m_u32GlobalKey |= (0x01UL) << u8Idx; } else {...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535