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 |
|---|---|---|---|---|---|---|---|
/* Create a new filter_expression and add it to the end of the list of filter_expressions. */ | struct filter_expression* filter_expression_new(const gchar *label, const gchar *expr, const gboolean enabled) | /* Create a new filter_expression and add it to the end of the list of filter_expressions. */
struct filter_expression* filter_expression_new(const gchar *label, const gchar *expr, const gboolean enabled) | {
struct filter_expression *expression;
struct filter_expression *prev;
expression = (struct filter_expression *)g_malloc0(sizeof(struct filter_expression));
expression->label = g_strdup(label);
expression->expression = g_strdup(expr);
expression->enabled = enabled;
if (*pfilter_expression_head == NULL) {
_filter_expression_head = expression;
} else {
prev = *pfilter_expression_head;
while (prev->next != NULL)
prev = prev->next;
prev->next = expression;
expression->filter_index = prev->filter_index + 1;
}
return(expression);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* We can have multiple work items (and connection probing) scheduling this timer, but we need to take care to only reschedule it when it should fire */ | static void run_again(struct ieee80211_if_managed *ifmgd, unsigned long timeout) | /* We can have multiple work items (and connection probing) scheduling this timer, but we need to take care to only reschedule it when it should fire */
static void run_again(struct ieee80211_if_managed *ifmgd, unsigned long timeout) | {
ASSERT_MGD_MTX(ifmgd);
if (!timer_pending(&ifmgd->timer) ||
time_before(timeout, ifmgd->timer.expires))
mod_timer(&ifmgd->timer, timeout);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Boards with RT10XX SOCs can register callbacks to set their clocks into normal/full speed mode, low speed mode, and low power mode. If callbacks are present, the low power subsystem will disable PLLs for power savings when entering low power states. */ | void imxrt_clock_pm_callbacks_register(struct clock_callbacks *callbacks) | /* Boards with RT10XX SOCs can register callbacks to set their clocks into normal/full speed mode, low speed mode, and low power mode. If callbacks are present, the low power subsystem will disable PLLs for power savings when entering low power states. */
void imxrt_clock_pm_callbacks_register(struct clock_callbacks *callbacks) | {
__ASSERT_NO_MSG(callbacks && callbacks->clock_set_run && callbacks->clock_set_low_power);
lpm_clock_hooks.clock_set_run = callbacks->clock_set_run;
lpm_clock_hooks.clock_set_low_power = callbacks->clock_set_low_power;
if (callbacks->clock_lpm_init) {
lpm_clock_hooks.clock_lpm_init = callbacks->clock_lpm_init;
}
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Print a new page of text. Called by dialog_textbox(). */ | static void print_page(WINDOW *win, int height, int width) | /* Print a new page of text. Called by dialog_textbox(). */
static void print_page(WINDOW *win, int height, int width) | {
int i, passed_end = 0;
page_length = 0;
for (i = 0; i < height; i++) {
print_line(win, i, width);
if (!passed_end)
page_length++;
if (end_reached && !passed_end)
passed_end = 1;
}
wnoutrefresh(win);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* this function is a POSIX compliant version, which will close the open file descriptor. */ | int close(int fd) | /* this function is a POSIX compliant version, which will close the open file descriptor. */
int close(int fd) | {
int result;
struct dfs_fd *d;
d = fd_get(fd);
if (d == NULL)
{
rt_set_errno(-EBADF);
return -1;
}
result = dfs_file_close(d);
fd_put(d);
if (result < 0)
{
rt_set_errno(result);
return -1;
}
fd_put(d);
return 0;
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* This function is called with hbalock. This function gives back the hbq buffer to firmware. If the HBQ does not have space to post the buffer, it will free the buffer. */ | void lpfc_sli_free_hbq(struct lpfc_hba *phba, struct hbq_dmabuf *hbq_buffer) | /* This function is called with hbalock. This function gives back the hbq buffer to firmware. If the HBQ does not have space to post the buffer, it will free the buffer. */
void lpfc_sli_free_hbq(struct lpfc_hba *phba, struct hbq_dmabuf *hbq_buffer) | {
uint32_t hbqno;
if (hbq_buffer) {
hbqno = hbq_buffer->tag >> 16;
if (lpfc_sli_hbq_to_firmware(phba, hbqno, hbq_buffer))
(phba->hbqs[hbqno].hbq_free_buffer)(phba, hbq_buffer);
}
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* The function is used to get JPEG information. */ | static VOID _jpegGetInfo(JPEG_INFO_T *info) | /* The function is used to get JPEG information. */
static VOID _jpegGetInfo(JPEG_INFO_T *info) | {
rt_memcpy(info, &jpegInfo, sizeof(JPEG_INFO_T));
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Retrieves the parameters of the RWW EEPROM Emulator memory layout.
Retrieves the configuration parameters of the RWW EEPROM Emulator, after it has been initialized. */ | enum status_code rww_eeprom_emulator_get_parameters(struct rww_eeprom_emulator_parameters *const parameters) | /* Retrieves the parameters of the RWW EEPROM Emulator memory layout.
Retrieves the configuration parameters of the RWW EEPROM Emulator, after it has been initialized. */
enum status_code rww_eeprom_emulator_get_parameters(struct rww_eeprom_emulator_parameters *const parameters) | {
if (_eeprom_instance.initialized == false) {
return STATUS_ERR_NOT_INITIALIZED;
}
parameters->page_size = RWW_EEPROM_PAGE_SIZE;
parameters->eeprom_number_of_pages = _eeprom_instance.logical_pages;
return STATUS_OK;
} | memfault/zero-to-main | C++ | null | 200 |
/* Get address of register REGNO in task TASK. */ | static unsigned long* get_reg_addr(struct task_struct *task, unsigned long regno) | /* Get address of register REGNO in task TASK. */
static unsigned long* get_reg_addr(struct task_struct *task, unsigned long regno) | {
unsigned long *addr;
if (regno == 30) {
addr = &task_thread_info(task)->pcb.usp;
} else if (regno == 65) {
addr = &task_thread_info(task)->pcb.unique;
} else if (regno == 31 || regno > 65) {
zero = 0;
addr = &zero;
} else {
addr = task_stack_page(task) + regoff[regno];
}
return addr;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* The mtdparts variable tends to be long. If we need to access it before the env is relocated, then we need to use our own stack buffer. gd->env_buf will be too small. */ | static const char* env_get_mtdparts(char *buf) | /* The mtdparts variable tends to be long. If we need to access it before the env is relocated, then we need to use our own stack buffer. gd->env_buf will be too small. */
static const char* env_get_mtdparts(char *buf) | {
if (gd->flags & GD_FLG_ENV_READY)
return env_get("mtdparts");
if (env_get_f("mtdparts", buf, MTDPARTS_MAXLEN) != -1)
return buf;
return NULL;
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Reads user data from the specified Data Backup Register. */ | uint16_t BAKPR_ReadBackupRegister(BAKPR_DATA_T bakrData) | /* Reads user data from the specified Data Backup Register. */
uint16_t BAKPR_ReadBackupRegister(BAKPR_DATA_T bakrData) | {
__IOM uint32_t tmp = 0;
tmp = (uint32_t)BAKPR_BASE;
tmp += bakrData;
return (*(__IOM uint32_t *) tmp);
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* When stack protection feature is enabled (see prj.conf file), the system error handler is invoked and reports a "Stack Check Fail" error. When stack protection feature is not enabled, the system crashes with error like: Trying to execute code outside RAM or ROM. */ | void __attribute__((noinline)) | /* When stack protection feature is enabled (see prj.conf file), the system error handler is invoked and reports a "Stack Check Fail" error. When stack protection feature is not enabled, the system crashes with error like: Trying to execute code outside RAM or ROM. */
void __attribute__((noinline)) | {
char buf[16];
strcpy(buf, input);
TC_PRINT("%s: %s\n", name, buf);
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* The pin(s) are specified using a bit-packed byte, where each bit that is set identifies the pin to be accessed, and where bit 0 of the byte represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on. */ | void GPIOPinTypeEPI(unsigned long ulPort, unsigned char ucPins) | /* The pin(s) are specified using a bit-packed byte, where each bit that is set identifies the pin to be accessed, and where bit 0 of the byte represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on. */
void GPIOPinTypeEPI(unsigned long ulPort, unsigned char ucPins) | {
ASSERT(GPIOBaseValid(ulPort));
GPIODirModeSet(ulPort, ucPins, GPIO_DIR_MODE_HW);
GPIOPadConfigSet(ulPort, ucPins, GPIO_STRENGTH_8MA, GPIO_PIN_TYPE_STD);
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* ZigBee helper function. extracts an EUI64 address and displays */ | guint64 zbee_parse_eui64(proto_tree *tree, int hfindex, tvbuff_t *tvb, guint *offset, guint length, proto_item **ti) | /* ZigBee helper function. extracts an EUI64 address and displays */
guint64 zbee_parse_eui64(proto_tree *tree, int hfindex, tvbuff_t *tvb, guint *offset, guint length, proto_item **ti) | {
proto_item *item = NULL;
guint64 value;
value = tvb_get_letoh64(tvb, *offset);
item = proto_tree_add_eui64(tree, hfindex, tvb, *offset, length, value);
*offset += (int)sizeof(guint64);
if (ti) *ti = item;
return value;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* This function is used to get inquiry data. Data format of Identify data is defined by the Interface GUID. */ | EFI_STATUS EFIAPI UsbDiskInfoInquiry(IN EFI_DISK_INFO_PROTOCOL *This, IN OUT VOID *InquiryData, IN OUT UINT32 *InquiryDataSize) | /* This function is used to get inquiry data. Data format of Identify data is defined by the Interface GUID. */
EFI_STATUS EFIAPI UsbDiskInfoInquiry(IN EFI_DISK_INFO_PROTOCOL *This, IN OUT VOID *InquiryData, IN OUT UINT32 *InquiryDataSize) | {
EFI_STATUS Status;
USB_MASS_DEVICE *UsbMass;
UsbMass = USB_MASS_DEVICE_FROM_DISK_INFO (This);
Status = EFI_BUFFER_TOO_SMALL;
if (*InquiryDataSize >= sizeof (UsbMass->InquiryData)) {
Status = EFI_SUCCESS;
CopyMem (InquiryData, &UsbMass->InquiryData, sizeof (UsbMass->InquiryData));
}
*InquiryDataSize = sizeof (UsbMass->InquiryData);
return Status;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Clears all of the I2C interrupt pending bit. */ | void USI_I2C_ClearAllINT(USI_TypeDef *USIx) | /* Clears all of the I2C interrupt pending bit. */
void USI_I2C_ClearAllINT(USI_TypeDef *USIx) | {
assert_param(IS_USI_I2C_ALL_PERIPH(USIx));
USIx->INTERRUPT_ALL_CLR = USI_INT_ALL_CLEAR;
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* __gc tag method for CLIBS table: calls 'll_unloadlib' for all lib handles in list CLIBS */ | static int gctm(lua_State *L) | /* __gc tag method for CLIBS table: calls 'll_unloadlib' for all lib handles in list CLIBS */
static int gctm(lua_State *L) | {
lua_rawgeti(L, 1, n);
ll_unloadlib(lua_touserdata(L, -1));
lua_pop(L, 1);
}
return 0;
} | opentx/opentx | C++ | GNU General Public License v2.0 | 2,025 |
/* Destroy root bridge and remove it from device tree. */ | VOID DestroyRootBridge(IN PCI_IO_DEVICE *RootBridge) | /* Destroy root bridge and remove it from device tree. */
VOID DestroyRootBridge(IN PCI_IO_DEVICE *RootBridge) | {
DestroyPciDeviceTree (RootBridge);
FreePciDevice (RootBridge);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* This function returns information of type InformationType from the adapter. If an adapter does not support the requested informational type, then EFI_UNSUPPORTED is returned. */ | EFI_STATUS EFIAPI HstiAipGetInfo(IN EFI_ADAPTER_INFORMATION_PROTOCOL *This, IN EFI_GUID *InformationType, OUT VOID **InformationBlock, OUT UINTN *InformationBlockSize) | /* This function returns information of type InformationType from the adapter. If an adapter does not support the requested informational type, then EFI_UNSUPPORTED is returned. */
EFI_STATUS EFIAPI HstiAipGetInfo(IN EFI_ADAPTER_INFORMATION_PROTOCOL *This, IN EFI_GUID *InformationType, OUT VOID **InformationBlock, OUT UINTN *InformationBlockSize) | {
HSTI_AIP_PRIVATE_DATA *HstiAip;
if ((This == NULL) || (InformationBlock == NULL) || (InformationBlockSize == NULL)) {
return EFI_INVALID_PARAMETER;
}
if (!CompareGuid (InformationType, &gAdapterInfoPlatformSecurityGuid)) {
return EFI_UNSUPPORTED;
}
HstiAip = HSTI_AIP_PRIVATE_DATA_FROM_THIS (This);
*InformationBlock = AllocateCopyPool (HstiAip->HstiSize, HstiAip->Hsti);
if (*InformationBlock == NULL) {
return EFI_OUT_OF_RESOURCES;
}
*InformationBlockSize = HstiAip->HstiSize;
return EFI_SUCCESS;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* In this example, user task fetches the sensor values every seconds. */ | void user_task_periodic(void *pvParameters) | /* In this example, user task fetches the sensor values every seconds. */
void user_task_periodic(void *pvParameters) | {
vTaskDelay (100/portTICK_PERIOD_MS);
while (1)
{
read_data ();
vTaskDelay(100/portTICK_PERIOD_MS);
}
} | RavenSystem/esp-homekit-devices | C++ | Other | 2,577 |
/* De-Initializes the low level portion of the device driver. */ | USBD_StatusTypeDef USBD_LL_DeInit(USBD_HandleTypeDef *pdev) | /* De-Initializes the low level portion of the device driver. */
USBD_StatusTypeDef USBD_LL_DeInit(USBD_HandleTypeDef *pdev) | {
HAL_StatusTypeDef hal_status = HAL_OK;
USBD_StatusTypeDef usb_status = USBD_OK;
hal_status = HAL_PCD_DeInit(pdev->pData);
usb_status = USBD_Get_USB_Status(hal_status);
return usb_status;
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* Helper function for easier register access.
Use this function to clear specific bits in the controller registers. */ | void hx8347a_clear_register(uint8_t address, uint8_t bitmask) | /* Helper function for easier register access.
Use this function to clear specific bits in the controller registers. */
void hx8347a_clear_register(uint8_t address, uint8_t bitmask) | {
uint8_t value;
value = hx8347a_read_register(address);
value &= ~bitmask;
hx8347a_write_register(address, value);
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* Prevent PCI layer from seeing the inbound host-bridge resources */ | static void __devinit pci_fixup_ixp23xx(struct pci_dev *dev) | /* Prevent PCI layer from seeing the inbound host-bridge resources */
static void __devinit pci_fixup_ixp23xx(struct pci_dev *dev) | {
int i;
dev->class &= 0xff;
dev->class |= PCI_CLASS_BRIDGE_HOST << 8;
for (i = 0; i < PCI_NUM_RESOURCES; i++) {
dev->resource[i].start = 0;
dev->resource[i].end = 0;
dev->resource[i].flags = 0;
}
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Decimation of read operation on Slave 1 starting from the sensor hub trigger.. */ | int32_t lsm6dsl_sh_slave_1_dec_set(stmdev_ctx_t *ctx, lsm6dsl_slave1_rate_t val) | /* Decimation of read operation on Slave 1 starting from the sensor hub trigger.. */
int32_t lsm6dsl_sh_slave_1_dec_set(stmdev_ctx_t *ctx, lsm6dsl_slave1_rate_t val) | {
lsm6dsl_slave1_config_t slave1_config;
int32_t ret;
ret = lsm6dsl_mem_bank_set(ctx, LSM6DSL_BANK_A);
if(ret == 0){
ret = lsm6dsl_read_reg(ctx, LSM6DSL_SLAVE1_CONFIG,
(uint8_t*)&slave1_config, 1);
if(ret == 0){
slave1_config.slave1_rate = (uint8_t) val;
ret = lsm6dsl_write_reg(ctx, LSM6DSL_SLAVE1_CONFIG,
(uint8_t*)&slave1_config, 1);
if(ret == 0){
ret = lsm6dsl_mem_bank_set(ctx, LSM6DSL_USER_BANK);
}
}
}
return ret;
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* Return 0 if a subject with the smack of sock could access an object with the smack of other, otherwise an error code */ | static int smack_unix_may_send(struct socket *sock, struct socket *other) | /* Return 0 if a subject with the smack of sock could access an object with the smack of other, otherwise an error code */
static int smack_unix_may_send(struct socket *sock, struct socket *other) | {
struct inode *sp = SOCK_INODE(sock);
struct inode *op = SOCK_INODE(other);
struct smk_audit_info ad;
smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_NET);
smk_ad_setfield_u_net_sk(&ad, other->sk);
return smk_access(smk_of_inode(sp), smk_of_inode(op), MAY_WRITE, &ad);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Erase the specified block of the device, retrying several time if it fails. */ | uint32_t nand_flash_raw_erase_block(const struct nand_flash_raw *raw, uint16_t block) | /* Erase the specified block of the device, retrying several time if it fails. */
uint32_t nand_flash_raw_erase_block(const struct nand_flash_raw *raw, uint16_t block) | {
uint32_t num_try = CONF_NF_ERASE_NUM_TRY;
while (num_try > 0) {
if (!erase_block(raw, block)) {
return 0;
}
num_try--;
}
return NAND_COMMON_ERROR_BADBLOCK;
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* This file is part of the Simba project. */ | int mock_write_analog_input_pin_module_init(int res) | /* This file is part of the Simba project. */
int mock_write_analog_input_pin_module_init(int res) | {
harness_mock_write("analog_input_pin_module_init()",
NULL,
0);
harness_mock_write("analog_input_pin_module_init(): return (res)",
&res,
sizeof(res));
return (0);
} | eerimoq/simba | C++ | Other | 337 |
/* Fills each config member with its default value. */ | void DMC_ConfigTimingStructInit(DMC_TimingConfig_T *timingConfig) | /* Fills each config member with its default value. */
void DMC_ConfigTimingStructInit(DMC_TimingConfig_T *timingConfig) | {
timingConfig->latencyCAS = DMC_CAS_LATENCY_3;
timingConfig->tARP = DMC_AUTO_REFRESH_10;
timingConfig->tRAS = DMC_RAS_MINIMUM_5;
timingConfig->tCMD = DMC_ATA_CMD_7;
timingConfig->tRCD = DMC_DELAY_TIME_2;
timingConfig->tRP = DMC_PRECHARGE_2;
timingConfig->tWR = DMC_NEXT_PRECHARGE_2;
timingConfig->tXSR = 6;
timingConfig->tRFP = 0xC3;
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* Returns 1 if bus reset already in progress, 0 otherwise. */ | int hpsb_reset_bus(struct hpsb_host *host, int type) | /* Returns 1 if bus reset already in progress, 0 otherwise. */
int hpsb_reset_bus(struct hpsb_host *host, int type) | {
if (!host->in_bus_reset) {
host->driver->devctl(host, RESET_BUS, type);
return 0;
} else {
return 1;
}
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Configure counter threshold value in receiving mode.You can use it to stop receiving IR data. */ | void IR_SetRxCounterThreshold(IR_TypeDef *IRx, u32 IR_RxCntThrType, u32 IR_RxCntThr) | /* Configure counter threshold value in receiving mode.You can use it to stop receiving IR data. */
void IR_SetRxCounterThreshold(IR_TypeDef *IRx, u32 IR_RxCntThrType, u32 IR_RxCntThr) | {
assert_param(IS_IR_ALL_PERIPH(IRx));
assert_param(IS_IR_RX_COUNT_LEVEL_CTRL(IR_RxCntThrType));
assert_param(IS_IR_RX_COUNTER_THRESHOLD(IR_RxCntThr));
IRx->IR_RX_CNT_INT_SEL = (IR_RxCntThrType) | (IR_RxCntThr);
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* This function waits for the bandgap to be stable and disables the bandgap self bias. After being powered up, it needs to wait for the bandgap stable to be stable and then disable Bandgap Self bias for best noise performance. */ | void PMU_DisableBandgapSelfBiasAfterPowerUp(void) | /* This function waits for the bandgap to be stable and disables the bandgap self bias. After being powered up, it needs to wait for the bandgap stable to be stable and then disable Bandgap Self bias for best noise performance. */
void PMU_DisableBandgapSelfBiasAfterPowerUp(void) | {
uint32_t temp32;
uint32_t regValue;
do
{
regValue = ANATOP_AI_Read(kAI_Itf_Bandgap, kAI_BANDGAP_STAT0);
} while ((regValue & AI_BANDGAP_STAT0_REFTOP_VBGUP_MASK) == 0UL);
temp32 = ANATOP_AI_Read(kAI_Itf_Bandgap, kAI_BANDGAP_CTRL0);
temp32 |= AI_BANDGAP_CTRL0_REFTOP_SELFBIASOFF_MASK;
ANATOP_AI_Write(kAI_Itf_Bandgap, kAI_BANDGAP_CTRL0, temp32);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Write a big-endian byte to an internal address of an I2C slave. */ | static int i2c_reg_write_byte_be(const struct i2c_dt_spec *bus, uint8_t reg_addr, uint8_t value) | /* Write a big-endian byte to an internal address of an I2C slave. */
static int i2c_reg_write_byte_be(const struct i2c_dt_spec *bus, uint8_t reg_addr, uint8_t value) | {
uint8_t tx_buf[3] = { reg_addr, value };
return i2c_write_dt(bus, tx_buf, 2);
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Gets the number of the first page of a region. */ | uint32_t flashcalw_get_region_first_page_number(uint32_t region) | /* Gets the number of the first page of a region. */
uint32_t flashcalw_get_region_first_page_number(uint32_t region) | {
return region * flashcalw_get_page_count_per_region();
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* SPI Set Bidirectional Simplex Mode.
The SPI peripheral is set for bidirectional transfers in two-wire simplex mode (using a clock wire and a bidirectional data wire). */ | void spi_set_bidirectional_mode(uint32_t spi) | /* SPI Set Bidirectional Simplex Mode.
The SPI peripheral is set for bidirectional transfers in two-wire simplex mode (using a clock wire and a bidirectional data wire). */
void spi_set_bidirectional_mode(uint32_t spi) | {
SPI_CR1(spi) |= SPI_CR1_BIDIMODE;
} | insane-adding-machines/unicore-mx | C++ | GNU General Public License v3.0 | 50 |
/* Read & remove one key data from the EFI key buffer. */ | EFI_STATUS PopEfikeyBufHead(IN EFI_KEY_QUEUE *Queue, OUT EFI_KEY_DATA *KeyData OPTIONAL) | /* Read & remove one key data from the EFI key buffer. */
EFI_STATUS PopEfikeyBufHead(IN EFI_KEY_QUEUE *Queue, OUT EFI_KEY_DATA *KeyData OPTIONAL) | {
if (IsEfikeyBufEmpty (Queue)) {
return EFI_NOT_READY;
}
if (KeyData != NULL) {
CopyMem (KeyData, &Queue->Buffer[Queue->Head], sizeof (EFI_KEY_DATA));
}
Queue->Head = (Queue->Head + 1) % KEYBOARD_EFI_KEY_MAX_COUNT;
return EFI_SUCCESS;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Absolute Wrist Tilt latency register (r/w). Absolute wrist tilt latency parameters. 1 LSB = 40 ms. Default value: 0Fh (600 ms).. */ | int32_t lsm6dsl_tilt_latency_set(stmdev_ctx_t *ctx, uint8_t *buff) | /* Absolute Wrist Tilt latency register (r/w). Absolute wrist tilt latency parameters. 1 LSB = 40 ms. Default value: 0Fh (600 ms).. */
int32_t lsm6dsl_tilt_latency_set(stmdev_ctx_t *ctx, uint8_t *buff) | {
int32_t ret;
ret = lsm6dsl_mem_bank_set(ctx, LSM6DSL_BANK_B);
if(ret == 0){
ret = lsm6dsl_write_reg(ctx, LSM6DSL_A_WRIST_TILT_LAT, buff, 1);
if(ret == 0){
ret = lsm6dsl_mem_bank_set(ctx, LSM6DSL_USER_BANK);
}
}
return ret;
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* Walk the blacklist table until the first match is found. Return the pointer to the matching entry or NULL if there's no match. */ | const struct dmi_system_id* dmi_first_match(const struct dmi_system_id *list) | /* Walk the blacklist table until the first match is found. Return the pointer to the matching entry or NULL if there's no match. */
const struct dmi_system_id* dmi_first_match(const struct dmi_system_id *list) | {
const struct dmi_system_id *d;
for (d = list; !dmi_is_end_of_table(d); d++)
if (dmi_matches(d))
return d;
return NULL;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Returns: a #GIOModule from given @filename, or NULL on error. */ | GIOModule* g_io_module_new(const gchar *filename) | /* Returns: a #GIOModule from given @filename, or NULL on error. */
GIOModule* g_io_module_new(const gchar *filename) | {
GIOModule *module;
g_return_val_if_fail (filename != NULL, NULL);
module = g_object_new (G_IO_TYPE_MODULE, NULL);
module->filename = g_strdup (filename);
return module;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Interrupt handler for AST periodic.
Enable an AST asynchronous wake-up source. */ | void ast_enable_wakeup(Ast *ast, ast_wakeup_source_t source) | /* Interrupt handler for AST periodic.
Enable an AST asynchronous wake-up source. */
void ast_enable_wakeup(Ast *ast, ast_wakeup_source_t source) | {
while (ast_is_busy(ast)) {
}
switch (source) {
case AST_WAKEUP_ALARM:
ast->AST_WER |= AST_WER_ALARM0_1;
break;
case AST_WAKEUP_PER:
ast->AST_WER |= AST_WER_PER0_1;
break;
case AST_WAKEUP_OVF:
ast->AST_WER |= AST_WER_OVF_1;
break;
default:
break;
}
while (ast_is_busy(ast)) {
}
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* DAC Channel DMA Disable.
Disable a digital to analog converter channel DMA mode. */ | void dac_dma_disable(uint32_t dac, int channel) | /* DAC Channel DMA Disable.
Disable a digital to analog converter channel DMA mode. */
void dac_dma_disable(uint32_t dac, int channel) | {
switch (channel) {
case DAC_CHANNEL1:
DAC_CR(dac) &= ~DAC_CR_DMAEN1;
break;
case DAC_CHANNEL2:
DAC_CR(dac) &= ~DAC_CR_DMAEN2;
break;
case DAC_CHANNEL_BOTH:
DAC_CR(dac) &= ~(DAC_CR_DMAEN1 | DAC_CR_DMAEN2);
break;
default:
break;
}
} | libopencm3/libopencm3 | C++ | GNU General Public License v3.0 | 2,931 |
/* release the preallocated buffer if not yet done. */ | static void snd_pcm_lib_preallocate_dma_free(struct snd_pcm_substream *substream) | /* release the preallocated buffer if not yet done. */
static void snd_pcm_lib_preallocate_dma_free(struct snd_pcm_substream *substream) | {
if (substream->dma_buffer.area == NULL)
return;
if (substream->dma_buf_id)
snd_dma_reserve_buf(&substream->dma_buffer, substream->dma_buf_id);
else
snd_dma_free_pages(&substream->dma_buffer);
substream->dma_buffer.area = NULL;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Deinitializes the CRYP peripheral registers to their default reset values. */ | void CRYP_DeInit(void) | /* Deinitializes the CRYP peripheral registers to their default reset values. */
void CRYP_DeInit(void) | {
RCC_AHB2PeriphResetCmd(RCC_AHB2Periph_CRYP, ENABLE);
RCC_AHB2PeriphResetCmd(RCC_AHB2Periph_CRYP, DISABLE);
} | MaJerle/stm32f429 | C++ | null | 2,036 |
/* Reads the status of the security session open register. */ | int32_t ST25DV_ReadI2CSecuritySession_Dyn(ST25DV_Object_t *pObj, ST25DV_I2CSSO_STATUS *const pSession) | /* Reads the status of the security session open register. */
int32_t ST25DV_ReadI2CSecuritySession_Dyn(ST25DV_Object_t *pObj, ST25DV_I2CSSO_STATUS *const pSession) | {
uint8_t reg_value;
int32_t status;
status = st25dv_get_i2c_sso_dyn_i2csso(&(pObj->Ctx), ®_value);
if( status == ST25DV_OK )
{
if( reg_value )
{
*pSession = ST25DV_SESSION_OPEN;
}
else
{
*pSession = ST25DV_SESSION_CLOSED;
}
}
return status;
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* This is the code that gets called when the processor first starts execution following a reset event. */ | void Default_ResetHandler(void) | /* This is the code that gets called when the processor first starts execution following a reset event. */
void Default_ResetHandler(void) | {
unsigned long *pulSrc, *pulDest;
volatile unsigned long *pVTOR;
pVTOR = (unsigned long *)0xe000ed08;
*pVTOR = (unsigned long)g_pfnVectors;
pulSrc = &_sidata;
for(pulDest = &_sdata; pulDest < &_edata; )
{
*(pulDest++) = *(pulSrc++);
}
for(pulDest = &_sbss; pulDest < &_ebss; )
{
*(pulDest++) = 0;
}
main();
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Returns 0 on success or negative error code on failure. */ | static int __init i2o_iop_init(void) | /* Returns 0 on success or negative error code on failure. */
static int __init i2o_iop_init(void) | {
int rc = 0;
printk(KERN_INFO OSM_DESCRIPTION " v" OSM_VERSION "\n");
if ((rc = i2o_driver_init()))
goto exit;
if ((rc = i2o_exec_init()))
goto driver_exit;
if ((rc = i2o_pci_init()))
goto exec_exit;
return 0;
exec_exit:
i2o_exec_exit();
driver_exit:
i2o_driver_exit();
exit:
return rc;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* UART MSP De-Initialization This function freeze the hardware resources used in this example. */ | void HAL_UART_MspDeInit(UART_HandleTypeDef *huart) | /* UART MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_UART_MspDeInit(UART_HandleTypeDef *huart) | {
if(huart->Instance==USART1)
{
__HAL_RCC_USART1_CLK_DISABLE();
HAL_GPIO_DeInit(GPIOA, GPIO_PIN_9|GPIO_PIN_10);
HAL_NVIC_DisableIRQ(USART1_IRQn);
}
else if(huart->Instance==USART2)
{
__HAL_RCC_USART2_CLK_DISABLE();
HAL_GPIO_DeInit(GPIOA, GPIO_PIN_2|GPIO_PIN_3);
HAL_NVIC_DisableIRQ(USART2_IRQn);
}
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* It's hard to assign blame to either the controller or the codec because both were made by C-Media ... */ | void oxygen_write_ac97(struct oxygen *chip, unsigned int codec, unsigned int index, u16 data) | /* It's hard to assign blame to either the controller or the codec because both were made by C-Media ... */
void oxygen_write_ac97(struct oxygen *chip, unsigned int codec, unsigned int index, u16 data) | {
unsigned int count, succeeded;
u32 reg;
reg = data;
reg |= index << OXYGEN_AC97_REG_ADDR_SHIFT;
reg |= OXYGEN_AC97_REG_DIR_WRITE;
reg |= codec << OXYGEN_AC97_REG_CODEC_SHIFT;
succeeded = 0;
for (count = 5; count > 0; --count) {
udelay(5);
oxygen_write32(chip, OXYGEN_AC97_REGS, reg);
if (oxygen_ac97_wait(chip, OXYGEN_AC97_INT_WRITE_DONE) >= 0 &&
++succeeded >= 2) {
chip->saved_ac97_registers[codec][index / 2] = data;
return;
}
}
snd_printk(KERN_ERR "AC'97 write timeout\n");
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* In case of data going from host to device, the data is at *ppbData. In case of data going from device to host, the handler can either choose to write its data at *ppbData or update the data pointer. */ | static BOOL _HandleRequest(TSetupPacket *pSetup, int *piLen, unsigned char **ppbData) | /* In case of data going from host to device, the data is at *ppbData. In case of data going from device to host, the handler can either choose to write its data at *ppbData or update the data pointer. */
static BOOL _HandleRequest(TSetupPacket *pSetup, int *piLen, unsigned char **ppbData) | {
TFnHandleRequest *pfnHandler;
int iType;
iType = REQTYPE_GET_TYPE(pSetup->bmRequestType);
pfnHandler = apfnReqHandlers[iType];
if (pfnHandler == NULL) {
DBG("No handler for reqtype %d\n", iType);
return FALSE;
}
return pfnHandler(pSetup, piLen, ppbData);
} | apopple/Pandaboard-FreeRTOS | C++ | null | 25 |
/* omap_read_buf16 - read data from NAND controller into buffer @mtd: MTD device structure @buf: buffer to store date @len: number of bytes to read */ | static void omap_read_buf16(struct mtd_info *mtd, u_char *buf, int len) | /* omap_read_buf16 - read data from NAND controller into buffer @mtd: MTD device structure @buf: buffer to store date @len: number of bytes to read */
static void omap_read_buf16(struct mtd_info *mtd, u_char *buf, int len) | {
struct nand_chip *nand = mtd->priv;
ioread16_rep(nand->IO_ADDR_R, buf, len / 2);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Writes a value to the RF Management dynamic register. */ | int32_t BSP_NFCTAG_WriteRFMngt_Dyn(uint32_t Instance, const uint8_t RF_Mngt) | /* Writes a value to the RF Management dynamic register. */
int32_t BSP_NFCTAG_WriteRFMngt_Dyn(uint32_t Instance, const uint8_t RF_Mngt) | {
UNUSED(Instance);
return ST25DV_WriteRFMngt_Dyn(&NfcTagObj, RF_Mngt);
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* Verifies programming of the desired flash area at a specified margin level.
This function verifies the data programed in the flash memory using the Flash Program Check Command and compares it to the expected data for a given flash area as determined by the start address and length. */ | status_t FLASH_VerifyProgram(flash_config_t *config, uint32_t start, uint32_t lengthInBytes, const uint8_t *expectedData, uint32_t *failedAddress, uint32_t *failedData) | /* Verifies programming of the desired flash area at a specified margin level.
This function verifies the data programed in the flash memory using the Flash Program Check Command and compares it to the expected data for a given flash area as determined by the start address and length. */
status_t FLASH_VerifyProgram(flash_config_t *config, uint32_t start, uint32_t lengthInBytes, const uint8_t *expectedData, uint32_t *failedAddress, uint32_t *failedData) | {
assert(BOOTLOADER_API_TREE_POINTER);
return BOOTLOADER_API_TREE_POINTER->flashDriver->flash_verify_program(config, start, lengthInBytes, expectedData,
failedAddress, failedData);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Function for reading the next event from specified event queue. */ | static uint32_t app_sched_event_get(void **pp_event_data, uint16_t *p_event_data_size, app_sched_event_handler_t *p_event_handler) | /* Function for reading the next event from specified event queue. */
static uint32_t app_sched_event_get(void **pp_event_data, uint16_t *p_event_data_size, app_sched_event_handler_t *p_event_handler) | {
uint32_t err_code = NRF_ERROR_NOT_FOUND;
if (!APP_SCHED_QUEUE_EMPTY())
{
uint16_t event_index;
event_index = m_queue_start_index;
m_queue_start_index = next_index(m_queue_start_index);
*pp_event_data = &m_queue_event_data[event_index * m_queue_event_size];
*p_event_data_size = m_queue_event_headers[event_index].event_data_size;
*p_event_handler = m_queue_event_headers[event_index].handler;
err_code = NRF_SUCCESS;
}
return err_code;
} | labapart/polymcu | C++ | null | 201 |
/* When a request has been completed either from the FCP adapter, or it has been dismissed due to a queue shutdown, this function is called to process the completion status and trigger further events related to the FSF request. */ | static void zfcp_fsf_req_complete(struct zfcp_fsf_req *req) | /* When a request has been completed either from the FCP adapter, or it has been dismissed due to a queue shutdown, this function is called to process the completion status and trigger further events related to the FSF request. */
static void zfcp_fsf_req_complete(struct zfcp_fsf_req *req) | {
if (unlikely(req->fsf_command == FSF_QTCB_UNSOLICITED_STATUS)) {
zfcp_fsf_status_read_handler(req);
return;
}
del_timer(&req->timer);
zfcp_fsf_protstatus_eval(req);
zfcp_fsf_fsfstatus_eval(req);
req->handler(req);
if (req->erp_action)
zfcp_erp_notify(req->erp_action, 0);
if (likely(req->status & ZFCP_STATUS_FSFREQ_CLEANUP))
zfcp_fsf_req_free(req);
else
complete(&req->completion);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Return the port of the first slave in @bond, or NULL if it can't be found. */ | static struct port* __get_first_port(struct bonding *bond) | /* Return the port of the first slave in @bond, or NULL if it can't be found. */
static struct port* __get_first_port(struct bonding *bond) | {
if (bond->slave_cnt == 0) {
return NULL;
}
return &(SLAVE_AD_INFO(bond->first_slave).port);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* There is special code here to handle the one source type with 5 sources. */ | int get_periph_clock_source(enum periph_id periph_id, enum clock_id parent, int *mux_bits, int *divider_bits) | /* There is special code here to handle the one source type with 5 sources. */
int get_periph_clock_source(enum periph_id periph_id, enum clock_id parent, int *mux_bits, int *divider_bits) | {
enum clock_type_id type;
int mux, err;
err = get_periph_clock_info(periph_id, mux_bits, divider_bits, &type);
assert(!err);
for (mux = 0; mux < CLOCK_MAX_MUX; mux++)
if (clock_source[type][mux] == parent)
return mux;
assert(type == CLOCK_TYPE_PCXTS);
assert(parent == CLOCK_ID_SFROM32KHZ);
if (type == CLOCK_TYPE_PCXTS && parent == CLOCK_ID_SFROM32KHZ)
return 4;
printf("Caller requested bad clock: periph=%d, parent=%d\n", periph_id,
parent);
return -1;
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* If Buffer is NULL, then ASSERT(). If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). */ | UINT32 FtwCalculateCrc32(IN VOID *Buffer, IN UINTN Length) | /* If Buffer is NULL, then ASSERT(). If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). */
UINT32 FtwCalculateCrc32(IN VOID *Buffer, IN UINTN Length) | {
EFI_STATUS Status;
UINT32 ReturnValue;
Status = gBS->CalculateCrc32 (Buffer, Length, &ReturnValue);
ASSERT_EFI_ERROR (Status);
return ReturnValue;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Closes an endpoint of the Low Level Driver. */ | USBD_StatusTypeDef USBD_LL_CloseEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr) | /* Closes an endpoint of the Low Level Driver. */
USBD_StatusTypeDef USBD_LL_CloseEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr) | {
HAL_PCD_EP_Close((PCD_HandleTypeDef*) pdev->pData, ep_addr);
return USBD_OK;
} | st-one/X-CUBE-USB-PD | C++ | null | 110 |
/* The channel will NOT be released if it's marked "busy" (see mxs_dma_enable()). */ | int mxs_dma_release(int channel) | /* The channel will NOT be released if it's marked "busy" (see mxs_dma_enable()). */
int mxs_dma_release(int channel) | {
struct mxs_dma_chan *pchan;
int ret;
ret = mxs_dma_validate_chan(channel);
if (ret)
return ret;
pchan = mxs_dma_channels + channel;
if (pchan->flags & MXS_DMA_FLAGS_BUSY)
return -EBUSY;
pchan->dev = 0;
pchan->active_num = 0;
pchan->pending_num = 0;
pchan->flags &= ~MXS_DMA_FLAGS_ALLOCATED;
return 0;
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Read sensor data.
This routine calls the appropriate internal data function to obtain the specified type of data from the sensor device. */ | static bool sfh7770_read(sensor_t *sensor, sensor_read_t type, sensor_data_t *data) | /* Read sensor data.
This routine calls the appropriate internal data function to obtain the specified type of data from the sensor device. */
static bool sfh7770_read(sensor_t *sensor, sensor_read_t type, sensor_data_t *data) | {
sensor_hal_t *const hal = sensor->hal;
switch (type) {
case SENSOR_READ_LIGHT:
return sfh7770_get_light(hal, data);
case SENSOR_READ_PROXIMITY:
return sfh7770_get_proximity(hal, data);
case SENSOR_READ_ID:
return sfh7770_device_id(hal, data);
default:
sensor->err = SENSOR_ERR_FUNCTION;
return false;
}
} | memfault/zero-to-main | C++ | null | 200 |
/* This function returns the status data for each of the Traffic Classes in use. */ | s32 ixgbe_dcb_get_tc_stats(struct ixgbe_hw *hw, struct ixgbe_hw_stats *stats, u8 tc_count) | /* This function returns the status data for each of the Traffic Classes in use. */
s32 ixgbe_dcb_get_tc_stats(struct ixgbe_hw *hw, struct ixgbe_hw_stats *stats, u8 tc_count) | {
s32 ret = 0;
if (hw->mac.type == ixgbe_mac_82598EB)
ret = ixgbe_dcb_get_tc_stats_82598(hw, stats, tc_count);
else if (hw->mac.type == ixgbe_mac_82599EB)
ret = ixgbe_dcb_get_tc_stats_82599(hw, stats, tc_count);
return ret;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Free a cluster using its L2 entry (handles clusters of all types, e.g. normal cluster, compressed cluster, etc.) */ | void qcow2_free_any_clusters(BlockDriverState *bs, uint64_t l2_entry, int nb_clusters, enum qcow2_discard_type type) | /* Free a cluster using its L2 entry (handles clusters of all types, e.g. normal cluster, compressed cluster, etc.) */
void qcow2_free_any_clusters(BlockDriverState *bs, uint64_t l2_entry, int nb_clusters, enum qcow2_discard_type type) | {
BDRVQcowState *s = bs->opaque;
switch (qcow2_get_cluster_type(l2_entry)) {
case QCOW2_CLUSTER_COMPRESSED:
{
int nb_csectors;
nb_csectors = ((l2_entry >> s->csize_shift) &
s->csize_mask) + 1;
qcow2_free_clusters(bs,
(l2_entry & s->cluster_offset_mask) & ~511,
nb_csectors * 512, type);
}
break;
case QCOW2_CLUSTER_NORMAL:
case QCOW2_CLUSTER_ZERO:
if (l2_entry & L2E_OFFSET_MASK) {
qcow2_free_clusters(bs, l2_entry & L2E_OFFSET_MASK,
nb_clusters << s->cluster_bits, type);
}
break;
case QCOW2_CLUSTER_UNALLOCATED:
break;
default:
abort();
}
} | ve3wwg/teensy3_qemu | C++ | Other | 15 |
/* The functions for inserting/removing us as a module. */ | static int __init h3600ts_init(void) | /* The functions for inserting/removing us as a module. */
static int __init h3600ts_init(void) | {
return serio_register_driver(&h3600ts_drv);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Fills the LCD with the specified 16-bit color. */ | void lcdFillRGB(uint16_t data) | /* Fills the LCD with the specified 16-bit color. */
void lcdFillRGB(uint16_t data) | {
uint16_t x,y;
s6b33b6xSetCursor(0, 0);
for(x=0;x<128;x++)
{
for(y=0;y<128;y++)
{
DATA(data>>8);
DATA(data & 0xFF);
}
}
} | microbuilder/LPC1343CodeBase | C++ | Other | 73 |
/* Set an entry to be a table pte. */ | STATIC UINTN SetTableEntry(IN UINTN Entry) | /* Set an entry to be a table pte. */
STATIC UINTN SetTableEntry(IN UINTN Entry) | {
Entry = SetValidPte (Entry);
Entry &= ~(RISCV_PG_X | RISCV_PG_W | RISCV_PG_R);
return Entry;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* This function multiplies the 64-bit unsigned value Multiplicand by the 32-bit unsigned value Multiplier and generates a 64-bit unsigned result. This 64- bit unsigned result is returned. */ | UINT64 EFIAPI MultU64x32(IN UINT64 Multiplicand, IN UINT32 Multiplier) | /* This function multiplies the 64-bit unsigned value Multiplicand by the 32-bit unsigned value Multiplier and generates a 64-bit unsigned result. This 64- bit unsigned result is returned. */
UINT64 EFIAPI MultU64x32(IN UINT64 Multiplicand, IN UINT32 Multiplier) | {
UINT64 Result;
Result = InternalMathMultU64x32 (Multiplicand, Multiplier);
return Result;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Written by Sven Verdoolaege, INRIA Saclay - Ile-de-France, Parc Club Orsay Universite, ZAC des vignes, 4 rue Jacques Monod, 91893 Orsay, France and Ecole Normale Superieure, 45 rue d’Ulm, 75230 Paris, France */ | isl_ctx* isl_local_space_get_ctx(__isl_keep isl_local_space *ls) | /* Written by Sven Verdoolaege, INRIA Saclay - Ile-de-France, Parc Club Orsay Universite, ZAC des vignes, 4 rue Jacques Monod, 91893 Orsay, France and Ecole Normale Superieure, 45 rue d’Ulm, 75230 Paris, France */
isl_ctx* isl_local_space_get_ctx(__isl_keep isl_local_space *ls) | {
return ls ? ls->dim->ctx : NULL;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Given an initialised but unloaded journal struct, poke about in the on-disk structure to update it to the most recent supported version. */ | int journal_update_format(journal_t *journal) | /* Given an initialised but unloaded journal struct, poke about in the on-disk structure to update it to the most recent supported version. */
int journal_update_format(journal_t *journal) | {
journal_superblock_t *sb;
int err;
err = journal_get_superblock(journal);
if (err)
return err;
sb = journal->j_superblock;
switch (be32_to_cpu(sb->s_header.h_blocktype)) {
case JFS_SUPERBLOCK_V2:
return 0;
case JFS_SUPERBLOCK_V1:
return journal_convert_superblock_v1(journal, sb);
default:
break;
}
return -EINVAL;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Checks whether the specified SPI/I2S flag is set or not. */ | uint8_t SPI_I2S_ReadStatusFlag(SPI_T *spi, SPI_FLAG_T flag) | /* Checks whether the specified SPI/I2S flag is set or not. */
uint8_t SPI_I2S_ReadStatusFlag(SPI_T *spi, SPI_FLAG_T flag) | {
return (spi->STS & flag) ? SET : RESET;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Converts the unicode character of the string from uppercase to lowercase. This is a internal function. */ | VOID EFIAPI HiiToLower(IN EFI_STRING ConfigString) | /* Converts the unicode character of the string from uppercase to lowercase. This is a internal function. */
VOID EFIAPI HiiToLower(IN EFI_STRING ConfigString) | {
EFI_STRING String;
BOOLEAN Lower;
ASSERT (ConfigString != NULL);
for (String = ConfigString, Lower = FALSE; *String != L'\0'; String++) {
if (*String == L'=') {
Lower = TRUE;
} else if (*String == L'&') {
Lower = FALSE;
} else if (Lower && (*String >= L'A') && (*String <= L'F')) {
*String = (CHAR16)(*String - L'A' + L'a');
}
}
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Undoes effect of sfi_map_table() by unmapping table if it did not completely fit on same page as SYST. */ | void sfi_unmap_table(struct sfi_table_header *th) | /* Undoes effect of sfi_map_table() by unmapping table if it did not completely fit on same page as SYST. */
void sfi_unmap_table(struct sfi_table_header *th) | {
if (!TABLE_ON_PAGE(syst_va, th, th->len))
sfi_unmap_memory(th, TABLE_ON_PAGE(th, th, th->len) ?
sizeof(*th) : th->len);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Fetch a POS value that was stored at boot time by the kernel when it scanned the MCA space. The register value is returned. Missing or invalid registers report 0. */ | unsigned char mca_device_read_stored_pos(struct mca_device *mca_dev, int reg) | /* Fetch a POS value that was stored at boot time by the kernel when it scanned the MCA space. The register value is returned. Missing or invalid registers report 0. */
unsigned char mca_device_read_stored_pos(struct mca_device *mca_dev, int reg) | {
if(reg < 0 || reg >= 8)
return 0;
return mca_dev->pos[reg];
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Executes the command. The actual code for the command execution is stored as location independant machine code in array flashExecCmd. The contents of this array are temporarily copied to RAM. This way the function can be executed from RAM avoiding problem when try to perform a flash operation on the same flash block that this driver is located on. */ | static void FlashExecuteCommand(void) | /* Executes the command. The actual code for the command execution is stored as location independant machine code in array flashExecCmd. The contents of this array are temporarily copied to RAM. This way the function can be executed from RAM avoiding problem when try to perform a flash operation on the same flash block that this driver is located on. */
static void FlashExecuteCommand(void) | {
pFlashExeCmdFct pExecCommandFct;
blt_int8u cnt;
for (cnt=0; cnt<(sizeof(flashExecCmd)/sizeof(flashExecCmd[0])); cnt++)
{
flashExecCmdRam[cnt] = flashExecCmd[cnt];
}
pExecCommandFct = (pFlashExeCmdFct)((void *)flashExecCmdRam);
pExecCommandFct();
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* Splits the given string into segments. You should call one of the macros coap_split_path() or coap_split_query() instead. */ | size_t coap_split_path_impl(coap_parse_iterator_t *parse_iter, segment_handler_t h, void *data) | /* Splits the given string into segments. You should call one of the macros coap_split_path() or coap_split_query() instead. */
size_t coap_split_path_impl(coap_parse_iterator_t *parse_iter, segment_handler_t h, void *data) | {
unsigned char *seg;
size_t length;
assert(parse_iter);
assert(h);
length = parse_iter->n;
while ( (seg = coap_parse_next(parse_iter)) ) {
h(seg, parse_iter->segment_length, data);
}
return length - (parse_iter->n - parse_iter->segment_length);
} | nodemcu/nodemcu-firmware | C++ | MIT License | 7,566 |
/* Helper function for asynchronously deleting objects. Useful for cases where you can't delete an object directly in an */ | void lv_obj_del_async(lv_obj_t *obj) | /* Helper function for asynchronously deleting objects. Useful for cases where you can't delete an object directly in an */
void lv_obj_del_async(lv_obj_t *obj) | {
lv_async_call(lv_obj_del_async_cb, obj);
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* Created on: 16 feb. 2019 Author: Daniel Mårtensson Concate A with B into C. A size row_a x column_a B size row_B x column_A C size (row_a + row_b) x column_a */ | void vertcat(double *A, double *B, double *C, int row_a, int column_a, int row_b) | /* Created on: 16 feb. 2019 Author: Daniel Mårtensson Concate A with B into C. A size row_a x column_a B size row_B x column_A C size (row_a + row_b) x column_a */
void vertcat(double *A, double *B, double *C, int row_a, int column_a, int row_b) | {
for (int j = 0; j < column_a; j++) {
*(C++) = *((A + i * column_a) + j);
}
}
for (int i = 0; i < row_b; i++) {
for (int j = 0; j < column_a; j++) {
*(C++) = *((B + i * column_a) + j);
}
}
} | DanielMartensson/EmbeddedLapack | C++ | MIT License | 129 |
/* XXX: This is a performance problem for unindexed directories. */ | int ocfs2_empty_dir(struct inode *inode) | /* XXX: This is a performance problem for unindexed directories. */
int ocfs2_empty_dir(struct inode *inode) | {
int ret;
loff_t start = 0;
struct ocfs2_empty_dir_priv priv;
memset(&priv, 0, sizeof(priv));
if (ocfs2_dir_indexed(inode)) {
ret = ocfs2_empty_dir_dx(inode, &priv);
if (ret)
mlog_errno(ret);
}
ret = ocfs2_dir_foreach(inode, &start, &priv, ocfs2_empty_dir_filldir);
if (ret)
mlog_errno(ret);
if (!priv.seen_dot || !priv.seen_dot_dot) {
mlog(ML_ERROR, "bad directory (dir #%llu) - no `.' or `..'\n",
(unsigned long long)OCFS2_I(inode)->ip_blkno);
return 1;
}
return !priv.seen_other;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Called when exiting the driver completely. We unregister the driver with the platform and exit */ | static void __exit davinci_emac_exit(void) | /* Called when exiting the driver completely. We unregister the driver with the platform and exit */
static void __exit davinci_emac_exit(void) | {
platform_driver_unregister(&davinci_emac_driver);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This function decodes the Add Group or Add Group If */ | static void dissect_zcl_color_control_move_to_hue(tvbuff_t *tvb, proto_tree *tree, guint *offset) | /* This function decodes the Add Group or Add Group If */
static void dissect_zcl_color_control_move_to_hue(tvbuff_t *tvb, proto_tree *tree, guint *offset) | {
proto_tree_add_item(tree, hf_zbee_zcl_color_control_hue, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
*offset += 1;
proto_tree_add_item(tree, hf_zbee_zcl_color_control_direction, tvb, *offset, 1, ENC_LITTLE_ENDIAN);
*offset += 1;
proto_tree_add_item(tree, hf_zbee_zcl_color_control_transit_time, tvb, *offset, 2, ENC_LITTLE_ENDIAN);
*offset += 2;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Indicates whether we should tre to connect to the sender of the specified advertisement. The function returns a positive result if the device advertises connectability and support for the Alert Notification service. */ | static int wm_ble_client_demo_should_connect(const struct ble_gap_disc_desc *disc) | /* Indicates whether we should tre to connect to the sender of the specified advertisement. The function returns a positive result if the device advertises connectability and support for the Alert Notification service. */
static int wm_ble_client_demo_should_connect(const struct ble_gap_disc_desc *disc) | {
struct ble_hs_adv_fields fields;
int rc;
int i;
if (disc->event_type != BLE_HCI_ADV_RPT_EVTYPE_ADV_IND &&
disc->event_type != BLE_HCI_ADV_RPT_EVTYPE_DIR_IND) {
return 0;
}
rc = ble_hs_adv_parse_fields(&fields, disc->data, disc->length_data);
if (rc != 0) {
return rc;
}
for (i = 0; i < fields.num_uuids16; i++) {
if (ble_uuid_u16(&fields.uuids16[i].u) == WM_BLE_SERVER_SVC_UUID) {
return 1;
}
}
return 0;
} | Nicholas3388/LuaNode | C++ | Other | 1,055 |
/* Configure the PDM module.
Please see the information on the am_hal_pdm_config_t configuration structure, found in am_hal_pdm.h, for more information on the parameters that may be set by this function. */ | void am_hal_pdm_config(am_hal_pdm_config_t *psConfig) | /* Configure the PDM module.
Please see the information on the am_hal_pdm_config_t configuration structure, found in am_hal_pdm.h, for more information on the parameters that may be set by this function. */
void am_hal_pdm_config(am_hal_pdm_config_t *psConfig) | {
AM_REG(PDM, PCFG) = psConfig->ui32PDMConfigReg;
AM_REG(PDM, VCFG) = psConfig->ui32VoiceConfigReg;
AM_REG(PDM, FTHR) = psConfig->ui32FIFOThreshold;
am_hal_pdm_fifo_flush();
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Enable the Low Speed APB (APB1) peripheral clock during Low Power (Sleep) mode. */ | void RCM_EnableAPB1PeriphClockLPMode(uint32_t APB1Periph) | /* Enable the Low Speed APB (APB1) peripheral clock during Low Power (Sleep) mode. */
void RCM_EnableAPB1PeriphClockLPMode(uint32_t APB1Periph) | {
RCM->LPAPB1CLKEN |= APB1Periph;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Enables or disables simultaneously the two DAC channels software triggers. */ | void DAC_DualSoftwareTrgEnable(FunctionalState Cmd) | /* Enables or disables simultaneously the two DAC channels software triggers. */
void DAC_DualSoftwareTrgEnable(FunctionalState Cmd) | {
assert_param(IS_FUNCTIONAL_STATE(Cmd));
if (Cmd != DISABLE)
{
DAC->SOTTR |= DUAL_SWTRIG_SET;
}
else
{
DAC->SOTTR &= DUAL_SWTRIG_RESET;
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Returns: (transfer full): a string with the data that was read before encountering any of the stop characters. Set @length to a #gsize to get the length of the string. This function will return NULL on an error. */ | char* g_data_input_stream_read_until(GDataInputStream *stream, const gchar *stop_chars, gsize *length, GCancellable *cancellable, GError **error) | /* Returns: (transfer full): a string with the data that was read before encountering any of the stop characters. Set @length to a #gsize to get the length of the string. This function will return NULL on an error. */
char* g_data_input_stream_read_until(GDataInputStream *stream, const gchar *stop_chars, gsize *length, GCancellable *cancellable, GError **error) | {
GBufferedInputStream *bstream;
gchar *result;
bstream = G_BUFFERED_INPUT_STREAM (stream);
result = g_data_input_stream_read_upto (stream, stop_chars, -1,
length, cancellable, error);
if (result != NULL && g_buffered_input_stream_get_available (bstream) > 0)
{
gsize res;
gchar b;
res = g_input_stream_read (G_INPUT_STREAM (stream), &b, 1, NULL, NULL);
g_assert (res == 1);
}
return result;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Build a netlink request message to delete a classifier */ | int rtnl_cls_build_delete_request(struct rtnl_cls *cls, int flags, struct nl_msg **result) | /* Build a netlink request message to delete a classifier */
int rtnl_cls_build_delete_request(struct rtnl_cls *cls, int flags, struct nl_msg **result) | {
return cls_build(cls, RTM_DELTFILTER, flags, result);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* As each period is completed, this function changes the the link descriptor pointers for that period to point to the next period. */ | static void fsl_dma_update_pointers(struct fsl_dma_private *dma_private) | /* As each period is completed, this function changes the the link descriptor pointers for that period to point to the next period. */
static void fsl_dma_update_pointers(struct fsl_dma_private *dma_private) | {
struct fsl_dma_link_descriptor *link =
&dma_private->link[dma_private->current_link];
if (dma_private->substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
link->source_addr =
cpu_to_be32(dma_private->dma_buf_next);
else
link->dest_addr =
cpu_to_be32(dma_private->dma_buf_next);
dma_private->dma_buf_next += dma_private->period_size;
if (dma_private->dma_buf_next >= dma_private->dma_buf_end)
dma_private->dma_buf_next = dma_private->dma_buf_phys;
if (++dma_private->current_link >= NUM_DMA_LINKS)
dma_private->current_link = 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* param base CAAM peripheral base address param handle jobRing used for this request. param stateHandle RNG state handle to uninstantiate return Status of the request */ | status_t CAAM_RNG_Deinit(CAAM_Type *base, caam_handle_t *handle, caam_rng_state_handle_t stateHandle) | /* param base CAAM peripheral base address param handle jobRing used for this request. param stateHandle RNG state handle to uninstantiate return Status of the request */
status_t CAAM_RNG_Deinit(CAAM_Type *base, caam_handle_t *handle, caam_rng_state_handle_t stateHandle) | {
status_t status;
caam_desc_rng_t rngUninstantiate = {0};
rngUninstantiate[0] = 0xB0800002u;
rngUninstantiate[1] = 0x8250000Cu;
if (kCAAM_RngStateHandle1 == stateHandle)
{
rngUninstantiate[1] |= 1u << 4;
}
do
{
status = caam_in_job_ring_add(base, handle->jobRing, &rngUninstantiate[0]);
} while (status != kStatus_Success);
status = CAAM_Wait(base, handle, &rngUninstantiate[0], kCAAM_Blocking);
return status;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* To protect aginst the timer going away while the interrupt is queued, we require that the it_requeue_pending flag be set. */ | void do_schedule_next_timer(struct siginfo *info) | /* To protect aginst the timer going away while the interrupt is queued, we require that the it_requeue_pending flag be set. */
void do_schedule_next_timer(struct siginfo *info) | {
struct k_itimer *timr;
unsigned long flags;
timr = lock_timer(info->si_tid, &flags);
if (timr && timr->it_requeue_pending == info->si_sys_private) {
if (timr->it_clock < 0)
posix_cpu_timer_schedule(timr);
else
schedule_next_timer(timr);
info->si_overrun += timr->it_overrun_last;
}
if (timr)
unlock_timer(timr, flags);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Construct a slave signals structure for setting the DTR and RTS signals as specified. */ | static void stli_mkasysigs(asysigs_t *sp, int dtr, int rts) | /* Construct a slave signals structure for setting the DTR and RTS signals as specified. */
static void stli_mkasysigs(asysigs_t *sp, int dtr, int rts) | {
memset(sp, 0, sizeof(asysigs_t));
if (dtr >= 0) {
sp->signal |= SG_DTR;
sp->sigvalue |= ((dtr > 0) ? SG_DTR : 0);
}
if (rts >= 0) {
sp->signal |= SG_RTS;
sp->sigvalue |= ((rts > 0) ? SG_RTS : 0);
}
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* If Cert is NULL, then return FALSE. If CACert is NULL, then return FALSE. If this interface is not supported, then return FALSE. */ | BOOLEAN EFIAPI CryptoServiceX509VerifyCert(IN CONST UINT8 *Cert, IN UINTN CertSize, IN CONST UINT8 *CACert, IN UINTN CACertSize) | /* If Cert is NULL, then return FALSE. If CACert is NULL, then return FALSE. If this interface is not supported, then return FALSE. */
BOOLEAN EFIAPI CryptoServiceX509VerifyCert(IN CONST UINT8 *Cert, IN UINTN CertSize, IN CONST UINT8 *CACert, IN UINTN CACertSize) | {
return CALL_BASECRYPTLIB (X509.Services.VerifyCert, X509VerifyCert, (Cert, CertSize, CACert, CACertSize), FALSE);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Find the default symbol for a choice. First try the default values for the choice symbol Next locate the first visible choice value Return NULL if none was found */ | struct symbol* sym_choice_default(struct symbol *sym) | /* Find the default symbol for a choice. First try the default values for the choice symbol Next locate the first visible choice value Return NULL if none was found */
struct symbol* sym_choice_default(struct symbol *sym) | {
struct symbol *def_sym;
struct property *prop;
struct expr *e;
for_all_defaults(sym, prop) {
prop->visible.tri = expr_calc_value(prop->visible.expr);
if (prop->visible.tri == no)
continue;
def_sym = prop_get_symbol(prop);
if (def_sym->visible != no)
return def_sym;
}
prop = sym_get_choice_prop(sym);
expr_list_for_each_sym(prop->expr, e, def_sym)
if (def_sym->visible != no)
return def_sym;
return NULL;
} | Nicholas3388/LuaNode | C++ | Other | 1,055 |
/* p = (nr <= nl) ? l : l*nr/nl */ | static u64 __sched_period(unsigned long nr_running) | /* p = (nr <= nl) ? l : l*nr/nl */
static u64 __sched_period(unsigned long nr_running) | {
u64 period = sysctl_sched_latency;
unsigned long nr_latency = sched_nr_latency;
if (unlikely(nr_running > nr_latency)) {
period = sysctl_sched_min_granularity;
period *= nr_running;
}
return period;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Signed division remainder operation.
Run the signed division operation and return the remainder. */ | int32_t divas_idivmod(int32_t numerator, int32_t denominator) | /* Signed division remainder operation.
Run the signed division operation and return the remainder. */
int32_t divas_idivmod(int32_t numerator, int32_t denominator) | {
cpu_irq_enter_critical();
DIVAS->CTRLA.reg |= DIVAS_CTRLA_SIGNED;
DIVAS->DIVIDEND.reg = numerator;
DIVAS->DIVISOR.reg = denominator;
while(DIVAS->STATUS.bit.BUSY){
}
int32_t remainder = DIVAS->REM.reg;
cpu_irq_leave_critical();
return remainder;
} | memfault/zero-to-main | C++ | null | 200 |
/* Calculates the atmospheric pressure (in hPa) at the destination altitude based on the current seal-level pressure (in hPa), altitude (in meters) and temperature (in C) */ | float pressureAtDestination(float seaLevel, float destTemp, float destAltitude) | /* Calculates the atmospheric pressure (in hPa) at the destination altitude based on the current seal-level pressure (in hPa), altitude (in meters) and temperature (in C) */
float pressureAtDestination(float seaLevel, float destTemp, float destAltitude) | {
return seaLevel * (float)pow(1.0F - (0.0065F * destAltitude) /
(destTemp + 0.0065F * destAltitude + 273.15F), 5.257F);
} | microbuilder/LPC11U_LPC13U_CodeBase | C++ | Other | 54 |
/* This function returns the current status of the last program or erase operation performed by the EEPROM. It is intended to provide error information to applications programming or setting EEPROM protection options under interrupt control. */ | uint32_t EEPROMStatusGet(void) | /* This function returns the current status of the last program or erase operation performed by the EEPROM. It is intended to provide error information to applications programming or setting EEPROM protection options under interrupt control. */
uint32_t EEPROMStatusGet(void) | {
return(HWREG(EEPROM_EEDONE));
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* s3c_hsotg_en_gsint - enable one or more of the general interrupt @hsotg: The device state @ints: A bitmask of the interrupts to enable */ | static void s3c_hsotg_en_gsint(struct s3c_hsotg *hsotg, u32 ints) | /* s3c_hsotg_en_gsint - enable one or more of the general interrupt @hsotg: The device state @ints: A bitmask of the interrupts to enable */
static void s3c_hsotg_en_gsint(struct s3c_hsotg *hsotg, u32 ints) | {
u32 gsintmsk = readl(hsotg->regs + GINTMSK);
u32 new_gsintmsk;
new_gsintmsk = gsintmsk | ints;
if (new_gsintmsk != gsintmsk) {
dev_dbg(hsotg->dev, "gsintmsk now 0x%08x\n", new_gsintmsk);
writel(new_gsintmsk, hsotg->regs + GINTMSK);
}
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* This API sets the interrupt mode in the sensor. */ | uint16_t bma4_set_interrupt_mode(uint8_t mode, struct bma4_dev *dev) | /* This API sets the interrupt mode in the sensor. */
uint16_t bma4_set_interrupt_mode(uint8_t mode, struct bma4_dev *dev) | {
uint16_t rslt = 0;
if (dev == NULL) {
rslt |= BMA4_E_NULL_PTR;
} else {
if (mode == BMA4_NON_LATCH_MODE || mode == BMA4_LATCH_MODE)
rslt |= bma4_write_regs(BMA4_INTR_LATCH_ADDR, &mode, 1, dev);
else
rslt |= BMA4_E_OUT_OF_RANGE;
}
return rslt;
} | arendst/Tasmota | C++ | GNU General Public License v3.0 | 21,318 |
/* Returns the current status register of the given TWI peripheral, but masking interrupt sources which are not currently enabled. This resets the internal value of the status register, so further read may yield different values. */ | unsigned int TWI_GetMaskedStatus(AT91S_TWI *pTwi) | /* Returns the current status register of the given TWI peripheral, but masking interrupt sources which are not currently enabled. This resets the internal value of the status register, so further read may yield different values. */
unsigned int TWI_GetMaskedStatus(AT91S_TWI *pTwi) | {
unsigned int status;
SANITY_CHECK(pTwi);
status = pTwi->TWI_SR;
status &= pTwi->TWI_IMR;
return status;
} | apopple/Pandaboard-FreeRTOS | C++ | null | 25 |
/* Returns pointer to pathname pattern if matched, @filename otherwise. */ | static const struct tomoyo_path_info* tomoyo_get_file_pattern(const struct tomoyo_path_info *filename) | /* Returns pointer to pathname pattern if matched, @filename otherwise. */
static const struct tomoyo_path_info* tomoyo_get_file_pattern(const struct tomoyo_path_info *filename) | {
struct tomoyo_pattern_entry *ptr;
const struct tomoyo_path_info *pattern = NULL;
down_read(&tomoyo_pattern_list_lock);
list_for_each_entry(ptr, &tomoyo_pattern_list, list) {
if (ptr->is_deleted)
continue;
if (!tomoyo_path_matches_pattern(filename, ptr->pattern))
continue;
pattern = ptr->pattern;
if (tomoyo_strendswith(pattern->name, "/\\*")) {
} else {
break;
}
}
up_read(&tomoyo_pattern_list_lock);
if (pattern)
filename = pattern;
return filename;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Remove and free all elements from a linked list. The list remain valid but become empty. */ | void lv_ll_clear(lv_ll_t *ll_p) | /* Remove and free all elements from a linked list. The list remain valid but become empty. */
void lv_ll_clear(lv_ll_t *ll_p) | {
void * i;
void * i_next;
i = lv_ll_get_head(ll_p);
i_next = NULL;
while(i != NULL) {
i_next = lv_ll_get_next(ll_p, i);
lv_ll_rem(ll_p, i);
lv_mem_free(i);
i = i_next;
}
} | RavenSystem/esp-homekit-devices | C++ | Other | 2,577 |
/* Set DMA control A register used by a HDMA channel. */ | void DMA_SetSourceBufferSize(unsigned char channel, unsigned int size, unsigned char sourceWidth, unsigned char destWidth, unsigned char done) | /* Set DMA control A register used by a HDMA channel. */
void DMA_SetSourceBufferSize(unsigned char channel, unsigned int size, unsigned char sourceWidth, unsigned char destWidth, unsigned char done) | {
ASSERT(channel < DMA_CHANNEL_NUM, "this channel does not exist");
ASSERT(sourceWidth < 4, "width does not support");
ASSERT(destWidth < 4, "width does not support");
AT91C_BASE_HDMA->HDMA_CH[channel].HDMA_CTRLA = (size |
sourceWidth << 24 |
destWidth << 28 |
done << 31);
} | apopple/Pandaboard-FreeRTOS | C++ | null | 25 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.