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
/* Check validity of input arguments. This function checks the validity of input arguments. */
static status_t cau3_hash_check_input_args(CAU3_Type *base, cau3_hash_ctx_t *ctx, cau3_hash_algo_t algo)
/* Check validity of input arguments. This function checks the validity of input arguments. */ static status_t cau3_hash_check_input_args(CAU3_Type *base, cau3_hash_ctx_t *ctx, cau3_hash_algo_t algo)
{ if (kStatus_Success != cau3_hash_check_input_alg(algo)) { return kStatus_InvalidArgument; } if ((NULL == ctx) || (NULL == base)) { return kStatus_InvalidArgument; } return kStatus_Success; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Refresh a part of an area which is on the actual Virtual Display Buffer */
static void lv_refr_area_part(const lv_area_t *area_p)
/* Refresh a part of an area which is on the actual Virtual Display Buffer */ static void lv_refr_area_part(const lv_area_t *area_p)
{ lv_disp_buf_t * vdb = lv_disp_get_buf(disp_refr); if(lv_disp_is_double_buf(disp_refr) == false) { while(vdb->flushing) ; } lv_obj_t * top_p; lv_area_t start_mask; lv_area_intersect(&start_mask, area_p, &vdb->area); top_p = lv_refr_get_top_obj(&start_mask, lv_disp_get_sc...
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Disable HART reception by disabling the demultiplexer that routes the AD5700 to the circuit inputs. To enable these multipliers the AD4111 GPIO0 must be driven low. */
int32_t cn0414_hart_disable(struct cn0414_dev *dev, uint8_t *arg)
/* Disable HART reception by disabling the demultiplexer that routes the AD5700 to the circuit inputs. To enable these multipliers the AD4111 GPIO0 must be driven low. */ int32_t cn0414_hart_disable(struct cn0414_dev *dev, uint8_t *arg)
{ ad717x_st_reg *preg; NVIC_DisableIRQ(TMR0_INT); NVIC_DisableIRQ(HART_CD_INT); preg = AD717X_GetReg(dev->ad4111_device, AD717X_GPIOCON_REG); preg->value &= ~AD4111_GPIOCON_REG_DATA0; NVIC_EnableIRQ(TMR0_INT); NVIC_EnableIRQ(HART_CD_INT); return AD717X_WriteRegister(dev->ad4111_device, AD717X_GPIOCON_REG); }
analogdevicesinc/EVAL-ADICUP3029
C++
Other
36
/* Tell the SCSI layer about a BUS RESET. */
void sym_xpt_async_bus_reset(struct sym_hcb *np)
/* Tell the SCSI layer about a BUS RESET. */ void sym_xpt_async_bus_reset(struct sym_hcb *np)
{ printf_notice("%s: SCSI BUS has been reset.\n", sym_name(np)); np->s.settle_time = jiffies + sym_driver_setup.settle_delay * HZ; np->s.settle_time_valid = 1; if (sym_verbose >= 2) printf_info("%s: command processing suspended for %d seconds\n", sym_name(np), sym_driver_setup.settle_delay); }
robutest/uclinux
C++
GPL-2.0
60
/* Evaluates the Bernstein polynomial that represents the curve, at 't'. 't' should be a value between 0.0 and 1.0 (though it can be any float, but the relevant values are between 0 and 1). 'x' and 'y' will contain the coordinates of the evaluated point. */
static void quad_bezier_eval(const quad_bezier_t *q, vg_lite_float_t t, vg_lite_float_t *x, vg_lite_float_t *y)
/* Evaluates the Bernstein polynomial that represents the curve, at 't'. 't' should be a value between 0.0 and 1.0 (though it can be any float, but the relevant values are between 0 and 1). 'x' and 'y' will contain the coordinates of the evaluated point. */ static void quad_bezier_eval(const quad_bezier_t *q, vg_lite_...
{ const vg_lite_float_t omt = 1.0 - t; *x = q->X0 * omt * omt + 2.0 * q->X1 * t * omt + q->X2 * t * t; *y = q->Y0 * omt * omt + 2.0 * q->Y1 * t * omt + q->Y2 * t * t; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* ps2_sendbyte() can only be called from a process context. */
int ps2_sendbyte(struct ps2dev *ps2dev, unsigned char byte, int timeout)
/* ps2_sendbyte() can only be called from a process context. */ int ps2_sendbyte(struct ps2dev *ps2dev, unsigned char byte, int timeout)
{ serio_pause_rx(ps2dev->serio); ps2dev->nak = 1; ps2dev->flags |= PS2_FLAG_ACK; serio_continue_rx(ps2dev->serio); if (serio_write(ps2dev->serio, byte) == 0) wait_event_timeout(ps2dev->wait, !(ps2dev->flags & PS2_FLAG_ACK), msecs_to_jiffies(timeout)); serio_pause_rx(ps2dev->serio); ps2dev->flags ...
robutest/uclinux
C++
GPL-2.0
60
/* USART pinmux initialization function. Set each required pin to USART functionality */
void TARGET_IO_PORT_init()
/* USART pinmux initialization function. Set each required pin to USART functionality */ void TARGET_IO_PORT_init()
{ gpio_set_pin_function(PA21, MUX_PA21A_USART1_RXD1); gpio_set_pin_function(PB4, MUX_PB4D_USART1_TXD1); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* If DateTimeStr is NULL, then return FALSE. If DateTimeSize is NULL, then return FALSE. If this interface is not supported, then return FALSE. */
BOOLEAN EFIAPI X509FormatDateTime(IN CONST CHAR8 *DateTimeStr, OUT VOID *DateTime, IN OUT UINTN *DateTimeSize)
/* If DateTimeStr is NULL, then return FALSE. If DateTimeSize is NULL, then return FALSE. If this interface is not supported, then return FALSE. */ BOOLEAN EFIAPI X509FormatDateTime(IN CONST CHAR8 *DateTimeStr, OUT VOID *DateTime, IN OUT UINTN *DateTimeSize)
{ CALL_CRYPTO_SERVICE (X509FormatDateTime, (DateTimeStr, DateTime, DateTimeSize), FALSE); }
tianocore/edk2
C++
Other
4,240
/* Enables or disables the specified I2C general call feature. */
void I2C_EnableGeneralCall(I2C_Module *I2Cx, FunctionalState Cmd)
/* Enables or disables the specified I2C general call feature. */ void I2C_EnableGeneralCall(I2C_Module *I2Cx, FunctionalState Cmd)
{ assert_param(IS_I2C_PERIPH(I2Cx)); assert_param(IS_FUNCTIONAL_STATE(Cmd)); if (Cmd != DISABLE) { I2Cx->CTRL1 |= CTRL1_GCEN_SET; } else { I2Cx->CTRL1 &= CTRL1_GCEN_RESET; } }
pikasTech/PikaPython
C++
MIT License
1,403
/* Deserializes the supplied (wire) buffer into connack data - return code */
int mqtt_deserialize_connack(unsigned char *sessionPresent, unsigned char *connack_rc, unsigned char *buf, int buflen)
/* Deserializes the supplied (wire) buffer into connack data - return code */ int mqtt_deserialize_connack(unsigned char *sessionPresent, unsigned char *connack_rc, unsigned char *buf, int buflen)
{ mqtt_header_t header = {0}; unsigned char* curdata = buf; unsigned char* enddata = NULL; int rc = 0; int mylen; mqtt_conn_ack_flags_t flags = {0}; FUNC_ENTRY; header.byte = mqtt_read_char(&curdata); if (header.bits.type != MQTTPACKET_CONNACK) goto exit; curdata += (rc = mqtt_packet_decode_buf(curdata, &my...
RavenSystem/esp-homekit-devices
C++
Other
2,577
/* Buffer to Main Memory Page Program with Built-in Erase. */
void AT45DB161_Buf_to_Mm(unsigned char ucBufferNum, unsigned short usPageAddr)
/* Buffer to Main Memory Page Program with Built-in Erase. */ void AT45DB161_Buf_to_Mm(unsigned char ucBufferNum, unsigned short usPageAddr)
{ while(!AT45DB161_WaitReady()); if (usPageAddr < AT45DB161_PAGES) { AT45DB161_CS = 0; if (ucBufferNum == AT45DB161_BUF1)SPISingleDataReadWrite(AT45DB161_SPI_PORT, AT45DB161_CMD_B1TMW); else SPISingleDataReadWrite(AT45DB161_SPI_PORT, AT45DB161_CMD_B2TMW); xSPISingleDataReadWr...
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Add or remove reception of all multicast frames to a device. While the count in the device remains above zero the interface remains listening to all interfaces. Once it hits zero the device reverts back to normal filtering operation. A negative @inc value is used to drop the counter when releasing a resource needing...
int dev_set_allmulti(struct net_device *dev, int inc)
/* Add or remove reception of all multicast frames to a device. While the count in the device remains above zero the interface remains listening to all interfaces. Once it hits zero the device reverts back to normal filtering operation. A negative @inc value is used to drop the counter when releasing a resource needing...
{ unsigned short old_flags = dev->flags; ASSERT_RTNL(); dev->flags |= IFF_ALLMULTI; dev->allmulti += inc; if (dev->allmulti == 0) { if (inc < 0) dev->flags &= ~IFF_ALLMULTI; else { dev->allmulti -= inc; printk(KERN_WARNING "%s: allmulti touches roof, " "set allmulti failed, allmulti feature of " ...
EmcraftSystems/linux-emcraft
C++
Other
266
/* System reset should not return, if it returns, it means the system does not support cold reset. */
VOID EFIAPI ResetCold(VOID)
/* System reset should not return, if it returns, it means the system does not support cold reset. */ VOID EFIAPI ResetCold(VOID)
{ IoWrite8 ((UINTN)mAcpiBoardInfo.ResetRegAddress, mAcpiBoardInfo.ResetValue); CpuDeadLoop (); }
tianocore/edk2
C++
Other
4,240
/* Returns: TRUE if the @appinfo should be shown, FALSE otherwise. */
gboolean g_app_info_should_show(GAppInfo *appinfo)
/* Returns: TRUE if the @appinfo should be shown, FALSE otherwise. */ gboolean g_app_info_should_show(GAppInfo *appinfo)
{ GAppInfoIface *iface; g_return_val_if_fail (G_IS_APP_INFO (appinfo), FALSE); iface = G_APP_INFO_GET_IFACE (appinfo); return (* iface->should_show) (appinfo); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* I2C Send Start Condition. If in Master mode this will cause a restart condition to occur at the end of the current transmission. If in Slave mode, this will initiate a start condition when the current bus activity is completed. */
void i2c_send_start(uint32_t i2c)
/* I2C Send Start Condition. If in Master mode this will cause a restart condition to occur at the end of the current transmission. If in Slave mode, this will initiate a start condition when the current bus activity is completed. */ void i2c_send_start(uint32_t i2c)
{ I2C_CR1(i2c) |= I2C_CR1_START; }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* Only called on rmmod for each platform device, since they are not hot-pluggable. Now we know, that all our users - hosts and devices have been unloaded already */
static int __devexit soc_camera_pdrv_remove(struct platform_device *pdev)
/* Only called on rmmod for each platform device, since they are not hot-pluggable. Now we know, that all our users - hosts and devices have been unloaded already */ static int __devexit soc_camera_pdrv_remove(struct platform_device *pdev)
{ struct soc_camera_device *icd = platform_get_drvdata(pdev); if (!icd) return -EINVAL; soc_camera_device_unregister(icd); kfree(icd); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* find the Hot Plug Resource Table in the specified region of memory. */
static void __iomem* detect_HRT_floating_pointer(void __iomem *begin, void __iomem *end)
/* find the Hot Plug Resource Table in the specified region of memory. */ static void __iomem* detect_HRT_floating_pointer(void __iomem *begin, void __iomem *end)
{ void __iomem *fp; void __iomem *endp; u8 temp1, temp2, temp3, temp4; int status = 0; endp = (end - sizeof(struct hrt) + 1); for (fp = begin; fp <= endp; fp += 16) { temp1 = readb(fp + SIG0); temp2 = readb(fp + SIG1); temp3 = readb(fp + SIG2); temp4 = readb(fp + SIG3); if (temp1 == '$' && temp2 =...
robutest/uclinux
C++
GPL-2.0
60
/* Checks whether the specified ADC interrupt has occurred or not. */
ITStatus ADC_GetITStatus(ADC_TypeDef *ADCx, uint16_t ADC_IT)
/* Checks whether the specified ADC interrupt has occurred or not. */ ITStatus ADC_GetITStatus(ADC_TypeDef *ADCx, uint16_t ADC_IT)
{ ITStatus bitstatus = RESET; uint32_t itmask = 0, enablestatus = 0; assert_param(IS_ADC_ALL_PERIPH(ADCx)); assert_param(IS_ADC_IT(ADC_IT)); itmask = (uint32_t)((uint32_t)ADC_IT >> 8); enablestatus = (ADCx->CR1 & ((uint32_t)0x01 << (uint8_t)ADC_IT)); if (((uint32_t)(ADCx->SR & (uint32_t)itmask) != (uint32...
avem-labs/Avem
C++
MIT License
1,752
/* In "no encryption" mode, encryption is trivial (a no-operation) so we just have to encode the header. */
static unsigned char* clear_encrypt(br_sslrec_out_clear_context *cc, int record_type, unsigned version, void *data, size_t *data_len)
/* In "no encryption" mode, encryption is trivial (a no-operation) so we just have to encode the header. */ static unsigned char* clear_encrypt(br_sslrec_out_clear_context *cc, int record_type, unsigned version, void *data, size_t *data_len)
{ unsigned char *buf; (void)cc; buf = (unsigned char *)data - 5; buf[0] = record_type; br_enc16be(buf + 1, version); br_enc16be(buf + 3, *data_len); *data_len += 5; return buf; }
RavenSystem/esp-homekit-devices
C++
Other
2,577
/* param base Pointer to the FLEXIO_SPI_Type structure. param handle Pointer to the flexio_spi_master_handle_t structure to store the transfer state. param callback The callback function. param userData The parameter of the callback function. retval kStatus_Success Successfully create the handle. retval kStatus_OutOfRa...
status_t FLEXIO_SPI_MasterTransferCreateHandle(FLEXIO_SPI_Type *base, flexio_spi_master_handle_t *handle, flexio_spi_master_transfer_callback_t callback, void *userData)
/* param base Pointer to the FLEXIO_SPI_Type structure. param handle Pointer to the flexio_spi_master_handle_t structure to store the transfer state. param callback The callback function. param userData The parameter of the callback function. retval kStatus_Success Successfully create the handle. retval kStatus_OutOfRa...
{ assert(handle); IRQn_Type flexio_irqs[] = FLEXIO_IRQS; memset(handle, 0, sizeof(*handle)); handle->callback = callback; handle->userData = userData; EnableIRQ(flexio_irqs[FLEXIO_SPI_GetInstance(base)]); return FLEXIO_RegisterHandleIRQ(base, handle, FLEXIO_SPI_MasterTransferHandleIRQ); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This function is intended for SHORT delays only. */
unsigned long cpu_usec2ticks(unsigned long usec)
/* This function is intended for SHORT delays only. */ unsigned long cpu_usec2ticks(unsigned long usec)
{ if (usec < 1000) return 1; return (usec / 1000); }
EmcraftSystems/u-boot
C++
Other
181
/* panic() calls con3270_flush through a panic_notifier before the system enters a disabled, endless loop. */
static void con3270_flush(void)
/* panic() calls con3270_flush through a panic_notifier before the system enters a disabled, endless loop. */ static void con3270_flush(void)
{ struct con3270 *cp; unsigned long flags; cp = condev; if (!cp->view.dev) return; raw3270_pm_unfreeze(&cp->view); spin_lock_irqsave(&cp->view.lock, flags); con3270_wait_write(cp); cp->nr_up = 0; con3270_rebuild_update(cp); con3270_update_status(cp); while (cp->update_flags != 0) { spin_unlock_irqrestore...
robutest/uclinux
C++
GPL-2.0
60
/* This function sets the status callback function. The callback function is called by the XGpioPs_IntrHandler when an interrupt occurs. */
void XGpioPs_SetCallbackHandler(XGpioPs *InstancePtr, void *CallBackRef, XGpioPs_Handler FuncPointer)
/* This function sets the status callback function. The callback function is called by the XGpioPs_IntrHandler when an interrupt occurs. */ void XGpioPs_SetCallbackHandler(XGpioPs *InstancePtr, void *CallBackRef, XGpioPs_Handler FuncPointer)
{ Xil_AssertVoid(InstancePtr != NULL); Xil_AssertVoid(FuncPointer != NULL); Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY); InstancePtr->Handler = FuncPointer; InstancePtr->CallBackRef = CallBackRef; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* At periodic intervals, scan through all active partitions and ensure their heartbeat is still active. If not, the partition is deactivated. */
static void xpc_check_remote_hb(void)
/* At periodic intervals, scan through all active partitions and ensure their heartbeat is still active. If not, the partition is deactivated. */ static void xpc_check_remote_hb(void)
{ struct xpc_partition *part; short partid; enum xp_retval ret; for (partid = 0; partid < xp_max_npartitions; partid++) { if (xpc_exiting) break; if (partid == xp_partition_id) continue; part = &xpc_partitions[partid]; if (part->act_state == XPC_P_AS_INACTIVE || part->act_state == XPC_P_AS_DEACT...
robutest/uclinux
C++
GPL-2.0
60
/* Enables or disables the specified I2C Clock stretching. */
void I2C_StretchClockCmd(I2C_TypeDef *I2Cx, FunctionalState NewState)
/* Enables or disables the specified I2C Clock stretching. */ void I2C_StretchClockCmd(I2C_TypeDef *I2Cx, FunctionalState NewState)
{ assert_param(IS_I2C_ALL_PERIPH(I2Cx)); assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState == DISABLE) { I2Cx->CR1 |= I2C_CR1_NOSTRETCH; } else { I2Cx->CR1 &= (uint16_t)~((uint16_t)I2C_CR1_NOSTRETCH); } }
MaJerle/stm32f429
C++
null
2,036
/* Waits until the RTC Time register (RTC_TR) is synchronized with RTC APB clock. */
u32 RTC_WaitForSynchro(void)
/* Waits until the RTC Time register (RTC_TR) is synchronized with RTC APB clock. */ u32 RTC_WaitForSynchro(void)
{ RTC_TypeDef* RTC = ((RTC_TypeDef *) RTC_BASE); u32 counter = 0; u32 status = 0; u32 synchrostatus = 0x00; if (RTC->CR & RTC_CR_BYPSHAD) { return 1; } RTC->WPR = 0xCA; RTC->WPR = 0x53; RTC->ISR |= RTC_ISR_RSF; do { synchrostatus = RTC->ISR & RTC_ISR_RSF; counter++; } while ((counter != SYNCHRO_TIMEOUT...
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Reset WINC1500 SoC by setting CHIP_EN and RESET_N signals low, CHIP_EN high then RESET_N high. */
nm_bsp_reset(void)
/* Reset WINC1500 SoC by setting CHIP_EN and RESET_N signals low, CHIP_EN high then RESET_N high. */ nm_bsp_reset(void)
{ ioport_set_pin_level(CONF_WINC_PIN_CHIP_ENABLE, IOPORT_PIN_LEVEL_LOW); ioport_set_pin_level(CONF_WINC_PIN_RESET, IOPORT_PIN_LEVEL_LOW); nm_bsp_sleep(1); ioport_set_pin_level(CONF_WINC_PIN_CHIP_ENABLE, IOPORT_PIN_LEVEL_HIGH); nm_bsp_sleep(10); ioport_set_pin_level(CONF_WINC_PIN_RESET, IOPORT_PIN_LEVEL_HIGH); }
remotemcu/remcu-chip-sdks
C++
null
436
/* Returns 1 if one or more PIO of the given Pin data to be driven on the I/O line level; otherwise returns 0. */
unsigned char PIO_GetOutputDataStatus(const Pin *pin)
/* Returns 1 if one or more PIO of the given Pin data to be driven on the I/O line level; otherwise returns 0. */ unsigned char PIO_GetOutputDataStatus(const Pin *pin)
{ if ((READ(pin->pio, PIO_ODSR) & pin->mask) == 0) { return 0; } else { return 1; } }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* Do the necessary ALSA-level cleanup to deallocate our driver ... */
static void soundscape_free(struct snd_card *c)
/* Do the necessary ALSA-level cleanup to deallocate our driver ... */ static void soundscape_free(struct snd_card *c)
{ struct soundscape *sscape = get_card_soundscape(c); release_and_free_resource(sscape->io_res); release_and_free_resource(sscape->wss_res); free_dma(sscape->chip->dma1); }
robutest/uclinux
C++
GPL-2.0
60
/* retval kStatus_Success Lock the sema4 gate successfully. retval kStatus_Fail Sema4 gate has been locked by another processor. */
status_t SEMA4_TryLock(SEMA4_Type *base, uint8_t gateNum, uint8_t procNum)
/* retval kStatus_Success Lock the sema4 gate successfully. retval kStatus_Fail Sema4 gate has been locked by another processor. */ status_t SEMA4_TryLock(SEMA4_Type *base, uint8_t gateNum, uint8_t procNum)
{ status_t status; assert(gateNum < (uint8_t)FSL_FEATURE_SEMA4_GATE_COUNT); ++procNum; SEMA4_GATEn(base, gateNum) = procNum; if (procNum != SEMA4_GATEn(base, gateNum)) { status = kStatus_Fail; } else { status = kStatus_Success; } return status; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Set the DMA Channelx transfer data of number. */
void DMA_SetDataNumber(DMA_CHANNEL_T *channel, uint32_t dataNumber)
/* Set the DMA Channelx transfer data of number. */ void DMA_SetDataNumber(DMA_CHANNEL_T *channel, uint32_t dataNumber)
{ channel->CHNDATA = (uint32_t)dataNumber; }
pikasTech/PikaPython
C++
MIT License
1,403
/* This function searches the list of configuration tables stored in the EFI System Table for a table with a GUID that matches TableGuid. If a match is found, then a pointer to the configuration table is returned in Table., and EFI_SUCCESS is returned. If a matching GUID is not found, then EFI_NOT_FOUND is returned. If...
EFI_STATUS EFIAPI EfiGetSystemConfigurationTable(IN EFI_GUID *TableGuid, OUT VOID **Table)
/* This function searches the list of configuration tables stored in the EFI System Table for a table with a GUID that matches TableGuid. If a match is found, then a pointer to the configuration table is returned in Table., and EFI_SUCCESS is returned. If a matching GUID is not found, then EFI_NOT_FOUND is returned. If...
{ EFI_SYSTEM_TABLE *SystemTable; UINTN Index; ASSERT (TableGuid != NULL); ASSERT (Table != NULL); SystemTable = gST; *Table = NULL; for (Index = 0; Index < SystemTable->NumberOfTableEntries; Index++) { if (CompareGuid (TableGuid, &(SystemTable->ConfigurationTable[Index].VendorGuid)))...
tianocore/edk2
C++
Other
4,240
/* Main program entry point. This routine configures the hardware required by the application, then enters a loop to run the application tasks in sequence. */
int main(void)
/* Main program entry point. This routine configures the hardware required by the application, then enters a loop to run the application tasks in sequence. */ int main(void)
{ SetupHardware(); puts_P(PSTR(ESC_FG_CYAN "CDC Host Demo running.\r\n" ESC_FG_WHITE)); LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); GlobalInterruptEnable(); for (;;) { CDCHost_Task(); CDC_Host_USBTask(&VirtualSerial_CDC_Interface); USB_USBTask(); } }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* get a block from the ring block buffer object */
rt_rbb_blk_t rt_rbb_blk_get(rt_rbb_t rbb)
/* get a block from the ring block buffer object */ rt_rbb_blk_t rt_rbb_blk_get(rt_rbb_t rbb)
{ rt_base_t level; rt_rbb_blk_t block = RT_NULL; rt_slist_t *node; RT_ASSERT(rbb); if (rt_slist_isempty(&rbb->blk_list)) return 0; level = rt_hw_interrupt_disable(); for (node = rt_slist_first(&rbb->blk_list); node; node = rt_slist_next(node)) { block = rt_slist_entry(nod...
pikasTech/PikaPython
C++
MIT License
1,403
/* this syscall returns the minimum rt_priority that can be used by a given scheduling class. */
SYSCALL_DEFINE1(sched_get_priority_min, int, policy)
/* this syscall returns the minimum rt_priority that can be used by a given scheduling class. */ SYSCALL_DEFINE1(sched_get_priority_min, int, policy)
{ int ret = -EINVAL; switch (policy) { case SCHED_FIFO: case SCHED_RR: ret = 1; break; case SCHED_NORMAL: case SCHED_BATCH: case SCHED_IDLE: ret = 0; } return ret; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* need to stop any outstanding workq queued up at this time because we will be resetting the sleep time. Then restart the workq on the new delay */
void edac_device_reset_delay_period(struct edac_device_ctl_info *edac_dev, unsigned long value)
/* need to stop any outstanding workq queued up at this time because we will be resetting the sleep time. Then restart the workq on the new delay */ void edac_device_reset_delay_period(struct edac_device_ctl_info *edac_dev, unsigned long value)
{ edac_device_workq_teardown(edac_dev); mutex_lock(&device_ctls_mutex); edac_device_workq_setup(edac_dev, value); mutex_unlock(&device_ctls_mutex); }
robutest/uclinux
C++
GPL-2.0
60
/* The Yellow LED is under the control of the Check task. All the other LED's are under the control of the uIP task. */
void prvToggleOnBoardLED(void)
/* The Yellow LED is under the control of the Check task. All the other LED's are under the control of the uIP task. */ void prvToggleOnBoardLED(void)
{ unsigned long ulState; ulState = GPIO0_IOPIN; if( ulState & mainYELLOW_LED ) { GPIO_IOCLR = mainYELLOW_LED; } else { GPIO_IOSET = mainYELLOW_LED; }}
apopple/Pandaboard-FreeRTOS
C++
null
25
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). If StartBit is greater than 31, then ASSERT(). If EndBit is greater than 31, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). */
UINT32 EFIAPI PciBitFieldRead32(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit)
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). If StartBit is greater than 31, then ASSERT(). If EndBit is greater than 31, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). */ UINT32 EFIAPI PciBitFieldRead32(IN UINTN Address, IN UINTN StartBit, IN...
{ return PciExpressBitFieldRead32 (Address, StartBit, EndBit); }
tianocore/edk2
C++
Other
4,240
/* Converts a text device path node to EMMC (Embedded MMC) device path structure. */
EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextEmmc(CHAR16 *TextDeviceNode)
/* Converts a text device path node to EMMC (Embedded MMC) device path structure. */ EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextEmmc(CHAR16 *TextDeviceNode)
{ CHAR16 *SlotNumberStr; EMMC_DEVICE_PATH *Emmc; SlotNumberStr = GetNextParamStr (&TextDeviceNode); Emmc = (EMMC_DEVICE_PATH *) CreateDeviceNode ( MESSAGING_DEVICE_PATH, MSG_EMMC_DP, ...
tianocore/edk2
C++
Other
4,240
/* Insert rq into dispatch queue of q. Queue lock must be held on entry. rq is added to the back of the dispatch queue. To be used by specific elevators. */
void elv_dispatch_add_tail(struct request_queue *q, struct request *rq)
/* Insert rq into dispatch queue of q. Queue lock must be held on entry. rq is added to the back of the dispatch queue. To be used by specific elevators. */ void elv_dispatch_add_tail(struct request_queue *q, struct request *rq)
{ if (q->last_merge == rq) q->last_merge = NULL; elv_rqhash_del(q, rq); q->nr_sorted--; q->end_sector = rq_end_sector(rq); q->boundary_rq = rq; list_add_tail(&rq->queuelist, &q->queue_head); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Charge the memory controller for page usage. Return 0 if the charge was successful < 0 if the cgroup is over its limit */
static int mem_cgroup_charge_common(struct page *page, struct mm_struct *mm, gfp_t gfp_mask, enum charge_type ctype, struct mem_cgroup *memcg)
/* Charge the memory controller for page usage. Return 0 if the charge was successful < 0 if the cgroup is over its limit */ static int mem_cgroup_charge_common(struct page *page, struct mm_struct *mm, gfp_t gfp_mask, enum charge_type ctype, struct mem_cgroup *memcg)
{ struct mem_cgroup *mem; struct page_cgroup *pc; int ret; pc = lookup_page_cgroup(page); if (unlikely(!pc)) return 0; prefetchw(pc); mem = memcg; ret = __mem_cgroup_try_charge(mm, gfp_mask, &mem, true, page); if (ret || !mem) return ret; __mem_cgroup_commit_charge(mem, pc, ctype); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* remove the object's xattr to mark it stale */
int cachefiles_remove_object_xattr(struct cachefiles_cache *cache, struct dentry *dentry)
/* remove the object's xattr to mark it stale */ int cachefiles_remove_object_xattr(struct cachefiles_cache *cache, struct dentry *dentry)
{ int ret; ret = vfs_removexattr(dentry, cachefiles_xattr_cache); if (ret < 0) { if (ret == -ENOENT || ret == -ENODATA) ret = 0; else if (ret != -ENOMEM) cachefiles_io_error(cache, "Can't remove xattr from %lu" " (error %d)", dentry->d_inode->i_ino, -ret); } _leave(" = %d", ret...
robutest/uclinux
C++
GPL-2.0
60
/* Determines whether the SSI transmitter is busy or not. */
bool SSIBusy(uint32_t ui32Base)
/* Determines whether the SSI transmitter is busy or not. */ bool SSIBusy(uint32_t ui32Base)
{ ASSERT(_SSIBaseValid(ui32Base)); return((HWREG(ui32Base + SSI_O_SR) & SSI_SR_BSY) ? true : false); }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Calculates the size of the target surface for a zoomSurface() call. The minimum size of the target surface is 1. The input factors can be positive or negative. */
void zoomSurfaceSize(int width, int height, double zoomx, double zoomy, int *dstwidth, int *dstheight)
/* Calculates the size of the target surface for a zoomSurface() call. The minimum size of the target surface is 1. The input factors can be positive or negative. */ void zoomSurfaceSize(int width, int height, double zoomx, double zoomy, int *dstwidth, int *dstheight)
{ int flipx, flipy; flipx = (zoomx<0.0); if (flipx) zoomx = -zoomx; flipy = (zoomy<0.0); if (flipy) zoomy = -zoomy; if (zoomx < VALUE_LIMIT) { zoomx = VALUE_LIMIT; } if (zoomy < VALUE_LIMIT) { zoomy = VALUE_LIMIT; } *dstwidth = (int) floor(((double) width * zoomx) + 0.5); *dstheight = (int) floor(((doubl...
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Dummy Platform Driver to extract & map shared register regions */
static void mpsc_resource_err(char *s)
/* Dummy Platform Driver to extract & map shared register regions */ static void mpsc_resource_err(char *s)
{ printk(KERN_WARNING "MPSC: Platform device resource error in %s\n", s); }
robutest/uclinux
C++
GPL-2.0
60
/* Converts a device node to its string representation. */
CHAR16* EFIAPI ConvertDeviceNodeToText(IN CONST EFI_DEVICE_PATH_PROTOCOL *DeviceNode, IN BOOLEAN DisplayOnly, IN BOOLEAN AllowShortcuts)
/* Converts a device node to its string representation. */ CHAR16* EFIAPI ConvertDeviceNodeToText(IN CONST EFI_DEVICE_PATH_PROTOCOL *DeviceNode, IN BOOLEAN DisplayOnly, IN BOOLEAN AllowShortcuts)
{ if (mDevicePathLibDevicePathToText == NULL) { mDevicePathLibDevicePathToText = UefiDevicePathLibLocateProtocol (&gEfiDevicePathToTextProtocolGuid); } if (mDevicePathLibDevicePathToText != NULL) { return mDevicePathLibDevicePathToText->ConvertDeviceNodeToText (DeviceNode, DisplayOnly, AllowShortcuts); ...
tianocore/edk2
C++
Other
4,240
/* Returns the clock source used as system clock. */
uint8_t RCC_GetSysclkSrc(void)
/* Returns the clock source used as system clock. */ uint8_t RCC_GetSysclkSrc(void)
{ return ((uint8_t)(RCC->CFG & CFG_SCLKSTS_MASK)); }
pikasTech/PikaPython
C++
MIT License
1,403
/* Basic board specific setup. Pinmux has been handled already. */
int board_init(void)
/* Basic board specific setup. Pinmux has been handled already. */ int board_init(void)
{ i2c_init(CONFIG_SYS_OMAP24_I2C_SPEED, CONFIG_SYS_OMAP24_I2C_SLAVE); gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100; return 0; }
4ms/stm32mp1-baremetal
C++
Other
137
/* @acb: The adapter device to be updated @dcb: A device that has previously been added to the adapter. */
static void adapter_remove_device(struct AdapterCtlBlk *acb, struct DeviceCtlBlk *dcb)
/* @acb: The adapter device to be updated @dcb: A device that has previously been added to the adapter. */ static void adapter_remove_device(struct AdapterCtlBlk *acb, struct DeviceCtlBlk *dcb)
{ struct DeviceCtlBlk *i; struct DeviceCtlBlk *tmp; dprintkdbg(DBG_0, "adapter_remove_device: <%02i-%i>\n", dcb->target_id, dcb->target_lun); if (acb->active_dcb == dcb) acb->active_dcb = NULL; if (acb->dcb_run_robin == dcb) acb->dcb_run_robin = dcb_get_next(&acb->dcb_list, dcb); list_for_each_entry_safe(i,...
robutest/uclinux
C++
GPL-2.0
60
/* Also adds any control attribute registered by the trigger driver */
static int iio_trigger_register_sysfs(struct iio_trigger *trig_info)
/* Also adds any control attribute registered by the trigger driver */ static int iio_trigger_register_sysfs(struct iio_trigger *trig_info)
{ int ret = 0; if (trig_info->control_attrs) ret = sysfs_create_group(&trig_info->dev.kobj, trig_info->control_attrs); return ret; }
robutest/uclinux
C++
GPL-2.0
60
/* Message: LineStatMessage Opcode: 0x0092 Type: RegistrationAndManagement Direction: pbx2dev VarLength: no */
static void handle_LineStatMessage(ptvcursor_t *cursor, packet_info *pinfo _U_)
/* Message: LineStatMessage Opcode: 0x0092 Type: RegistrationAndManagement Direction: pbx2dev VarLength: no */ static void handle_LineStatMessage(ptvcursor_t *cursor, packet_info *pinfo _U_)
{ ptvcursor_add(cursor, hf_skinny_lineNumber, 4, ENC_LITTLE_ENDIAN); ptvcursor_add(cursor, hf_skinny_lineDirNumber, 24, ENC_ASCII|ENC_NA); ptvcursor_add(cursor, hf_skinny_lineFullyQualifiedDisplayName, 40, ENC_ASCII|ENC_NA); ptvcursor_add(cursor, hf_skinny_lineTextLabel, 40, ENC_ASCII|ENC_NA); ptvcursor_add(c...
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* / '/' + 'One or more repetitions of dir/' (e.g. /dir/ /dir/dir/ /dir/dir/dir/ ). */
bool tomoyo_path_matches_pattern(const struct tomoyo_path_info *filename, const struct tomoyo_path_info *pattern)
/* / '/' + 'One or more repetitions of dir/' (e.g. /dir/ /dir/dir/ /dir/dir/dir/ ). */ bool tomoyo_path_matches_pattern(const struct tomoyo_path_info *filename, const struct tomoyo_path_info *pattern)
{ const char *f = filename->name; const char *p = pattern->name; const int len = pattern->const_len; if (!pattern->is_patterned) return !tomoyo_pathcmp(filename, pattern); if (filename->is_dir != pattern->is_dir) return false; if (strncmp(f, p, len)) return false; f += len; p += len; return tomoyo_path_m...
EmcraftSystems/linux-emcraft
C++
Other
266
/* 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, pfnHandler); IntEnable(INT_WATCHDOG); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Transfer length bytes of input buffer, starting at Address, to memory. */
VOID TransferFromInBufToMem(IN UINTN Length, IN unsigned char *Address, IN CHAR8 *NewData)
/* Transfer length bytes of input buffer, starting at Address, to memory. */ VOID TransferFromInBufToMem(IN UINTN Length, IN unsigned char *Address, IN CHAR8 *NewData)
{ CHAR8 c1; CHAR8 c2; while (Length-- > 0) { c1 = (CHAR8)HexCharToInt (*NewData++); c2 = (CHAR8)HexCharToInt (*NewData++); if ((c1 < 0) || (c2 < 0)) { Print ((CHAR16 *)L"Bad message from write to memory..\n"); SendError (GDB_EBADMEMDATA); return; } *Address++ = (UINT8)((c1 ...
tianocore/edk2
C++
Other
4,240
/* Return codes: instance - a unique integer ID allocated as the new instance. -1 - lpfc get instance failed. */
int lpfc_get_instance(void)
/* Return codes: instance - a unique integer ID allocated as the new instance. -1 - lpfc get instance failed. */ int lpfc_get_instance(void)
{ int instance = 0; if (!idr_pre_get(&lpfc_hba_index, GFP_KERNEL)) return -1; if (idr_get_new(&lpfc_hba_index, NULL, &instance)) return -1; return instance; }
robutest/uclinux
C++
GPL-2.0
60
/* Import n from unsigned binary data, big endian. */
rt_err_t rt_hwcrypto_bignum_import_bin(struct hw_bignum_mpi *n, rt_uint8_t *buf, int len)
/* Import n from unsigned binary data, big endian. */ rt_err_t rt_hwcrypto_bignum_import_bin(struct hw_bignum_mpi *n, rt_uint8_t *buf, int len)
{ int cp_len, i, j; void *temp_p; if (n == RT_NULL || buf == RT_NULL) { return 0; } if (n->total < len) { temp_p = rt_malloc(len); if (temp_p == RT_NULL) { return 0; } rt_memset(temp_p, 0, len); rt_free(n->p); n->p =...
pikasTech/PikaPython
C++
MIT License
1,403
/* This function checks whether the HOST IF is enabled for command operation and also checks whether the previous command is completed. It busy waits in case of previous command is not completed. */
static s32 e1000_mng_enable_host_if(struct e1000_hw *hw)
/* This function checks whether the HOST IF is enabled for command operation and also checks whether the previous command is completed. It busy waits in case of previous command is not completed. */ static s32 e1000_mng_enable_host_if(struct e1000_hw *hw)
{ u32 hicr; u8 i; hicr = er32(HICR); if ((hicr & E1000_HICR_EN) == 0) { e_dbg("E1000_HOST_EN bit disabled.\n"); return -E1000_ERR_HOST_INTERFACE_COMMAND; } for (i = 0; i < E1000_MNG_DHCP_COMMAND_TIMEOUT; i++) { hicr = er32(HICR); if (!(hicr & E1000_HICR_C)) break; mdelay(1); } if (i == E1000_MNG_DH...
robutest/uclinux
C++
GPL-2.0
60
/* Control frame filtering configuration is indicated by one of the following values which may be extracted from the returned value using the mask */
uint32_t EMACFrameFilterGet(uint32_t ui32Base)
/* Control frame filtering configuration is indicated by one of the following values which may be extracted from the returned value using the mask */ uint32_t EMACFrameFilterGet(uint32_t ui32Base)
{ return(HWREG(ui32Base + EMAC_O_FRAMEFLTR) & VALID_FRMFILTER_FLAGS); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This API reads acceleration data Y values of 8bit resolution from location 05h. */
BMA2x2_RETURN_FUNCTION_TYPE bma2x2_read_accel_eight_resolution_y(s8 *accel_y_s8)
/* This API reads acceleration data Y values of 8bit resolution from location 05h. */ BMA2x2_RETURN_FUNCTION_TYPE bma2x2_read_accel_eight_resolution_y(s8 *accel_y_s8)
{ BMA2x2_RETURN_FUNCTION_TYPE com_rslt = ERROR; u8 data = BMA2x2_INIT_VALUE; if (p_bma2x2 == BMA2x2_NULL) { return E_BMA2x2_NULL_PTR; } else { com_rslt = p_bma2x2->BMA2x2_BUS_READ_FUNC (p_bma2x2->dev_addr, BMA2x2_Y_AXIS_MSB_ADDR, &data,...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This routine is invoked to allocate the driver's active sgl memory. This array will hold the sglq_entry's for active IOs. */
static int lpfc_init_active_sgl_array(struct lpfc_hba *)
/* This routine is invoked to allocate the driver's active sgl memory. This array will hold the sglq_entry's for active IOs. */ static int lpfc_init_active_sgl_array(struct lpfc_hba *)
{ int size; size = sizeof(struct lpfc_sglq *); size *= phba->sli4_hba.max_cfg_param.max_xri; phba->sli4_hba.lpfc_sglq_active_list = kzalloc(size, GFP_KERNEL); if (!phba->sli4_hba.lpfc_sglq_active_list) return -ENOMEM; return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Initialize *LOC to "nowhere", push it onto the location stack. The top of that stack is the current location. Needs a matching loc_pop(). Return LOC. */
Location* loc_push_none(Location *loc)
/* Initialize *LOC to "nowhere", push it onto the location stack. The top of that stack is the current location. Needs a matching loc_pop(). Return LOC. */ Location* loc_push_none(Location *loc)
{ loc->kind = LOC_NONE; loc->prev = NULL; return loc_push_restore(loc); }
ve3wwg/teensy3_qemu
C++
Other
15
/* More details for reference count strategy can refer to the API description for */
EFI_STATUS EFIAPI JsonArrayRemoveValue(IN EDKII_JSON_ARRAY JsonArray, IN UINTN Index)
/* More details for reference count strategy can refer to the API description for */ EFI_STATUS EFIAPI JsonArrayRemoveValue(IN EDKII_JSON_ARRAY JsonArray, IN UINTN Index)
{ if (json_array_remove ((json_t *)JsonArray, Index) != 0) { return EFI_ABORTED; } else { return EFI_SUCCESS; } }
tianocore/edk2
C++
Other
4,240
/* activate/deactivate link with host; minimize power usage for inactive links by cutting clocks and transceiver power. */
static void pullup(struct at91_udc *udc, int is_on)
/* activate/deactivate link with host; minimize power usage for inactive links by cutting clocks and transceiver power. */ static void pullup(struct at91_udc *udc, int is_on)
{ if (!udc->enabled || !udc->vbus) is_on = 0; DBG("%sactive\n", is_on ? "" : "in"); if (is_on) { clk_on(udc); at91_udp_write(udc, AT91_UDP_ICR, AT91_UDP_RXRSM); at91_udp_write(udc, AT91_UDP_TXVC, 0); } else { stop_activity(udc); at91_udp_write(udc, AT91_UDP_IDR, AT91_UDP_RXRSM); at91_udp_write(udc, AT...
4ms/stm32mp1-baremetal
C++
Other
137
/* This function will attempt to read BufferSize bytes from the TLS object and places the data in Buffer. */
INTN EFIAPI TlsCtrlTrafficOut(IN VOID *Tls, IN OUT VOID *Buffer, IN UINTN BufferSize)
/* This function will attempt to read BufferSize bytes from the TLS object and places the data in Buffer. */ INTN EFIAPI TlsCtrlTrafficOut(IN VOID *Tls, IN OUT VOID *Buffer, IN UINTN BufferSize)
{ CALL_CRYPTO_SERVICE (TlsCtrlTrafficOut, (Tls, Buffer, BufferSize), 0); }
tianocore/edk2
C++
Other
4,240
/* Resets the TC module. Resets the TC module, restoring all hardware module registers to their default values and disabling the module. The TC module will not be accessible while the reset is being performed. */
enum status_code tc_reset(const struct tc_module *const module_inst)
/* Resets the TC module. Resets the TC module, restoring all hardware module registers to their default values and disabling the module. The TC module will not be accessible while the reset is being performed. */ enum status_code tc_reset(const struct tc_module *const module_inst)
{ Assert(module_inst); Assert(module_inst->hw); TcCount8 *const tc_module = &(module_inst->hw->COUNT8); if (tc_module->STATUS.reg & TC_STATUS_SLAVE) { return STATUS_ERR_UNSUPPORTED_DEV; } if (tc_module->CTRLA.reg & TC_CTRLA_ENABLE) { tc_disable(module_inst); while (tc_is_syncing(module_inst)) { } } tc_m...
memfault/zero-to-main
C++
null
200
/* Subdissector for the ZigBee specific TX Power IE (information element) */
static void dissect_ieee802154_zigbee_txpower(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint *offset)
/* Subdissector for the ZigBee specific TX Power IE (information element) */ static void dissect_ieee802154_zigbee_txpower(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint *offset)
{ gint32 txpower; txpower = (char)tvb_get_guint8(tvb, *offset); proto_tree_add_item_ret_int(tree, hf_ieee802154_zigbee_ie_tx_power, tvb, *offset, 1, ENC_NA, &txpower); proto_item_append_text(tree, ", TX Power %d dBm", txpower); *offset += 1; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Store a partial block of iplan2 data after c2p conversion */
static void store_iplan2_masked(void *dst, u32 bpp, u32 d[4], u32 mask)
/* Store a partial block of iplan2 data after c2p conversion */ static void store_iplan2_masked(void *dst, u32 bpp, u32 d[4], u32 mask)
{ int i; for (i = 0; i < bpp/2; i++, dst += 4) put_unaligned_be32(comp(d[perm_c2p_16x8[i]], get_unaligned_be32(dst), mask), dst); }
robutest/uclinux
C++
GPL-2.0
60
/* A typical O/EHCI will stop operating, set itself into error state (which can be queried by MMIO) and will set PERR in its config space to signal that it got an error */
static void ohci_die(OHCIState *ohci)
/* A typical O/EHCI will stop operating, set itself into error state (which can be queried by MMIO) and will set PERR in its config space to signal that it got an error */ static void ohci_die(OHCIState *ohci)
{ OHCIPCIState *dev = container_of(ohci, OHCIPCIState, state); fprintf(stderr, "%s: DMA error\n", __func__); ohci_set_interrupt(ohci, OHCI_INTR_UE); ohci_bus_stop(ohci); pci_set_word(dev->parent_obj.config + PCI_STATUS, PCI_STATUS_DETECTED_PARITY); }
ve3wwg/teensy3_qemu
C++
Other
15
/* If the security protocol command completes without an error, the function shall return EFI_SUCCESS. If the security protocol command completes with an error, the function shall return EFI_DEVICE_ERROR. */
EFI_STATUS EFIAPI NvmeStorageSecurityReceiveData(IN EDKII_PEI_STORAGE_SECURITY_CMD_PPI *This, IN UINTN DeviceIndex, IN UINT64 Timeout, IN UINT8 SecurityProtocolId, IN UINT16 SecurityProtocolSpecificData, IN UINTN PayloadBufferSize, OUT VOID *PayloadBuffer, OUT UINTN *PayloadTransferSize)
/* If the security protocol command completes without an error, the function shall return EFI_SUCCESS. If the security protocol command completes with an error, the function shall return EFI_DEVICE_ERROR. */ EFI_STATUS EFIAPI NvmeStorageSecurityReceiveData(IN EDKII_PEI_STORAGE_SECURITY_CMD_PPI *This, IN UINTN DeviceInd...
{ PEI_NVME_CONTROLLER_PRIVATE_DATA *Private; EFI_STATUS Status; if ((PayloadBuffer == NULL) || (PayloadTransferSize == NULL) || (PayloadBufferSize == 0)) { return EFI_INVALID_PARAMETER; } Private = GET_NVME_PEIM_HC_PRIVATE_DATA_FROM_THIS_STROAGE_SECURITY (This); Status = TrustTra...
tianocore/edk2
C++
Other
4,240
/* returns the number of ELS/CT IOCBs to reserve */
int lpfc_sli4_get_els_iocb_cnt(struct lpfc_hba *phba)
/* returns the number of ELS/CT IOCBs to reserve */ int lpfc_sli4_get_els_iocb_cnt(struct lpfc_hba *phba)
{ int max_xri = phba->sli4_hba.max_cfg_param.max_xri; if (phba->sli_rev == LPFC_SLI_REV4) { if (max_xri <= 100) return 10; else if (max_xri <= 256) return 25; else if (max_xri <= 512) return 50; else if (max_xri <= 1024) return 100; else return 150; } else return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Return a pointer to the n-th record in the btree block. */
STATIC union xfs_btree_rec* xfs_btree_rec_addr(struct xfs_btree_cur *cur, int n, struct xfs_btree_block *block)
/* Return a pointer to the n-th record in the btree block. */ STATIC union xfs_btree_rec* xfs_btree_rec_addr(struct xfs_btree_cur *cur, int n, struct xfs_btree_block *block)
{ return (union xfs_btree_rec *) ((char *)block + xfs_btree_rec_offset(cur, n)); }
robutest/uclinux
C++
GPL-2.0
60
/* Update interrupt register. The status depends on command. */
static void onenand_update_interrupt(struct onenand_chip *this, int cmd)
/* Update interrupt register. The status depends on command. */ static void onenand_update_interrupt(struct onenand_chip *this, int cmd)
{ int interrupt = ONENAND_INT_MASTER; switch (cmd) { case ONENAND_CMD_READ: case ONENAND_CMD_READOOB: interrupt |= ONENAND_INT_READ; break; case ONENAND_CMD_PROG: case ONENAND_CMD_PROGOOB: interrupt |= ONENAND_INT_WRITE; break; case ONENAND_CMD_ERASE: interrupt |= ONENAND_INT_ERASE; break; case ONEN...
robutest/uclinux
C++
GPL-2.0
60
/* Note: the tidaw-list is assumed to be contiguous with no ttics. The caller must ensure that there is enough space for the new tidaw. The last-tidaw flag for the last tidaw in the list will be set by tcw_finalize. */
struct tidaw* tcw_add_tidaw(struct tcw *tcw, int num_tidaws, u8 flags, void *addr, u32 count)
/* Note: the tidaw-list is assumed to be contiguous with no ttics. The caller must ensure that there is enough space for the new tidaw. The last-tidaw flag for the last tidaw in the list will be set by tcw_finalize. */ struct tidaw* tcw_add_tidaw(struct tcw *tcw, int num_tidaws, u8 flags, void *addr, u32 count)
{ struct tidaw *tidaw; tidaw = ((struct tidaw *) tcw_get_data(tcw)) + num_tidaws; memset(tidaw, 0, sizeof(struct tidaw)); tidaw->flags = flags; tidaw->count = count; tidaw->addr = (u64) ((addr_t) addr); return tidaw; }
robutest/uclinux
C++
GPL-2.0
60
/* This function is used to enable touch sensor's irq. */
int tls_touchsensor_irq_enable(u32 sensorno)
/* This function is used to enable touch sensor's irq. */ int tls_touchsensor_irq_enable(u32 sensorno)
{ u32 value = 0; if (sensorno && (sensorno <= 15)) { value = tls_reg_read32(HR_TC_INT_EN); value |= (1<<(sensorno+15)); tls_reg_write32(HR_TC_INT_EN, value); tls_irq_enable(TOUCH_IRQn); return 0; } return -1; }
Nicholas3388/LuaNode
C++
Other
1,055
/* param base FlexCAN peripheral base address. param handle FlexCAN handle pointer. */
void FLEXCAN_TransferAbortReceiveFifo(CAN_Type *base, flexcan_handle_t *handle)
/* param base FlexCAN peripheral base address. param handle FlexCAN handle pointer. */ void FLEXCAN_TransferAbortReceiveFifo(CAN_Type *base, flexcan_handle_t *handle)
{ assert(handle); if (base->MCR & CAN_MCR_RFEN_MASK) { FLEXCAN_DisableMbInterrupts( base, kFLEXCAN_RxFifoOverflowFlag | kFLEXCAN_RxFifoWarningFlag | kFLEXCAN_RxFifoFrameAvlFlag); handle->rxFifoFrameBuf = 0x0; } handle->rxFifoState = kFLEXCAN_StateIdle; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Unregisters an interrupt handler for the CAN controller. */
void CANIntUnregister(unsigned long ulBase)
/* Unregisters an interrupt handler for the CAN controller. */ void CANIntUnregister(unsigned long ulBase)
{ unsigned long ulIntNumber; ASSERT(CANBaseValid(ulBase)); ulIntNumber = CANIntNumberGet(ulBase); IntDisable(ulIntNumber); IntUnregister(ulIntNumber); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* @wm831x: Device to write to. @reg: Register to write to. @val: Value to write. */
int wm831x_reg_write(struct wm831x *wm831x, unsigned short reg, unsigned short val)
/* @wm831x: Device to write to. @reg: Register to write to. @val: Value to write. */ int wm831x_reg_write(struct wm831x *wm831x, unsigned short reg, unsigned short val)
{ int ret; mutex_lock(&wm831x->io_lock); ret = wm831x_write(wm831x, reg, 2, &val); mutex_unlock(&wm831x->io_lock); return ret; }
robutest/uclinux
C++
GPL-2.0
60
/* This FILTER_FUNCTION checks if a handle corresponds to a Virtio RNG device at the VIRTIO_DEVICE_PROTOCOL level. */
STATIC BOOLEAN EFIAPI IsVirtioRng(IN EFI_HANDLE Handle, IN CONST CHAR16 *ReportText)
/* This FILTER_FUNCTION checks if a handle corresponds to a Virtio RNG device at the VIRTIO_DEVICE_PROTOCOL level. */ STATIC BOOLEAN EFIAPI IsVirtioRng(IN EFI_HANDLE Handle, IN CONST CHAR16 *ReportText)
{ return IsVirtio (Handle, ReportText, VIRTIO_SUBSYSTEM_ENTROPY_SOURCE); }
tianocore/edk2
C++
Other
4,240
/* OS entry point to allow for host driver to free allocated memory Called if no device present or device being unloaded */
static void mptfc_target_destroy(struct scsi_target *starget)
/* OS entry point to allow for host driver to free allocated memory Called if no device present or device being unloaded */ static void mptfc_target_destroy(struct scsi_target *starget)
{ struct fc_rport *rport; struct mptfc_rport_info *ri; rport = starget_to_rport(starget); if (rport) { ri = *((struct mptfc_rport_info **)rport->dd_data); if (ri) ri->starget = NULL; } if (starget->hostdata) kfree(starget->hostdata); starget->hostdata = NULL; }
robutest/uclinux
C++
GPL-2.0
60
/* Get clock time specified by clock_id. See IEEE 1003.1 */
int z_impl___posix_clock_get_base(clockid_t clock_id, struct timespec *base)
/* Get clock time specified by clock_id. See IEEE 1003.1 */ int z_impl___posix_clock_get_base(clockid_t clock_id, struct timespec *base)
{ switch (clock_id) { case CLOCK_MONOTONIC: base->tv_sec = 0; base->tv_nsec = 0; break; case CLOCK_REALTIME: K_SPINLOCK(&rt_clock_base_lock) { *base = rt_clock_base; } break; default: errno = EINVAL; return -1; } return 0; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Set write enable latch with Write Enable command. Returns negative if error occurred. */
static int write_enable(struct spi_nor *nor)
/* Set write enable latch with Write Enable command. Returns negative if error occurred. */ static int write_enable(struct spi_nor *nor)
{ return spi_nor_write_reg(nor, SPINOR_OP_WREN, NULL, 0); }
4ms/stm32mp1-baremetal
C++
Other
137
/* If String is not NULL and not aligned on a 16-bit boundary, then ASSERT(). If FormatString is NULL, then ASSERT(). If FormatString is not aligned on a 16-bit boundary, then ASSERT(). */
CHAR16* EFIAPI CatVSPrint(IN CHAR16 *String OPTIONAL, IN CONST CHAR16 *FormatString, IN VA_LIST Marker)
/* If String is not NULL and not aligned on a 16-bit boundary, then ASSERT(). If FormatString is NULL, then ASSERT(). If FormatString is not aligned on a 16-bit boundary, then ASSERT(). */ CHAR16* EFIAPI CatVSPrint(IN CHAR16 *String OPTIONAL, IN CONST CHAR16 *FormatString, IN VA_LIST Marker)
{ UINTN CharactersRequired; UINTN SizeRequired; CHAR16 *BufferToReturn; VA_LIST ExtraMarker; VA_COPY (ExtraMarker, Marker); CharactersRequired = SPrintLength (FormatString, ExtraMarker); VA_END (ExtraMarker); if (String != NULL) { SizeRequired = StrSize (String) + (CharactersRequired * size...
tianocore/edk2
C++
Other
4,240
/* If the timer has already been set, it ignores the new request. This function MUST be called within a section locking the segment semaphore. */
static void nilfs_segctor_start_timer(struct nilfs_sc_info *)
/* If the timer has already been set, it ignores the new request. This function MUST be called within a section locking the segment semaphore. */ static void nilfs_segctor_start_timer(struct nilfs_sc_info *)
{ spin_lock(&sci->sc_state_lock); if (sci->sc_timer && !(sci->sc_state & NILFS_SEGCTOR_COMMIT)) { sci->sc_timer->expires = jiffies + sci->sc_interval; add_timer(sci->sc_timer); sci->sc_state |= NILFS_SEGCTOR_COMMIT; } spin_unlock(&sci->sc_state_lock); }
robutest/uclinux
C++
GPL-2.0
60
/* Returns: a new #GNode containing the same data pointers */
GNode* g_node_copy(GNode *node)
/* Returns: a new #GNode containing the same data pointers */ GNode* g_node_copy(GNode *node)
{ GNode *new_node = NULL; if (node) { GNode *child; new_node = g_node_new (node->data); for (child = g_node_last_child (node); child; child = child->prev) g_node_prepend (new_node, g_node_copy (child)); } return new_node; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Get the enable status of the Si1147 interrupt pin. */
int Si1147_GetInterruptOutputEnable(I2C_TypeDef *i2c, uint8_t addr, int *enable)
/* Get the enable status of the Si1147 interrupt pin. */ int Si1147_GetInterruptOutputEnable(I2C_TypeDef *i2c, uint8_t addr, int *enable)
{ int retval = 0; si114x_handle->addr = addr; si114x_handle->i2c = i2c; *enable = Si114xReadFromRegister(si114x_handle, REG_INT_CFG); return retval; }
remotemcu/remcu-chip-sdks
C++
null
436
/* 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 Vector55_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 Vector55_handler(void)
{ asm { LDX(VCT_USER_PROGRAM_VECTOR_TABLE_STARTADDR + (55 * 2)) JMP 0,X } }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Disable Off-State in Run Mode. Disables the off-state in run mode for the break function of an advanced timer in which the complementary outputs have been configured. It has no effect if no complementary output is present. When the capture-compare output is disabled, the output is also disabled. */
void timer_set_disabled_off_state_in_run_mode(uint32_t timer_peripheral)
/* Disable Off-State in Run Mode. Disables the off-state in run mode for the break function of an advanced timer in which the complementary outputs have been configured. It has no effect if no complementary output is present. When the capture-compare output is disabled, the output is also disabled. */ void timer_set_d...
{ TIM_BDTR(timer_peripheral) &= ~TIM_BDTR_OSSR; }
libopencm3/libopencm3
C++
GNU General Public License v3.0
2,931
/* Drain pages out of the cpu's pagevecs. Either "cpu" is the current CPU, and preemption has already been disabled; or "cpu" is being hot-unplugged, and is already dead. */
static void drain_cpu_pagevecs(int cpu)
/* Drain pages out of the cpu's pagevecs. Either "cpu" is the current CPU, and preemption has already been disabled; or "cpu" is being hot-unplugged, and is already dead. */ static void drain_cpu_pagevecs(int cpu)
{ struct pagevec *pvecs = per_cpu(lru_add_pvecs, cpu); struct pagevec *pvec; int lru; for_each_lru(lru) { pvec = &pvecs[lru - LRU_BASE]; if (pagevec_count(pvec)) ____pagevec_lru_add(pvec, lru); } pvec = &per_cpu(lru_rotate_pvecs, cpu); if (pagevec_count(pvec)) { unsigned long flags; local_irq_save(fla...
robutest/uclinux
C++
GPL-2.0
60
/* this function is a POSIX compliant version, which will make a directory */
int mkdir(const char *path, mode_t mode)
/* this function is a POSIX compliant version, which will make a directory */ int mkdir(const char *path, mode_t mode)
{ int fd; struct dfs_fd *d; int result; fd = fd_new(); if (fd == -1) { rt_set_errno(-ENOMEM); return -1; } d = fd_get(fd); result = dfs_file_open(d, path, O_DIRECTORY | O_CREAT); if (result < 0) { fd_put(d); fd_put(d); rt_set_errno(resu...
pikasTech/PikaPython
C++
MIT License
1,403
/* We really shouldn't be doing this unless there is a */
static u32 add_byte(u32 **p_buffer, u8 value, u32 *used, u32 *avail)
/* We really shouldn't be doing this unless there is a */ static u32 add_byte(u32 **p_buffer, u8 value, u32 *used, u32 *avail)
{ u8 **tByte; if ((*used + 1) > *avail) return(1); *((u8*)*p_buffer) = value; tByte = (u8**)p_buffer; (*tByte)++; *used+=1; return(0); }
robutest/uclinux
C++
GPL-2.0
60
/* Setups the link between PHY and MAC and returns the status of connection. */
int32_t MSS_MAC_auto_setup_link(void)
/* Setups the link between PHY and MAC and returns the status of connection. */ int32_t MSS_MAC_auto_setup_link(void)
{ int32_t link; PHY_auto_negotiate(); link = MSS_MAC_link_status(); if( (link & MSS_MAC_LINK_STATUS_LINK) != 0u ) { int32_t ret; ret = MAC_stop_transmission(); MAC_CHECK( ret == MAC_OK, ret ); ret = MAC_stop_receiving(); MAC_CHECK( ret == MAC_OK, ret ); MAC_BITBAND->CSR6_TT...
apopple/Pandaboard-FreeRTOS
C++
null
25
/* Create a new line and append it to the line list. Fields affected: NumLines Lines */
HEFI_EDITOR_LINE* HBufferImageCreateLine(VOID)
/* Create a new line and append it to the line list. Fields affected: NumLines Lines */ HEFI_EDITOR_LINE* HBufferImageCreateLine(VOID)
{ HEFI_EDITOR_LINE *Line; Line = AllocateZeroPool (sizeof (HEFI_EDITOR_LINE)); if (Line == NULL) { return NULL; } Line->Signature = EFI_EDITOR_LINE_LIST; Line->Size = 0; HBufferImage.NumLines++; InsertTailList (HBufferImage.ListHead, &Line->Link); if (HBufferImage.Lines == NULL) { HBuffe...
tianocore/edk2
C++
Other
4,240
/* The PWMB default IRQ, declared in StartUp code. */
void PWM1CH0_IRQHandler(void)
/* The PWMB default IRQ, declared in StartUp code. */ void PWM1CH0_IRQHandler(void)
{ unsigned long ulPWMStastus; unsigned long ulBase = PWMB_BASE; ulPWMStastus = xHWREG(ulBase + PWM_INTSTS) & 0x01010101; xHWREG(ulBase + PWM_INTSTS) = ulPWMStastus; if (g_pfnPWMHandlerCallbacks[0] != 0) { if(ulPWMStastus & 0x0101) { g_pfnPWMHandlerCallbacks[1](0, PWM_...
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* The index into the key table for this PTK is the same as the device's port index. */
int whc_set_ptk(struct wusbhc *wusbhc, u8 port_idx, u32 tkid, const void *ptk, size_t key_size)
/* The index into the key table for this PTK is the same as the device's port index. */ int whc_set_ptk(struct wusbhc *wusbhc, u8 port_idx, u32 tkid, const void *ptk, size_t key_size)
{ struct whc *whc = wusbhc_to_whc(wusbhc); struct di_buf_entry *di = &whc->di_buf[port_idx]; int ret; mutex_lock(&whc->mutex); if (ptk) { ret = whc_set_key(whc, port_idx, tkid, ptk, key_size, false); if (ret) goto out; di->addr_sec_info &= ~WHC_DI_KEY_IDX_MASK; di->addr_sec_info |= WHC_DI_SECURE | WHC_D...
robutest/uclinux
C++
GPL-2.0
60
/* Return the scb from the head of the free list. NULL if there are none available. */
static scb_t* megaraid_alloc_scb(adapter_t *adapter, struct scsi_cmnd *scp)
/* Return the scb from the head of the free list. NULL if there are none available. */ static scb_t* megaraid_alloc_scb(adapter_t *adapter, struct scsi_cmnd *scp)
{ struct list_head *head = &adapter->kscb_pool; scb_t *scb = NULL; unsigned long flags; spin_lock_irqsave(SCSI_FREE_LIST_LOCK(adapter), flags); if (list_empty(head)) { spin_unlock_irqrestore(SCSI_FREE_LIST_LOCK(adapter), flags); return NULL; } scb = list_entry(head->next, scb_t, list); list_del_init(&scb...
robutest/uclinux
C++
GPL-2.0
60
/* MTD methods which simply translate the effective address and pass through to the */
static int part_read(struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf)
/* MTD methods which simply translate the effective address and pass through to the */ static int part_read(struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf)
{ struct mtd_ecc_stats stats; int res; stats = mtd->parent->ecc_stats; res = mtd->parent->_read(mtd->parent, from + mtd->offset, len, retlen, buf); if (unlikely(mtd_is_eccerr(res))) mtd->ecc_stats.failed += mtd->parent->ecc_stats.failed - stats.failed; else mtd->ecc_stats.corrected += mtd->parent->...
4ms/stm32mp1-baremetal
C++
Other
137
/* This function will be called when the adapter is removed from the USB bus. */
static void disconnect_st5481(struct usb_interface *intf)
/* This function will be called when the adapter is removed from the USB bus. */ static void disconnect_st5481(struct usb_interface *intf)
{ struct st5481_adapter *adapter = usb_get_intfdata(intf); DBG(1,""); usb_set_intfdata(intf, NULL); if (!adapter) return; list_del(&adapter->list); st5481_stop(adapter); st5481_release_b(&adapter->bcs[1]); st5481_release_b(&adapter->bcs[0]); st5481_release_d(adapter); mdelay(2); st5481_release_usb(adapter)...
robutest/uclinux
C++
GPL-2.0
60
/* This is the code that gets called on processor reset. To initialize the device, and call the main() routine. */
void Reset_Handler(void)
/* This is the code that gets called on processor reset. To initialize the device, and call the main() routine. */ void Reset_Handler(void)
{ uint32_t *pSrc, *pDest; pSrc = &_etext; pDest = &_srelocate; if (pSrc != pDest) { for (; pDest < &_erelocate;) { *pDest++ = *pSrc++; } } for (pDest = &_szero; pDest < &_ezero;) { *pDest++ = 0; ...
memfault/zero-to-main
C++
null
200
/* We're now finished for good with this ioend structure. Update the page state via the associated buffer_heads, release holds on the inode and bio, and finally free up memory. Do not use the ioend after this. */
STATIC void xfs_destroy_ioend(xfs_ioend_t *ioend)
/* We're now finished for good with this ioend structure. Update the page state via the associated buffer_heads, release holds on the inode and bio, and finally free up memory. Do not use the ioend after this. */ STATIC void xfs_destroy_ioend(xfs_ioend_t *ioend)
{ struct buffer_head *bh, *next; struct xfs_inode *ip = XFS_I(ioend->io_inode); for (bh = ioend->io_buffer_head; bh; bh = next) { next = bh->b_private; bh->b_end_io(bh, !ioend->io_error); } if (unlikely(ioend->io_error == -ENODEV)) { xfs_do_force_shutdown(ip->i_mount, SHUTDOWN_DEVICE_REQ, __FILE__,...
robutest/uclinux
C++
GPL-2.0
60
/* Starts all the other tasks, then starts the scheduler. */
int main(void)
/* Starts all the other tasks, then starts the scheduler. */ int main(void)
{ prvSetupHardware(); xTaskCreate( vuIP_Task, "uIP", mainUIP_TASK_STACK_SIZE, NULL, mainUIP_PRIORITY, NULL ); vStartUSBTask( mainUSB_PRIORITY ); vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY ); vCreateBlockTimeTasks(); vStartLEDFlashTasks( mainFLASH_PRIORITY ); vStartGenericQueueTasks( mainGEN_QU...
apopple/Pandaboard-FreeRTOS
C++
null
25