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
/* scc_pata_prereset - prepare for reset @ap: ATA port to be reset @deadline: deadline jiffies for the operation */
static int scc_pata_prereset(struct ata_link *link, unsigned long deadline)
/* scc_pata_prereset - prepare for reset @ap: ATA port to be reset @deadline: deadline jiffies for the operation */ static int scc_pata_prereset(struct ata_link *link, unsigned long deadline)
{ link->ap->cbl = ATA_CBL_PATA80; return ata_sff_prereset(link, deadline); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* megasas_bios_param - Returns disk geometry for a disk @sdev: device handle @bdev: block device @capacity: drive capacity @geom: geometry parameters */
static int megasas_bios_param(struct scsi_device *sdev, struct block_device *bdev, sector_t capacity, int geom[])
/* megasas_bios_param - Returns disk geometry for a disk @sdev: device handle @bdev: block device @capacity: drive capacity @geom: geometry parameters */ static int megasas_bios_param(struct scsi_device *sdev, struct block_device *bdev, sector_t capacity, int geom[])
{ int heads; int sectors; sector_t cylinders; unsigned long tmp; heads = 64; sectors = 32; tmp = heads * sectors; cylinders = capacity; sector_div(cylinders, tmp); if (capacity >= 0x200000) { heads = 255; sectors = 63; tmp = heads*sectors; cylinders = capacity; sector_div(cylinders, tmp); } geom[0] = heads; geom[1] = sectors; geom[2] = cylinders; return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* tipc_named_withdraw - tell other nodes about a withdrawn publication by this node */
void tipc_named_withdraw(struct publication *publ)
/* tipc_named_withdraw - tell other nodes about a withdrawn publication by this node */ void tipc_named_withdraw(struct publication *publ)
{ struct sk_buff *buf; struct distr_item *item; list_del(&publ->local_list); publ_cnt--; buf = named_prepare_buf(WITHDRAWAL, ITEM_SIZE, 0); if (!buf) { warn("Withdrawl distribution failure\n"); return; } item = (struct distr_item *)msg_data(buf_msg(buf)); publ_to_item(item, publ); dbg("tipc_named_withdraw: broadcasting withdraw msg\n"); tipc_cltr_broadcast(buf); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Initializes the USARTx peripheral Clock according to the specified parameters in the USART_ClockInitStruct. */
void USART_ClockInit(USART_TypeDef *USARTx, USART_ClockInitTypeDef *USART_ClockInitStruct)
/* Initializes the USARTx peripheral Clock according to the specified parameters in the USART_ClockInitStruct. */ void USART_ClockInit(USART_TypeDef *USARTx, USART_ClockInitTypeDef *USART_ClockInitStruct)
{ uint32_t tmpreg = 0; assert_param(IS_USART_ALL_PERIPH(USARTx)); assert_param(IS_USART_CLOCK(USART_ClockInitStruct->USART_Clock)); assert_param(IS_USART_CPOL(USART_ClockInitStruct->USART_CPOL)); assert_param(IS_USART_CPHA(USART_ClockInitStruct->USART_CPHA)); assert_param(IS_USART_LASTBIT(USART_ClockInitStruct->USART_LastBit)); tmpreg = USARTx->CR2; tmpreg &= (uint32_t)~((uint32_t)CR2_CLOCK_CLEAR_MASK); tmpreg |= (uint32_t)(USART_ClockInitStruct->USART_Clock | USART_ClockInitStruct->USART_CPOL | USART_ClockInitStruct->USART_CPHA | USART_ClockInitStruct->USART_LastBit); USARTx->CR2 = tmpreg; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Rules: you can only create a cgroup if */
static struct cgroup_subsys_state* ns_create(struct cgroup_subsys *ss, struct cgroup *cgroup)
/* Rules: you can only create a cgroup if */ static struct cgroup_subsys_state* ns_create(struct cgroup_subsys *ss, struct cgroup *cgroup)
{ struct ns_cgroup *ns_cgroup; if (!capable(CAP_SYS_ADMIN)) return ERR_PTR(-EPERM); if (!cgroup_is_descendant(cgroup, current)) return ERR_PTR(-EPERM); ns_cgroup = kzalloc(sizeof(*ns_cgroup), GFP_KERNEL); if (!ns_cgroup) return ERR_PTR(-ENOMEM); return &ns_cgroup->css; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Find the first occurrence of find in s. */
char* strstr(const char *s, const char *find)
/* Find the first occurrence of find in s. */ char* strstr(const char *s, const char *find)
{ char c, sc; size_t len; c = *find++; if (c != 0) { len = strlen(find); do { do { sc = *s++; if (sc == 0) { return NULL; } } while (sc != c); } while (strncmp(s, find, len) != 0); s--; } return (char *)s; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Converts NRFX return codes to the zephyr ones. */
static int qspi_get_zephyr_ret_code(nrfx_err_t res)
/* Converts NRFX return codes to the zephyr ones. */ static int qspi_get_zephyr_ret_code(nrfx_err_t res)
{ switch (res) { case NRFX_SUCCESS: return 0; case NRFX_ERROR_INVALID_PARAM: case NRFX_ERROR_INVALID_ADDR: return -EINVAL; case NRFX_ERROR_INVALID_STATE: return -ECANCELED; case NRFX_ERROR_BUSY: case NRFX_ERROR_TIMEOUT: default: return -EBUSY; } }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* returns: the targeted node offset in the base device tree Negative error code on error */
static int overlay_get_target(const void *fdt, const void *fdto, int fragment, char const **pathp)
/* returns: the targeted node offset in the base device tree Negative error code on error */ static int overlay_get_target(const void *fdt, const void *fdto, int fragment, char const **pathp)
{ uint32_t phandle; const char *path = NULL; int path_len = 0, ret; phandle = overlay_get_target_phandle(fdto, fragment); if (phandle == (uint32_t)-1) return -FDT_ERR_BADPHANDLE; if (!phandle) { path = fdt_getprop(fdto, fragment, "target-path", &path_len); if (path) ret = fdt_path_offset(fdt, path); else ret = path_len; } else ret = fdt_node_offset_by_phandle(fdt, phandle); if (ret < 0 && path_len == -FDT_ERR_NOTFOUND) ret = -FDT_ERR_BADOVERLAY; if (ret < 0) return ret; if (pathp) *pathp = path ? path : NULL; return ret; }
4ms/stm32mp1-baremetal
C++
Other
137
/* This function will set network interface device active internet status. @NOTE it can only be called in the network interface device driver. */
void netdev_low_level_set_internet_status(struct netdev *netdev, rt_bool_t is_up)
/* This function will set network interface device active internet status. @NOTE it can only be called in the network interface device driver. */ void netdev_low_level_set_internet_status(struct netdev *netdev, rt_bool_t is_up)
{ if (netdev && netdev_is_internet_up(netdev) != is_up) { if (is_up) { netdev->flags |= NETDEV_FLAG_INTERNET_UP; } else { netdev->flags &= ~NETDEV_FLAG_INTERNET_UP; } if (netdev->status_callback) { netdev->status_callback(netdev, is_up ? NETDEV_CB_STATUS_INTERNET_UP : NETDEV_CB_STATUS_INTERNET_DOWN); } } }
pikasTech/PikaPython
C++
MIT License
1,403
/* Function for swapping bits in a 32 bit word for each byte individually. The bits are swapped as follows: */
static uint32_t bytewise_bitswap(uint32_t inp)
/* Function for swapping bits in a 32 bit word for each byte individually. The bits are swapped as follows: */ static uint32_t bytewise_bitswap(uint32_t inp)
{ return (swap_bits(inp >> 24) << 24) | (swap_bits(inp >> 16) << 16) | (swap_bits(inp >> 8) << 8) | (swap_bits(inp)); }
labapart/polymcu
C++
null
201
/* Parser a string to get a false value. If the first character after the value is different of '}' or ']' is set to '\0'. */
static char* falseValue(char *ptr, json_t *property)
/* Parser a string to get a false value. If the first character after the value is different of '}' or ']' is set to '\0'. */ static char* falseValue(char *ptr, json_t *property)
{ return primitiveValue(ptr, property, "false", JSON_BOOLEAN); }
Luos-io/luos_engine
C++
MIT License
496
/* Extracts the 12 bits, from a multicast address, to determine which bit-vector to set in the multicast table. The hardware uses 12 bits, from incoming rx multicast addresses, to determine the bit-vector to check in the MTA. Which of the 4 combination, of 12-bits, the hardware uses is set by the MO field of the MCSTCTRL. The MO field is set during initialization to mc_filter_type. */
static s32 ixgbe_mta_vector(struct ixgbe_hw *hw, u8 *mc_addr)
/* Extracts the 12 bits, from a multicast address, to determine which bit-vector to set in the multicast table. The hardware uses 12 bits, from incoming rx multicast addresses, to determine the bit-vector to check in the MTA. Which of the 4 combination, of 12-bits, the hardware uses is set by the MO field of the MCSTCTRL. The MO field is set during initialization to mc_filter_type. */ static s32 ixgbe_mta_vector(struct ixgbe_hw *hw, u8 *mc_addr)
{ u32 vector = 0; switch (hw->mac.mc_filter_type) { case 0: vector = ((mc_addr[4] >> 4) | (((u16)mc_addr[5]) << 4)); break; case 1: vector = ((mc_addr[4] >> 3) | (((u16)mc_addr[5]) << 5)); break; case 2: vector = ((mc_addr[4] >> 2) | (((u16)mc_addr[5]) << 6)); break; case 3: vector = ((mc_addr[4]) | (((u16)mc_addr[5]) << 8)); break; default: hw_dbg(hw, "MC filter type param set incorrectly\n"); break; } vector &= 0xFFF; return vector; }
robutest/uclinux
C++
GPL-2.0
60
/* Called very early, MMU is off, device-tree isn't unflattened */
static int __init mpc831x_rdb_probe(void)
/* Called very early, MMU is off, device-tree isn't unflattened */ static int __init mpc831x_rdb_probe(void)
{ unsigned long root = of_get_flat_dt_root(); return of_flat_dt_is_compatible(root, "MPC8313ERDB") || of_flat_dt_is_compatible(root, "fsl,mpc8315erdb"); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* PE_Send_Soft_Reset Entry State NOTE: Sender Response Timer is handled in super state. */
static void pe_send_soft_reset_entry(void *obj)
/* PE_Send_Soft_Reset Entry State NOTE: Sender Response Timer is handled in super state. */ static void pe_send_soft_reset_entry(void *obj)
{ struct policy_engine *pe = (struct policy_engine *)obj; const struct device *dev = pe->dev; LOG_INF("PE_SNK_Send_Soft_Reset"); prl_reset(dev); atomic_set_bit(pe->flags, PE_FLAGS_SEND_SOFT_RESET); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Transmit two 4-9 bit frames, or one 10-16 bit frame. Notice that possible parity/stop bits in asynchronous mode are not considered part of specified frame bit length. */
void USART_TxDouble(USART_TypeDef *usart, uint16_t data)
/* Transmit two 4-9 bit frames, or one 10-16 bit frame. Notice that possible parity/stop bits in asynchronous mode are not considered part of specified frame bit length. */ void USART_TxDouble(USART_TypeDef *usart, uint16_t data)
{ while (!(usart->STATUS & USART_STATUS_TXBL)) ; usart->TXDOUBLE = (uint32_t)data; }
feaser/openblt
C++
GNU General Public License v3.0
601
/* This routine modifies fcp_poll_timer field of @phba by cfg_poll_tmo. The default value of cfg_poll_tmo is 10 milliseconds. */
static __inline__ void lpfc_poll_rearm_timer(struct lpfc_hba *phba)
/* This routine modifies fcp_poll_timer field of @phba by cfg_poll_tmo. The default value of cfg_poll_tmo is 10 milliseconds. */ static __inline__ void lpfc_poll_rearm_timer(struct lpfc_hba *phba)
{ unsigned long poll_tmo_expires = (jiffies + msecs_to_jiffies(phba->cfg_poll_tmo)); if (phba->sli.ring[LPFC_FCP_RING].txcmplq_cnt) mod_timer(&phba->fcp_poll_timer, poll_tmo_expires); }
robutest/uclinux
C++
GPL-2.0
60
/* Enables or disables access to the RTC and backup registers. */
void PWR_RTCAccessCmd(FunctionalState NewState)
/* Enables or disables access to the RTC and backup registers. */ void PWR_RTCAccessCmd(FunctionalState NewState)
{ assert_param(IS_FUNCTIONAL_STATE(NewState)); *(__IO uint32_t *) CR_DBP_BB = (uint32_t)NewState; }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* Indicates the new alternate setting that the interface targetted by a SET_INTERFACE request should use. */
unsigned char USBInterfaceRequest_GetAlternateSetting(const USBGenericRequest *request)
/* Indicates the new alternate setting that the interface targetted by a SET_INTERFACE request should use. */ unsigned char USBInterfaceRequest_GetAlternateSetting(const USBGenericRequest *request)
{ return (USBGenericRequest_GetValue(request) & 0xFF); }
opentx/opentx
C++
GNU General Public License v2.0
2,025
/* Returns: (transfer full): a #GFile. Free the returned object with g_object_unref(). */
GFile* g_vfs_get_file_for_path(GVfs *vfs, const char *path)
/* Returns: (transfer full): a #GFile. Free the returned object with g_object_unref(). */ GFile* g_vfs_get_file_for_path(GVfs *vfs, const char *path)
{ GVfsClass *class; g_return_val_if_fail (G_IS_VFS (vfs), NULL); g_return_val_if_fail (path != NULL, NULL); class = G_VFS_GET_CLASS (vfs); return (* class->get_file_for_path) (vfs, path); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Check whether there are data in Transmit Holding Register or Transmit Shift Register in SPI master mode. */
uint32_t usart_spi_is_tx_empty(volatile avr32_usart_t *p_usart)
/* Check whether there are data in Transmit Holding Register or Transmit Shift Register in SPI master mode. */ uint32_t usart_spi_is_tx_empty(volatile avr32_usart_t *p_usart)
{ return usart_tx_empty(p_usart); }
memfault/zero-to-main
C++
null
200
/* This comparator searches for the next Endpoint descriptor inside the current interface descriptor, aborting the search if another interface descriptor is found before the required endpoint. */
uint8_t DComp_NextHIDInterfaceDataEndpoint(void *CurrentDescriptor)
/* This comparator searches for the next Endpoint descriptor inside the current interface descriptor, aborting the search if another interface descriptor is found before the required endpoint. */ uint8_t DComp_NextHIDInterfaceDataEndpoint(void *CurrentDescriptor)
{ USB_Descriptor_Header_t* Header = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Header_t); if (Header->Type == DTYPE_Endpoint) { return DESCRIPTOR_SEARCH_Found; } else if (Header->Type == DTYPE_Interface) { return DESCRIPTOR_SEARCH_Fail; } return DESCRIPTOR_SEARCH_NotFound; }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* Converts a 16-bit RGB565 color to a standard 32-bit BGRA32 color (with alpha set to 0xFF) */
uint32_t colorsRGB565toBGRA32(uint16_t color)
/* Converts a 16-bit RGB565 color to a standard 32-bit BGRA32 color (with alpha set to 0xFF) */ uint32_t colorsRGB565toBGRA32(uint16_t color)
{ uint32_t bits = (uint32_t)color; uint32_t blue = bits & 0x001F; uint32_t green = bits & 0x07E0; uint32_t red = bits & 0xF800; return (red << 8) | (green << 5) | (blue << 3) | 0xFF000000; }
microbuilder/LPC1343CodeBase
C++
Other
73
/* Gets the page number of the address relative to the bank. */
static blt_int32u FlashGetPage(blt_addr address)
/* Gets the page number of the address relative to the bank. */ static blt_int32u FlashGetPage(blt_addr address)
{ blt_int32u page = 0; if (address < (FLASH_BASE + FLASH_BANK_SIZE)) { page = (address - FLASH_BASE) / FLASH_PAGE_SIZE; } else { page = (address - (FLASH_BASE + FLASH_BANK_SIZE)) / FLASH_PAGE_SIZE; } return page; }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely. */
static int num_compare(const void *_a, const void *_b)
/* Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely. */ static int num_compare(const void *_a, const void *_b)
{ const int a = *((const int *) _a); const int b = *((const int *) _b); return (a < b) ? -1 : ((a > b) ? 1 : 0); }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* If you need to allocate memory here, use GFP_NOIO or GFP_ATOMIC, if you are in atomic context. */
static int i2400mu_post_reset(struct usb_interface *iface)
/* If you need to allocate memory here, use GFP_NOIO or GFP_ATOMIC, if you are in atomic context. */ static int i2400mu_post_reset(struct usb_interface *iface)
{ struct i2400mu *i2400mu = usb_get_intfdata(iface); return i2400m_post_reset(&i2400mu->i2400m); }
robutest/uclinux
C++
GPL-2.0
60
/* param base GPC CPU module base address. param mode CPU mode. Refer to "gpc_cpu_mode_t". */
void GPC_CM_ClearStandbyModeRequest(GPC_CPU_MODE_CTRL_Type *base, const gpc_cpu_mode_t mode)
/* param base GPC CPU module base address. param mode CPU mode. Refer to "gpc_cpu_mode_t". */ void GPC_CM_ClearStandbyModeRequest(GPC_CPU_MODE_CTRL_Type *base, const gpc_cpu_mode_t mode)
{ assert(mode != kGPC_RunMode); switch (mode) { case kGPC_WaitMode: base->CM_STBY_CTRL &= ~GPC_CPU_MODE_CTRL_CM_STBY_CTRL_STBY_WAIT_MASK; break; case kGPC_StopMode: base->CM_STBY_CTRL &= ~GPC_CPU_MODE_CTRL_CM_STBY_CTRL_STBY_STOP_MASK; break; case kGPC_SuspendMode: base->CM_STBY_CTRL &= ~GPC_CPU_MODE_CTRL_CM_STBY_CTRL_STBY_SUSPEND_MASK; break; default: break; } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* According to the MAX6957AAX datasheet, we should release the chip select halfway through the read sequence, when the actual register value is read; but the WORK_92105 hardware prevents the MAX6957AAX SPI OUT from reaching the LPC32XX SIP MISO if chip is not selected. so let's release the CS an hold it again while reading the result. */
static uint8_t max6957aax_read(uint8_t reg)
/* According to the MAX6957AAX datasheet, we should release the chip select halfway through the read sequence, when the actual register value is read; but the WORK_92105 hardware prevents the MAX6957AAX SPI OUT from reaching the LPC32XX SIP MISO if chip is not selected. so let's release the CS an hold it again while reading the result. */ static uint8_t max6957aax_read(uint8_t reg)
{ uint8_t dout[2], din[2]; dout[0] = reg | 0x80; dout[1] = 0; gpio_set_value(GPO_15, 0); spi_xfer(slave, 16, dout, dout, SPI_XFER_BEGIN | SPI_XFER_END); gpio_set_value(GPO_15, 1); din[0] = 0; din[1] = 0; gpio_set_value(GPO_15, 0); spi_xfer(slave, 16, din, din, SPI_XFER_BEGIN | SPI_XFER_END); gpio_set_value(GPO_15, 1); return din[1]; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Allocate an (aligned) area in the buffer. This is called under b_lock. Returns ~0 on failure. */
static unsigned int mon_buff_area_alloc(struct mon_reader_bin *rp, unsigned int size)
/* Allocate an (aligned) area in the buffer. This is called under b_lock. Returns ~0 on failure. */ static unsigned int mon_buff_area_alloc(struct mon_reader_bin *rp, unsigned int size)
{ unsigned int offset; size = (size + PKT_ALIGN-1) & ~(PKT_ALIGN-1); if (rp->b_cnt + size > rp->b_size) return ~0; offset = rp->b_in; rp->b_cnt += size; if ((rp->b_in += size) >= rp->b_size) rp->b_in -= rp->b_size; return offset; }
robutest/uclinux
C++
GPL-2.0
60
/* param handle codec handle. param channel audio codec play channel, can be a value or combine value of _codec_play_channel. param volume volume value, support 0 ~ 100, 0 is mute, 100 is the maximum volume value. return kStatus_Success is success, else configure failed. */
status_t HAL_CODEC_WM8904_SetVolume(void *handle, uint32_t playChannel, uint32_t volume)
/* param handle codec handle. param channel audio codec play channel, can be a value or combine value of _codec_play_channel. param volume volume value, support 0 ~ 100, 0 is mute, 100 is the maximum volume value. return kStatus_Success is success, else configure failed. */ status_t HAL_CODEC_WM8904_SetVolume(void *handle, uint32_t playChannel, uint32_t volume)
{ assert(handle != NULL); return WM8904_SetChannelVolume((wm8904_handle_t *)((uint32_t)(((codec_handle_t *)handle)->codecDevHandle)), playChannel, volume); }
eclipse-threadx/getting-started
C++
Other
310
/* Resets the hardware timer and has_reset flags of each task on the list. Called within critical */
static void reset_hw_timer()
/* Resets the hardware timer and has_reset flags of each task on the list. Called within critical */ static void reset_hw_timer()
{ TIMERG0.wdt_wprotect=TIMG_WDT_WKEY_VALUE; TIMERG0.wdt_feed=1; TIMERG0.wdt_wprotect=0; for (twdt_task_t *task = twdt_config->list; task != NULL; task = task->next){ task->has_reset=false; } }
retro-esp32/RetroESP32
C++
Creative Commons Attribution Share Alike 4.0 International
581
/* Stalls the CPU for at least the given number of ticks. It's invoked by */
VOID InternalAcpiDelay(IN UINT32 Delay)
/* Stalls the CPU for at least the given number of ticks. It's invoked by */ VOID InternalAcpiDelay(IN UINT32 Delay)
{ UINT32 Ticks; UINT32 Times; Times = Delay >> 22; Delay &= BIT22 - 1; do { Ticks = InternalAcpiGetTimerTick () + Delay; Delay = BIT22; while (((Ticks - InternalAcpiGetTimerTick ()) & BIT23) == 0) { CpuPause (); } } while (Times-- > 0); }
tianocore/edk2
C++
Other
4,240
/* param base Pointer to FLEXIO_SPI_Type structure. param handle FlexIO SPI eDMA handle pointer. param count Number of bytes transferred so far by the non-blocking transaction. */
status_t FLEXIO_SPI_MasterTransferGetCountEDMA(FLEXIO_SPI_Type *base, flexio_spi_master_edma_handle_t *handle, size_t *count)
/* param base Pointer to FLEXIO_SPI_Type structure. param handle FlexIO SPI eDMA handle pointer. param count Number of bytes transferred so far by the non-blocking transaction. */ status_t FLEXIO_SPI_MasterTransferGetCountEDMA(FLEXIO_SPI_Type *base, flexio_spi_master_edma_handle_t *handle, size_t *count)
{ assert(handle); if (!count) { return kStatus_InvalidArgument; } if (handle->rxInProgress) { *count = (handle->transferSize - (uint32_t)handle->nbytes * EDMA_GetRemainingMajorLoopCount( handle->rxHandle->base, handle->rxHandle->channel)); } else { *count = (handle->transferSize - (uint32_t)handle->nbytes * EDMA_GetRemainingMajorLoopCount( handle->txHandle->base, handle->txHandle->channel)); } return kStatus_Success; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Magnetometer Y-axis coordinates rotation (to be aligned to accelerometer/gyroscope axes orientation).. */
int32_t lsm6dso_mag_y_orient_set(lsm6dso_ctx_t *ctx, lsm6dso_mag_y_axis_t val)
/* Magnetometer Y-axis coordinates rotation (to be aligned to accelerometer/gyroscope axes orientation).. */ int32_t lsm6dso_mag_y_orient_set(lsm6dso_ctx_t *ctx, lsm6dso_mag_y_axis_t val)
{ lsm6dso_mag_cfg_a_t reg; int32_t ret; ret = lsm6dso_ln_pg_read_byte(ctx, LSM6DSO_MAG_CFG_A, (uint8_t*)&reg); if (ret == 0) { reg.mag_y_axis = (uint8_t)val; ret = lsm6dso_ln_pg_write_byte(ctx, LSM6DSO_MAG_CFG_A,(uint8_t*) &reg); } return ret; }
alexander-g-dean/ESF
C++
null
41
/* Ops array is stored in the following format: {op(8bit), offset(24bit, big endian), data(32bit, big endian)} */
static void bnx2x_prep_ops(const u8 *_source, u8 *_target, u32 n)
/* Ops array is stored in the following format: {op(8bit), offset(24bit, big endian), data(32bit, big endian)} */ static void bnx2x_prep_ops(const u8 *_source, u8 *_target, u32 n)
{ const __be32 *source = (const __be32 *)_source; struct raw_op *target = (struct raw_op *)_target; u32 i, j, tmp; for (i = 0, j = 0; i < n/8; i++, j += 2) { tmp = be32_to_cpu(source[j]); target[i].op = (tmp >> 24) & 0xff; target[i].offset = tmp & 0xffffff; target[i].raw_data = be32_to_cpu(source[j+1]); } }
robutest/uclinux
C++
GPL-2.0
60
/* Retrieve data stored in FIFO. Can be used in polling mode, but works best when interrupts are used */
int32_t adxl372_service_fifo_ev(adxl372_dev *dev, adxl372_xyz_accel_data *fifo_data, uint16_t *fifo_entries)
/* Retrieve data stored in FIFO. Can be used in polling mode, but works best when interrupts are used */ int32_t adxl372_service_fifo_ev(adxl372_dev *dev, adxl372_xyz_accel_data *fifo_data, uint16_t *fifo_entries)
{ uint8_t status1, status2; int32_t ret; ret = adxl372_get_status(dev, &status1, &status2, fifo_entries); if (ret) return -1; if (ADXL372_STATUS_1_FIFO_OVR(status1)) { printf("FIFO overrun\n"); return -1; } if (dev->fifo_config.fifo_mode != ADXL372_FIFO_BYPASSED) { if ((ADXL372_STATUS_1_FIFO_RDY(status1)) || (ADXL372_STATUS_1_FIFO_FULL(status1))) { *fifo_entries -= 3; ret = adxl372_get_fifo_xyz_data(dev, fifo_data, *fifo_entries); } } return ret; }
analogdevicesinc/EVAL-ADICUP3029
C++
Other
36
/* Called when the link layer has become established. */
void x25_link_established(struct x25_neigh *nb)
/* Called when the link layer has become established. */ void x25_link_established(struct x25_neigh *nb)
{ switch (nb->state) { case X25_LINK_STATE_0: nb->state = X25_LINK_STATE_2; break; case X25_LINK_STATE_1: x25_transmit_restart_request(nb); nb->state = X25_LINK_STATE_2; x25_start_t20timer(nb); break; } }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Waits for a character from the specified port. */
int32_t UARTCharGet(uint32_t ui32Base)
/* Waits for a character from the specified port. */ int32_t UARTCharGet(uint32_t ui32Base)
{ ASSERT(_UARTBaseValid(ui32Base)); while (HWREG(ui32Base + UART_O_FR) & UART_FR_RXFE) { } return (HWREG(ui32Base + UART_O_DR)); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* configure the GPIO ports , V1.0.0, firmware for GD32F1x0(x=3,5) , V2.0.0, firmware for GD32F1x0(x=3,5,7,9) , V3.0.0, firmware update for GD32F1x0(x=3,5,7,9) */
void gpio_config(void)
/* configure the GPIO ports , V1.0.0, firmware for GD32F1x0(x=3,5) , V2.0.0, firmware for GD32F1x0(x=3,5,7,9) , V3.0.0, firmware update for GD32F1x0(x=3,5,7,9) */ void gpio_config(void)
{ rcu_periph_clock_enable(RCU_GPIOA); gpio_mode_set(GPIOA, GPIO_MODE_AF, GPIO_PUPD_NONE, GPIO_PIN_0); gpio_output_options_set(GPIOA, GPIO_OTYPE_PP, GPIO_OSPEED_50MHZ,GPIO_PIN_0); gpio_mode_set(GPIOA, GPIO_MODE_AF, GPIO_PUPD_NONE, GPIO_PIN_1); gpio_output_options_set(GPIOA, GPIO_OTYPE_PP, GPIO_OSPEED_50MHZ,GPIO_PIN_1); gpio_af_set(GPIOA, GPIO_AF_2, GPIO_PIN_0); gpio_af_set(GPIOA, GPIO_AF_2, GPIO_PIN_1); }
liuxuming/trochili
C++
Apache License 2.0
132
/* Wait for the Cadence NAND controller to become idle. */
static int32_t cdns_nand_wait_idle(uintptr_t base_address)
/* Wait for the Cadence NAND controller to become idle. */ static int32_t cdns_nand_wait_idle(uintptr_t base_address)
{ if (!WAIT_FOR(CNF_GET_CTRL_BUSY(sys_read32(CNF_CMDREG(base_address, CTRL_STATUS))) == 0U, IDLE_TIME_OUT, k_msleep(1))) { LOG_ERR("Timed out waiting for wait idle response"); return -ETIMEDOUT; } return 0; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* This function will put core in infinite loop. This will be called when the ESBC can not proceed further due to some unknown errors. */
void branch_to_self(void)
/* This function will put core in infinite loop. This will be called when the ESBC can not proceed further due to some unknown errors. */ void branch_to_self(void)
{ printf("Core is in infinite loop due to errors.\n"); self: goto self; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Sets whether the base stream will be closed when @stream is closed. */
void g_filter_input_stream_set_close_base_stream(GFilterInputStream *stream, gboolean close_base)
/* Sets whether the base stream will be closed when @stream is closed. */ void g_filter_input_stream_set_close_base_stream(GFilterInputStream *stream, gboolean close_base)
{ GFilterInputStreamPrivate *priv; g_return_if_fail (G_IS_FILTER_INPUT_STREAM (stream)); close_base = !!close_base; priv = g_filter_input_stream_get_instance_private (stream); if (priv->close_base != close_base) { priv->close_base = close_base; g_object_notify (G_OBJECT (stream), "close-base-stream"); } }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Transmits the address byte to select the slave device. */
void I2C_Send7bitAddress(I2C_TypeDef *i2c, u8 addr, u8 dir)
/* Transmits the address byte to select the slave device. */ void I2C_Send7bitAddress(I2C_TypeDef *i2c, u8 addr, u8 dir)
{ i2c->IC_TAR = addr >> 1; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Retrieves the current line number and the number of the character on that line. Intended for use in error messages; there are no strict semantics for what constitutes the "current" line number other than "the best number we could come up with for error messages." */
void g_markup_parse_context_get_position(GMarkupParseContext *context, gint *line_number, gint *char_number)
/* Retrieves the current line number and the number of the character on that line. Intended for use in error messages; there are no strict semantics for what constitutes the "current" line number other than "the best number we could come up with for error messages." */ void g_markup_parse_context_get_position(GMarkupParseContext *context, gint *line_number, gint *char_number)
{ g_return_if_fail (context != NULL); if (line_number) *line_number = context->line_number; if (char_number) *char_number = context->char_number; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* It sets a flag indicating that SMRAM has been locked. */
EFI_STATUS EFIAPI SmmReadyToLockEventNotify(IN CONST EFI_GUID *Protocol, IN VOID *Interface, IN EFI_HANDLE Handle)
/* It sets a flag indicating that SMRAM has been locked. */ EFI_STATUS EFIAPI SmmReadyToLockEventNotify(IN CONST EFI_GUID *Protocol, IN VOID *Interface, IN EFI_HANDLE Handle)
{ mLocked = TRUE; return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* Enables or disables the Internal Low Speed oscillator (LSI). */
void RCC_LSICmd(FunctionalState NewState)
/* Enables or disables the Internal Low Speed oscillator (LSI). */ void RCC_LSICmd(FunctionalState NewState)
{ assert_param(IS_FUNCTIONAL_STATE(NewState)); *(__IO uint32_t *) CSR_LSION_BB = (uint32_t)NewState; }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* Displays the code value as a character, not its ASCII value, as would be done by BASE_DEC and friends. */
static void format_liquidity_flag(char *buf, guint32 value)
/* Displays the code value as a character, not its ASCII value, as would be done by BASE_DEC and friends. */ static void format_liquidity_flag(char *buf, guint32 value)
{ g_snprintf(buf, ITEM_LABEL_LENGTH, "%s (%c)", val_to_str_const(value, ouch_liquidity_flag_val, "Unknown"), value); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* TCP Westwood Here limit is evaluated as Bw estimation*RTTmin (for obtaining it in packets we use mss_cache). Rttmin is guaranteed to be >= 2 so avoids ever returning 0. */
static u32 tcp_westwood_bw_rttmin(const struct sock *sk)
/* TCP Westwood Here limit is evaluated as Bw estimation*RTTmin (for obtaining it in packets we use mss_cache). Rttmin is guaranteed to be >= 2 so avoids ever returning 0. */ static u32 tcp_westwood_bw_rttmin(const struct sock *sk)
{ const struct tcp_sock *tp = tcp_sk(sk); const struct westwood *w = inet_csk_ca(sk); return max_t(u32, (w->bw_est * w->rtt_min) / tp->mss_cache, 2); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Puts the processor into sleep mode. This function places the processor into sleep mode; it will not return until the processor returns to run mode. */
void SysCtlSleep(void)
/* Puts the processor into sleep mode. This function places the processor into sleep mode; it will not return until the processor returns to run mode. */ void SysCtlSleep(void)
{ SysCtlPowerDownEnable(1); xCPUwfi(); SysCtlPowerDownEnable(0); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Derive SHA384 HMAC-based Extract key Derivation Function (HKDF). */
BOOLEAN EFIAPI CryptoServiceHkdfSha384Extract(IN CONST UINT8 *Key, IN UINTN KeySize, IN CONST UINT8 *Salt, IN UINTN SaltSize, OUT UINT8 *PrkOut, UINTN PrkOutSize)
/* Derive SHA384 HMAC-based Extract key Derivation Function (HKDF). */ BOOLEAN EFIAPI CryptoServiceHkdfSha384Extract(IN CONST UINT8 *Key, IN UINTN KeySize, IN CONST UINT8 *Salt, IN UINTN SaltSize, OUT UINT8 *PrkOut, UINTN PrkOutSize)
{ return CALL_BASECRYPTLIB (Hkdf.Services.Sha384Extract, HkdfSha384Extract, (Key, KeySize, Salt, SaltSize, PrkOut, PrkOutSize), FALSE); }
tianocore/edk2
C++
Other
4,240
/* Set WM8731 power mode to MIC record only. */
void wm8731_power_mode_adc_mic(void)
/* Set WM8731 power mode to MIC record only. */ void wm8731_power_mode_adc_mic(void)
{ g_us_wm8731_reg_power_down_control_value = 0x19; wm8731_write_register(WM8731_REG_POWER_DOWN_CONTROL, g_us_wm8731_reg_power_down_control_value); }
remotemcu/remcu-chip-sdks
C++
null
436
/* param name The name of the selected body bias. Please see the enumeration pmu_body_bias_name_t for details. param setpointMap The map of setpoints that the specific body bias will be enabled in those setpoints, this value should be the OR'ed Value of _pmu_setpoint_map. */
void PMU_GPCEnableBodyBias(pmu_body_bias_name_t name, uint32_t setpointMap)
/* param name The name of the selected body bias. Please see the enumeration pmu_body_bias_name_t for details. param setpointMap The map of setpoints that the specific body bias will be enabled in those setpoints, this value should be the OR'ed Value of _pmu_setpoint_map. */ void PMU_GPCEnableBodyBias(pmu_body_bias_name_t name, uint32_t setpointMap)
{ uint32_t bodyBiasEnableRegArray[] = PMU_BODY_BIAS_ENABLE_REGISTERS; (*(volatile uint32_t *)bodyBiasEnableRegArray[(uint8_t)name]) = ~setpointMap; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Write to the port registers of certain register function. */
static int write_port_regs(const struct device *dev, uint8_t reg, uint8_t *cache, uint8_t value)
/* Write to the port registers of certain register function. */ static int write_port_regs(const struct device *dev, uint8_t reg, uint8_t *cache, uint8_t value)
{ const struct gpio_fxl6408_config *const config = dev->config; int ret = 0; if (*cache != value) { ret = i2c_reg_write_byte_dt(&config->i2c, reg, value); if (ret != 0) { LOG_ERR("error writing to register 0x%X (%d)", reg, ret); return ret; } *cache = value; LOG_DBG("Write: REG[0x%X] = 0x%X", reg, *cache); } return ret; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Return code NULL - No vport with the matching @vpi found Otherwise - Address to the vport with the matching @vpi. */
struct lpfc_vport* lpfc_find_vport_by_vpid(struct lpfc_hba *phba, uint16_t vpi)
/* Return code NULL - No vport with the matching @vpi found Otherwise - Address to the vport with the matching @vpi. */ struct lpfc_vport* lpfc_find_vport_by_vpid(struct lpfc_hba *phba, uint16_t vpi)
{ struct lpfc_vport *vport; unsigned long flags; spin_lock_irqsave(&phba->hbalock, flags); list_for_each_entry(vport, &phba->port_list, listentry) { if (vport->vpi == vpi) { spin_unlock_irqrestore(&phba->hbalock, flags); return vport; } } spin_unlock_irqrestore(&phba->hbalock, flags); return NULL; }
robutest/uclinux
C++
GPL-2.0
60
/* region = Region Number address = Region Base Address attr = Region Attributes and Size */
void cortex_m3_mpu_set_region(u32 region, u32 address, u32 attr)
/* region = Region Number address = Region Base Address attr = Region Attributes and Size */ void cortex_m3_mpu_set_region(u32 region, u32 address, u32 attr)
{ CM3_MPU_REGS->rnr = region; CM3_MPU_REGS->rbar = address; CM3_MPU_REGS->rasr = attr; }
EmcraftSystems/u-boot
C++
Other
181
/* Wrap Write register component function to Bus IO function. */
static int32_t WriteRegWrap(void *Handle, uint8_t Reg, uint8_t *pData, uint16_t Length)
/* Wrap Write register component function to Bus IO function. */ static int32_t WriteRegWrap(void *Handle, uint8_t Reg, uint8_t *pData, uint16_t Length)
{ HTS221_Object_t *pObj = (HTS221_Object_t *)Handle; if (pObj->IO.BusType == (uint32_t)HTS221_I2C_BUS) { return pObj->IO.WriteReg(pObj->IO.Address, (Reg | 0x80U), pData, Length); } else { return pObj->IO.WriteReg(pObj->IO.Address, (Reg | 0x40U), pData, Length); } }
eclipse-threadx/getting-started
C++
Other
310
/* Gets the external interrupt sensitivity of the selected port. */
EXTI_Trigger_TypeDef EXTI_GetPortSensitivity(EXTI_Port_TypeDef EXTI_Port)
/* Gets the external interrupt sensitivity of the selected port. */ EXTI_Trigger_TypeDef EXTI_GetPortSensitivity(EXTI_Port_TypeDef EXTI_Port)
{ uint8_t portsensitivity = 0; assert_param(IS_EXTI_PORT(EXTI_Port)); if ((EXTI_Port & 0xF0) == 0x00) { portsensitivity = (uint8_t)((uint8_t)0x03 & (uint8_t)(EXTI->CR3 >> EXTI_Port)); } else { portsensitivity = (uint8_t)((uint8_t)0x03 & (uint8_t)(EXTI->CR4 >> (EXTI_Port & 0x0F))); } return((EXTI_Trigger_TypeDef)portsensitivity); }
remotemcu/remcu-chip-sdks
C++
null
436
/* print_u32 - Print 32 bit of gcov data */
static void print_u32(uint32_t v)
/* print_u32 - Print 32 bit of gcov data */ static void print_u32(uint32_t v)
{ uint8_t *ptr = (uint8_t *)&v; print_u8(*ptr); print_u8(*(ptr+1)); print_u8(*(ptr+2)); print_u8(*(ptr+3)); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Decode an unsigned LEB128 encoded datum. The algorithm is taken from Appendix C of the DWARF 3 spec. For information on the encodings refer to section "7.6 - Variable Length Data". Return the number of bytes read. */
static unsigned long dwarf_read_uleb128(char *addr, unsigned int *ret)
/* Decode an unsigned LEB128 encoded datum. The algorithm is taken from Appendix C of the DWARF 3 spec. For information on the encodings refer to section "7.6 - Variable Length Data". Return the number of bytes read. */ static unsigned long dwarf_read_uleb128(char *addr, unsigned int *ret)
{ unsigned int result; unsigned char byte; int shift, count; result = 0; shift = 0; count = 0; while (1) { byte = __raw_readb(addr); addr++; count++; result |= (byte & 0x7f) << shift; shift += 7; if (!(byte & 0x80)) break; } *ret = result; return count; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Some Atmel chips (e.g. the AT49BV6416) power-up with all sectors locked by default. */
static void fixup_use_atmel_lock(struct mtd_info *mtd, void *param)
/* Some Atmel chips (e.g. the AT49BV6416) power-up with all sectors locked by default. */ static void fixup_use_atmel_lock(struct mtd_info *mtd, void *param)
{ mtd->lock = cfi_atmel_lock; mtd->unlock = cfi_atmel_unlock; mtd->flags |= MTD_POWERUP_LOCK; }
robutest/uclinux
C++
GPL-2.0
60
/* Sets I2C stop condition (Low -> High on SDA while SCL is High) */
static void ixgbe_i2c_stop(struct ixgbe_hw *hw)
/* Sets I2C stop condition (Low -> High on SDA while SCL is High) */ static void ixgbe_i2c_stop(struct ixgbe_hw *hw)
{ u32 i2cctl = IXGBE_READ_REG(hw, IXGBE_I2CCTL); ixgbe_set_i2c_data(hw, &i2cctl, 0); ixgbe_raise_i2c_clk(hw, &i2cctl); udelay(IXGBE_I2C_T_SU_STO); ixgbe_set_i2c_data(hw, &i2cctl, 1); udelay(IXGBE_I2C_T_BUF); }
robutest/uclinux
C++
GPL-2.0
60
/* Compute ISA PnP checksum for first eight bytes. */
static unsigned char __init isapnp_checksum(unsigned char *data)
/* Compute ISA PnP checksum for first eight bytes. */ static unsigned char __init isapnp_checksum(unsigned char *data)
{ int i, j; unsigned char checksum = 0x6a, bit, b; for (i = 0; i < 8; i++) { b = data[i]; for (j = 0; j < 8; j++) { bit = 0; if (b & (1 << j)) bit = 1; checksum = ((((checksum ^ (checksum >> 1)) & 0x01) ^ bit) << 7) | (checksum >> 1); } } return checksum; }
robutest/uclinux
C++
GPL-2.0
60
/* This function returns offset of the first non-0xff byte in @buf or %-1 if the buffer contains only 0xff bytes. */
static int first_non_ff(void *buf, int len)
/* This function returns offset of the first non-0xff byte in @buf or %-1 if the buffer contains only 0xff bytes. */ static int first_non_ff(void *buf, int len)
{ uint8_t *p = buf; int i; for (i = 0; i < len; i++) if (*p++ != 0xff) return i; return -1; }
robutest/uclinux
C++
GPL-2.0
60
/* Check whether the TxCb is still a valid control block in the instance's retry list. */
BOOLEAN Dhcp6IsValidTxCb(IN DHCP6_INSTANCE *Instance, IN DHCP6_TX_CB *TxCb)
/* Check whether the TxCb is still a valid control block in the instance's retry list. */ BOOLEAN Dhcp6IsValidTxCb(IN DHCP6_INSTANCE *Instance, IN DHCP6_TX_CB *TxCb)
{ LIST_ENTRY *Entry; NET_LIST_FOR_EACH (Entry, &Instance->TxList) { if (TxCb == NET_LIST_USER_STRUCT (Entry, DHCP6_TX_CB, Link)) { return TRUE; } } return FALSE; }
tianocore/edk2
C++
Other
4,240
/* Enables the selected ADC software start conversion of the regular channels. */
void ADC_SoftwareStartConv(ADC_TypeDef *ADCx)
/* Enables the selected ADC software start conversion of the regular channels. */ void ADC_SoftwareStartConv(ADC_TypeDef *ADCx)
{ assert_param(IS_ADC_ALL_PERIPH(ADCx)); ADCx->CR2 |= (uint32_t)ADC_CR2_SWSTART; }
avem-labs/Avem
C++
MIT License
1,752
/* Create new Big Number computation context. This is an opaque structure which should be passed to any function that requires it. The BN context is needed to optimize calculations and expensive allocations. */
VOID* EFIAPI BigNumNewContext(VOID)
/* Create new Big Number computation context. This is an opaque structure which should be passed to any function that requires it. The BN context is needed to optimize calculations and expensive allocations. */ VOID* EFIAPI BigNumNewContext(VOID)
{ CALL_CRYPTO_SERVICE (BigNumNewContext, (), NULL); }
tianocore/edk2
C++
Other
4,240
/* The constructor function locates PCI Root Bridge I/O protocol from protocol database. It will ASSERT() if that operation fails and it will always return EFI_SUCCESS. */
EFI_STATUS EFIAPI PciLibConstructor(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
/* The constructor function locates PCI Root Bridge I/O protocol from protocol database. It will ASSERT() if that operation fails and it will always return EFI_SUCCESS. */ EFI_STATUS EFIAPI PciLibConstructor(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
{ EFI_STATUS Status; Status = gSmst->SmmLocateProtocol (&gEfiSmmPciRootBridgeIoProtocolGuid, NULL, (VOID **)&mSmmPciRootBridgeIo); ASSERT_EFI_ERROR (Status); ASSERT (mSmmPciRootBridgeIo != NULL); return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* Returns the new list or NULL in case of failure. */
CRSelector* cr_selector_append_simple_sel(CRSelector *a_this, CRSimpleSel *a_simple_sel)
/* Returns the new list or NULL in case of failure. */ CRSelector* cr_selector_append_simple_sel(CRSelector *a_this, CRSimpleSel *a_simple_sel)
{ CRSelector *selector = NULL; selector = cr_selector_new (a_simple_sel); g_return_val_if_fail (selector, NULL); return cr_selector_append (a_this, selector); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Draw a Pixel of grayscale at coordinate (x,y) to LCD. */
void halLcdPixel(int x, int y, unsigned char GrayScale)
/* Draw a Pixel of grayscale at coordinate (x,y) to LCD. */ void halLcdPixel(int x, int y, unsigned char GrayScale)
{ int Address, Value; unsigned char offset; if ( (x>=0 ) && (x<LCD_COL) && (y>=0) && (y<LCD_ROW)) { Address = (y << 5) + (x >> 3) ; Value = LCD_MEM[(y << 4)+ y + (x>>3)]; offset = (x & 0x07) << 1; Value &= ~ (3 << offset); Value |= GrayScale << offset; halLcdDrawBlock( Address, Value ); } }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* Detach a thread (thread storage can be reclaimed when thread terminates). */
osStatus_t osThreadDetach(osThreadId_t thread_id)
/* Detach a thread (thread storage can be reclaimed when thread terminates). */ osStatus_t osThreadDetach(osThreadId_t thread_id)
{ struct cv2_thread *tid = (struct cv2_thread *)thread_id; if ((tid == NULL) || (is_cmsis_rtos_v2_thread(tid) == NULL)) { return osErrorParameter; } if (k_is_in_isr()) { return osErrorISR; } if (_is_thread_cmsis_inactive(&tid->z_thread)) { return osErrorResource; } __ASSERT(tid->attr_bits != osThreadDetached, "Thread already detached, behaviour undefined."); tid->attr_bits = osThreadDetached; k_sem_give(&tid->join_guard); return osOK; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Configs the COMP peripheral according to the specified parameters in COMP_InitStruct. */
void COMP_Config(COMP_SELECT_T compSelect, COMP_Config_T *compConfig)
/* Configs the COMP peripheral according to the specified parameters in COMP_InitStruct. */ void COMP_Config(COMP_SELECT_T compSelect, COMP_Config_T *compConfig)
{ if(compSelect == COMP_SELECT_COMP1) { COMP->CSTS_B.INVINSEL1 = compConfig->invertingInput; COMP->CSTS_B.OUTSEL1 = compConfig->output; COMP->CSTS_B.OPINV1 = compConfig->outputPol; COMP->CSTS_B.HYSCFG1 = compConfig->hysterrsis; COMP->CSTS_B.MOD1 = compConfig->mode; } else { COMP->CSTS_B.INVINSEL2= compConfig->invertingInput; COMP->CSTS_B.OUTSEL2 = compConfig->output; COMP->CSTS_B.OPINV2 = compConfig->outputPol; COMP->CSTS_B.HYSCFG2 = compConfig->hysterrsis; COMP->CSTS_B.MOD2= compConfig->mode; } }
pikasTech/PikaPython
C++
MIT License
1,403
/* CDC_Itf_DataRx Data received over USB OUT endpoint are sent over CDC interface through this function. */
static int8_t CDC_Itf_Receive(uint8_t *Buf, uint32_t *Len)
/* CDC_Itf_DataRx Data received over USB OUT endpoint are sent over CDC interface through this function. */ static int8_t CDC_Itf_Receive(uint8_t *Buf, uint32_t *Len)
{ HAL_UART_Transmit_DMA(&UartHandle, Buf, *Len); return (USBD_OK); }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* Align an sk_buff to a boundary power of 2 */
static void my_skb_align(struct sk_buff *skb, int n)
/* Align an sk_buff to a boundary power of 2 */ static void my_skb_align(struct sk_buff *skb, int n)
{ unsigned long x = (unsigned long)skb->data; unsigned long v; v = ALIGN(x, n); skb_reserve(skb, v - x); }
robutest/uclinux
C++
GPL-2.0
60
/* Sets or clears the selected GPIO port pin. */
void GPIO_WriteBit(GPIO_TypeDef *gpio, u16 pin, BitAction value)
/* Sets or clears the selected GPIO port pin. */ void GPIO_WriteBit(GPIO_TypeDef *gpio, u16 pin, BitAction value)
{ (value) ? (gpio->BSRR = pin) : (gpio->BRR = pin); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* TIM_Base MSP Initialization This function configures the hardware resources used in this example. */
void HAL_TIM_Base_MspInit(TIM_HandleTypeDef *htim_base)
/* TIM_Base MSP Initialization This function configures the hardware resources used in this example. */ void HAL_TIM_Base_MspInit(TIM_HandleTypeDef *htim_base)
{ if(htim_base->Instance==TIM2) { __HAL_RCC_TIM2_CLK_ENABLE(); } else if(htim_base->Instance==TIM3) { __HAL_RCC_TIM3_CLK_ENABLE(); } else if(htim_base->Instance==TIM11) { __HAL_RCC_TIM11_CLK_ENABLE(); } else if(htim_base->Instance==TIM13) { __HAL_RCC_TIM13_CLK_ENABLE(); } else if(htim_base->Instance==TIM14) { __HAL_RCC_TIM14_CLK_ENABLE(); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Get EC group order. This function will set the provided Big Number object to the corresponding value. The caller needs to make sure that the "out" BigNumber parameter is properly initialized. */
BOOLEAN EFIAPI CryptoServiceEcGroupGetOrder(IN VOID *EcGroup, OUT VOID *BnOrder)
/* Get EC group order. This function will set the provided Big Number object to the corresponding value. The caller needs to make sure that the "out" BigNumber parameter is properly initialized. */ BOOLEAN EFIAPI CryptoServiceEcGroupGetOrder(IN VOID *EcGroup, OUT VOID *BnOrder)
{ return CALL_BASECRYPTLIB (Ec.Services.GroupGetOrder, EcGroupGetOrder, (EcGroup, BnOrder), FALSE); }
tianocore/edk2
C++
Other
4,240
/* If any reserved bits in Address are set, then ASSERT(). */
UINT8 EFIAPI PciSegmentRead8(IN UINT64 Address)
/* If any reserved bits in Address are set, then ASSERT(). */ UINT8 EFIAPI PciSegmentRead8(IN UINT64 Address)
{ ASSERT_INVALID_PCI_SEGMENT_ADDRESS (Address, 0); return (UINT8)DxePciSegmentLibPciRootBridgeIoReadWorker (Address, EfiPciWidthUint8); }
tianocore/edk2
C++
Other
4,240
/* Serializes a sensors_event_t object as a byte array. */
size_t sensorsSerializeSensorsEvent(uint8_t *buffer, const sensors_event_t *event)
/* Serializes a sensors_event_t object as a byte array. */ size_t sensorsSerializeSensorsEvent(uint8_t *buffer, const sensors_event_t *event)
{ size_t i = 0; memcpy(&buffer[i], &event->version, sizeof event->version); i += sizeof event->version; memcpy(&buffer[i], &event->sensor_id, sizeof event->sensor_id); i += sizeof event->sensor_id; memcpy(&buffer[i], &event->type, sizeof event->type); i += sizeof event->type; memcpy(&buffer[i], &event->reserved0, sizeof event->reserved0); i += sizeof event->reserved0; memcpy(&buffer[i], &event->timestamp, sizeof event->timestamp); i += sizeof event->timestamp; memcpy(&buffer[i], &event->data, sizeof event->data); i += sizeof event->data; return i; }
microbuilder/LPC11U_LPC13U_CodeBase
C++
Other
54
/* Change Logs: Date Author Notes flyingcys first version chushicheng add pin and i2c flyingcys update bsp file structure */
static void system_clock_init(void)
/* Change Logs: Date Author Notes flyingcys first version chushicheng add pin and i2c flyingcys update bsp file structure */ static void system_clock_init(void)
{ GLB_Power_On_XTAL_And_PLL_CLK(GLB_XTAL_40M, GLB_PLL_WIFIPLL | GLB_PLL_CPUPLL | GLB_PLL_UHSPLL | GLB_PLL_MIPIPLL); GLB_Set_MCU_System_CLK(GLB_MCU_SYS_CLK_WIFIPLL_320M); GLB_Set_DSP_System_CLK(GLB_DSP_SYS_CLK_CPUPLL_400M); GLB_Config_CPU_PLL(GLB_XTAL_40M, cpuPllCfg_480M); CPU_Set_MTimer_CLK(ENABLE, CPU_Get_MTimer_Source_Clock() / 1000 / 1000 - 1); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This file is part of the Simba project. */
int mock_write_analog_output_pin_module_init(int res)
/* This file is part of the Simba project. */ int mock_write_analog_output_pin_module_init(int res)
{ harness_mock_write("analog_output_pin_module_init()", NULL, 0); harness_mock_write("analog_output_pin_module_init(): return (res)", &res, sizeof(res)); return (0); }
eerimoq/simba
C++
Other
337
/* Return a pointer to the location within a WQE that we're using as a link when the WQE is in the free list. We use the imm field because in the Tavor case, posting a WQE may overwrite the next segment of the previous WQE, but a receive WQE will never touch the imm field. This avoids corrupting our free list if the previous WQE has already completed and been put on the free list when we post the next WQE. */
static int* wqe_to_link(void *wqe)
/* Return a pointer to the location within a WQE that we're using as a link when the WQE is in the free list. We use the imm field because in the Tavor case, posting a WQE may overwrite the next segment of the previous WQE, but a receive WQE will never touch the imm field. This avoids corrupting our free list if the previous WQE has already completed and been put on the free list when we post the next WQE. */ static int* wqe_to_link(void *wqe)
{ return (int *) (wqe + offsetof(struct mthca_next_seg, imm)); }
robutest/uclinux
C++
GPL-2.0
60
/* Returns: the found #GList element, or NULL if it is not found */
GList* g_list_find_custom(GList *list, gconstpointer data, GCompareFunc func)
/* Returns: the found #GList element, or NULL if it is not found */ GList* g_list_find_custom(GList *list, gconstpointer data, GCompareFunc func)
{ g_return_val_if_fail (func != NULL, list); while (list) { if (! func (list->data, data)) return list; list = list->next; } return NULL; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Returns the clock source used as LSX clock (for TSC/LPRCNT). */
uint32_t RCC_GetLSXClkSrc(void)
/* Returns the clock source used as LSX clock (for TSC/LPRCNT). */ uint32_t RCC_GetLSXClkSrc(void)
{ return ((uint32_t)(RCC->LDCTRL & RCC_LDCTRL_LSXSEL)); }
pikasTech/PikaPython
C++
MIT License
1,403
/* Message: ClearPromptStatusMessage Opcode: 0x0113 Type: CallControl Direction: pbx2dev VarLength: no */
static void handle_ClearPromptStatusMessage(ptvcursor_t *cursor, packet_info *pinfo _U_)
/* Message: ClearPromptStatusMessage Opcode: 0x0113 Type: CallControl Direction: pbx2dev VarLength: no */ static void handle_ClearPromptStatusMessage(ptvcursor_t *cursor, packet_info *pinfo _U_)
{ si->lineId = tvb_get_letohl(ptvcursor_tvbuff(cursor), ptvcursor_current_offset(cursor)); ptvcursor_add(cursor, hf_skinny_lineInstance, 4, ENC_LITTLE_ENDIAN); si->callId = tvb_get_letohl(ptvcursor_tvbuff(cursor), ptvcursor_current_offset(cursor)); ptvcursor_add(cursor, hf_skinny_callReference, 4, ENC_LITTLE_ENDIAN); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Retrieves the number of logical processor in the platform and the number of those logical processors that are enabled on this boot. This service may only be called from the BSP. */
EFI_STATUS EFIAPI MpInitLibGetNumberOfProcessors(OUT UINTN *NumberOfProcessors OPTIONAL, OUT UINTN *NumberOfEnabledProcessors OPTIONAL)
/* Retrieves the number of logical processor in the platform and the number of those logical processors that are enabled on this boot. This service may only be called from the BSP. */ EFI_STATUS EFIAPI MpInitLibGetNumberOfProcessors(OUT UINTN *NumberOfProcessors OPTIONAL, OUT UINTN *NumberOfEnabledProcessors OPTIONAL)
{ *NumberOfProcessors = 1; *NumberOfEnabledProcessors = 1; return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* Return codes 0 - Success (currently always return 0) */
int lpfc_read_la(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb, struct lpfc_dmabuf *mp)
/* Return codes 0 - Success (currently always return 0) */ int lpfc_read_la(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb, struct lpfc_dmabuf *mp)
{ MAILBOX_t *mb; struct lpfc_sli *psli; psli = &phba->sli; mb = &pmb->u.mb; memset(pmb, 0, sizeof (LPFC_MBOXQ_t)); INIT_LIST_HEAD(&mp->list); mb->mbxCommand = MBX_READ_LA64; mb->un.varReadLA.un.lilpBde64.tus.f.bdeSize = 128; mb->un.varReadLA.un.lilpBde64.addrHigh = putPaddrHigh(mp->phys); mb->un.varReadLA.un.lilpBde64.addrLow = putPaddrLow(mp->phys); pmb->context1 = (uint8_t *) mp; mb->mbxOwner = OWN_HOST; return (0); }
robutest/uclinux
C++
GPL-2.0
60
/* Set the callback that discharges VCONN from the Device Policy Manager. */
void usbc_set_vconn_discharge(const struct device *dev, const tcpc_vconn_discharge_cb_t cb)
/* Set the callback that discharges VCONN from the Device Policy Manager. */ void usbc_set_vconn_discharge(const struct device *dev, const tcpc_vconn_discharge_cb_t cb)
{ struct usbc_port_data *data = dev->data; const struct device *tcpc = data->tcpc; tcpc_set_vconn_discharge_cb(tcpc, cb); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Return Value: On success, pointer to the nilfs object is returned. On error, NULL is returned. */
struct the_nilfs* find_or_create_nilfs(struct block_device *bdev)
/* Return Value: On success, pointer to the nilfs object is returned. On error, NULL is returned. */ struct the_nilfs* find_or_create_nilfs(struct block_device *bdev)
{ struct the_nilfs *nilfs, *new = NULL; retry: spin_lock(&nilfs_lock); list_for_each_entry(nilfs, &nilfs_objects, ns_list) { if (nilfs->ns_bdev == bdev) { get_nilfs(nilfs); spin_unlock(&nilfs_lock); if (new) put_nilfs(new); return nilfs; } } if (new) { list_add_tail(&new->ns_list, &nilfs_objects); spin_unlock(&nilfs_lock); return new; } spin_unlock(&nilfs_lock); new = alloc_nilfs(bdev); if (new) goto retry; return NULL; }
robutest/uclinux
C++
GPL-2.0
60
/* Timestamp register resolution setting. Configuration of this bit affects TIMESTAMP0_REG(40h), TIMESTAMP1_REG(41h), TIMESTAMP2_REG(42h), STEP_TIMESTAMP_L(49h), STEP_TIMESTAMP_H(4Ah) and STEP_COUNT_DELTA(15h) registers.. */
int32_t lsm6dsl_timestamp_res_get(stmdev_ctx_t *ctx, lsm6dsl_timer_hr_t *val)
/* Timestamp register resolution setting. Configuration of this bit affects TIMESTAMP0_REG(40h), TIMESTAMP1_REG(41h), TIMESTAMP2_REG(42h), STEP_TIMESTAMP_L(49h), STEP_TIMESTAMP_H(4Ah) and STEP_COUNT_DELTA(15h) registers.. */ int32_t lsm6dsl_timestamp_res_get(stmdev_ctx_t *ctx, lsm6dsl_timer_hr_t *val)
{ lsm6dsl_wake_up_dur_t wake_up_dur; int32_t ret; ret = lsm6dsl_read_reg(ctx, LSM6DSL_WAKE_UP_DUR, (uint8_t*)&wake_up_dur, 1); switch (wake_up_dur.timer_hr) { case LSM6DSL_LSB_6ms4: *val = LSM6DSL_LSB_6ms4; break; case LSM6DSL_LSB_25us: *val = LSM6DSL_LSB_25us; break; default: *val = LSM6DSL_TS_RES_ND; break; } return ret; }
eclipse-threadx/getting-started
C++
Other
310
/* If RsaContext is NULL, then return FALSE. If MessageHash is NULL, then return FALSE. If HashSize is not equal to the size of MD5, SHA-1 or SHA-256 digest, then return FALSE. If SigSize is large enough but Signature is NULL, then return FALSE. If this interface is not supported, then return FALSE. */
BOOLEAN EFIAPI CryptoServiceRsaPkcs1Sign(IN VOID *RsaContext, IN CONST UINT8 *MessageHash, IN UINTN HashSize, OUT UINT8 *Signature, IN OUT UINTN *SigSize)
/* If RsaContext is NULL, then return FALSE. If MessageHash is NULL, then return FALSE. If HashSize is not equal to the size of MD5, SHA-1 or SHA-256 digest, then return FALSE. If SigSize is large enough but Signature is NULL, then return FALSE. If this interface is not supported, then return FALSE. */ BOOLEAN EFIAPI CryptoServiceRsaPkcs1Sign(IN VOID *RsaContext, IN CONST UINT8 *MessageHash, IN UINTN HashSize, OUT UINT8 *Signature, IN OUT UINTN *SigSize)
{ return CALL_BASECRYPTLIB (Rsa.Services.Pkcs1Sign, RsaPkcs1Sign, (RsaContext, MessageHash, HashSize, Signature, SigSize), FALSE); }
tianocore/edk2
C++
Other
4,240
/* If DateTime1 is NULL, then return -2. If DateTime2 is NULL, then return -2. If DateTime1 == DateTime2, then return 0 If DateTime1 > DateTime2, then return 1 If DateTime1 < DateTime2, then return -1 */
INT32 EFIAPI X509CompareDateTime(IN CONST VOID *DateTime1, IN CONST VOID *DateTime2)
/* If DateTime1 is NULL, then return -2. If DateTime2 is NULL, then return -2. If DateTime1 == DateTime2, then return 0 If DateTime1 > DateTime2, then return 1 If DateTime1 < DateTime2, then return -1 */ INT32 EFIAPI X509CompareDateTime(IN CONST VOID *DateTime1, IN CONST VOID *DateTime2)
{ return (INT32)ASN1_TIME_compare (DateTime1, DateTime2); }
tianocore/edk2
C++
Other
4,240
/* When the silicon family has not implemented a forced speed/duplex function for the PHY, simply return 0. */
static s32 e1000_phy_force_speed_duplex(struct e1000_hw *hw)
/* When the silicon family has not implemented a forced speed/duplex function for the PHY, simply return 0. */ static s32 e1000_phy_force_speed_duplex(struct e1000_hw *hw)
{ if (hw->phy.ops.force_speed_duplex) return hw->phy.ops.force_speed_duplex(hw); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* @ah: The &struct ath5k_hw @timeout: Timeout in usec */
int ath5k_hw_set_ack_timeout(struct ath5k_hw *ah, unsigned int timeout)
/* @ah: The &struct ath5k_hw @timeout: Timeout in usec */ int ath5k_hw_set_ack_timeout(struct ath5k_hw *ah, unsigned int timeout)
{ ATH5K_TRACE(ah->ah_sc); if (ath5k_hw_clocktoh(AR5K_REG_MS(0xffffffff, AR5K_TIME_OUT_ACK), ah->ah_turbo) <= timeout) return -EINVAL; AR5K_REG_WRITE_BITS(ah, AR5K_TIME_OUT, AR5K_TIME_OUT_ACK, ath5k_hw_htoclock(timeout, ah->ah_turbo)); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* @handle: handle to be checked Return: status code */
static efi_status_t check_node_type(efi_handle_t handle)
/* @handle: handle to be checked Return: status code */ static efi_status_t check_node_type(efi_handle_t handle)
{ efi_status_t r, ret = EFI_SUCCESS; const struct efi_device_path *dp; r = EFI_CALL(systab.boottime->open_protocol( handle, &efi_guid_device_path, (void **)&dp, NULL, NULL, EFI_OPEN_PROTOCOL_GET_PROTOCOL)); if (r == EFI_SUCCESS && dp) { const struct efi_device_path *node = efi_dp_last_node(dp); if (!node || node->type == DEVICE_PATH_TYPE_MEDIA_DEVICE) ret = EFI_UNSUPPORTED; } return ret; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Unregisters an interrupt handler for an Ethernet interrupt. */
void EMACIntUnregister(uint32_t ui32Base)
/* Unregisters an interrupt handler for an Ethernet interrupt. */ void EMACIntUnregister(uint32_t ui32Base)
{ IntDisable(INT_EMAC0); IntUnregister(INT_EMAC0); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* I have my own version of udelay(), as it is needed when initialising the chip, before the delay loop has been calibrated. Should probably reference one of the vmechip2 or pccchip2 counter for an accurate delay, but this wild guess will do for now. */
void my_udelay(long us)
/* I have my own version of udelay(), as it is needed when initialising the chip, before the delay loop has been calibrated. Should probably reference one of the vmechip2 or pccchip2 counter for an accurate delay, but this wild guess will do for now. */ void my_udelay(long us)
{ u_char x; volatile u_char *p = &x; int i; while (us--) for (i = 100; i; i--) x |= *p; }
robutest/uclinux
C++
GPL-2.0
60
/* @rows: pointer to return number of rows @cols: pointer to return number of columns Returns: 0 on success */
static int query_console_serial(int *rows, int *cols)
/* @rows: pointer to return number of rows @cols: pointer to return number of columns Returns: 0 on success */ static int query_console_serial(int *rows, int *cols)
{ int ret = 0; int n[2]; while (tstc()) getc(); printf(ESC "7" ESC "[r" ESC "[999;999H" ESC "[6n"); if (term_read_reply(n, 2, 'R')) { ret = 1; goto out; } *cols = n[1]; *rows = n[0]; out: printf(ESC "8"); return ret; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Checks if a bus off or bus heavy situation occurred. */
static bool CanUsbIsBusError(void)
/* Checks if a bus off or bus heavy situation occurred. */ static bool CanUsbIsBusError(void)
{ bool result = false; int32_t status; if (canUsbCanHandle != 0) { status = CanUsbLibFuncStatus(canUsbCanHandle); if ((status & CANSTATUS_BUS_ERROR) != 0) { result = true; (void)CanUsbCloseChannel(); (void)CanUsbOpenChannel(); } } return result; }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Configures the External Low Speed oscillator (LSE) drive capability. */
void RCC_LSEDriveConfig(uint32_t RCC_LSEDrive)
/* Configures the External Low Speed oscillator (LSE) drive capability. */ void RCC_LSEDriveConfig(uint32_t RCC_LSEDrive)
{ assert_param(IS_RCC_LSE_DRIVE(RCC_LSEDrive)); RCC->BDCR &= ~(RCC_BDCR_LSEDRV); RCC->BDCR |= RCC_LSEDrive; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Find an efiobj from device-path, if 'rem' is not NULL, returns the remaining part of the device path after the matched object. */
struct efi_object* efi_dp_find_obj(struct efi_device_path *dp, struct efi_device_path **rem)
/* Find an efiobj from device-path, if 'rem' is not NULL, returns the remaining part of the device path after the matched object. */ struct efi_object* efi_dp_find_obj(struct efi_device_path *dp, struct efi_device_path **rem)
{ struct efi_object *efiobj; efiobj = find_obj(dp, false, NULL); if (!efiobj) efiobj = find_obj(dp, false, rem); if (!efiobj) efiobj = find_obj(dp, true, rem); return efiobj; }
4ms/stm32mp1-baremetal
C++
Other
137
/* This routine purges the input queue of those frames that have been acknowledged. This replaces the boxes labelled "V(a) <- N(r)" on the SDL diagram. */
void x25_frames_acked(struct sock *sk, unsigned short nr)
/* This routine purges the input queue of those frames that have been acknowledged. This replaces the boxes labelled "V(a) <- N(r)" on the SDL diagram. */ void x25_frames_acked(struct sock *sk, unsigned short nr)
{ struct sk_buff *skb; struct x25_sock *x25 = x25_sk(sk); int modulus = x25->neighbour->extended ? X25_EMODULUS : X25_SMODULUS; if (x25->va != nr) while (skb_peek(&x25->ack_queue) && x25->va != nr) { skb = skb_dequeue(&x25->ack_queue); kfree_skb(skb); x25->va = (x25->va + 1) % modulus; } }
EmcraftSystems/linux-emcraft
C++
Other
266