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 |
|---|---|---|---|---|---|---|---|
/* Update number of Flash wait states in line with new frequency and current voltage range. */ | ErrorStatus UTILS_SetFlashLatency(uint32_t HCLK_Frequency) | /* Update number of Flash wait states in line with new frequency and current voltage range. */
ErrorStatus UTILS_SetFlashLatency(uint32_t HCLK_Frequency) | {
ErrorStatus status = SUCCESS;
uint32_t latency = LL_FLASH_LATENCY_0;
if (HCLK_Frequency == 0U)
{
status = ERROR;
}
else
{
if (HCLK_Frequency > UTILS_SCALE1_LATENCY1_FREQ)
{
latency = LL_FLASH_LATENCY_1;
}
else
{
}
LL_FLASH_SetLatency(latency);
if (LL_FLASH_GetLatency() != latency)
{
status = ERROR;
}
}
return status;
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* SDMMCHOST detect card remove status by host controller. */ | static void SDMMCHOST_DetectCardRemoveByHost(SDMMCHOST_TYPE *base, void *userData) | /* SDMMCHOST detect card remove status by host controller. */
static void SDMMCHOST_DetectCardRemoveByHost(SDMMCHOST_TYPE *base, void *userData) | {
(void)base;
s_sdInsertedFlag = false;
if (userData && ((sdmmchost_detect_card_t *)userData)->cardRemoved)
{
((sdmmchost_detect_card_t *)userData)->cardRemoved(false, ((sdmmchost_detect_card_t *)userData)->userData);
}
} | nanoframework/nf-interpreter | C++ | MIT License | 293 |
/* If 32-bit I/O port operations are not supported, then ASSERT(). */ | UINT32 EFIAPI S3IoOr32(IN UINTN Port, IN UINT32 OrData) | /* If 32-bit I/O port operations are not supported, then ASSERT(). */
UINT32 EFIAPI S3IoOr32(IN UINTN Port, IN UINT32 OrData) | {
return InternalSaveIoWrite32ValueToBootScript (Port, IoOr32 (Port, OrData));
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Send a signal to only one task, even if it's a CLONE_THREAD task. */ | SYSCALL_DEFINE2(tkill, pid_t, pid, int, sig) | /* Send a signal to only one task, even if it's a CLONE_THREAD task. */
SYSCALL_DEFINE2(tkill, pid_t, pid, int, sig) | {
if (pid <= 0)
return -EINVAL;
return do_tkill(0, pid, sig);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* If the current execution mode is not 32-bit protected mode with flat descriptors, then ASSERT(). If EntryPoint is 0, then ASSERT(). If NewStack is 0, then ASSERT(). */ | VOID EFIAPI UnitTestHostBaseLibAsmEnablePaging64(IN UINT16 Cs, IN UINT64 EntryPoint, IN UINT64 Context1 OPTIONAL, IN UINT64 Context2 OPTIONAL, IN UINT64 NewStack) | /* If the current execution mode is not 32-bit protected mode with flat descriptors, then ASSERT(). If EntryPoint is 0, then ASSERT(). If NewStack is 0, then ASSERT(). */
VOID EFIAPI UnitTestHostBaseLibAsmEnablePaging64(IN UINT16 Cs, IN UINT64 EntryPoint, IN UINT64 Context1 OPTIONAL, IN UINT64 Context2 OPTIONAL, IN UINT64 NewStack) | {
SWITCH_STACK_ENTRY_POINT NewEntryPoint;
NewEntryPoint = (SWITCH_STACK_ENTRY_POINT)(UINTN)(EntryPoint);
NewEntryPoint ((VOID *)(UINTN)Context1, (VOID *)(UINTN)Context2);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* RTC MSP Initialization This function configures the hardware resources used in this example: */ | void HAL_RTC_MspInit(RTC_HandleTypeDef *hrtc) | /* RTC MSP Initialization This function configures the hardware resources used in this example: */
void HAL_RTC_MspInit(RTC_HandleTypeDef *hrtc) | {
RCC_OscInitTypeDef RCC_OscInitStruct;
RCC_PeriphCLKInitTypeDef PeriphClkInitStruct;
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_LSI;
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE;
RCC_OscInitStruct.LSIState = RCC_LSI_ON;
RCC_OscInitStruct.LSEState = RCC_LSE_OFF;
if(HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
{
Error_Handler();
}
PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_RTC;
PeriphClkInitStruct.RTCClockSelection = RCC_RTCCLKSOURCE_LSI;
if(HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK)
{
Error_Handler();
}
__HAL_RCC_RTC_ENABLE();
HAL_NVIC_SetPriority(RTC_WKUP_IRQn, 0x0F, 0);
HAL_NVIC_EnableIRQ(RTC_WKUP_IRQn);
} | STMicroelectronics/STM32CubeF4 | C++ | Other | 789 |
/* Configure all GPIO's to AN to reduce the power consumption. */ | static void GPIO_ConfigAN(void) | /* Configure all GPIO's to AN to reduce the power consumption. */
static void GPIO_ConfigAN(void) | {
GPIO_InitTypeDef GPIO_InitStruct;
__HAL_RCC_GPIOA_CLK_ENABLE();
__HAL_RCC_GPIOB_CLK_ENABLE();
__HAL_RCC_GPIOC_CLK_ENABLE();
__HAL_RCC_GPIOH_CLK_ENABLE();
GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Pin = GPIO_PIN_All;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
HAL_GPIO_Init(GPIOH, &GPIO_InitStruct);
__HAL_RCC_GPIOA_CLK_DISABLE();
__HAL_RCC_GPIOB_CLK_DISABLE();
__HAL_RCC_GPIOC_CLK_DISABLE();
__HAL_RCC_GPIOH_CLK_DISABLE();
} | STMicroelectronics/STM32CubeF4 | C++ | Other | 789 |
/* Concatenates (partial) iovecs from src to the end of dst. It starts copying after skipping */ | void qemu_iovec_concat(QEMUIOVector *dst, QEMUIOVector *src, size_t soffset, size_t sbytes) | /* Concatenates (partial) iovecs from src to the end of dst. It starts copying after skipping */
void qemu_iovec_concat(QEMUIOVector *dst, QEMUIOVector *src, size_t soffset, size_t sbytes) | {
qemu_iovec_concat_iov(dst, src->iov, src->niov, soffset, sbytes);
} | ve3wwg/teensy3_qemu | C++ | Other | 15 |
/* I2C NACK Next Byte.
Causes the I2C controller to NACK the reception of the next byte */ | void i2c_nack_next(uint32_t i2c) | /* I2C NACK Next Byte.
Causes the I2C controller to NACK the reception of the next byte */
void i2c_nack_next(uint32_t i2c) | {
I2C_CR1(i2c) |= I2C_CR1_POS;
} | insane-adding-machines/unicore-mx | C++ | GNU General Public License v3.0 | 50 |
/* Returns the short identifying name of the codec. */ | const char* snd_ac97_get_short_name(struct snd_ac97 *ac97) | /* Returns the short identifying name of the codec. */
const char* snd_ac97_get_short_name(struct snd_ac97 *ac97) | {
const struct ac97_codec_id *pid;
for (pid = snd_ac97_codec_ids; pid->id; pid++)
if (pid->id == (ac97->id & pid->mask))
return pid->name;
return "unknown codec";
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* iis2dh_trigger_set - link external trigger to event data ready */ | int iis2dh_trigger_set(const struct device *dev, const struct sensor_trigger *trig, sensor_trigger_handler_t handler) | /* iis2dh_trigger_set - link external trigger to event data ready */
int iis2dh_trigger_set(const struct device *dev, const struct sensor_trigger *trig, sensor_trigger_handler_t handler) | {
struct iis2dh_data *iis2dh = dev->data;
const struct iis2dh_device_config *cfg = dev->config;
int16_t raw[3];
int state = (handler != NULL) ? PROPERTY_ENABLE : PROPERTY_DISABLE;
if (!cfg->int_gpio.port) {
return -ENOTSUP;
}
switch (trig->type) {
case SENSOR_TRIG_DATA_READY:
iis2dh->drdy_handler = handler;
iis2dh->drdy_trig = trig;
if (state) {
iis2dh_acceleration_raw_get(iis2dh->ctx, raw);
}
return iis2dh_enable_drdy(dev, SENSOR_TRIG_DATA_READY, state);
default:
LOG_ERR("Unsupported sensor trigger");
return -ENOTSUP;
}
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Push a formatted message referring to the current filter onto the statusbar. */ | void statusbar_push_filter_msg(const gchar *msg_format,...) | /* Push a formatted message referring to the current filter onto the statusbar. */
void statusbar_push_filter_msg(const gchar *msg_format,...) | {
va_list ap;
gchar *msg;
if (higher_priority_status_level(STATUS_LEVEL_FILTER))
return;
status_levels[STATUS_LEVEL_FILTER]++;
va_start(ap, msg_format);
msg = g_strdup_vprintf(msg_format, ap);
va_end(ap);
gtk_statusbar_push(GTK_STATUSBAR(info_bar), filter_ctx, msg);
g_free(msg);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Reads the product board assembly (PBA) number from the EEPROM and stores the value in part_num. */ | s32 igb_read_part_num(struct e1000_hw *hw, u32 *part_num) | /* Reads the product board assembly (PBA) number from the EEPROM and stores the value in part_num. */
s32 igb_read_part_num(struct e1000_hw *hw, u32 *part_num) | {
s32 ret_val;
u16 nvm_data;
ret_val = hw->nvm.ops.read(hw, NVM_PBA_OFFSET_0, 1, &nvm_data);
if (ret_val) {
hw_dbg("NVM Read Error\n");
goto out;
}
*part_num = (u32)(nvm_data << 16);
ret_val = hw->nvm.ops.read(hw, NVM_PBA_OFFSET_1, 1, &nvm_data);
if (ret_val) {
hw_dbg("NVM Read Error\n");
goto out;
}
*part_num |= nvm_data;
out:
return ret_val;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* write the current volume in info to the h/w and update the cache */ | static void put_vol_mute(struct hda_codec *codec, struct hda_amp_info *info, hda_nid_t nid, int ch, int direction, int index, int val) | /* write the current volume in info to the h/w and update the cache */
static void put_vol_mute(struct hda_codec *codec, struct hda_amp_info *info, hda_nid_t nid, int ch, int direction, int index, int val) | {
u32 parm;
parm = ch ? AC_AMP_SET_RIGHT : AC_AMP_SET_LEFT;
parm |= direction == HDA_OUTPUT ? AC_AMP_SET_OUTPUT : AC_AMP_SET_INPUT;
parm |= index << AC_AMP_SET_INDEX_SHIFT;
parm |= val;
snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, parm);
info->vol[ch] = val;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* The Olimex demo board has a single built in LED. This function simply toggles its state. */ | void prvToggleOnBoardLED(void) | /* The Olimex demo board has a single built in LED. This function simply toggles its state. */
void prvToggleOnBoardLED(void) | {
unsigned long ulState;
ulState = GPIO0_IOPIN;
if( ulState & mainON_BOARD_LED_BIT )
{
GPIO_IOCLR = mainON_BOARD_LED_BIT;
}
else
{
GPIO_IOSET = mainON_BOARD_LED_BIT;
}} | apopple/Pandaboard-FreeRTOS | C++ | null | 25 |
/* If nothing was found, 1 is returned, < 0 on error */ | int find_first_extent_bit(struct extent_io_tree *tree, u64 start, u64 *start_ret, u64 *end_ret, int bits) | /* If nothing was found, 1 is returned, < 0 on error */
int find_first_extent_bit(struct extent_io_tree *tree, u64 start, u64 *start_ret, u64 *end_ret, int bits) | {
struct rb_node *node;
struct extent_state *state;
int ret = 1;
spin_lock(&tree->lock);
node = tree_search(tree, start);
if (!node)
goto out;
while (1) {
state = rb_entry(node, struct extent_state, rb_node);
if (state->end >= start && (state->state & bits)) {
*start_ret = state->start;
*end_ret = state->end;
ret = 0;
break;
}
node = rb_next(node);
if (!node)
break;
}
out:
spin_unlock(&tree->lock);
return ret;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* In cases where a dual chip select mode is in use and different clock rates are required for each chip select, the */ | void EPIDividerSet(unsigned long ulBase, unsigned long ulDivider) | /* In cases where a dual chip select mode is in use and different clock rates are required for each chip select, the */
void EPIDividerSet(unsigned long ulBase, unsigned long ulDivider) | {
ASSERT(ulBase == EPI0_BASE);
HWREG(ulBase + EPI_O_BAUD) = ulDivider;
} | watterott/WebRadio | C++ | null | 71 |
/* wait for connection following a successful provisioning process */ | static int32_t WaitForConn(void) | /* wait for connection following a successful provisioning process */
static int32_t WaitForConn(void) | {
Provisioning_AppContext *const pCtx = &gAppCtx;
struct timespec ts;
int32_t retVal;
return (ReportSuccess());
} | nanoframework/nf-interpreter | C++ | MIT License | 293 |
/* Check if a CAN controller is present at the specified location by trying to set 'em into the PeliCAN mode */ | static int ems_pci_check_chan(const struct sja1000_priv *priv) | /* Check if a CAN controller is present at the specified location by trying to set 'em into the PeliCAN mode */
static int ems_pci_check_chan(const struct sja1000_priv *priv) | {
unsigned char res;
priv->write_reg(priv, REG_MOD, 1);
priv->write_reg(priv, REG_CDR, CDR_PELICAN);
res = priv->read_reg(priv, REG_CDR);
if (res == CDR_PELICAN)
return 1;
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Returns: TRUE if @data was successfully added to the @stream. */ | gboolean g_data_output_stream_put_int64(GDataOutputStream *stream, gint64 data, GCancellable *cancellable, GError **error) | /* Returns: TRUE if @data was successfully added to the @stream. */
gboolean g_data_output_stream_put_int64(GDataOutputStream *stream, gint64 data, GCancellable *cancellable, GError **error) | {
gsize bytes_written;
g_return_val_if_fail (G_IS_DATA_OUTPUT_STREAM (stream), FALSE);
switch (stream->priv->byte_order)
{
case G_DATA_STREAM_BYTE_ORDER_BIG_ENDIAN:
data = GINT64_TO_BE (data);
break;
case G_DATA_STREAM_BYTE_ORDER_LITTLE_ENDIAN:
data = GINT64_TO_LE (data);
break;
case G_DATA_STREAM_BYTE_ORDER_HOST_ENDIAN:
default:
break;
}
return g_output_stream_write_all (G_OUTPUT_STREAM (stream),
&data, 8,
&bytes_written,
cancellable, error);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* deinit CRC calculation unit
, 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 crc_deinit(void) | /* deinit CRC calculation unit
, 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 crc_deinit(void) | {
CRC_IDATA = 0xFFFFFFFF;
CRC_DATA = 0xFFFFFFFF;
CRC_FDATA = 0x00;
CRC_CTL = CRC_CTL_RST;
} | liuxuming/trochili | C++ | Apache License 2.0 | 132 |
/* Return value: number of bytes printed to buffer */ | static ssize_t pmcraid_show_drv_version(struct device *dev, struct device_attribute *attr, char *buf) | /* Return value: number of bytes printed to buffer */
static ssize_t pmcraid_show_drv_version(struct device *dev, struct device_attribute *attr, char *buf) | {
return snprintf(buf, PAGE_SIZE, "version: %s, build date: %s\n",
PMCRAID_DRIVER_VERSION, PMCRAID_DRIVER_DATE);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* We are not always called with irqs disabled - do that here, and also avoid lockdep recursion: */ | void lock_acquire(struct lockdep_map *lock, unsigned int subclass, int trylock, int read, int check, struct lockdep_map *nest_lock, unsigned long ip) | /* We are not always called with irqs disabled - do that here, and also avoid lockdep recursion: */
void lock_acquire(struct lockdep_map *lock, unsigned int subclass, int trylock, int read, int check, struct lockdep_map *nest_lock, unsigned long ip) | {
unsigned long flags;
trace_lock_acquire(lock, subclass, trylock, read, check, nest_lock, ip);
if (unlikely(current->lockdep_recursion))
return;
raw_local_irq_save(flags);
check_flags(flags);
current->lockdep_recursion = 1;
__lock_acquire(lock, subclass, trylock, read, check,
irqs_disabled_flags(flags), nest_lock, ip, 0);
current->lockdep_recursion = 0;
raw_local_irq_restore(flags);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* This method will free @invocation, you cannot use it afterwards. */ | void _g_freedesktop_dbus_complete_remove_match(_GFreedesktopDBus *object, GDBusMethodInvocation *invocation) | /* This method will free @invocation, you cannot use it afterwards. */
void _g_freedesktop_dbus_complete_remove_match(_GFreedesktopDBus *object, GDBusMethodInvocation *invocation) | {
g_dbus_method_invocation_return_value (invocation,
g_variant_new ("()"));
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Programs a double word (64-bit) at a specified address. */ | FLASH_Status FLASH_ProgramDoubleWord(uint32_t Address, uint64_t Data) | /* Programs a double word (64-bit) at a specified address. */
FLASH_Status FLASH_ProgramDoubleWord(uint32_t Address, uint64_t Data) | {
FLASH_Status status = FLASH_COMPLETE;
assert_param(IS_FLASH_ADDRESS(Address));
status = FLASH_WaitForLastOperation();
if(status == FLASH_COMPLETE)
{
FLASH->CR &= CR_PSIZE_MASK;
FLASH->CR |= FLASH_PSIZE_DOUBLE_WORD;
FLASH->CR |= FLASH_CR_PG;
*(__IO uint64_t*)Address = Data;
status = FLASH_WaitForLastOperation();
FLASH->CR &= (~FLASH_CR_PG);
}
return status;
} | MaJerle/stm32f429 | C++ | null | 2,036 |
/* This function calculates the value needed for a valid UINT8 checksum */ | UINT8 CalculateChecksum8(IN UINT8 *Buffer, IN UINTN Size) | /* This function calculates the value needed for a valid UINT8 checksum */
UINT8 CalculateChecksum8(IN UINT8 *Buffer, IN UINTN Size) | {
return (UINT8) (0x100 - CalculateSum8 (Buffer, Size));
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Returns 0 if memory pointed to by s1 and and s2 are identical; non-zero otherwise. */ | static int osdp_ct_compare(const void *s1, const void *s2, size_t len) | /* Returns 0 if memory pointed to by s1 and and s2 are identical; non-zero otherwise. */
static int osdp_ct_compare(const void *s1, const void *s2, size_t len) | {
size_t i, ret = 0;
const uint8_t *_s1 = s1;
const uint8_t *_s2 = s2;
for (i = 0; i < len; i++) {
ret |= _s1[i] ^ _s2[i];
}
return (int)ret;
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* TIM MSP Initialization This function configures the hardware resources used in this example: */ | void HAL_TIM_IC_MspInit(TIM_HandleTypeDef *htim) | /* TIM MSP Initialization This function configures the hardware resources used in this example: */
void HAL_TIM_IC_MspInit(TIM_HandleTypeDef *htim) | {
GPIO_InitTypeDef GPIO_InitStruct;
TIMx_CLK_ENABLE();
TIMx_CHANNEL_GPIO_PORT();
GPIO_InitStruct.Pin = GPIO_PIN_CHANNEL2;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_PULLUP;
GPIO_InitStruct.Speed = GPIO_SPEED_HIGH;
GPIO_InitStruct.Alternate = GPIO_AF_TIMx;
HAL_GPIO_Init(GPIO_PORT, &GPIO_InitStruct);
HAL_NVIC_SetPriority(TIMx_CC_IRQn, 0, 1);
HAL_NVIC_EnableIRQ(TIMx_CC_IRQn);
} | STMicroelectronics/STM32CubeF4 | C++ | Other | 789 |
/* Reads the value of the pins from pcf857x respectively from a connected device. */ | static int pcf857x_process_input(const struct device *dev, gpio_port_value_t *value) | /* Reads the value of the pins from pcf857x respectively from a connected device. */
static int pcf857x_process_input(const struct device *dev, gpio_port_value_t *value) | {
const struct pcf857x_drv_cfg *drv_cfg = dev->config;
struct pcf857x_drv_data *drv_data = dev->data;
int rc = 0;
uint8_t rx_buf[2] = {0};
rc = i2c_read_dt(&drv_cfg->i2c, rx_buf, drv_data->num_bytes);
if (rc != 0) {
LOG_ERR("%s: failed to read from device: %d", dev->name, rc);
return -EIO;
}
if (value) {
*value = sys_get_le16(rx_buf);
}
drv_data->input_port_last = sys_get_le16(rx_buf);
return rc;
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* probe function to register wifi to connectivity framwotk */ | int32_t mxwifi_probe(void **ll_drv_context) | /* probe function to register wifi to connectivity framwotk */
int32_t mxwifi_probe(void **ll_drv_context) | {
if (MX_WIFI_RegisterBusIO(&MxWifiObj,
MX_WIFI_UART_Init,
MX_WIFI_UART_DeInit,
MX_WIFI_IO_DELAY,
MX_WIFI_UART_SendData,
MX_WIFI_UART_ReceiveData) == 0)
{
*ll_drv_context = &MxWifiObj;
return 0;
}
return -1;
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* Copy a RAM buffer to a flash memory section. */ | static void mem_flash_write(isp_addr_t dst, const void *src, uint16_t nbytes) | /* Copy a RAM buffer to a flash memory section. */
static void mem_flash_write(isp_addr_t dst, const void *src, uint16_t nbytes) | {
nvm_flash_erase_and_write_buffer(dst, src, nbytes, true);
} | memfault/zero-to-main | C++ | null | 200 |
/* Adjust the number of results from an expression list 'e' with 'nexps' expressions to 'nvars' values. */ | static void adjust_assign(LexState *ls, int nvars, int nexps, expdesc *e) | /* Adjust the number of results from an expression list 'e' with 'nexps' expressions to 'nvars' values. */
static void adjust_assign(LexState *ls, int nvars, int nexps, expdesc *e) | {
int extra = needed + 1;
if (extra < 0)
extra = 0;
luaK_setreturns(fs, e, extra);
}
else {
if (e->k != VVOID)
luaK_exp2nextreg(fs, e);
if (needed > 0)
luaK_nil(fs, fs->freereg, needed);
}
if (needed > 0)
luaK_reserveregs(fs, needed);
else
fs->freereg += needed;
} | Nicholas3388/LuaNode | C++ | Other | 1,055 |
/* This function initiates TX and RX DMA transfers by enabling DMA channels. */ | void StartTransfers(void) | /* This function initiates TX and RX DMA transfers by enabling DMA channels. */
void StartTransfers(void) | {
LL_USART_EnableDMAReq_RX(USART1);
LL_USART_EnableDMAReq_TX(USART1);
LL_DMA_EnableStream(DMA2, LL_DMA_STREAM_5);
LL_DMA_EnableStream(DMA2, LL_DMA_STREAM_7);
} | STMicroelectronics/STM32CubeF4 | C++ | Other | 789 |
/* This API is used to get the FOC status from the sensor. */ | static int8_t get_foc_status(uint8_t *foc_status, struct bmi160_dev const *dev) | /* This API is used to get the FOC status from the sensor. */
static int8_t get_foc_status(uint8_t *foc_status, struct bmi160_dev const *dev) | {
int8_t rslt;
uint8_t data;
rslt = bmi160_get_regs(BMI160_STATUS_ADDR, &data, 1, dev);
if (rslt == BMI160_OK)
{
*foc_status = BMI160_GET_BITS(data, BMI160_FOC_STATUS);
}
return rslt;
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* Stop conversion of insert channels, disable interruption of end-of-conversion. Disable ADC peripheral if no normal conversion is on going. */ | ald_status_t ald_adc_insert_stop_by_it(ald_adc_handle_t *hperh) | /* Stop conversion of insert channels, disable interruption of end-of-conversion. Disable ADC peripheral if no normal conversion is on going. */
ald_status_t ald_adc_insert_stop_by_it(ald_adc_handle_t *hperh) | {
assert_param(IS_ADC_TYPE(hperh->perh));
CLEAR_BIT(hperh->state, ALD_ADC_STATE_BUSY_I);
ALD_ADC_DISABLE(hperh);
ald_adc_interrupt_config(hperh, ALD_ADC_IT_ICH, DISABLE);
return ALD_OK;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Try to consume stocked charge on this cpu. If success, PAGE_SIZE is consumed from local stock and true is returned. If the stock is 0 or charges from a cgroup which is not current target, returns false. This stock will be refilled. */ | static bool consume_stock(struct mem_cgroup *mem) | /* Try to consume stocked charge on this cpu. If success, PAGE_SIZE is consumed from local stock and true is returned. If the stock is 0 or charges from a cgroup which is not current target, returns false. This stock will be refilled. */
static bool consume_stock(struct mem_cgroup *mem) | {
struct memcg_stock_pcp *stock;
bool ret = true;
stock = &get_cpu_var(memcg_stock);
if (mem == stock->cached && stock->charge)
stock->charge -= PAGE_SIZE;
else
ret = false;
put_cpu_var(memcg_stock);
return ret;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* An interrupt will be generated every time the timer fires */ | int mpc52xx_gpt_start_timer(struct mpc52xx_gpt_priv *gpt, u64 period, int continuous) | /* An interrupt will be generated every time the timer fires */
int mpc52xx_gpt_start_timer(struct mpc52xx_gpt_priv *gpt, u64 period, int continuous) | {
return mpc52xx_gpt_do_start(gpt, period, continuous, 0);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Returns a pointer to the appropraite Smack label if there is one, otherwise a pointer to the invalid Smack label. */ | char* smack_from_secid(const u32 secid) | /* Returns a pointer to the appropraite Smack label if there is one, otherwise a pointer to the invalid Smack label. */
char* smack_from_secid(const u32 secid) | {
struct smack_known *skp;
rcu_read_lock();
list_for_each_entry_rcu(skp, &smack_known_list, list) {
if (skp->smk_secid == secid) {
rcu_read_unlock();
return skp->smk_known;
}
}
rcu_read_unlock();
return smack_known_invalid.smk_known;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* get the bit state of ADCx software start conversion */ | FlagStatus adc_routine_software_startconv_flag_get(uint32_t adc_periph) | /* get the bit state of ADCx software start conversion */
FlagStatus adc_routine_software_startconv_flag_get(uint32_t adc_periph) | {
FlagStatus reval = RESET;
if((uint32_t)RESET != (ADC_STAT(adc_periph) & ADC_STAT_STRC)) {
reval = SET;
}
return reval;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* If there is no additional space for HOB creation, then ASSERT(). */ | VOID EFIAPI BuildCpuHob(IN UINT8 SizeOfMemorySpace, IN UINT8 SizeOfIoSpace) | /* If there is no additional space for HOB creation, then ASSERT(). */
VOID EFIAPI BuildCpuHob(IN UINT8 SizeOfMemorySpace, IN UINT8 SizeOfIoSpace) | {
EFI_HOB_CPU *Hob;
Hob = InternalPeiCreateHob (EFI_HOB_TYPE_CPU, (UINT16)sizeof (EFI_HOB_CPU));
if (Hob == NULL) {
return;
}
Hob->SizeOfMemorySpace = SizeOfMemorySpace;
Hob->SizeOfIoSpace = SizeOfIoSpace;
ZeroMem (Hob->Reserved, sizeof (Hob->Reserved));
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Helper calls to extract info from desriptors and other trivial state from regs. */ | static int stream_desc_sof(struct SDesc *d) | /* Helper calls to extract info from desriptors and other trivial state from regs. */
static int stream_desc_sof(struct SDesc *d) | {
return d->control & SDESC_CTRL_SOF;
} | ve3wwg/teensy3_qemu | C++ | Other | 15 |
/* Determines if there is any space in the transmit FIFO. */ | bool UARTSpaceAvail(uint32_t ui32Base) | /* Determines if there is any space in the transmit FIFO. */
bool UARTSpaceAvail(uint32_t ui32Base) | {
ASSERT(_UARTBaseValid(ui32Base));
return((HWREG(ui32Base + UART_O_FR) & UART_FR_TXFF) ? false : true);
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* Software reset. Restore the default values in user registers. */ | int32_t lsm6dsl_reset_get(stmdev_ctx_t *ctx, uint8_t *val) | /* Software reset. Restore the default values in user registers. */
int32_t lsm6dsl_reset_get(stmdev_ctx_t *ctx, uint8_t *val) | {
lsm6dsl_ctrl3_c_t ctrl3_c;
int32_t ret;
ret = lsm6dsl_read_reg(ctx, LSM6DSL_CTRL3_C, (uint8_t*)&ctrl3_c, 1);
*val = ctrl3_c.sw_reset;
return ret;
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* This function validates error status address space for type 4 structure. */ | STATIC VOID EFIAPI ValidatePccErrStatusGas(IN UINT8 *Ptr, IN VOID *Context) | /* This function validates error status address space for type 4 structure. */
STATIC VOID EFIAPI ValidatePccErrStatusGas(IN UINT8 *Ptr, IN VOID *Context) | {
if (*PccSubspaceType == EFI_ACPI_6_4_PCCT_SUBSPACE_TYPE_4_EXTENDED_PCC) {
return;
}
ValidatePccGas (Ptr, Context);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* This function will write the specified length of data to the pipe. */ | rt_ssize_t rt_pipe_write(rt_device_t device, rt_off_t pos, const void *buffer, rt_size_t count) | /* This function will write the specified length of data to the pipe. */
rt_ssize_t rt_pipe_write(rt_device_t device, rt_off_t pos, const void *buffer, rt_size_t count) | {
uint8_t *pbuf;
rt_size_t write_bytes = 0;
rt_pipe_t *pipe = (rt_pipe_t *)device;
if (device == RT_NULL)
{
rt_set_errno(-EINVAL);
return 0;
}
if (count == 0)
{
return 0;
}
pbuf = (uint8_t*)buffer;
rt_mutex_take(&pipe->lock, -1);
while (write_bytes < count)
{
int len = rt_ringbuffer_put(pipe->fifo, &pbuf[write_bytes], count - write_bytes);
if (len <= 0)
{
break;
}
write_bytes += len;
}
rt_mutex_release(&pipe->lock);
return write_bytes;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* We want to avoid an expensive divide : (offset / cache->buffer_size) Using the fact that buffer_size is a constant for a particular cache, we can replace (offset / cache->buffer_size) by reciprocal_divide(offset, cache->reciprocal_buffer_size) */ | static unsigned int obj_to_index(const struct kmem_cache *cache, const struct slab *slab, void *obj) | /* We want to avoid an expensive divide : (offset / cache->buffer_size) Using the fact that buffer_size is a constant for a particular cache, we can replace (offset / cache->buffer_size) by reciprocal_divide(offset, cache->reciprocal_buffer_size) */
static unsigned int obj_to_index(const struct kmem_cache *cache, const struct slab *slab, void *obj) | {
u32 offset = (obj - slab->s_mem);
return reciprocal_divide(offset, cache->reciprocal_buffer_size);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Routine to write bytes to the Modem Management Controller. We start by the end because it is the way it should be ! */ | static void mmc_write(u_long base, u_char o, u_char *b, int n) | /* Routine to write bytes to the Modem Management Controller. We start by the end because it is the way it should be ! */
static void mmc_write(u_long base, u_char o, u_char *b, int n) | {
o += n;
b += n;
while(n-- > 0 )
mmc_out(base, --o, *(--b));
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Builds a pdu frame as a REJ command. */ | void llc_pdu_init_as_rej_cmd(struct sk_buff *skb, u8 p_bit, u8 nr) | /* Builds a pdu frame as a REJ command. */
void llc_pdu_init_as_rej_cmd(struct sk_buff *skb, u8 p_bit, u8 nr) | {
struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb);
pdu->ctrl_1 = LLC_PDU_TYPE_S;
pdu->ctrl_1 |= LLC_2_PDU_CMD_REJ;
pdu->ctrl_2 = 0;
pdu->ctrl_2 |= p_bit & LLC_S_PF_BIT_MASK;
pdu->ctrl_1 &= 0x0F;
pdu->ctrl_2 |= (nr << 1) & 0xFE;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* This routine prepares the mailbox command for reading HBA revision information. */ | void lpfc_read_rev(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) | /* This routine prepares the mailbox command for reading HBA revision information. */
void lpfc_read_rev(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) | {
MAILBOX_t *mb = &pmb->u.mb;
memset(pmb, 0, sizeof (LPFC_MBOXQ_t));
mb->un.varRdRev.cv = 1;
mb->un.varRdRev.v3req = 1;
mb->mbxCommand = MBX_READ_REV;
mb->mbxOwner = OWN_HOST;
return;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Description: Set a range of bits, starting at @start and ending with @end. Returns zero on success, negative values on failure. */ | int netlbl_secattr_catmap_setrng(struct netlbl_lsm_secattr_catmap *catmap, u32 start, u32 end, gfp_t flags) | /* Description: Set a range of bits, starting at @start and ending with @end. Returns zero on success, negative values on failure. */
int netlbl_secattr_catmap_setrng(struct netlbl_lsm_secattr_catmap *catmap, u32 start, u32 end, gfp_t flags) | {
int ret_val = 0;
struct netlbl_lsm_secattr_catmap *iter = catmap;
u32 iter_max_spot;
u32 spot;
while (iter->next != NULL &&
start >= (iter->startbit + NETLBL_CATMAP_SIZE))
iter = iter->next;
iter_max_spot = iter->startbit + NETLBL_CATMAP_SIZE;
for (spot = start; spot <= end && ret_val == 0; spot++) {
if (spot >= iter_max_spot && iter->next != NULL) {
iter = iter->next;
iter_max_spot = iter->startbit + NETLBL_CATMAP_SIZE;
}
ret_val = netlbl_secattr_catmap_setbit(iter, spot, GFP_ATOMIC);
}
return ret_val;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Message: Reset Opcode: 0x009f Type: RegistrationAndManagement Direction: pbx2dev VarLength: no */ | static void handle_Reset(ptvcursor_t *cursor, packet_info *pinfo _U_) | /* Message: Reset Opcode: 0x009f Type: RegistrationAndManagement Direction: pbx2dev VarLength: no */
static void handle_Reset(ptvcursor_t *cursor, packet_info *pinfo _U_) | {
ptvcursor_add(cursor, hf_skinny_resetType, 4, ENC_LITTLE_ENDIAN);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* In general all page table modifications should use the V8 atomic swap instruction. This insures the mmu and the cpu are in sync with respect to ref/mod bits in the page tables. */ | static unsigned long srmmu_swap(unsigned long *addr, unsigned long value) | /* In general all page table modifications should use the V8 atomic swap instruction. This insures the mmu and the cpu are in sync with respect to ref/mod bits in the page tables. */
static unsigned long srmmu_swap(unsigned long *addr, unsigned long value) | {
__asm__ __volatile__("swap [%2], %0" : "=&r" (value) : "0" (value), "r" (addr));
return value;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Find a file within a volume by its name. */ | EFI_STATUS EFIAPI PeiFfsFindFileByName(IN CONST EFI_GUID *FileName, IN EFI_PEI_FV_HANDLE VolumeHandle, OUT EFI_PEI_FILE_HANDLE *FileHandle) | /* Find a file within a volume by its name. */
EFI_STATUS EFIAPI PeiFfsFindFileByName(IN CONST EFI_GUID *FileName, IN EFI_PEI_FV_HANDLE VolumeHandle, OUT EFI_PEI_FILE_HANDLE *FileHandle) | {
PEI_CORE_FV_HANDLE *CoreFvHandle;
if ((VolumeHandle == NULL) || (FileName == NULL) || (FileHandle == NULL)) {
return EFI_INVALID_PARAMETER;
}
CoreFvHandle = FvHandleToCoreHandle (VolumeHandle);
if ((CoreFvHandle == NULL) || (CoreFvHandle->FvPpi == NULL)) {
return EFI_NOT_FOUND;
}
return CoreFvHandle->FvPpi->FindFileByName (CoreFvHandle->FvPpi, FileName, &VolumeHandle, FileHandle);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Internal worker function that transfers control to an enabled periodic SMI handler on the specified logical CPU. This function determines if the periodic SMI handler yielded and needs to be resumed. It also and switches to an allocated stack if one was allocated in */ | VOID EFIAPI PeriodicSmiDispatchFunctionOnCpu(PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT *PeriodicSmiLibraryHandler) | /* Internal worker function that transfers control to an enabled periodic SMI handler on the specified logical CPU. This function determines if the periodic SMI handler yielded and needs to be resumed. It also and switches to an allocated stack if one was allocated in */
VOID EFIAPI PeriodicSmiDispatchFunctionOnCpu(PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT *PeriodicSmiLibraryHandler) | {
if (SetJump (&PeriodicSmiLibraryHandler->DispatchJumpBuffer) != 0) {
return;
}
PeriodicSmiLibraryHandler->DispatchTotalTime = 0;
PeriodicSmiLibraryHandler->DispatchCheckPointTime = GetPerformanceCounter ();
if (PeriodicSmiLibraryHandler->YieldFlag) {
LongJump (&PeriodicSmiLibraryHandler->YieldJumpBuffer, 1);
} else if (PeriodicSmiLibraryHandler->Stack == NULL) {
PeriodicSmiLibraryHandler->DispatchFunction (
PeriodicSmiLibraryHandler->Context,
PeriodicSmiLibraryHandler->ElapsedTime
);
PeriodicSmiExit ();
} else {
SwitchStack (
PeriodicSmiDispatchFunctionSwitchStack,
PeriodicSmiLibraryHandler,
NULL,
(UINT8 *)PeriodicSmiLibraryHandler->Stack + PeriodicSmiLibraryHandler->StackSize
);
}
ASSERT (FALSE);
CpuDeadLoop ();
} | tianocore/edk2 | C++ | Other | 4,240 |
/* genphy_restart_aneg - Enable and Restart Autonegotiation @phydev: target phy_device struct */ | int genphy_restart_aneg(struct phy_device *phydev) | /* genphy_restart_aneg - Enable and Restart Autonegotiation @phydev: target phy_device struct */
int genphy_restart_aneg(struct phy_device *phydev) | {
int ctl;
ctl = phy_read(phydev, MDIO_DEVAD_NONE, MII_BMCR);
if (ctl < 0)
return ctl;
ctl |= (BMCR_ANENABLE | BMCR_ANRESTART);
ctl &= ~(BMCR_ISOLATE);
ctl = phy_write(phydev, MDIO_DEVAD_NONE, MII_BMCR, ctl);
return ctl;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Command response callback function for ble_gap_device_name_get_req_enc BLE command.
Callback for decoding the output parameters and the command response return code. */ | static uint32_t gap_device_name_get_rsp_dec(const uint8_t *p_buffer, uint16_t length) | /* Command response callback function for ble_gap_device_name_get_req_enc BLE command.
Callback for decoding the output parameters and the command response return code. */
static uint32_t gap_device_name_get_rsp_dec(const uint8_t *p_buffer, uint16_t length) | {
uint32_t result_code;
const uint32_t err_code =
ble_gap_device_name_get_rsp_dec(p_buffer,
length,
m_output_params.gap_device_name_get_out_params.p_dev_name,
m_output_params.gap_device_name_get_out_params.p_len,
&result_code);
APP_ERROR_CHECK(err_code);
return result_code;
} | labapart/polymcu | C++ | null | 201 |
/* Create a IP6_MLD_GROUP list entry node and record to IP6 service binding data. */ | IP6_MLD_GROUP* Ip6CreateMldEntry(IN OUT IP6_SERVICE *IpSb, IN EFI_IPv6_ADDRESS *MulticastAddr, IN UINT32 DelayTimer) | /* Create a IP6_MLD_GROUP list entry node and record to IP6 service binding data. */
IP6_MLD_GROUP* Ip6CreateMldEntry(IN OUT IP6_SERVICE *IpSb, IN EFI_IPv6_ADDRESS *MulticastAddr, IN UINT32 DelayTimer) | {
IP6_MLD_GROUP *Entry;
NET_CHECK_SIGNATURE (IpSb, IP6_SERVICE_SIGNATURE);
ASSERT (MulticastAddr != NULL && IP6_IS_MULTICAST (MulticastAddr));
Entry = AllocatePool (sizeof (IP6_MLD_GROUP));
if (Entry != NULL) {
Entry->RefCnt = 1;
Entry->DelayTimer = DelayTimer;
Entry->SendByUs = FALSE;
IP6_COPY_ADDRESS (&Entry->Address, MulticastAddr);
InsertTailList (&IpSb->MldCtrl.Groups, &Entry->Link);
}
return Entry;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Enable basic functions of the Madge chipset needed for initialization. */ | static void abyss_enable(struct net_device *dev) | /* Enable basic functions of the Madge chipset needed for initialization. */
static void abyss_enable(struct net_device *dev) | {
unsigned char reset_reg;
unsigned long ioaddr;
ioaddr = dev->base_addr;
reset_reg = inb(ioaddr + PCIBM2_RESET_REG);
reset_reg |= PCIBM2_RESET_REG_CHIP_NRES;
outb(reset_reg, ioaddr + PCIBM2_RESET_REG);
tms380tr_wait(100);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This function prepares the state before issuing the class specific commands. */ | USBH_StatusTypeDef USBH_CDC_GetLineCoding(USBH_HandleTypeDef *phost, CDC_LineCodingTypeDef *linecodin) | /* This function prepares the state before issuing the class specific commands. */
USBH_StatusTypeDef USBH_CDC_GetLineCoding(USBH_HandleTypeDef *phost, CDC_LineCodingTypeDef *linecodin) | {
CDC_HandleTypeDef *CDC_Handle = (CDC_HandleTypeDef*) phost->pActiveClass->pData;
if((phost->gState == HOST_CLASS) ||(phost->gState == HOST_CLASS_REQUEST))
{
*linecodin = CDC_Handle->LineCoding;
return USBH_OK;
}
else
{
return USBH_FAIL;
}
} | labapart/polymcu | C++ | null | 201 |
/* From experiments, it appears that a USB reset causes USBReEP to re-initialise to 3 (= just the control endpoints). However, a USB bus reset does not disturb the USBMaxPSize settings. */ | static void USBHwEPRealize(int idx, U16 wMaxPSize) | /* From experiments, it appears that a USB reset causes USBReEP to re-initialise to 3 (= just the control endpoints). However, a USB bus reset does not disturb the USBMaxPSize settings. */
static void USBHwEPRealize(int idx, U16 wMaxPSize) | {
LPC_USB->USBReEP |= (1 << idx);
LPC_USB->USBEpInd = idx;
LPC_USB->USBMaxPSize = wMaxPSize;
Wait4DevInt(EP_RLZED);
} | ajhc/demo-cortex-m3 | C++ | null | 38 |
/* For example: DisplaySELVariableDataFormatTypes(UINT8 Type, UINT8 Option) has a item: "0x07-0x7F, Unused" Now define Key = 0x7F07, that is to say: High = 0x7F, Low = 0x07. Then all the Key Value between Low and High gets the same string L"Unused". */ | UINT8 QueryTable(IN TABLE_ITEM *Table, IN UINTN Number, IN UINT8 Key, IN OUT CHAR16 *Info, IN UINTN InfoLen) | /* For example: DisplaySELVariableDataFormatTypes(UINT8 Type, UINT8 Option) has a item: "0x07-0x7F, Unused" Now define Key = 0x7F07, that is to say: High = 0x7F, Low = 0x07. Then all the Key Value between Low and High gets the same string L"Unused". */
UINT8 QueryTable(IN TABLE_ITEM *Table, IN UINTN Number, IN UINT8 Key, IN OUT CHAR16 *Info, IN UINTN InfoLen) | {
UINTN Index;
UINT8 High;
UINT8 Low;
for (Index = 0; Index < Number; Index++) {
High = (UINT8)(Table[Index].Key >> 8);
Low = (UINT8)(Table[Index].Key & 0x00FF);
if ( ((High > Low) && (Key >= Low) && (Key <= High))
|| (Table[Index].Key == Key))
{
StrnCpyS (Info, InfoLen, Table[Index].Info, InfoLen - 1);
StrnCatS (Info, InfoLen, L"\n", InfoLen - 1 - StrLen (Info));
return Key;
}
}
StrCpyS (Info, InfoLen, L"Undefined Value\n");
return QUERY_TABLE_UNFOUND;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Returns: (array length=n_properties) (transfer container): an array of #GParamSpec* which should be freed after use */ | GParamSpec** g_object_class_list_properties(GObjectClass *class, guint *n_properties_p) | /* Returns: (array length=n_properties) (transfer container): an array of #GParamSpec* which should be freed after use */
GParamSpec** g_object_class_list_properties(GObjectClass *class, guint *n_properties_p) | {
GParamSpec **pspecs;
guint n;
g_return_val_if_fail (G_IS_OBJECT_CLASS (class), NULL);
pspecs = g_param_spec_pool_list (pspec_pool,
G_OBJECT_CLASS_TYPE (class),
&n);
if (n_properties_p)
*n_properties_p = n;
return pspecs;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Check if the given time value is zero. */ | BOOLEAN IsTimeZero(IN EFI_TIME *Time) | /* Check if the given time value is zero. */
BOOLEAN IsTimeZero(IN EFI_TIME *Time) | {
if ((Time->Year == 0) && (Time->Month == 0) && (Time->Day == 0) &&
(Time->Hour == 0) && (Time->Minute == 0) && (Time->Second == 0))
{
return TRUE;
}
return FALSE;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Converts 32bit lower physical addr into a virt address. */ | void* mpt2sas_base_get_reply_virt_addr(struct MPT2SAS_ADAPTER *ioc, u32 phys_addr) | /* Converts 32bit lower physical addr into a virt address. */
void* mpt2sas_base_get_reply_virt_addr(struct MPT2SAS_ADAPTER *ioc, u32 phys_addr) | {
if (!phys_addr)
return NULL;
return ioc->reply + (phys_addr - (u32)ioc->reply_dma);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Read a PHY register through the MDIO interface. */ | int32_t lan8742_io_read_reg(uint32_t DevAddr, uint32_t RegAddr, uint32_t *pRegVal) | /* Read a PHY register through the MDIO interface. */
int32_t lan8742_io_read_reg(uint32_t DevAddr, uint32_t RegAddr, uint32_t *pRegVal) | {
if(HAL_ETH_ReadPHYRegister(ð_handle, DevAddr, RegAddr, pRegVal) != HAL_OK)
{
return ETH_PHY_STATUS_ERROR;
}
return ETH_PHY_STATUS_OK;
} | nanoframework/nf-interpreter | C++ | MIT License | 293 |
/* In the case of a PHY power down to save power, or to turn off link during a driver unload, or wake on lan is not enabled, restore the link to previous settings. */ | void e1000_power_down_phy_copper(struct e1000_hw *hw) | /* In the case of a PHY power down to save power, or to turn off link during a driver unload, or wake on lan is not enabled, restore the link to previous settings. */
void e1000_power_down_phy_copper(struct e1000_hw *hw) | {
u16 mii_reg = 0;
e1e_rphy(hw, PHY_CONTROL, &mii_reg);
mii_reg |= MII_CR_POWER_DOWN;
e1e_wphy(hw, PHY_CONTROL, mii_reg);
msleep(1);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Remove the provided input device. Make sure not to use the provided input device afterwards anymore. */ | void lv_indev_delete(lv_indev_t *indev) | /* Remove the provided input device. Make sure not to use the provided input device afterwards anymore. */
void lv_indev_delete(lv_indev_t *indev) | {
LV_ASSERT_NULL(indev);
LV_ASSERT_NULL(indev->driver);
LV_ASSERT_NULL(indev->driver->read_timer);
lv_timer_del(indev->driver->read_timer);
_lv_ll_remove(&LV_GC_ROOT(_lv_indev_ll), indev);
lv_mem_free(indev);
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* lis2de12_handle_interrupt - handle the drdy event read data and call handler if registered any */ | static void lis2de12_handle_interrupt(const struct device *dev) | /* lis2de12_handle_interrupt - handle the drdy event read data and call handler if registered any */
static void lis2de12_handle_interrupt(const struct device *dev) | {
struct lis2de12_data *lis2de12 = dev->data;
const struct lis2de12_config *cfg = dev->config;
stmdev_ctx_t *ctx = (stmdev_ctx_t *)&cfg->ctx;
lis2de12_status_reg_t status;
while (1) {
if (lis2de12_status_get(ctx, &status) < 0) {
LOG_ERR("failed reading status reg");
return;
}
if (status.zyxda == 0) {
break;
}
if ((status.zyxda) && (lis2de12->handler_drdy_acc != NULL)) {
lis2de12->handler_drdy_acc(dev, lis2de12->trig_drdy_acc);
}
}
gpio_pin_interrupt_configure_dt(lis2de12->drdy_gpio,
GPIO_INT_EDGE_TO_ACTIVE);
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* This application must call this API repeatedly, passing in sequential chunks of data from the boot image (SB file) that is to be processed. The ROM will perform the selected operation on this data and return. The application may call this function with as much or as little data as it wishes, which can be used to select the granularity of time given to the application in between executing the operation. */ | status_t kb_execute(kb_session_ref_t *session, const uint8_t *data, uint32_t dataLength) | /* This application must call this API repeatedly, passing in sequential chunks of data from the boot image (SB file) that is to be processed. The ROM will perform the selected operation on this data and return. The application may call this function with as much or as little data as it wishes, which can be used to select the granularity of time given to the application in between executing the operation. */
status_t kb_execute(kb_session_ref_t *session, const uint8_t *data, uint32_t dataLength) | {
assert(BOOTLOADER_API_TREE_POINTER);
return BOOTLOADER_API_TREE_POINTER->kbApi->kb_execute_function(session, data, dataLength);
} | ARMmbed/DAPLink | C++ | Apache License 2.0 | 2,140 |
/* Deinitializes the PWR peripheral registers to their default reset values. */ | void PWR_DeInit(void) | /* Deinitializes the PWR peripheral registers to their default reset values. */
void PWR_DeInit(void) | {
RCC_APB1PeriphResetCmd(RCC_APB1Periph_PWR, ENABLE);
RCC_APB1PeriphResetCmd(RCC_APB1Periph_PWR, DISABLE);
} | gcallipo/RadioDSP-Stm32f103 | C++ | Common Creative - Attribution 3.0 | 51 |
/* Enable the automatic slave select function of the specified SPI port.
The */ | void SPIAutoSSEnable(unsigned long ulBase, unsigned long ulSlaveSel) | /* Enable the automatic slave select function of the specified SPI port.
The */
void SPIAutoSSEnable(unsigned long ulBase, unsigned long ulSlaveSel) | {
xASSERT((ulBase == SPI0_BASE) || (ulBase == SPI1_BASE)||
(ulBase == SPI2_BASE) || (ulBase == SPI3_BASE));
xASSERT((ulSlaveSel == SPI_SS_NONE) || (ulSlaveSel == SPI_SS0) ||
(ulSlaveSel == SPI_SS1) || (ulSlaveSel == SPI_SS0_SS1));
xHWREG(ulBase + SPI_SSR) |= SPI_SSR_AUTOSS;
xHWREG(ulBase + SPI_SSR) &= ~SPI_SSR_SSR_M;
xHWREG(ulBase + SPI_SSR) |= ulSlaveSel;
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Routine to get the next Handle, when you are searching for all handles. */ | IHANDLE* SmmGetNextLocateAllHandles(IN OUT LOCATE_POSITION *Position, OUT VOID **Interface) | /* Routine to get the next Handle, when you are searching for all handles. */
IHANDLE* SmmGetNextLocateAllHandles(IN OUT LOCATE_POSITION *Position, OUT VOID **Interface) | {
IHANDLE *Handle;
Position->Position = Position->Position->ForwardLink;
Handle = NULL;
*Interface = NULL;
if (Position->Position != &gHandleList) {
Handle = CR (Position->Position, IHANDLE, AllHandles, EFI_HANDLE_SIGNATURE);
}
return Handle;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Configures the I2C slave own address 2 and mask. */ | void I2C_OwnAddress2Config(I2C_TypeDef *I2Cx, uint16_t Address, uint8_t Mask) | /* Configures the I2C slave own address 2 and mask. */
void I2C_OwnAddress2Config(I2C_TypeDef *I2Cx, uint16_t Address, uint8_t Mask) | {
uint32_t tmpreg = 0;
assert_param(IS_I2C_ALL_PERIPH(I2Cx));
assert_param(IS_I2C_OWN_ADDRESS2(Address));
assert_param(IS_I2C_OWN_ADDRESS2_MASK(Mask));
tmpreg = I2Cx->OAR2;
tmpreg &= (uint32_t)~((uint32_t)(I2C_OAR2_OA2 | I2C_OAR2_OA2MSK));
tmpreg |= (uint32_t)(((uint32_t)Address & I2C_OAR2_OA2) | \
(((uint32_t)Mask << 8) & I2C_OAR2_OA2MSK)) ;
I2Cx->OAR2 = tmpreg;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Returns the number of Tx descriptors needed for the given Ethernet packet. Ethernet packets require addition of WR and CPL headers. */ | static unsigned int calc_tx_descs(const struct sk_buff *skb) | /* Returns the number of Tx descriptors needed for the given Ethernet packet. Ethernet packets require addition of WR and CPL headers. */
static unsigned int calc_tx_descs(const struct sk_buff *skb) | {
unsigned int flits;
if (skb->len <= WR_LEN - sizeof(struct cpl_tx_pkt))
return 1;
flits = sgl_len(skb_shinfo(skb)->nr_frags + 1) + 2;
if (skb_shinfo(skb)->gso_size)
flits++;
return flits_to_desc(flits);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This does not actually stop the event loop. The reason is we have to pass libuv handle closures through its event loop. So this tries to close all wsi, and set a flag; when all the wsi closures are finalized then we actually stop the libuv event loops. */ | LWS_VISIBLE void lws_libuv_stop(struct lws_context *context) | /* This does not actually stop the event loop. The reason is we have to pass libuv handle closures through its event loop. So this tries to close all wsi, and set a flag; when all the wsi closures are finalized then we actually stop the libuv event loops. */
LWS_VISIBLE void lws_libuv_stop(struct lws_context *context) | {
struct lws_context_per_thread *pt;
int n, m;
if (context->requested_kill)
return;
context->requested_kill = 1;
m = context->count_threads;
context->being_destroyed = 1;
while (m--) {
pt = &context->pt[m];
for (n = 0; (unsigned int)n < context->pt[m].fds_count; n++) {
struct lws *wsi = wsi_from_fd(context, pt->fds[n].fd);
if (!wsi)
continue;
lws_close_free_wsi(wsi,
LWS_CLOSE_STATUS_NOSTATUS_CONTEXT_DESTROY);
n--;
}
}
lwsl_info("%s: feels everything closed\n", __func__);
if (context->count_wsi_allocated == 0)
lws_libuv_kill(context);
} | Nicholas3388/LuaNode | C++ | Other | 1,055 |
/* Sets the ADC window mode.
Sets the ADC window mode to a given mode and value range. */ | void adc_set_window_mode(struct adc_module *const module_inst, const enum adc_window_mode window_mode, const int16_t window_lower_value, const int16_t window_upper_value) | /* Sets the ADC window mode.
Sets the ADC window mode to a given mode and value range. */
void adc_set_window_mode(struct adc_module *const module_inst, const enum adc_window_mode window_mode, const int16_t window_lower_value, const int16_t window_upper_value) | {
Assert(module_inst);
Assert(module_inst->hw);
Adc *const adc_module = module_inst->hw;
while (adc_is_syncing(module_inst)) {
}
adc_module->CTRLC.reg = window_mode;
while (adc_is_syncing(module_inst)) {
}
adc_module->WINLT.reg = window_lower_value;
while (adc_is_syncing(module_inst)) {
}
adc_module->WINUT.reg = window_upper_value;
while (adc_is_syncing(module_inst)) {
}
} | memfault/zero-to-main | C++ | null | 200 |
/* RFC 5280, section 7.5, requires that only the domain is compared in a case-insensitive manner. */ | static int equal_email(const unsigned char *a, size_t a_len, const unsigned char *b, size_t b_len, unsigned int unused_flags) | /* RFC 5280, section 7.5, requires that only the domain is compared in a case-insensitive manner. */
static int equal_email(const unsigned char *a, size_t a_len, const unsigned char *b, size_t b_len, unsigned int unused_flags) | {
size_t i = a_len;
if (a_len != b_len)
return 0;
while (i > 0) {
--i;
if (a[i] == '@' || b[i] == '@') {
if (!equal_nocase(a + i, a_len - i, b + i, a_len - i, 0))
return 0;
break;
}
}
if (i == 0)
i = a_len;
return equal_case(a, i, b, i, 0);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Created on: 16 feb. 2019 Author: Daniel Mårtensson Take the square root of every element of matrix A, size row x column */ | void sqrte(double *A, int row, int column) | /* Created on: 16 feb. 2019 Author: Daniel Mårtensson Take the square root of every element of matrix A, size row x column */
void sqrte(double *A, int row, int column) | {
*A = sqrt(*(A));
A++;
}
} | DanielMartensson/EmbeddedLapack | C++ | MIT License | 129 |
/* The constructor function locates CpuIo2 protocol from protocol database. It will ASSERT() if that operation fails and it will always return EFI_SUCCESS. */ | EFI_STATUS EFIAPI IoLibConstructor(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable) | /* The constructor function locates CpuIo2 protocol from protocol database. It will ASSERT() if that operation fails and it will always return EFI_SUCCESS. */
EFI_STATUS EFIAPI IoLibConstructor(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable) | {
EFI_STATUS Status;
Status = gBS->LocateProtocol (&gEfiCpuIo2ProtocolGuid, NULL, (VOID **)&mCpuIo);
ASSERT_EFI_ERROR (Status);
return Status;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Disables interrupts coming from the given (unique) source. */ | void AIC_DisableIT(unsigned int source) | /* Disables interrupts coming from the given (unique) source. */
void AIC_DisableIT(unsigned int source) | {
AT91C_BASE_AIC->AIC_IDCR = 1 << source;
} | apopple/Pandaboard-FreeRTOS | C++ | null | 25 |
/* Flushes an endpoint of the Low Level Driver. */ | USBD_StatusTypeDef USBD_LL_FlushEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr) | /* Flushes an endpoint of the Low Level Driver. */
USBD_StatusTypeDef USBD_LL_FlushEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr) | {
HAL_PCD_EP_Flush((PCD_HandleTypeDef*) pdev->pData, ep_addr);
return USBD_OK;
} | st-one/X-CUBE-USB-PD | C++ | null | 110 |
/* Enable fault detect mask function of selected channel. */ | void EPWM_EnableFaultDetectMask(EPWM_T *epwm, uint32_t u32ChannelNum, uint32_t u32MaskCnt) | /* Enable fault detect mask function of selected channel. */
void EPWM_EnableFaultDetectMask(EPWM_T *epwm, uint32_t u32ChannelNum, uint32_t u32MaskCnt) | {
(epwm)->FDCTL[(u32ChannelNum)] = ((epwm)->FDCTL[(u32ChannelNum)] & (~EPWM_FDCTL0_TRMSKCNT_Msk)) | (EPWM_FDCTL0_FDMSKEN_Msk | (u32MaskCnt));
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Writes up to 4 bytes of data to the serial flash. The location of the write needs to be specified prior to calling this by issuing the appropriate commands to the serial flash. */ | static int sf1_write(struct adapter *adapter, unsigned int byte_cnt, int cont, u32 val) | /* Writes up to 4 bytes of data to the serial flash. The location of the write needs to be specified prior to calling this by issuing the appropriate commands to the serial flash. */
static int sf1_write(struct adapter *adapter, unsigned int byte_cnt, int cont, u32 val) | {
if (!byte_cnt || byte_cnt > 4)
return -EINVAL;
if (t3_read_reg(adapter, A_SF_OP) & F_BUSY)
return -EBUSY;
t3_write_reg(adapter, A_SF_DATA, val);
t3_write_reg(adapter, A_SF_OP,
V_CONT(cont) | V_BYTECNT(byte_cnt - 1) | V_OP(1));
return t3_wait_op_done(adapter, A_SF_OP, F_BUSY, 0, SF_ATTEMPTS, 10);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This function gets the value of the PHY registers through the MII interface. */ | int imx_fec_mii_read(volatile hw_fec_t *fec_reg, unsigned char phy_addr, unsigned char reg_addr, unsigned short int *value) | /* This function gets the value of the PHY registers through the MII interface. */
int imx_fec_mii_read(volatile hw_fec_t *fec_reg, unsigned char phy_addr, unsigned char reg_addr, unsigned short int *value) | {
unsigned long waiting = FEC_MII_TIMEOUT;
if (fec_reg->EIR.U & FEC_EVENT_MII) {
fec_reg->EIR.U = FEC_EVENT_MII;
}
fec_reg->MMFR.U = FEC_MII_READ(phy_addr, reg_addr);
while (1) {
if (fec_reg->EIR.U & FEC_EVENT_MII) {
fec_reg->EIR.U = FEC_EVENT_MII;
break;
}
if ((--waiting) == 0)
return -1;
hal_delay_us(FEC_MII_TICK);
}
*value = FEC_MII_GET_DATA(fec_reg->MMFR.U);
return 0;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Acquires semaphore, if necessary, then reads the PHY register at offset and stores the retrieved information in data. Release any acquired semaphores before exiting. */ | static s32 __e1000e_read_phy_reg_igp(struct e1000_hw *hw, u32 offset, u16 *data, bool locked) | /* Acquires semaphore, if necessary, then reads the PHY register at offset and stores the retrieved information in data. Release any acquired semaphores before exiting. */
static s32 __e1000e_read_phy_reg_igp(struct e1000_hw *hw, u32 offset, u16 *data, bool locked) | {
s32 ret_val = 0;
if (!locked) {
if (!(hw->phy.ops.acquire))
goto out;
ret_val = hw->phy.ops.acquire(hw);
if (ret_val)
goto out;
}
if (offset > MAX_PHY_MULTI_PAGE_REG) {
ret_val = e1000e_write_phy_reg_mdic(hw,
IGP01E1000_PHY_PAGE_SELECT,
(u16)offset);
if (ret_val)
goto release;
}
ret_val = e1000e_read_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset,
data);
release:
if (!locked)
hw->phy.ops.release(hw);
out:
return ret_val;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Support for TX4938 in 2.6 - Manish Lachwani ( */ | static void rbtx4938_machine_restart(char *command) | /* Support for TX4938 in 2.6 - Manish Lachwani ( */
static void rbtx4938_machine_restart(char *command) | {
local_irq_disable();
writeb(1, rbtx4938_softresetlock_addr);
writeb(1, rbtx4938_sfvol_addr);
writeb(1, rbtx4938_softreset_addr);
(*_machine_halt)();
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Set the I2C digital filter. These bits are used to configure the digital noise filter on SDA and SCL input. The digital filter will filter spikes with a length of up to dnf_setting * I2CCLK clocks */ | void i2c_set_digital_filter(uint32_t i2c, uint8_t dnf_setting) | /* Set the I2C digital filter. These bits are used to configure the digital noise filter on SDA and SCL input. The digital filter will filter spikes with a length of up to dnf_setting * I2CCLK clocks */
void i2c_set_digital_filter(uint32_t i2c, uint8_t dnf_setting) | {
I2C_CR1(i2c) = (I2C_CR1(i2c) & ~(I2C_CR1_DNF_MASK << I2C_CR1_DNF_SHIFT)) |
(dnf_setting << I2C_CR1_DNF_SHIFT);
} | libopencm3/libopencm3 | C++ | GNU General Public License v3.0 | 2,931 |
/* This enables the unused memory to be freed on older Acorn machines. We are freeing memory on behalf of the architecture initialisation code here. */ | static void free_unused_pages(unsigned int virtual_start, unsigned int virtual_end) | /* This enables the unused memory to be freed on older Acorn machines. We are freeing memory on behalf of the architecture initialisation code here. */
static void free_unused_pages(unsigned int virtual_start, unsigned int virtual_end) | {
int mb_freed = 0;
virtual_start = PAGE_ALIGN(virtual_start);
virtual_end = PAGE_ALIGN(virtual_end);
while (virtual_start < virtual_end) {
struct page *page;
page = virt_to_page(virtual_start);
ClearPageReserved(page);
init_page_count(page);
free_page(virtual_start);
virtual_start += PAGE_SIZE;
mb_freed += PAGE_SIZE / 1024;
}
printk("acornfb: freed %dK memory\n", mb_freed);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* If HmacSha384Context is NULL, then return FALSE. If this interface is not supported, then return FALSE. */ | BOOLEAN EFIAPI CryptoServiceHmacSha384Update(IN OUT VOID *HmacSha384Context, IN CONST VOID *Data, IN UINTN DataSize) | /* If HmacSha384Context is NULL, then return FALSE. If this interface is not supported, then return FALSE. */
BOOLEAN EFIAPI CryptoServiceHmacSha384Update(IN OUT VOID *HmacSha384Context, IN CONST VOID *Data, IN UINTN DataSize) | {
return CALL_BASECRYPTLIB (HmacSha384.Services.Update, HmacSha384Update, (HmacSha384Context, Data, DataSize), FALSE);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Used for 112 format frame disassemble : 1 byte function code:2 byte data:2 byte data when exception the format is: 1 byte error code:1 byte excepton code The function code that conform to this format : 0x05 0x06 */ | mb_status_t pdu_type122_disassemble(mb_handler_t *req_handler, uint8_t function_code, uint16_t *data1, uint16_t *data2, uint8_t *exception_code) | /* Used for 112 format frame disassemble : 1 byte function code:2 byte data:2 byte data when exception the format is: 1 byte error code:1 byte excepton code The function code that conform to this format : 0x05 0x06 */
mb_status_t pdu_type122_disassemble(mb_handler_t *req_handler, uint8_t function_code, uint16_t *data1, uint16_t *data2, uint8_t *exception_code) | {
mb_status_t status = MB_SUCCESS;
uint8_t *pdu_buf = &req_handler->mb_frame_buff[req_handler->pdu_offset];
uint16_t revdata;
if ((pdu_buf[0] & 0x80) != 0 ) {
if (exception_code != NULL) {
*exception_code = pdu_buf[1];
}
status = MB_RESPOND_EXCEPTION;
return status;
}
if (data1 != NULL) {
revdata = pdu_buf[2];
revdata = pdu_buf[1] | (revdata << 8);
*data1 = betoh16(revdata);
}
if (data2 != NULL) {
revdata = pdu_buf[4];
revdata = pdu_buf[3] | (revdata << 8);
*data2 = betoh16(revdata);
}
return status;
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* Registers the callback function that this server calls, whenever a client requests the reading of a specific coil. */ | void TbxMbServerSetCallbackReadCoil(tTbxMbServer channel, tTbxMbServerReadCoil callback) | /* Registers the callback function that this server calls, whenever a client requests the reading of a specific coil. */
void TbxMbServerSetCallbackReadCoil(tTbxMbServer channel, tTbxMbServerReadCoil callback) | {
TBX_ASSERT((channel != NULL) && (callback != NULL));
if ((channel != NULL) && (callback != NULL))
{
tTbxMbServerCtx * serverCtx = (tTbxMbServerCtx *)channel;
TBX_ASSERT(serverCtx->type == TBX_MB_SERVER_CONTEXT_TYPE);
TbxCriticalSectionEnter();
serverCtx->readCoilFcn = callback;
TbxCriticalSectionExit();
}
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* Find child node given the parent node and the edge character */ | NODE Child(IN NODE LoopVar6, IN UINT8 LoopVar5) | /* Find child node given the parent node and the edge character */
NODE Child(IN NODE LoopVar6, IN UINT8 LoopVar5) | {
NODE LoopVar4;
LoopVar4 = mNext[HASH (LoopVar6, LoopVar5)];
mParent[NIL] = LoopVar6;
while (mParent[LoopVar4] != LoopVar6) {
LoopVar4 = mNext[LoopVar4];
}
return LoopVar4;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Get the Falling Latched PWM counter of the PWM module.
The */ | unsigned long PWMCAPFallingCounterGet(unsigned long ulBase, unsigned long ulChannel) | /* Get the Falling Latched PWM counter of the PWM module.
The */
unsigned long PWMCAPFallingCounterGet(unsigned long ulBase, unsigned long ulChannel) | {
unsigned long ulChannelTemp;
ulChannelTemp = (ulBase == PWMA_BASE) ? ulChannel : (ulChannel - 4);
xASSERT((ulBase == PWMA_BASE) || (ulBase == PWMB_BASE));
xASSERT(((ulChannelTemp >= 0) || (ulChannelTemp <= 3)));
return xHWREG(ulBase + PWM_CFLR0 + ulChannelTemp * 8);
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* /sys/devices/platform/ep93xx-pwm.N /min_freq read-only minimum pwm output frequency /max_req read-only maximum pwm output frequency /freq read-write pwm output frequency (0 = disable output) /duty_percent read-write pwm duty cycle percent (1..99) /invert read-write invert pwm output */ | static ssize_t ep93xx_pwm_get_min_freq(struct device *dev, struct device_attribute *attr, char *buf) | /* /sys/devices/platform/ep93xx-pwm.N /min_freq read-only minimum pwm output frequency /max_req read-only maximum pwm output frequency /freq read-write pwm output frequency (0 = disable output) /duty_percent read-write pwm duty cycle percent (1..99) /invert read-write invert pwm output */
static ssize_t ep93xx_pwm_get_min_freq(struct device *dev, struct device_attribute *attr, char *buf) | {
struct platform_device *pdev = to_platform_device(dev);
struct ep93xx_pwm *pwm = platform_get_drvdata(pdev);
unsigned long rate = clk_get_rate(pwm->clk);
return sprintf(buf, "%ld\n", rate / (EP93XX_PWM_MAX_COUNT + 1));
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Call platform code to clean up, restart processes, and free the console that we've allocated. This is not called for suspend-to-disk. */ | static void suspend_finish(void) | /* Call platform code to clean up, restart processes, and free the console that we've allocated. This is not called for suspend-to-disk. */
static void suspend_finish(void) | {
suspend_thaw_processes();
usermodehelper_enable();
pm_notifier_call_chain(PM_POST_SUSPEND);
pm_restore_console();
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* param pfd PFD control name return PFD bypass status. */ | bool CLOCK_IsSysPfdEnabled(clock_pfd_t pfd) | /* param pfd PFD control name return PFD bypass status. */
bool CLOCK_IsSysPfdEnabled(clock_pfd_t pfd) | {
return ((CCM_ANALOG->PFD_528 & (uint32_t)CCM_ANALOG_PFD_528_PFD0_CLKGATE_MASK << (8UL * (uint8_t)pfd)) == 0U);
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* The available mappings are supplied on a per-device basis in */ | void GPIOPinConfigure(uint32_t ui32PinConfig) | /* The available mappings are supplied on a per-device basis in */
void GPIOPinConfigure(uint32_t ui32PinConfig) | {
uint32_t ui32Base, ui32Shift;
ASSERT(((ui32PinConfig >> 16) & 0xff) < 15);
ASSERT(((ui32PinConfig >> 8) & 0xe3) == 0);
ui32Base = (ui32PinConfig >> 16) & 0xff;
if(HWREG(SYSCTL_GPIOHBCTL) & (1 << ui32Base))
{
ui32Base = g_pui32GPIOBaseAddrs[(ui32Base << 1) + 1];
}
else
{
ui32Base = g_pui32GPIOBaseAddrs[ui32Base << 1];
}
ui32Shift = (ui32PinConfig >> 8) & 0xff;
HWREG(ui32Base + GPIO_O_PCTL) = ((HWREG(ui32Base + GPIO_O_PCTL) &
~(0xf << ui32Shift)) |
((ui32PinConfig & 0xf) << ui32Shift));
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* Lock POSIX mutex with blocking call.
See IEEE 1003.1 */ | int pthread_mutex_lock(pthread_mutex_t *m) | /* Lock POSIX mutex with blocking call.
See IEEE 1003.1 */
int pthread_mutex_lock(pthread_mutex_t *m) | {
return acquire_mutex(m, K_FOREVER);
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* __release_rx_machine_lock - unlock the port's RX machine @port: the port we're looking at */ | static void __release_rx_machine_lock(struct port *port) | /* __release_rx_machine_lock - unlock the port's RX machine @port: the port we're looking at */
static void __release_rx_machine_lock(struct port *port) | {
spin_unlock_bh(&(SLAVE_AD_INFO(port->slave).rx_machine_lock));
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Calculate how many messages will fit in the buffer. Also calculate if remaining free space is size of message or not. This impacts how many messages are dropped. If free space is equal to message size then when buffer is full, adding new message will lead to one message drop, otherwise 2 message will be dropped. */ | static size_t get_short_msg_capacity(void) | /* Calculate how many messages will fit in the buffer. Also calculate if remaining free space is size of message or not. This impacts how many messages are dropped. If free space is equal to message size then when buffer is full, adding new message will lead to one message drop, otherwise 2 message will be dropped. */
static size_t get_short_msg_capacity(void) | {
return CONFIG_LOG_BUFFER_SIZE / LOG_SIMPLE_MSG_LEN;
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.