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
/* brief DMA instance 1, channel 13 IRQ handler. */
void EDMA_1_CH13_DriverIRQHandler(void)
/* brief DMA instance 1, channel 13 IRQ handler. */ void EDMA_1_CH13_DriverIRQHandler(void)
{ EDMA_DriverIRQHandler(1U, 13U); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This is SMP safe as current->tgid does not change. */
SYSCALL_DEFINE0(getpid)
/* This is SMP safe as current->tgid does not change. */ SYSCALL_DEFINE0(getpid)
{ return task_tgid_vnr(current); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Set system VDD Low-voltage level selection. This function selects the system VDD low-voltage level. Changing system VDD low-voltage level must be done after disabling the System VDD low voltage reset and interrupt. */
void SPC_SetSystemVDDLowVoltageLevel(SPC_Type *base, spc_low_voltage_level_select_t level)
/* Set system VDD Low-voltage level selection. This function selects the system VDD low-voltage level. Changing system VDD low-voltage level must be done after disabling the System VDD low voltage reset and interrupt. */ void SPC_SetSystemVDDLowVoltageLevel(SPC_Type *base, spc_low_voltage_level_select_t level)
{ uint32_t reg; reg = base->VD_SYS_CFG; base->VD_SYS_CFG &= ~(SPC_VD_SYS_CFG_LVDRE_MASK | SPC_VD_SYS_CFG_LVDIE_MASK); reg |= SPC_VD_SYS_CFG_LVSEL(level); base->VD_SYS_CFG = reg; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Configure queue statistics registers, all queues belonging to same traffic class uses a single set of queue statistics counters. */
s32 ixgbe_dcb_config_tc_stats(struct ixgbe_hw *hw)
/* Configure queue statistics registers, all queues belonging to same traffic class uses a single set of queue statistics counters. */ s32 ixgbe_dcb_config_tc_stats(struct ixgbe_hw *hw)
{ s32 ret = 0; if (hw->mac.type == ixgbe_mac_82598EB) ret = ixgbe_dcb_config_tc_stats_82598(hw); else if (hw->mac.type == ixgbe_mac_82599EB) ret = ixgbe_dcb_config_tc_stats_82599(hw); return ret; }
robutest/uclinux
C++
GPL-2.0
60
/* updates the NPE firewall operating mode and firewall address table */
IX_ETH_DB_PUBLIC IxEthDBStatus ixEthDBFirewallUpdate(IxEthDBPortId portID, void *address, UINT32 epDelta)
/* updates the NPE firewall operating mode and firewall address table */ IX_ETH_DB_PUBLIC IxEthDBStatus ixEthDBFirewallUpdate(IxEthDBPortId portID, void *address, UINT32 epDelta)
{ IxNpeMhMessage message; IX_STATUS result; UINT32 mode = 0; PortInfo *portInfo = &ixEthDBPortInfo[portID]; mode = (portInfo->srcAddressFilterEnabled != FALSE) << 1 | (portInfo->firewallMode == IX_ETH_DB_FIREWALL_WHITE_LIST); FILL_SETFIREWALLMODE_MSG(message, IX_ETH_DB_PORT_I...
EmcraftSystems/u-boot
C++
Other
181
/* Handle stings for SFO Output with escape character ^ in a string */
EFI_STRING HandleStringWithEscapeCharForParse(IN CHAR16 *String)
/* Handle stings for SFO Output with escape character ^ in a string */ EFI_STRING HandleStringWithEscapeCharForParse(IN CHAR16 *String)
{ EFI_STRING NewStr; EFI_STRING StrWalker; EFI_STRING ReturnStr; if (String == NULL) { return NULL; } NewStr = AllocateZeroPool (StrSize (String)); if (NewStr == NULL) { return NULL; } ReturnStr = NewStr; StrWalker = String; while (*StrWalker != CHAR_NULL) { if ((*StrWalker == L'^')...
tianocore/edk2
C++
Other
4,240
/* Get the extra question attribute from override question list. */
UINT32 ProcessQuestionExtraAttr(IN EFI_QUESTION_ID QuestionId)
/* Get the extra question attribute from override question list. */ UINT32 ProcessQuestionExtraAttr(IN EFI_QUESTION_ID QuestionId)
{ LIST_ENTRY *Link; QUESTION_ATTRIBUTE_OVERRIDE *QuestionDesc; if (QuestionId == 0) { return HII_DISPLAY_NONE; } Link = GetFirstNode (&mPrivateData.FormBrowserEx2.OverrideQestListHead); while (!IsNull (&mPrivateData.FormBrowserEx2.OverrideQestListHead, Link)) { QuestionDesc = FORM...
tianocore/edk2
C++
Other
4,240
/* This API initialize the auxiliary sensor in order to access it. */
int8_t bmi160_aux_init(const struct bmi160_dev *dev)
/* This API initialize the auxiliary sensor in order to access it. */ int8_t bmi160_aux_init(const struct bmi160_dev *dev)
{ int8_t rslt; rslt = null_ptr_check(dev); if (rslt != BMI160_OK) { rslt = BMI160_E_NULL_PTR; } else { if (dev->aux_cfg.aux_sensor_enable == BMI160_ENABLE) { rslt = config_aux_settg(dev); } else { rslt = BMI160_E_INVALID...
eclipse-threadx/getting-started
C++
Other
310
/* Checks whether the specified RTC interrupt has occurred or not. */
ITStatus RTC_GetITStatus(RTC_IT_TypeDef it)
/* Checks whether the specified RTC interrupt has occurred or not. */ ITStatus RTC_GetITStatus(RTC_IT_TypeDef it)
{ return (ITStatus)(RTC->CSR & it); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Lookup the device configuration based on the unique device ID. The table contains the configuration info for each device in the system. */
XEmacPs_Config* XEmacPs_LookupConfig(u16 DeviceId)
/* Lookup the device configuration based on the unique device ID. The table contains the configuration info for each device in the system. */ XEmacPs_Config* XEmacPs_LookupConfig(u16 DeviceId)
{ XEmacPs_Config *CfgPtr = NULL; u32 i; for (i = 0U; i < (u32)XPAR_XEMACPS_NUM_INSTANCES; i++) { if (XEmacPs_ConfigTable[i].DeviceId == DeviceId) { CfgPtr = &XEmacPs_ConfigTable[i]; break; } } return (XEmacPs_Config *)(CfgPtr); } /** @}
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Initial SD host controller with lowest clock frequency, max power and max timeout value at initialization. */
EFI_STATUS SdPeimHcInitHost(IN UINTN Bar)
/* Initial SD host controller with lowest clock frequency, max power and max timeout value at initialization. */ EFI_STATUS SdPeimHcInitHost(IN UINTN Bar)
{ EFI_STATUS Status; Status = SdPeimHcInitClockFreq (Bar); if (EFI_ERROR (Status)) { return Status; } Status = SdPeimHcInitPowerVoltage (Bar); if (EFI_ERROR (Status)) { return Status; } Status = SdPeimHcInitTimeoutCtrl (Bar); return Status; }
tianocore/edk2
C++
Other
4,240
/* If there is no room in the transmit FIFO, then this function will wait in a polling loop until the data can be written. */
void I2STxDataPut(unsigned long ulBase, unsigned long ulData)
/* If there is no room in the transmit FIFO, then this function will wait in a polling loop until the data can be written. */ void I2STxDataPut(unsigned long ulBase, unsigned long ulData)
{ ASSERT(ulBase == I2S0_BASE); while(HWREG(ulBase + I2S_O_TXLEV) >= 16) { } HWREG(ulBase + I2S_O_TXFIFO) = ulData; }
watterott/WebRadio
C++
null
71
/* Sets the designated bits in a 16-bit write-protected data word at the remote CPU system address */
uint16_t IPCLtoRSetBits_Protected(volatile tIpcController *psController, uint32_t ulAddress, uint32_t ulMask, uint16_t usLength, uint16_t bBlock)
/* Sets the designated bits in a 16-bit write-protected data word at the remote CPU system address */ uint16_t IPCLtoRSetBits_Protected(volatile tIpcController *psController, uint32_t ulAddress, uint32_t ulMask, uint16_t usLength, uint16_t bBlock)
{ uint16_t status; tIpcMessage sMessage; sMessage.ulcommand = IPC_SET_BITS_PROTECTED; sMessage.uladdress = ulAddress; sMessage.uldataw1 = (uint32_t)usLength; sMessage.uldataw2 = ulMask; status = IpcPut (psController, &sMessage, bBlock); return status; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Un-Register the Service B.2 and all its Characteristics... */
void service_b_2_2_remove(void)
/* Un-Register the Service B.2 and all its Characteristics... */ void service_b_2_2_remove(void)
{ bt_gatt_service_unregister(&service_b_2_2_svc); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* enable the oscillator bypass mode, HXTALEN or LXTALEN must be reset before it */
void rcu_osci_bypass_mode_enable(rcu_osci_type_enum osci)
/* enable the oscillator bypass mode, HXTALEN or LXTALEN must be reset before it */ void rcu_osci_bypass_mode_enable(rcu_osci_type_enum osci)
{ uint32_t reg; switch(osci){ case RCU_HXTAL: reg = RCU_CTL; RCU_CTL &= ~RCU_CTL_HXTALEN; RCU_CTL = (reg | RCU_CTL_HXTALBPS); break; case RCU_LXTAL: reg = RCU_BDCTL; RCU_BDCTL &= ~RCU_BDCTL_LXTALEN; RCU_BDCTL = (reg | RCU_BDCTL_LXTALBPS); b...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Check if point is inside area. This function checks if a point is inside a given area. */
bool win_is_inside_area(const struct win_area *area, const struct win_point *point)
/* Check if point is inside area. This function checks if a point is inside a given area. */ bool win_is_inside_area(const struct win_area *area, const struct win_point *point)
{ return (area->pos.x <= point->x) && (area->pos.y <= point->y) && (point->x < (area->pos.x + area->size.x)) && (point->y < (area->pos.y + area->size.y)); }
memfault/zero-to-main
C++
null
200
/* Gets the number of bits transferred per frame. */
unsigned char xSPIBitLengthGet(unsigned long ulBase)
/* Gets the number of bits transferred per frame. */ unsigned char xSPIBitLengthGet(unsigned long ulBase)
{ xASSERT((ulBase == SPI0_BASE) || (ulBase == SPI1_BASE)|| (ulBase == SPI2_BASE) || (ulBase == SPI3_BASE)); return ((xHWREG(ulBase + SPI_CNTRL) & SPI_CNTRL_TX_BIT_LEN_M) >> SPI_CNTRL_TX_BIT_LEN_S); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Returns: the data of the first element in the queue, or NULL if the queue is empty */
gpointer g_queue_peek_head(GQueue *queue)
/* Returns: the data of the first element in the queue, or NULL if the queue is empty */ gpointer g_queue_peek_head(GQueue *queue)
{ g_return_val_if_fail (queue != NULL, NULL); return queue->head ? queue->head->data : NULL; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* This function writes a data buffer in flash (data are 32-bit aligned). */
uint32_t FLASH_If_Write(__IO uint32_t *FlashAddress, uint32_t *Data, uint16_t DataLength)
/* This function writes a data buffer in flash (data are 32-bit aligned). */ uint32_t FLASH_If_Write(__IO uint32_t *FlashAddress, uint32_t *Data, uint16_t DataLength)
{ uint32_t i = 0; for (i = 0; (i < DataLength) && (*FlashAddress <= (USER_FLASH_END_ADDRESS-4)); i++) { if (HAL_FLASH_Program(FLASH_TYPEPROGRAM_WORD, *FlashAddress, *(uint32_t*)(Data+i)) == HAL_OK) { if (*(uint32_t*)*FlashAddress != *(uint32_t*)(Data+i)) { return(2); } *F...
STMicroelectronics/STM32CubeF4
C++
Other
789
/* VCP_DataRx Data received over USB OUT endpoint are sent over CDC interface through this function. */
uint16_t VCP_DataRx(uint8_t *Buf, uint32_t Len)
/* VCP_DataRx Data received over USB OUT endpoint are sent over CDC interface through this function. */ uint16_t VCP_DataRx(uint8_t *Buf, uint32_t Len)
{ TM_INT_USB_VCP_AddReceived(*(Buf + i)); } return USBD_OK; }
MaJerle/stm32f429
C++
null
2,036
/* This function assigns a default peripheral mapping for uDMA channels 20-25. This function must be called in order to prevent multiple channels from being assigned to the same peripheral by moving these channels to an encoding where they are in reserved status. */
void uDMAInit(void)
/* This function assigns a default peripheral mapping for uDMA channels 20-25. This function must be called in order to prevent multiple channels from being assigned to the same peripheral by moving these channels to an encoding where they are in reserved status. */ void uDMAInit(void)
{ uDMAChannelAssign(UDMA_CH20_RESERVED7); uDMAChannelAssign(UDMA_CH21_RESERVED7); uDMAChannelAssign(UDMA_CH22_RESERVED7); uDMAChannelAssign(UDMA_CH23_RESERVED7); uDMAChannelAssign(UDMA_CH24_RESERVED7); uDMAChannelAssign(UDMA_CH25_RESERVED7); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Registers an interrupt handler for the EPI module. */
void EPIIntRegister(unsigned long ulBase, void(*pfnHandler)(void))
/* Registers an interrupt handler for the EPI module. */ void EPIIntRegister(unsigned long ulBase, void(*pfnHandler)(void))
{ ASSERT(ulBase == EPI0_BASE); ASSERT(pfnHandler); IntRegister(INT_EPI0, pfnHandler); IntEnable(INT_EPI0); }
watterott/WebRadio
C++
null
71
/* If the allocation of the new buffer is successful and the smaller of NewSize and OldSize is greater than (MAX_ADDRESS - OldBuffer + 1), then ASSERT(). */
VOID* EFIAPI ReallocatePool(IN UINTN OldSize, IN UINTN NewSize, IN VOID *OldBuffer OPTIONAL)
/* If the allocation of the new buffer is successful and the smaller of NewSize and OldSize is greater than (MAX_ADDRESS - OldBuffer + 1), then ASSERT(). */ VOID* EFIAPI ReallocatePool(IN UINTN OldSize, IN UINTN NewSize, IN VOID *OldBuffer OPTIONAL)
{ VOID *NewBuffer; NewBuffer = AllocatePool (NewSize); if (NewBuffer == NULL) { return NULL; } if (OldBuffer != NULL) { if (OldSize > 0) { CopyMem (NewBuffer, OldBuffer, OldSize); } FreePool (OldBuffer); } return NewBuffer; }
tianocore/edk2
C++
Other
4,240
/* Returns: -ENODEV if no register could be found */
static int speedstep_find_register(void)
/* Returns: -ENODEV if no register could be found */ static int speedstep_find_register(void)
{ if (!speedstep_chipset_dev) return -ENODEV; pci_read_config_dword(speedstep_chipset_dev, 0x40, &pmbase); if (!(pmbase & 0x01)) { printk(KERN_ERR "speedstep-ich: could not find speedstep register\n"); return -ENODEV; } pmbase &= 0xFFFFFFFE; if (!pmbase) { printk(KERN_ERR "speedstep-ich: could not find sp...
EmcraftSystems/linux-emcraft
C++
Other
266
/* Initializes the DAC peripheral according to the specified parameters in the DAC_InitStruct. */
void DAC_Init(uint32_t DAC_Channel, DAC_InitType *DAC_InitStruct)
/* Initializes the DAC peripheral according to the specified parameters in the DAC_InitStruct. */ void DAC_Init(uint32_t DAC_Channel, DAC_InitType *DAC_InitStruct)
{ uint32_t tmpreg1 = 0, tmpreg2 = 0; assert_param(IS_DAC_TRIGGER(DAC_InitStruct->Trigger)); assert_param(IS_DAC_GENERATE_WAVE(DAC_InitStruct->WaveGen)); assert_param(IS_DAC_LFSR_UNMASK_TRIANGLE_AMPLITUDE(DAC_InitStruct->LfsrUnMaskTriAmp)); assert_param(IS_DAC_OUTPUT_BUFFER_STATE(DAC_InitStruct->Buff...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). If StartBit is greater than 15, then ASSERT(). If EndBit is greater than 15, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If OrData is larger than the bitmask value range specified by StartBit and...
UINT16 EFIAPI S3PciBitFieldOr16(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT16 OrData)
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). If StartBit is greater than 15, then ASSERT(). If EndBit is greater than 15, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If OrData is larger than the bitmask value range specified by StartBit and...
{ return InternalSavePciWrite16ValueToBootScript (Address, PciBitFieldOr16 (Address, StartBit, EndBit, OrData)); }
tianocore/edk2
C++
Other
4,240
/* Attempts to configure interrupts using the best available capabilities of the hardware and kernel. */
static int igbvf_request_irq(struct igbvf_adapter *adapter)
/* Attempts to configure interrupts using the best available capabilities of the hardware and kernel. */ static int igbvf_request_irq(struct igbvf_adapter *adapter)
{ int err = -1; if (adapter->msix_entries) err = igbvf_request_msix(adapter); if (!err) return err; dev_err(&adapter->pdev->dev, "Unable to allocate interrupt, Error: %d\n", err); return err; }
robutest/uclinux
C++
GPL-2.0
60
/* USB Device Connect Function Called by the User to Connect/Disconnect USB Device Parameters: con: Connect/Disconnect Return Value: None */
void USBD_Connect(BOOL con)
/* USB Device Connect Function Called by the User to Connect/Disconnect USB Device Parameters: con: Connect/Disconnect Return Value: None */ void USBD_Connect(BOOL con)
{ if (con) { HSUSBD_CLR_SE0(); } else { HSUSBD_SET_SE0(); } }
ARMmbed/DAPLink
C++
Apache License 2.0
2,140
/* Adjusts the Internal High Speed 48 oscillator (HSI 48) calibration value. */
void CRS_FrequencyErrorCounterReloadValue(uint16_t reloadVal)
/* Adjusts the Internal High Speed 48 oscillator (HSI 48) calibration value. */ void CRS_FrequencyErrorCounterReloadValue(uint16_t reloadVal)
{ CRS->CFG_B.RLDVAL = reloadVal; }
pikasTech/PikaPython
C++
MIT License
1,403
/* Send the interrupt coalescing parameter set by ethtool to the card. */
int netxen_config_intr_coalesce(struct netxen_adapter *adapter)
/* Send the interrupt coalescing parameter set by ethtool to the card. */ int netxen_config_intr_coalesce(struct netxen_adapter *adapter)
{ nx_nic_req_t req; u64 word; int rv; memset(&req, 0, sizeof(nx_nic_req_t)); req.qhdr = cpu_to_le64(NX_HOST_REQUEST << 23); word = NETXEN_CONFIG_INTR_COALESCE | ((u64)adapter->portnum << 16); req.req_hdr = cpu_to_le64(word); memcpy(&req.words[0], &adapter->coal, sizeof(adapter->coal)); rv = netxen_send_cmd_des...
robutest/uclinux
C++
GPL-2.0
60
/* ISR handler for a specific vector index in the interrupt vector table for linking the actual interrupts vectors to the one in the user program's vector table. */
void Vector30_handler(void)
/* ISR handler for a specific vector index in the interrupt vector table for linking the actual interrupts vectors to the one in the user program's vector table. */ void Vector30_handler(void)
{ asm { LDX(VCT_USER_PROGRAM_VECTOR_TABLE_STARTADDR + (30 * 2)) JMP 0,X } }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Function used by an Ethernet Switch driver to set the functions that must be called by the parser when an ethsw command is given */
int ethsw_define_functions(const struct ethsw_command_func *cmd_func)
/* Function used by an Ethernet Switch driver to set the functions that must be called by the parser when an ethsw command is given */ int ethsw_define_functions(const struct ethsw_command_func *cmd_func)
{ int i; void **aux_p; int (*cmd_func_aux)(struct ethsw_command_def *); if (!cmd_func->ethsw_name) return -EINVAL; ethsw_name = cmd_func->ethsw_name; for (i = 0; i < ARRAY_SIZE(ethsw_cmd_def); i++) { if (ethsw_cmd_def[i].keyword_function) continue; aux_p = (void *)cmd_func + ethsw_cmd_def[i].cmd_func_off...
4ms/stm32mp1-baremetal
C++
Other
137
/* Event handler for the library USB Control Request reception event. */
void EVENT_USB_Device_ControlRequest(void)
/* Event handler for the library USB Control Request reception event. */ void EVENT_USB_Device_ControlRequest(void)
{ CCID_Device_ProcessControlRequest(&CCID_Interface); }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* list_splice - join two lists, this is designed for stacks @list: the new list to add. @head: the place to add it in the first list. */
static void list_splice(const struct list_head *list, struct list_head *head)
/* list_splice - join two lists, this is designed for stacks @list: the new list to add. @head: the place to add it in the first list. */ static void list_splice(const struct list_head *list, struct list_head *head)
{ if (!list_empty(list)) __list_splice(list, head, head->next); }
robutest/uclinux
C++
GPL-2.0
60
/* memory_bm_free - free memory occupied by the memory bitmap @bm */
static void memory_bm_free(struct memory_bitmap *bm, int clear_nosave_free)
/* memory_bm_free - free memory occupied by the memory bitmap @bm */ static void memory_bm_free(struct memory_bitmap *bm, int clear_nosave_free)
{ struct bm_block *bb; list_for_each_entry(bb, &bm->blocks, hook) if (bb->data) free_image_page(bb->data, clear_nosave_free); free_list_of_pages(bm->p_list, clear_nosave_free); INIT_LIST_HEAD(&bm->blocks); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Retrieve the amount of cycles to delay for the given amount of us. */
uint32_t _get_cycles_for_us(const uint16_t us)
/* Retrieve the amount of cycles to delay for the given amount of us. */ uint32_t _get_cycles_for_us(const uint16_t us)
{ return _get_cycles_for_us_internal(us, CONF_CPU_FREQUENCY, CPU_FREQ_POWER); }
eclipse-threadx/getting-started
C++
Other
310
/* This function is used to Wait until DMA operation completes. */
int tls_dma_wait_complt(unsigned char ch)
/* This function is used to Wait until DMA operation completes. */ int tls_dma_wait_complt(unsigned char ch)
{ unsigned long timeout = 0; while(DMA_CHNLCTRL_REG(ch) & DMA_CHNL_CTRL_CHNL_ON) { tls_os_time_delay(1); timeout ++; if(timeout > 500) return -1; } return 0; }
Nicholas3388/LuaNode
C++
Other
1,055
/* Specify the number of exact address filters that should be reserved for unicast addresses. Caller should reload the unicast and multicast addresses after calling this. */
int t3_mac_set_num_ucast(struct cmac *mac, int n)
/* Specify the number of exact address filters that should be reserved for unicast addresses. Caller should reload the unicast and multicast addresses after calling this. */ int t3_mac_set_num_ucast(struct cmac *mac, int n)
{ if (n > EXACT_ADDR_FILTERS) return -EINVAL; mac->nucast = n; return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* See mss_uart.h for details of how to use this function. */
void MSS_UART_disable_rx_timeout(mss_uart_instance_t *this_uart)
/* See mss_uart.h for details of how to use this function. */ void MSS_UART_disable_rx_timeout(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,ERTO); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Add memory segment to the segment list if it doesn't overlap with an already present segment. */
static int insert_memory_segment(struct memory_segment *seg)
/* Add memory segment to the segment list if it doesn't overlap with an already present segment. */ static int insert_memory_segment(struct memory_segment *seg)
{ struct memory_segment *tmp; if (seg->start + seg->size > VMEM_MAX_PHYS || seg->start + seg->size < seg->start) return -ERANGE; list_for_each_entry(tmp, &mem_segs, list) { if (seg->start >= tmp->start + tmp->size) continue; if (seg->start + seg->size <= tmp->start) continue; return -ENOSPC; } l...
EmcraftSystems/linux-emcraft
C++
Other
266
/* Sends SD switch function CMD6. See table 4-32 in SD physical specification for argument details. When setting a function, we should set the 4 bit block of the command argument corresponding to that function to "value", and all other 4 bit blocks should be left as 0xF (no effect on current function) */
static int sdmmc_switch(struct sd_card *card, enum sd_switch_arg mode, enum sd_group_num group, uint8_t value, uint8_t *response)
/* Sends SD switch function CMD6. See table 4-32 in SD physical specification for argument details. When setting a function, we should set the 4 bit block of the command argument corresponding to that function to "value", and all other 4 bit blocks should be left as 0xF (no effect on current function) */ static int sd...
{ struct sdhc_command cmd = {0}; struct sdhc_data data = {0}; cmd.opcode = SD_SWITCH; cmd.arg = ((mode & 0x1) << 31) | 0x00FFFFFF; cmd.arg &= ~(0xFU << (group * 4)); cmd.arg |= (value & 0xF) << (group * 4); cmd.response_type = (SD_RSP_TYPE_R1 | SD_SPI_RSP_TYPE_R1); cmd.timeout_ms = CONFIG_SD_CMD_TIMEOUT; data....
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Get number of memory blocks used in a Memory Pool. */
uint32_t osMemoryPoolGetCount(osMemoryPoolId_t mp_id)
/* Get number of memory blocks used in a Memory Pool. */ uint32_t osMemoryPoolGetCount(osMemoryPoolId_t mp_id)
{ struct cv2_mslab *mslab = (struct cv2_mslab *)mp_id; if (mslab == NULL) { return 0; } else { return k_mem_slab_num_used_get(&mslab->z_mslab); } }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* The destructor function frees any allocated buffers and closes the Set Virtual Address Map event. */
EFI_STATUS EFIAPI DxeRuntimePciSegmentLibDestructor(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
/* The destructor function frees any allocated buffers and closes the Set Virtual Address Map event. */ EFI_STATUS EFIAPI DxeRuntimePciSegmentLibDestructor(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
{ EFI_STATUS Status; if (mDxeRuntimePciSegmentLibRegistrationTable != NULL) { FreePool (mDxeRuntimePciSegmentLibRegistrationTable); } Status = gBS->CloseEvent (mDxeRuntimePciSegmentLibVirtualNotifyEvent); ASSERT_EFI_ERROR (Status); return Status; }
tianocore/edk2
C++
Other
4,240
/* Writes a 16/32-bit data word to a write-protected remote CPU system address */
uint16_t IPCLtoRDataWrite_Protected(volatile tIpcController *psController, uint32_t ulAddress, uint32_t ulData, uint16_t usLength, uint16_t bBlock, uint32_t ulResponseFlag)
/* Writes a 16/32-bit data word to a write-protected remote CPU system address */ uint16_t IPCLtoRDataWrite_Protected(volatile tIpcController *psController, uint32_t ulAddress, uint32_t ulData, uint16_t usLength, uint16_t bBlock, uint32_t ulResponseFlag)
{ uint16_t status; tIpcMessage sMessage; sMessage.ulcommand = IPC_DATA_WRITE_PROTECTED; sMessage.uladdress = ulAddress; sMessage.uldataw1 = ulResponseFlag |(uint32_t)usLength; sMessage.uldataw2 = ulData; status = IpcPut (psController, &sMessage, bBlock); return status; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Advance from the current 1-byte tag/1-byte length/variable-length value triple, to the next, returning a pointer to the next. If the current or next TLV is invalid (does not fit in given buffer length), NULL is returned. *buflen is not modified if the TLV elt parameter is invalid, or is decremented by the TLV parame...
bcm_tlv_t* bcm_next_tlv(bcm_tlv_t *elt, int *buflen)
/* Advance from the current 1-byte tag/1-byte length/variable-length value triple, to the next, returning a pointer to the next. If the current or next TLV is invalid (does not fit in given buffer length), NULL is returned. *buflen is not modified if the TLV elt parameter is invalid, or is decremented by the TLV parame...
{ int len; if (!bcm_valid_tlv(elt, *buflen)) return NULL; len = elt->len; elt = (bcm_tlv_t*)(elt->data + len); *buflen -= (TLV_HDR_LEN + len); if (!bcm_valid_tlv(elt, *buflen)) return NULL; return elt; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* If 64-bit I/O port operations are not supported, then ASSERT(). If Port is not aligned on a 64-bit boundary, then ASSERT(). If StartBit is greater than 63, then ASSERT(). If EndBit is greater than 63, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If AndData is larger than the bitmask value range spe...
UINT64 EFIAPI IoBitFieldAnd64(IN UINTN Port, IN UINTN StartBit, IN UINTN EndBit, IN UINT64 AndData)
/* If 64-bit I/O port operations are not supported, then ASSERT(). If Port is not aligned on a 64-bit boundary, then ASSERT(). If StartBit is greater than 63, then ASSERT(). If EndBit is greater than 63, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If AndData is larger than the bitmask value range spe...
{ return IoWrite64 ( Port, BitFieldAnd64 (IoRead64 (Port), StartBit, EndBit, AndData) ); }
tianocore/edk2
C++
Other
4,240
/* Enables the Reset state on the USB line. */
void ohci_bus_reset(void)
/* Enables the Reset state on the USB line. */ void ohci_bus_reset(void)
{ Assert(!(OHCI->HcRhPortStatus & RH_PS_CCS)); OHCI->HcRhPortStatus = RH_PS_PRS; while (OHCI->HcRhPortStatus & RH_PS_PRS); delay_ms(100); OHCI->HcRhPortStatus = RH_PS_PRSC; bus_reset_flag = true; }
remotemcu/remcu-chip-sdks
C++
null
436
/* Write data to a given memory address and length. */
static int gdb_mem_write(const uint8_t *buf, uintptr_t addr, size_t len)
/* Write data to a given memory address and length. */ static int gdb_mem_write(const uint8_t *buf, uintptr_t addr, size_t len)
{ uint8_t align; int ret; if (!gdb_mem_can_write(addr, len, &align)) { ret = -1; goto out; } if (align > 1) { ret = gdb_mem_write_aligned(buf, addr, len, align); } else { ret = gdb_mem_write_unaligned(buf, addr, len); } out: return ret; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Send channel number (i.e., switch to a different sound). */
int line6_send_program(struct usb_line6 *line6, int value)
/* Send channel number (i.e., switch to a different sound). */ int line6_send_program(struct usb_line6 *line6, int value)
{ unsigned char *buffer; size_t len = 2; buffer = kmalloc(len, GFP_KERNEL); if (!buffer) { dev_err(line6->ifcdev, "out of memory\n"); return -ENOMEM; } buffer[0] = LINE6_PROGRAM_CHANGE | LINE6_CHANNEL_HOST; buffer[1] = value; return line6_send(line6, buffer, len); }
robutest/uclinux
C++
GPL-2.0
60
/* This function will set network interface device DNS server address. */
int netdev_set_dns_server(struct netdev *netdev, uint8_t dns_num, const ip_addr_t *dns_server)
/* This function will set network interface device DNS server address. */ int netdev_set_dns_server(struct netdev *netdev, uint8_t dns_num, const ip_addr_t *dns_server)
{ ASSERT(netdev); ASSERT(dns_server); if (dns_num >= NETDEV_DNS_SERVERS_NUM) { LOGE(TAG, "The number of DNS servers(%d) set exceeds the maximum number(%d).", dns_num + 1, NETDEV_DNS_SERVERS_NUM); return -1; } if (!netdev->ops || !netdev->ops->set_dns_server) { LOGE(TA...
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* LCS detect function setup channels and make them I/O ready */
static int lcs_detect(struct lcs_card *card)
/* LCS detect function setup channels and make them I/O ready */ static int lcs_detect(struct lcs_card *card)
{ int rc = 0; LCS_DBF_TEXT(2, setup, "lcsdetct"); if (card->dev) netif_stop_queue(card->dev); rc = lcs_stop_channels(card); if (rc == 0) { rc = lcs_start_channels(card); if (rc == 0) { rc = lcs_send_startup(card, LCS_INITIATOR_TCPIP); if (rc == 0) rc = lcs_startlan(card); } } if (rc == 0) { c...
robutest/uclinux
C++
GPL-2.0
60
/* initialise some of the unit hardware before gdbstub is set up */
asmlinkage void __init unit_init(void)
/* initialise some of the unit hardware before gdbstub is set up */ asmlinkage void __init unit_init(void)
{ SET_XIRQ_TRIGGER(0, XIRQ_TRIGGER_HILEVEL); SET_XIRQ_TRIGGER(2, XIRQ_TRIGGER_LOWLEVEL); SET_XIRQ_TRIGGER(3, XIRQ_TRIGGER_HILEVEL); SET_XIRQ_TRIGGER(4, XIRQ_TRIGGER_LOWLEVEL); SET_XIRQ_TRIGGER(5, XIRQ_TRIGGER_LOWLEVEL); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* If Cert is NULL, then return FALSE. If SingleX509Cert is NULL, then return FALSE. If this interface is not supported, then return FALSE. */
BOOLEAN EFIAPI CryptoServiceX509ConstructCertificate(IN CONST UINT8 *Cert, IN UINTN CertSize, OUT UINT8 **SingleX509Cert)
/* If Cert is NULL, then return FALSE. If SingleX509Cert is NULL, then return FALSE. If this interface is not supported, then return FALSE. */ BOOLEAN EFIAPI CryptoServiceX509ConstructCertificate(IN CONST UINT8 *Cert, IN UINTN CertSize, OUT UINT8 **SingleX509Cert)
{ return CALL_BASECRYPTLIB (X509.Services.ConstructCertificate, X509ConstructCertificate, (Cert, CertSize, SingleX509Cert), FALSE); }
tianocore/edk2
C++
Other
4,240
/* The key difference that _exclusive makes it that userspace is explicitly not allowed to map the resource via /dev/mem or sysfs. */
int pci_request_region_exclusive(struct pci_dev *pdev, int bar, const char *res_name)
/* The key difference that _exclusive makes it that userspace is explicitly not allowed to map the resource via /dev/mem or sysfs. */ int pci_request_region_exclusive(struct pci_dev *pdev, int bar, const char *res_name)
{ return __pci_request_region(pdev, bar, res_name, IORESOURCE_EXCLUSIVE); }
robutest/uclinux
C++
GPL-2.0
60
/* This function tries to make a free PEB by means of synchronous execution of pending works. This may be needed if, for example the background thread is disabled. Returns zero in case of success and a negative error code in case of failure. */
static int produce_free_peb(struct ubi_device *ubi)
/* This function tries to make a free PEB by means of synchronous execution of pending works. This may be needed if, for example the background thread is disabled. Returns zero in case of success and a negative error code in case of failure. */ static int produce_free_peb(struct ubi_device *ubi)
{ int err; while (!ubi->free.rb_node && ubi->works_count) { dbg_wl("do one work synchronously"); err = do_work(ubi); if (err) return err; } return 0; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Get low frequency RC oscillator clock frequency for target system. */
uint32_t SystemLFRCOClockGet(void)
/* Get low frequency RC oscillator clock frequency for target system. */ uint32_t SystemLFRCOClockGet(void)
{ return EFM32_LFRCO_FREQ; }
remotemcu/remcu-chip-sdks
C++
null
436
/* Returns the last data output value of the selected DAC channel. */
uint16_t DAC_GetDataOutputValue(DAC_TypeDef *DACx, uint32_t DAC_Channel)
/* Returns the last data output value of the selected DAC channel. */ uint16_t DAC_GetDataOutputValue(DAC_TypeDef *DACx, uint32_t DAC_Channel)
{ __IO uint32_t tmp = 0; assert_param(IS_DAC_ALL_PERIPH(DACx)); assert_param(IS_DAC_CHANNEL(DAC_Channel)); tmp = (uint32_t) DACx; tmp += DOR_OFFSET + ((uint32_t)DAC_Channel >> 2); return (uint16_t) (*(__IO uint32_t*) tmp); }
avem-labs/Avem
C++
MIT License
1,752
/* Returns: the element, or NULL if the position is off the end of the #GList */
GList* g_list_nth_prev(GList *list, guint n)
/* Returns: the element, or NULL if the position is off the end of the #GList */ GList* g_list_nth_prev(GList *list, guint n)
{ while ((n-- > 0) && list) list = list->prev; return list; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Reads the AP information from the Scan Result list with the given index, the response received in wifi_cb M2M_WIFI_RESP_SCAN_RESULT, the response pointer should be casted with tstrM2mWifiscanResult structure */
NMI_API sint8 m2m_wifi_req_scan_result(uint8 index)
/* Reads the AP information from the Scan Result list with the given index, the response received in wifi_cb M2M_WIFI_RESP_SCAN_RESULT, the response pointer should be casted with tstrM2mWifiscanResult structure */ NMI_API sint8 m2m_wifi_req_scan_result(uint8 index)
{ sint8 ret = M2M_SUCCESS; tstrM2mReqScanResult strReqScanRlt; strReqScanRlt.u8Index = index; ret = hif_send(M2M_REQ_GROUP_WIFI, M2M_WIFI_REQ_SCAN_RESULT, (uint8*) &strReqScanRlt, sizeof(tstrM2mReqScanResult), NULL, 0, 0); return ret; }
remotemcu/remcu-chip-sdks
C++
null
436
/* This file is part of the Simba project. */
int board_pin_string_to_device_index(const char *str_p)
/* This file is part of the Simba project. */ int board_pin_string_to_device_index(const char *str_p)
{ long pin; if (tolower((int)str_p[0]) == 'd') { if (std_strtol(&str_p[1], &pin) == NULL) { return (-ENODEV); } if ((pin < 2) || (pin > 13)) { return (-ENODEV); } } else if (tolower((int)str_p[0]) == 'a') { if (std_strtol(&str_p[1], &pin) == NU...
eerimoq/simba
C++
Other
337
/* Map virtual memory address for DMA. This field can be set to zero if there is no mapping service. */
UINTN MapIt(IN NIC_DATA *Nic, IN UINT64 MemAddr, IN UINT32 Size, IN UINT32 Direction, OUT UINT64 MappedAddr)
/* Map virtual memory address for DMA. This field can be set to zero if there is no mapping service. */ UINTN MapIt(IN NIC_DATA *Nic, IN UINT64 MemAddr, IN UINT32 Size, IN UINT32 Direction, OUT UINT64 MappedAddr)
{ UINT64 *PhyAddr; PhyAddr = (UINT64 *)(UINTN)MappedAddr; if (Nic->PxeStart.Map_Mem == 0) { *PhyAddr = MemAddr; } else { ((void (*)(UINT64, UINT64, UINT32, UINT32, UINT64))(UINTN) Nic->PxeStart.Map_Mem)( Nic->PxeStart.Unique_ID, MemAddr, Size, Direction, MappedAddr ); } return PXE_STATC...
tianocore/edk2
C++
Other
4,240
/* The timer routine will simply return once we set FIP_ST_DISABLED. This guarantees that no further timeouts or work will be scheduled. */
void fcoe_ctlr_destroy(struct fcoe_ctlr *fip)
/* The timer routine will simply return once we set FIP_ST_DISABLED. This guarantees that no further timeouts or work will be scheduled. */ void fcoe_ctlr_destroy(struct fcoe_ctlr *fip)
{ cancel_work_sync(&fip->recv_work); skb_queue_purge(&fip->fip_recv_list); spin_lock_bh(&fip->lock); fip->state = FIP_ST_DISABLED; fcoe_ctlr_reset_fcfs(fip); spin_unlock_bh(&fip->lock); del_timer_sync(&fip->timer); cancel_work_sync(&fip->link_work); }
robutest/uclinux
C++
GPL-2.0
60
/* Indicates external trigger valid edge interrupt (EXTTRIGIE) is enabled. @rmtoll IER EXTTRIGIE LPTIM_IsEnabledIT_EXTTRIG. */
uint32_t LPTIM_IsEnabledIT_EXTTRIG(LPTIM_Module *LPTIMx)
/* Indicates external trigger valid edge interrupt (EXTTRIGIE) is enabled. @rmtoll IER EXTTRIGIE LPTIM_IsEnabledIT_EXTTRIG. */ uint32_t LPTIM_IsEnabledIT_EXTTRIG(LPTIM_Module *LPTIMx)
{ return (((READ_BIT(LPTIMx->INTEN, LPTIM_INTEN_EXTRIGIE) == LPTIM_INTEN_EXTRIGIE)? 1UL : 0UL)); }
pikasTech/PikaPython
C++
MIT License
1,403
/* Called from the receive_buf path so single threaded. */
static void n_tty_receive_break(struct tty_struct *tty)
/* Called from the receive_buf path so single threaded. */ static void n_tty_receive_break(struct tty_struct *tty)
{ if (I_IGNBRK(tty)) return; if (I_BRKINT(tty)) { isig(SIGINT, tty, 1); return; } if (I_PARMRK(tty)) { put_tty_queue('\377', tty); put_tty_queue('\0', tty); } put_tty_queue('\0', tty); wake_up_interruptible(&tty->read_wait); }
robutest/uclinux
C++
GPL-2.0
60
/* is_kernel is needed because on some architectures you cannot tell if you are in kernel or user space simply by looking at pc. We tag this in the buffer by generating kernel enter/exit events whenever is_kernel changes */
static int log_sample(struct oprofile_cpu_buffer *cpu_buf, unsigned long pc, unsigned long backtrace, int is_kernel, unsigned long event)
/* is_kernel is needed because on some architectures you cannot tell if you are in kernel or user space simply by looking at pc. We tag this in the buffer by generating kernel enter/exit events whenever is_kernel changes */ static int log_sample(struct oprofile_cpu_buffer *cpu_buf, unsigned long pc, unsigned long back...
{ cpu_buf->sample_received++; if (pc == ESCAPE_CODE) { cpu_buf->sample_invalid_eip++; return 0; } if (op_add_code(cpu_buf, backtrace, is_kernel, current)) goto fail; if (op_add_sample(cpu_buf, pc, event)) goto fail; return 1; fail: cpu_buf->sample_lost_overflow++; return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Return a pointer to a free buffer within xEthernetBuffers. */
static unsigned char * prvGetNextBuffer(void)
/* Return a pointer to a free buffer within xEthernetBuffers. */ static unsigned char * prvGetNextBuffer(void)
{ long x; unsigned char *pucReturn = NULL; unsigned long ulAttempts = 0; while( pucReturn == NULL ) { for( x = 0; x < emacNUM_BUFFERS; x++ ) { if( ucBufferInUse[ x ] == pdFALSE ) { ucBufferInUse[ x ] = pdTRUE; pucReturn = ( unsigned char * ) &( xEthernetBuffers[ x ][ 0 ] ); break; } } if(...
apopple/Pandaboard-FreeRTOS
C++
null
25
/* Obtain the mutex p. If successful, return SQLITE_OK. Otherwise, if another thread holds the mutex and it cannot be obtained, return SQLITE_BUSY. */
SQLITE_API int sqlite3_mutex_try(sqlite3_mutex *)
/* Obtain the mutex p. If successful, return SQLITE_OK. Otherwise, if another thread holds the mutex and it cannot be obtained, return SQLITE_BUSY. */ SQLITE_API int sqlite3_mutex_try(sqlite3_mutex *)
{ int rc = SQLITE_OK; if( p ){ return sqlite3GlobalConfig.mutex.xMutexTry(p); } return rc; }
DC-SWAT/DreamShell
C++
null
404
/* Please refer to the official documentation for function purpose and expected parameters. */
int ph7_value_is_object(ph7_value *pVal)
/* Please refer to the official documentation for function purpose and expected parameters. */ int ph7_value_is_object(ph7_value *pVal)
{ return (pVal->iFlags & MEMOBJ_HASHMAP) ? TRUE : FALSE; }
pikasTech/PikaPython
C++
MIT License
1,403
/* Remark: we just assume it is correct board here! */
int checkboard(void)
/* Remark: we just assume it is correct board here! */ int checkboard(void)
{ printf("BOARD: Cogent CSB472\n"); return 0; }
EmcraftSystems/u-boot
C++
Other
181
/* This function returns with the FV erase polarity. If the erase polarity for a bit is 1, the function return TRUE. */
EFI_STATUS GetErasePolarity(OUT BOOLEAN *ErasePolarity)
/* This function returns with the FV erase polarity. If the erase polarity for a bit is 1, the function return TRUE. */ EFI_STATUS GetErasePolarity(OUT BOOLEAN *ErasePolarity)
{ EFI_STATUS Status; if (mFvHeader == NULL || mFvLength == 0) { return EFI_ABORTED; } Status = VerifyFv (mFvHeader); if (EFI_ERROR (Status)) { return EFI_ABORTED; } if (ErasePolarity == NULL) { return EFI_INVALID_PARAMETER; } if (mFvHeader->Attributes & EFI_FVB2_ERASE_POLARITY) { *Era...
tianocore/edk2
C++
Other
4,240
/* Send netlink message and check & extend header values as needed. */
int nl_send_auto_complete(struct nl_sock *sk, struct nl_msg *msg)
/* Send netlink message and check & extend header values as needed. */ int nl_send_auto_complete(struct nl_sock *sk, struct nl_msg *msg)
{ struct nl_cb *cb = sk->s_cb; nl_auto_complete(sk, msg); if (cb->cb_send_ow) return cb->cb_send_ow(sk, msg); else return nl_send(sk, msg); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* This routine reads and masks, as appropriate, all the relevant status registers that deal with ibm,sdram-4xx-ddr2 ECC errors. While we read all of them, for correctable errors, we only expect to deal with ECCES. For uncorrectable errors, we expect to deal with all of them. */
static void ppc4xx_ecc_get_status(const struct mem_ctl_info *mci, struct ppc4xx_ecc_status *status)
/* This routine reads and masks, as appropriate, all the relevant status registers that deal with ibm,sdram-4xx-ddr2 ECC errors. While we read all of them, for correctable errors, we only expect to deal with ECCES. For uncorrectable errors, we expect to deal with all of them. */ static void ppc4xx_ecc_get_status(const...
{ const struct ppc4xx_edac_pdata *pdata = mci->pvt_info; const dcr_host_t *dcr_host = &pdata->dcr_host; status->ecces = mfsdram(dcr_host, SDRAM_ECCES) & SDRAM_ECCES_MASK; status->wmirq = mfsdram(dcr_host, SDRAM_WMIRQ) & SDRAM_WMIRQ_MASK; status->besr = mfsdram(dcr_host, SDRAM_BESR) & SDRAM_BESR_MASK; status->be...
robutest/uclinux
C++
GPL-2.0
60
/* PM support is not complete. Turn it off. */
static void aaci_ac97_select_codec(struct aaci *aaci, struct snd_ac97 *ac97)
/* PM support is not complete. Turn it off. */ static void aaci_ac97_select_codec(struct aaci *aaci, struct snd_ac97 *ac97)
{ u32 v, maincr = aaci->maincr | MAINCR_SCRA(ac97->num); v = readl(aaci->base + AACI_SLFR); if (v & SLFR_2RXV) readl(aaci->base + AACI_SL2RX); if (v & SLFR_1RXV) readl(aaci->base + AACI_SL1RX); writel(maincr, aaci->base + AACI_MAINCR); }
robutest/uclinux
C++
GPL-2.0
60
/* ADC MSP Initialization This function configures the hardware resources used in this example. */
void HAL_ADC_MspInit(ADC_HandleTypeDef *hadc)
/* ADC MSP Initialization This function configures the hardware resources used in this example. */ void HAL_ADC_MspInit(ADC_HandleTypeDef *hadc)
{ GPIO_InitTypeDef GPIO_InitStruct = {0}; if(hadc->Instance==ADC1) { __HAL_RCC_ADC1_CLK_ENABLE(); __HAL_RCC_GPIOC_CLK_ENABLE(); GPIO_InitStruct.Pin = GPIO_PIN_0|GPIO_PIN_3; GPIO_InitStruct.Mode = GPIO_MODE_ANALOG; GPIO_InitStruct.Pull = GPIO_NOPULL; HAL_GPIO_Init(GPIOC, &GPIO_InitStruct); ...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Output: void, but we will add to proto tree if !NULL. */
void isis_dissect_hostname_clv(tvbuff_t *tvb, proto_tree *tree, int offset, int length, int tree_id)
/* Output: void, but we will add to proto tree if !NULL. */ void isis_dissect_hostname_clv(tvbuff_t *tvb, proto_tree *tree, int offset, int length, int tree_id)
{ proto_item* ti = proto_tree_add_item( tree, tree_id, tvb, offset, length, ENC_ASCII|ENC_NA); if ( length == 0 ) { proto_item_append_text(ti, "--none--" ); } }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Written by Sven Verdoolaege, K.U.Leuven, Departement Computerwetenschappen, Celestijnenlaan 200A, B-3001 Leuven, Belgium */
uint32_t isl_hash_string(uint32_t hash, const char *s)
/* Written by Sven Verdoolaege, K.U.Leuven, Departement Computerwetenschappen, Celestijnenlaan 200A, B-3001 Leuven, Belgium */ uint32_t isl_hash_string(uint32_t hash, const char *s)
{ for (; *s; s++) isl_hash_byte(hash, *s); return hash; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* If this interface is not supported, then return FALSE. */
STATIC BOOLEAN HmacMdAll(IN mbedtls_md_type_t MdType, IN CONST VOID *Data, IN UINTN DataSize, IN CONST UINT8 *Key, IN UINTN KeySize, OUT UINT8 *HmacValue)
/* If this interface is not supported, then return FALSE. */ STATIC BOOLEAN HmacMdAll(IN mbedtls_md_type_t MdType, IN CONST VOID *Data, IN UINTN DataSize, IN CONST UINT8 *Key, IN UINTN KeySize, OUT UINT8 *HmacValue)
{ const mbedtls_md_info_t *md_info; INT32 Ret; md_info = mbedtls_md_info_from_type (MdType); ASSERT (md_info != NULL); Ret = mbedtls_md_hmac (md_info, Key, KeySize, Data, DataSize, HmacValue); if (Ret != 0) { return FALSE; } return TRUE; }
tianocore/edk2
C++
Other
4,240
/* SPI MSP Initialization This function configures the hardware resources used in this example. */
void HAL_SPI_MspInit(SPI_HandleTypeDef *hspi)
/* SPI MSP Initialization This function configures the hardware resources used in this example. */ void HAL_SPI_MspInit(SPI_HandleTypeDef *hspi)
{ GPIO_InitTypeDef GPIO_InitStruct = {0}; if(hspi->Instance==SPI1) { __HAL_RCC_SPI1_CLK_ENABLE(); __HAL_RCC_GPIOA_CLK_ENABLE(); GPIO_InitStruct.Pin = SPI1_SCK_Pin|SPI1_MISO_Pin|SPI1_MOSI_Pin; GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Speed ...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* The leaf data grows from end-to-front in the node. this returns the address of the start of the last item, which is the stop of the leaf data stack */
static unsigned int leaf_data_end(struct btrfs_root *root, struct extent_buffer *leaf)
/* The leaf data grows from end-to-front in the node. this returns the address of the start of the last item, which is the stop of the leaf data stack */ static unsigned int leaf_data_end(struct btrfs_root *root, struct extent_buffer *leaf)
{ u32 nr = btrfs_header_nritems(leaf); if (nr == 0) return BTRFS_LEAF_DATA_SIZE(root); return btrfs_item_offset_nr(leaf, nr - 1); }
robutest/uclinux
C++
GPL-2.0
60
/* This function returns the scanned information on success and a negative error code on failure. */
struct ubifs_scan_leb* ubifs_start_scan(const struct ubifs_info *c, int lnum, int offs, void *sbuf)
/* This function returns the scanned information on success and a negative error code on failure. */ struct ubifs_scan_leb* ubifs_start_scan(const struct ubifs_info *c, int lnum, int offs, void *sbuf)
{ struct ubifs_scan_leb *sleb; int err; dbg_scan("scan LEB %d:%d", lnum, offs); sleb = kzalloc(sizeof(struct ubifs_scan_leb), GFP_NOFS); if (!sleb) return ERR_PTR(-ENOMEM); sleb->lnum = lnum; INIT_LIST_HEAD(&sleb->nodes); sleb->buf = sbuf; err = ubifs_leb_read(c, lnum, sbuf + offs, offs, c->leb_size - offs, ...
4ms/stm32mp1-baremetal
C++
Other
137
/* This function is a wrapper of InitializeSeparateExceptionStacks. It's mainly for the sake of AP's init because of EFI_AP_PROCEDURE API requirement. */
VOID EFIAPI InitializeExceptionStackSwitchHandlersPerAp(IN OUT VOID *Buffer)
/* This function is a wrapper of InitializeSeparateExceptionStacks. It's mainly for the sake of AP's init because of EFI_AP_PROCEDURE API requirement. */ VOID EFIAPI InitializeExceptionStackSwitchHandlersPerAp(IN OUT VOID *Buffer)
{ EXCEPTION_STACK_SWITCH_CONTEXT *CpuSwitchStackData; CpuSwitchStackData = (EXCEPTION_STACK_SWITCH_CONTEXT *)Buffer; if ((CpuSwitchStackData->Status == EFI_NOT_STARTED) || (CpuSwitchStackData->Status == EFI_BUFFER_TOO_SMALL)) { CpuSwitchStackData->Status = InitializeSeparateExceptionStacks (CpuSwitchStackDat...
tianocore/edk2
C++
Other
4,240
/* Enables the LCD controller, after waiting for the specified number of frames. */
void LCD_Enable(unsigned int frames)
/* Enables the LCD controller, after waiting for the specified number of frames. */ void LCD_Enable(unsigned int frames)
{ ASSERT((frames & 0xFFFFFF80) == 0, "LCD_Enable: Wrong frames value.\n\r"); AT91C_BASE_LCDC->LCDC_PWRCON = AT91C_LCDC_PWR | (frames << 1); }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* __vxge_hw_vpath_xmac_tx_stats_get - Get the TX Statistics of a vpath */
enum vxge_hw_status __vxge_hw_vpath_xmac_tx_stats_get(struct __vxge_hw_virtualpath *vpath, struct vxge_hw_xmac_vpath_tx_stats *vpath_tx_stats)
/* __vxge_hw_vpath_xmac_tx_stats_get - Get the TX Statistics of a vpath */ enum vxge_hw_status __vxge_hw_vpath_xmac_tx_stats_get(struct __vxge_hw_virtualpath *vpath, struct vxge_hw_xmac_vpath_tx_stats *vpath_tx_stats)
{ u64 *val64; int i; u32 offset = VXGE_HW_STATS_VPATH_TX_OFFSET; enum vxge_hw_status status = VXGE_HW_OK; val64 = (u64 *) vpath_tx_stats; if (vpath->vp_open == VXGE_HW_VP_NOT_OPEN) { status = VXGE_HW_ERR_VPATH_NOT_OPEN; goto exit; } for (i = 0; i < sizeof(struct vxge_hw_xmac_vpath_tx_stats) / 8; i++) { st...
robutest/uclinux
C++
GPL-2.0
60
/* If an imprecise data rate is too high due to rounding error propagation, compute a suitably rounded mclk_ps to compute a working memory controller configuration. */
unsigned int get_memory_clk_period_ps(const unsigned int ctrl_num)
/* If an imprecise data rate is too high due to rounding error propagation, compute a suitably rounded mclk_ps to compute a working memory controller configuration. */ unsigned int get_memory_clk_period_ps(const unsigned int ctrl_num)
{ unsigned int data_rate = get_ddr_freq(ctrl_num); unsigned int result; unsigned long long rem, mclk_ps = ULL_2E12; rem = do_div(mclk_ps, data_rate); result = (rem >= (data_rate >> 1)) ? mclk_ps + 1 : mclk_ps; return result; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Programs a half word at a specified Option Byte Data address. */
FLASH_Status FLASH_ProgramOptionByteData(uint32_t Address, uint8_t Data)
/* Programs a half word at a specified Option Byte Data address. */ FLASH_Status FLASH_ProgramOptionByteData(uint32_t Address, uint8_t Data)
{ FLASH_Status status = FLASH_COMPLETE; assert_param(IS_OB_DATA_ADDRESS(Address)); status = FLASH_WaitForLastOperation(ProgramTimeout); if(status == FLASH_COMPLETE) { FLASH->OPTKEYR = FLASH_KEY1; FLASH->OPTKEYR = FLASH_KEY2; FLASH->CR |= CR_OPTPG_Set; *(__IO uint16_t*)Address = Data; stat...
pikasTech/PikaPython
C++
MIT License
1,403
/* Post the request to upper level. Don't use any pxa specific harware configuration capabilities */
static void pxa27x_change_interface(struct pxa_udc *udc, int iface, int alt)
/* Post the request to upper level. Don't use any pxa specific harware configuration capabilities */ static void pxa27x_change_interface(struct pxa_udc *udc, int iface, int alt)
{ struct usb_ctrlrequest req; dev_dbg(udc->dev, "interface=%d, alternate setting=%d\n", iface, alt); udc->last_interface = iface; udc->last_alternate = alt; req.bRequestType = USB_RECIP_INTERFACE; req.bRequest = USB_REQ_SET_INTERFACE; req.wValue = alt; req.wIndex = iface; req.wLength = 0; set_ep0state(udc, W...
robutest/uclinux
C++
GPL-2.0
60
/* nilfs_destroy_transaction_cache() frees the slab cache for the struct nilfs_transaction_info. */
void nilfs_destroy_transaction_cache(void)
/* nilfs_destroy_transaction_cache() frees the slab cache for the struct nilfs_transaction_info. */ void nilfs_destroy_transaction_cache(void)
{ kmem_cache_destroy(nilfs_transaction_cachep); }
robutest/uclinux
C++
GPL-2.0
60
/* Get the last Write Record pointer. The last write Record is the Record whose DestinationCompleted state hasn't been set. After all, this Record may be a EMPTY record entry for next write. */
EFI_STATUS FtwGetLastWriteRecord(IN EFI_FAULT_TOLERANT_WRITE_HEADER *FtwWriteHeader, OUT EFI_FAULT_TOLERANT_WRITE_RECORD **FtwWriteRecord)
/* Get the last Write Record pointer. The last write Record is the Record whose DestinationCompleted state hasn't been set. After all, this Record may be a EMPTY record entry for next write. */ EFI_STATUS FtwGetLastWriteRecord(IN EFI_FAULT_TOLERANT_WRITE_HEADER *FtwWriteHeader, OUT EFI_FAULT_TOLERANT_WRITE_RECORD **Ftw...
{ UINTN Index; EFI_FAULT_TOLERANT_WRITE_RECORD *FtwRecord; *FtwWriteRecord = NULL; FtwRecord = (EFI_FAULT_TOLERANT_WRITE_RECORD *)(FtwWriteHeader + 1); for (Index = 0; Index < FtwWriteHeader->NumberOfWrites; Index += 1) { if (FtwRecord->DestinationComplete != FTW_VALID_ST...
tianocore/edk2
C++
Other
4,240
/* This function only actually saves the state when necessary. */
static void c_pkt_data_save(c_pkt_data *d, packet_info *pinfo, guint off)
/* This function only actually saves the state when necessary. */ static void c_pkt_data_save(c_pkt_data *d, packet_info *pinfo, guint off)
{ if (!pinfo->fd->flags.visited) { p_add_proto_data(wmem_file_scope(), pinfo, proto_ceph, off, c_conv_data_clone(d->convd)); } }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Get pointer to CPU MP Data structure from GUIDed HOB. */
CPU_MP_DATA* GetCpuMpDataFromGuidedHob(VOID)
/* Get pointer to CPU MP Data structure from GUIDed HOB. */ CPU_MP_DATA* GetCpuMpDataFromGuidedHob(VOID)
{ EFI_HOB_GUID_TYPE *GuidHob; VOID *DataInHob; CPU_MP_DATA *CpuMpData; CpuMpData = NULL; GuidHob = GetFirstGuidHob (&mCpuInitMpLibHobGuid); if (GuidHob != NULL) { DataInHob = GET_GUID_HOB_DATA (GuidHob); CpuMpData = (CPU_MP_DATA *)(*(UINTN *)DataInHob); } return CpuMpData...
tianocore/edk2
C++
Other
4,240
/* Function for printing speed or cadence page2 data. */
static void page2_data_log(ant_bsc_page2_data_t const *p_page_data)
/* Function for printing speed or cadence page2 data. */ static void page2_data_log(ant_bsc_page2_data_t const *p_page_data)
{ LOG_PAGE2("%-30s %u\n\r", "Manufacturer ID:", (unsigned int)p_page_data->manuf_id); LOG_PAGE2("%-30s 0x%X\n\r", "Serial No (upper 16-bits):", (unsigned int)p_page_data->serial_num); }
labapart/polymcu
C++
null
201
/* Perform a blocking write of 16 words of data to the SHA/MD5 module. */
void SHAMD5DataWrite(uint32_t ui32Base, uint32_t *pui32Src)
/* Perform a blocking write of 16 words of data to the SHA/MD5 module. */ void SHAMD5DataWrite(uint32_t ui32Base, uint32_t *pui32Src)
{ uint32_t ui32Counter; ASSERT(ui32Base == SHAMD5_BASE); while((HWREG(ui32Base + SHAMD5_O_IRQSTATUS) & SHAMD5_INT_INPUT_READY) == 0) { } for(ui32Counter = 0; ui32Counter < 64; ui32Counter += 4) { HWREG(ui32Base + SHAMD5_O_DATA_0_IN + ui32Counter) = *pui32Src++; } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Work out if the given window supports palletised data at the specified bpp. */
static int s3c_fb_win_has_palette(unsigned int win, unsigned int bpp)
/* Work out if the given window supports palletised data at the specified bpp. */ static int s3c_fb_win_has_palette(unsigned int win, unsigned int bpp)
{ return s3c_fb_win_pal_size(win) <= (1 << bpp); }
robutest/uclinux
C++
GPL-2.0
60
/* Lookup the first record less than or equal to in the btree given by cur. */
STATIC int xfs_alloc_lookup_le(struct xfs_btree_cur *cur, xfs_agblock_t bno, xfs_extlen_t len, int *stat)
/* Lookup the first record less than or equal to in the btree given by cur. */ STATIC int xfs_alloc_lookup_le(struct xfs_btree_cur *cur, xfs_agblock_t bno, xfs_extlen_t len, int *stat)
{ cur->bc_rec.a.ar_startblock = bno; cur->bc_rec.a.ar_blockcount = len; return xfs_btree_lookup(cur, XFS_LOOKUP_LE, stat); }
robutest/uclinux
C++
GPL-2.0
60
/* Sets whether or not the @stream's buffer should automatically grow. If @auto_grow is true, then each write will just make the buffer larger, and you must manually flush the buffer to actually write out the data to the underlying stream. */
void g_buffered_output_stream_set_auto_grow(GBufferedOutputStream *stream, gboolean auto_grow)
/* Sets whether or not the @stream's buffer should automatically grow. If @auto_grow is true, then each write will just make the buffer larger, and you must manually flush the buffer to actually write out the data to the underlying stream. */ void g_buffered_output_stream_set_auto_grow(GBufferedOutputStream *stream, g...
{ GBufferedOutputStreamPrivate *priv; g_return_if_fail (G_IS_BUFFERED_OUTPUT_STREAM (stream)); priv = stream->priv; auto_grow = auto_grow != FALSE; if (priv->auto_grow != auto_grow) { priv->auto_grow = auto_grow; g_object_notify (G_OBJECT (stream), "auto-grow"); } }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Called to return the currently running connection state machine end time. Always called when interrupts are disabled. */
int ble_ll_conn_is_lru(struct ble_ll_conn_sm *s1, struct ble_ll_conn_sm *s2)
/* Called to return the currently running connection state machine end time. Always called when interrupts are disabled. */ int ble_ll_conn_is_lru(struct ble_ll_conn_sm *s1, struct ble_ll_conn_sm *s2)
{ int rc; if (CPUTIME_LT(s1->last_scheduled, s2->last_scheduled)) { rc = 1; } else { rc = 0; } return rc; }
arendst/Tasmota
C++
GNU General Public License v3.0
21,318
/* Waits a DATA IN packets on control endpoint. */
static void main_usb_send_in(uint8_t *payload, uint8_t size)
/* Waits a DATA IN packets on control endpoint. */ static void main_usb_send_in(uint8_t *payload, uint8_t size)
{ uint8_t *ptr_dest; do { while (!Is_udd_in_send(0)); ptr_dest = (uint8_t *) & udd_get_endpoint_fifo_access(0, 8); for (uint8_t i = 0; (i<udd_get_endpoint_size(0)) && size; i++) { *ptr_dest++ = *payload++; size--; } udd_ack_in_send(0); } while (size); while (!Is_udd_in_send(0)); }
remotemcu/remcu-chip-sdks
C++
null
436
/* param base LCDIFv2 peripheral base address. param layerIndex Layer layerIndex. param config Pointer to the configuration. */
void LCDIFV2_SetLayerBufferConfig(LCDIFV2_Type *base, uint8_t layerIndex, const lcdifv2_buffer_config_t *config)
/* param base LCDIFv2 peripheral base address. param layerIndex Layer layerIndex. param config Pointer to the configuration. */ void LCDIFV2_SetLayerBufferConfig(LCDIFV2_Type *base, uint8_t layerIndex, const lcdifv2_buffer_config_t *config)
{ assert(NULL != config); uint32_t reg; base->LAYER[layerIndex].CTRLDESCL3 = config->strideBytes; reg = base->LAYER[layerIndex].CTRLDESCL5; reg = (reg & ~(LCDIFV2_CTRLDESCL5_BPP_MASK | LCDIFV2_CTRLDESCL5_YUV_FORMAT_MASK)) | (uint32_t)config->pixelFormat; if (0U == (reg & LCDIFV2_CTRLDESCL5_AB_MO...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Convert from Linux-centric to bus-centric addresses for bridge devices. */
void pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region, struct resource *res)
/* Convert from Linux-centric to bus-centric addresses for bridge devices. */ void pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region, struct resource *res)
{ struct pci_sys_data *root = dev->sysdata; unsigned long offset = 0; if (res->flags & IORESOURCE_IO) offset = root->io_offset; if (res->flags & IORESOURCE_MEM) offset = root->mem_offset; region->start = res->start - offset; region->end = res->end - offset; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Cause a processor trigger for a sample sequence. */
void ADCProcessorTrigger(unsigned long ulBase)
/* Cause a processor trigger for a sample sequence. */ void ADCProcessorTrigger(unsigned long ulBase)
{ xASSERT(ulBase == ADC_BASE); xHWREG(ulBase + ADC0_SC2) &= ~ADC0_SC2_ADTRG_HARD; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104