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 |
|---|---|---|---|---|---|---|---|
/* Deliver IP Packets to the higher protocol layers. */ | int ip_local_deliver(struct sk_buff *skb) | /* Deliver IP Packets to the higher protocol layers. */
int ip_local_deliver(struct sk_buff *skb) | {
if (ip_hdr(skb)->frag_off & htons(IP_MF | IP_OFFSET)) {
if (ip_defrag(skb, IP_DEFRAG_LOCAL_DELIVER))
return 0;
}
return NF_HOOK(PF_INET, NF_INET_LOCAL_IN, skb, skb->dev, NULL,
ip_local_deliver_finish);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Enable or Disable Host config 0x6 to reset SDU sdu_rst_ sd_rst_. */ | BL_Err_Type GLB_Config_SDIO_Host_Reset_SDU(uint8_t enable) | /* Enable or Disable Host config 0x6 to reset SDU sdu_rst_ sd_rst_. */
BL_Err_Type GLB_Config_SDIO_Host_Reset_SDU(uint8_t enable) | {
uint32_t tmpVal = 0;
tmpVal = BL_RD_REG(GLB_BASE, GLB_SDIO_CFG0);
if (enable) {
tmpVal = BL_CLR_REG_BIT(tmpVal, GLB_REG_SDU_RST_SD_DIS);
tmpVal = BL_CLR_REG_BIT(tmpVal, GLB_REG_SD_RST_SD_DIS);
} else {
tmpVal = BL_SET_REG_BIT(tmpVal, GLB_REG_SDU_RST_SD_DIS);
tmpVal = BL... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Master selection of compression modules. This is done once at the start of processing an image. We determine which modules will be used and give them appropriate initialization calls. */ | jinit_compress_master(j_compress_ptr cinfo) | /* Master selection of compression modules. This is done once at the start of processing an image. We determine which modules will be used and give them appropriate initialization calls. */
jinit_compress_master(j_compress_ptr cinfo) | {
jinit_c_master_control(cinfo, FALSE);
if (! cinfo->raw_data_in) {
jinit_color_converter(cinfo);
jinit_downsampler(cinfo);
jinit_c_prep_controller(cinfo, FALSE);
}
jinit_forward_dct(cinfo);
if (cinfo->arith_code)
jinit_arith_encoder(cinfo);
else {
jinit_huff_encoder(cinfo);
}
jinit_... | STMicroelectronics/STM32CubeF4 | C++ | Other | 789 |
/* In future, the driver should check to see if the device has an EEPROM attached and whether that has a valid ethernet address in it. */ | static void ks8851_init_mac(struct ks8851_net *ks) | /* In future, the driver should check to see if the device has an EEPROM attached and whether that has a valid ethernet address in it. */
static void ks8851_init_mac(struct ks8851_net *ks) | {
struct net_device *dev = ks->netdev;
random_ether_addr(dev->dev_addr);
ks8851_write_mac_addr(dev);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* If 8-bit I/O port operations are not supported, then ASSERT(). If StartBit is greater than 7, then ASSERT(). If EndBit is greater than 7, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */ | UINT8 EFIAPI IoBitFieldWrite8(IN UINTN Port, IN UINTN StartBit, IN UINTN EndBit, IN UINT8 Value) | /* If 8-bit I/O port operations are not supported, then ASSERT(). If StartBit is greater than 7, then ASSERT(). If EndBit is greater than 7, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */
UINT8 EFIAPI IoB... | {
return IoWrite8 (
Port,
BitFieldWrite8 (IoRead8 (Port), StartBit, EndBit, Value)
);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Return: true if he supplied lane count is valid, false otherwise */ | static bool is_lane_count_valid(struct udevice *dev, u8 lane_count) | /* Return: true if he supplied lane count is valid, false otherwise */
static bool is_lane_count_valid(struct udevice *dev, u8 lane_count) | {
struct dp_tx *dp_tx = dev_get_priv(dev);
bool valid = true;
if (lane_count != LANE_COUNT_SET_1 &&
lane_count != LANE_COUNT_SET_2 &&
lane_count != LANE_COUNT_SET_4)
valid = false;
else if (lane_count > dp_tx->link_config.max_lane_count)
valid = false;
return valid;
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* This function processes the results of changes in configuration. */ | EFI_STATUS EFIAPI Tcg2RouteConfig(IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, IN CONST EFI_STRING Configuration, OUT EFI_STRING *Progress) | /* This function processes the results of changes in configuration. */
EFI_STATUS EFIAPI Tcg2RouteConfig(IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, IN CONST EFI_STRING Configuration, OUT EFI_STRING *Progress) | {
if ((Configuration == NULL) || (Progress == NULL)) {
return EFI_INVALID_PARAMETER;
}
*Progress = Configuration;
return EFI_NOT_FOUND;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* This service enables PEIMs to discover additional firmware files. */ | EFI_STATUS EFIAPI PeiServicesFfsFindNextFile(IN EFI_FV_FILETYPE SearchType, IN EFI_PEI_FV_HANDLE VolumeHandle, IN OUT EFI_PEI_FILE_HANDLE *FileHandle) | /* This service enables PEIMs to discover additional firmware files. */
EFI_STATUS EFIAPI PeiServicesFfsFindNextFile(IN EFI_FV_FILETYPE SearchType, IN EFI_PEI_FV_HANDLE VolumeHandle, IN OUT EFI_PEI_FILE_HANDLE *FileHandle) | {
return SecFfsFindNextFile (SearchType, VolumeHandle, FileHandle);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* This function destroys a wear leveling entry and removes the reference from the lookup table. */ | static void wl_entry_destroy(struct ubi_device *ubi, struct ubi_wl_entry *e) | /* This function destroys a wear leveling entry and removes the reference from the lookup table. */
static void wl_entry_destroy(struct ubi_device *ubi, struct ubi_wl_entry *e) | {
ubi->lookuptbl[e->pnum] = NULL;
kmem_cache_free(ubi_wl_entry_slab, e);
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* 'E NN' Send an error with the given error number after converting to hex. The error number is put into the buffer in hex. '255' is the biggest errno we can send. ex: 162 will be sent as A2. */ | VOID EFIAPI SendError(IN UINT8 ErrorNum) | /* 'E NN' Send an error with the given error number after converting to hex. The error number is put into the buffer in hex. '255' is the biggest errno we can send. ex: 162 will be sent as A2. */
VOID EFIAPI SendError(IN UINT8 ErrorNum) | {
gError[1] = mHexToStr[ErrorNum >> 4];
gError[2] = mHexToStr[ErrorNum & 0x0f];
SendPacket (gError);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* TIM_Base MSP Initialization This function configures the hardware resources used in this example. */ | void HAL_TIM_Base_MspInit(TIM_HandleTypeDef *htim_base) | /* TIM_Base MSP Initialization This function configures the hardware resources used in this example. */
void HAL_TIM_Base_MspInit(TIM_HandleTypeDef *htim_base) | {
if(htim_base->Instance==TIM7)
{
__HAL_RCC_TIM7_CLK_ENABLE();
}
else if(htim_base->Instance==TIM15)
{
__HAL_RCC_TIM15_CLK_ENABLE();
}
else if(htim_base->Instance==TIM16)
{
__HAL_RCC_TIM16_CLK_ENABLE();
}
else if(htim_base->Instance==TIM17)
{
__HAL_RCC_TIM17_CLK_ENABLE();
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* fc_lport_config() - Configure a fc_lport @lport: The local port to be configured */ | int fc_lport_config(struct fc_lport *lport) | /* fc_lport_config() - Configure a fc_lport @lport: The local port to be configured */
int fc_lport_config(struct fc_lport *lport) | {
INIT_DELAYED_WORK(&lport->retry_work, fc_lport_timeout);
mutex_init(&lport->lp_mutex);
fc_lport_state_enter(lport, LPORT_ST_DISABLED);
fc_lport_add_fc4_type(lport, FC_TYPE_FCP);
fc_lport_add_fc4_type(lport, FC_TYPE_CT);
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Message: DropParticipantReqMessage Opcode: 0x013b Type: IntraCCM Direction: pbx2pbx VarLength: no */ | static void handle_DropParticipantReqMessage(ptvcursor_t *cursor, packet_info *pinfo _U_) | /* Message: DropParticipantReqMessage Opcode: 0x013b Type: IntraCCM Direction: pbx2pbx VarLength: no */
static void handle_DropParticipantReqMessage(ptvcursor_t *cursor, packet_info *pinfo _U_) | {
ptvcursor_add(cursor, hf_skinny_conferenceID, 4, ENC_LITTLE_ENDIAN);
si->callId = tvb_get_letohl(ptvcursor_tvbuff(cursor), ptvcursor_current_offset(cursor));
ptvcursor_add(cursor, hf_skinny_callReference, 4, ENC_LITTLE_ENDIAN);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* This function handles External line 1 interrupt request. */ | void EXTI1_IRQHandler(void) | /* This function handles External line 1 interrupt request. */
void EXTI1_IRQHandler(void) | {
HAL_GPIO_EXTI_IRQHandler(TS_INT_PIN);
} | STMicroelectronics/STM32CubeF4 | C++ | Other | 789 |
/* This function initialize PUF config structure to default values. */ | void PUF_GetDefaultConfig(puf_config_t *conf) | /* This function initialize PUF config structure to default values. */
void PUF_GetDefaultConfig(puf_config_t *conf) | {
conf->dataEndianness = kPUF_EndianBig;
conf->CKGATING = 0U;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Get contents of register REGNO in task TASK. */ | static long get_reg(struct task_struct *task, int regno) | /* Get contents of register REGNO in task TASK. */
static long get_reg(struct task_struct *task, int regno) | {
unsigned long *addr;
if (regno == PT_USP)
addr = &task->thread.usp;
else if (regno < ARRAY_SIZE(regoff))
addr = (unsigned long *)(task->thread.esp0 + regoff[regno]);
else
return 0;
if (regno == PT_SR || regno == PT_PC) {
long stkadj = *(long *)(task->thread.esp0 + PT_REG(stkadj));
addr = (unsigned long... | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* If the requested operation results in an overflow or an underflow condition, then Result is set to INT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */ | RETURN_STATUS EFIAPI SafeInt8Mult(IN INT8 Multiplicand, IN INT8 Multiplier, OUT INT8 *Result) | /* If the requested operation results in an overflow or an underflow condition, then Result is set to INT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */
RETURN_STATUS EFIAPI SafeInt8Mult(IN INT8 Multiplicand, IN INT8 Multiplier, OUT INT8 *Result) | {
return SafeInt32ToInt8 (((INT32)Multiplier) *((INT32)Multiplicand), Result);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Finds out the remanining packets to be sent */ | static u32 xhci_v1_0_td_remainder(int running_total, int trb_buff_len, unsigned int total_packet_count, int maxpacketsize, unsigned int num_trbs_left) | /* Finds out the remanining packets to be sent */
static u32 xhci_v1_0_td_remainder(int running_total, int trb_buff_len, unsigned int total_packet_count, int maxpacketsize, unsigned int num_trbs_left) | {
int packets_transferred;
if (num_trbs_left == 0 || (running_total == 0 && trb_buff_len == 0))
return 0;
packets_transferred = (running_total + trb_buff_len) / maxpacketsize;
if ((total_packet_count - packets_transferred) > 31)
return 31 << 17;
return (total_packet_count - packets_transferred) << 17;
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* The Slave I2CSCSR register is write-only, so any call to */ | void I2CSlaveFIFOEnable(uint32_t ui32Base, uint32_t ui32Config) | /* The Slave I2CSCSR register is write-only, so any call to */
void I2CSlaveFIFOEnable(uint32_t ui32Base, uint32_t ui32Config) | {
ASSERT(_I2CBaseValid(ui32Base));
HWREG(ui32Base + I2C_O_SCSR) = ui32Config | I2C_SCSR_DA;
} | micropython/micropython | C++ | Other | 18,334 |
/* Enables or disables the CRC value calculation of the transferred bytes. */ | void SPI_CalculateCRC(SPI_TypeDef *SPIx, FunctionalState NewState) | /* Enables or disables the CRC value calculation of the transferred bytes. */
void SPI_CalculateCRC(SPI_TypeDef *SPIx, FunctionalState NewState) | {
assert_param(IS_SPI_ALL_PERIPH(SPIx));
assert_param(IS_FUNCTIONAL_STATE(NewState));
if (NewState != DISABLE)
{
SPIx->CR1 |= SPI_CR1_CRCEN;
}
else
{
SPIx->CR1 &= (uint16_t)~((uint16_t)SPI_CR1_CRCEN);
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Allocates an mbuf to be used for an ATT response. If an mbuf cannot be allocated, the received request mbuf is reused for the error response. */ | static int ble_att_svr_pkt(struct os_mbuf **rxom, struct os_mbuf **out_txom, uint8_t *out_att_err) | /* Allocates an mbuf to be used for an ATT response. If an mbuf cannot be allocated, the received request mbuf is reused for the error response. */
static int ble_att_svr_pkt(struct os_mbuf **rxom, struct os_mbuf **out_txom, uint8_t *out_att_err) | {
*out_txom = ble_hs_mbuf_l2cap_pkt();
if (*out_txom != NULL) {
return 0;
}
*out_txom = *rxom;
*rxom = NULL;
*out_att_err = BLE_ATT_ERR_INSUFFICIENT_RES;
return BLE_HS_ENOMEM;
} | Nicholas3388/LuaNode | C++ | Other | 1,055 |
/* Initialize a new Message Text Object (MTO) at the end of the provided buffer with enough room for max_len characters. Return 0 on success. */ | static int sclp_initialize_mto(struct sclp_buffer *buffer, int max_len) | /* Initialize a new Message Text Object (MTO) at the end of the provided buffer with enough room for max_len characters. Return 0 on success. */
static int sclp_initialize_mto(struct sclp_buffer *buffer, int max_len) | {
struct write_sccb *sccb;
struct mto *mto;
int mto_size;
mto_size = sizeof(struct mto) + max_len;
sccb = buffer->sccb;
if ((MAX_SCCB_ROOM - sccb->header.length) < mto_size)
return -ENOMEM;
mto = (struct mto *)(((addr_t) sccb) + sccb->header.length);
memset(mto, 0, sizeof(struct mto));
mto->length = sizeof(s... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* prune==1 -> only immediate children of node (certainly, ignoring pure split nodes) will be scanned. */ | static void fib6_clean_tree(struct net *net, struct fib6_node *root, int(*func)(struct rt6_info *, void *arg), int prune, void *arg) | /* prune==1 -> only immediate children of node (certainly, ignoring pure split nodes) will be scanned. */
static void fib6_clean_tree(struct net *net, struct fib6_node *root, int(*func)(struct rt6_info *, void *arg), int prune, void *arg) | {
struct fib6_cleaner_t c;
c.w.root = root;
c.w.func = fib6_clean_node;
c.w.prune = prune;
c.func = func;
c.arg = arg;
c.net = net;
fib6_walk(&c.w);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* _detach is called to deconfigure a device. It should deallocate resources. This function is also called when _attach() fails, so it should be careful not to release resources that were not necessarily allocated by _attach(). dev->private and dev->subdevices are deallocated automatically by the core. */ | static int pci6208_detach(struct comedi_device *dev) | /* _detach is called to deconfigure a device. It should deallocate resources. This function is also called when _attach() fails, so it should be careful not to release resources that were not necessarily allocated by _attach(). dev->private and dev->subdevices are deallocated automatically by the core. */
static int p... | {
printk(KERN_INFO "comedi%d: pci6208: remove\n", dev->minor);
if (devpriv && devpriv->pci_dev) {
if (dev->iobase)
comedi_pci_disable(devpriv->pci_dev);
pci_dev_put(devpriv->pci_dev);
}
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* It is not safe to use bdrv_unref() from a callback function when the callers still need the BlockDriverState. In such cases we schedule a BH to release the reference. */ | static void bdrv_put_ref_bh_schedule(BlockDriverState *bs) | /* It is not safe to use bdrv_unref() from a callback function when the callers still need the BlockDriverState. In such cases we schedule a BH to release the reference. */
static void bdrv_put_ref_bh_schedule(BlockDriverState *bs) | {
BDRVPutRefBH *s;
s = g_new(BDRVPutRefBH, 1);
s->bh = qemu_bh_new(bdrv_put_ref_bh, s);
s->bs = bs;
qemu_bh_schedule(s->bh);
} | ve3wwg/teensy3_qemu | C | Other | 15 |
/* Get scratch buffer size needed by softmax function. */ | int32_t esp_nn_get_softmax_scratch_size_opt(const int32_t width, const int32_t height) | /* Get scratch buffer size needed by softmax function. */
int32_t esp_nn_get_softmax_scratch_size_opt(const int32_t width, const int32_t height) | {
(void) height;
return width * 4;
} | arendst/Tasmota | C++ | GNU General Public License v3.0 | 21,318 |
/* 6.5.2.5. SM Set Assignment Info (Confirmed Service Id = 14) 6.5.2.5.1. Request Message Parameters */ | static void dissect_ff_msg_sm_set_assign_info_req_dev_redundancy_state(tvbuff_t *tvb, gint offset, proto_tree *tree) | /* 6.5.2.5. SM Set Assignment Info (Confirmed Service Id = 14) 6.5.2.5.1. Request Message Parameters */
static void dissect_ff_msg_sm_set_assign_info_req_dev_redundancy_state(tvbuff_t *tvb, gint offset, proto_tree *tree) | {
static const int * state_flags[] = {
&hf_ff_sm_set_assign_info_req_dev_redundancy_state_reserved,
&hf_ff_sm_set_assign_info_req_dev_redundancy_state_role,
&hf_ff_sm_set_assign_info_req_dev_redundancy_state_type,
NULL
};
proto_tree_add_bitmask(tree, tvb, offset, hf_ff_sm_set... | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* This internal API sets the oversampling settings for pressure, temperature and humidity in the sensor. */ | static int8_t set_osr_settings(uint8_t desired_settings, const struct bme280_settings *settings, struct bme280_dev *dev) | /* This internal API sets the oversampling settings for pressure, temperature and humidity in the sensor. */
static int8_t set_osr_settings(uint8_t desired_settings, const struct bme280_settings *settings, struct bme280_dev *dev) | {
int8_t rslt = BME280_W_INVALID_OSR_MACRO;
if (desired_settings & BME280_OSR_HUM_SEL)
{
rslt = set_osr_humidity_settings(settings, dev);
}
if (desired_settings & (BME280_OSR_PRESS_SEL | BME280_OSR_TEMP_SEL))
{
rslt = set_osr_press_temp_settings(desired_settings, settings, dev);
... | eclipse-threadx/getting-started | C++ | Other | 310 |
/* (jd) RMT duplicate address actions leave the ring or reinsert just as configured */ | static void rmt_dup_actions(struct s_smc *smc) | /* (jd) RMT duplicate address actions leave the ring or reinsert just as configured */
static void rmt_dup_actions(struct s_smc *smc) | {
if (smc->r.jm_flag) {
}
else {
if (smc->s.rmt_dup_mac_behavior) {
SMT_ERR_LOG(smc,SMT_E0138, SMT_E0138_MSG) ;
rmt_reinsert_actions(smc) ;
}
else {
SMT_ERR_LOG(smc,SMT_E0135, SMT_E0135_MSG) ;
rmt_leave_actions(smc) ;
}
}
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Get an extra reference on a read context. */ | static void nfs_fh_get_context(void *cookie_netfs_data, void *context) | /* Get an extra reference on a read context. */
static void nfs_fh_get_context(void *cookie_netfs_data, void *context) | {
get_nfs_open_context(context);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* initialize the structure of IPA background parameter struct with the default values, it is suggested that call this function after an ipa_background_parameter_struct structure is defined */ | void ipa_background_struct_para_init(ipa_background_parameter_struct *background_struct) | /* initialize the structure of IPA background parameter struct with the default values, it is suggested that call this function after an ipa_background_parameter_struct structure is defined */
void ipa_background_struct_para_init(ipa_background_parameter_struct *background_struct) | {
background_struct->background_memaddr = IPA_DEFAULT_VALUE;
background_struct->background_lineoff = IPA_DEFAULT_VALUE;
background_struct->background_prealpha = IPA_DEFAULT_VALUE;
background_struct->background_alpha_algorithm = IPA_BG_ALPHA_MODE_0;
background_struct->background_pf = BACKGROUND_PPF_A... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* the PCI Express Base Specification, Revision 2.1 2.2.8.1: INTx interrutp signaling - Rules the Implementation Note Table 2-20 0 <= pin <= 3 0 = INTA, 1 = INTB, 2 = INTC, 3 = INTD 0-origin unlike PCI interrupt pin register. */ | int pci_swizzle_map_irq_fn(PCIDevice *pci_dev, int pin) | /* the PCI Express Base Specification, Revision 2.1 2.2.8.1: INTx interrutp signaling - Rules the Implementation Note Table 2-20 0 <= pin <= 3 0 = INTA, 1 = INTB, 2 = INTC, 3 = INTD 0-origin unlike PCI interrupt pin register. */
int pci_swizzle_map_irq_fn(PCIDevice *pci_dev, int pin) | {
return (pin + PCI_SLOT(pci_dev->devfn)) % PCI_NUM_PINS;
} | ve3wwg/teensy3_qemu | C++ | Other | 15 |
/* Initialize an urb_link to be a single element list. If the urb_link is being used as a distinguished list head the list is empty when the head is the only link in the list. */ | void urb_link_init(urb_link *ul) | /* Initialize an urb_link to be a single element list. If the urb_link is being used as a distinguished list head the list is empty when the head is the only link in the list. */
void urb_link_init(urb_link *ul) | {
if (ul) {
ul->prev = ul->next = ul;
}
} | EmcraftSystems/u-boot | C++ | Other | 181 |
/* We have our own functionality to toggle sort order on a column to avoid having empty sorting arrow widgets in the column header. */ | static void packet_list_column_clicked_cb(GtkTreeViewColumn *col, gpointer user_data _U_) | /* We have our own functionality to toggle sort order on a column to avoid having empty sorting arrow widgets in the column header. */
static void packet_list_column_clicked_cb(GtkTreeViewColumn *col, gpointer user_data _U_) | {
GtkSortType order = gtk_tree_view_column_get_sort_order (col);
gint col_id = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(col), E_MPACKET_LIST_COL_KEY));
if (cfile.state == FILE_READ_IN_PROGRESS)
return;
if (!gtk_tree_view_column_get_sort_indicator(col)) {
packet_list_sort_column (col_id, col, GTK_SORT_ASCENDIN... | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Some shared mappigns will want the pages marked read-only to track write events. If so, we'll downgrade vm_page_prot to the private version (using protection_map without the VM_SHARED bit). */ | int vma_wants_writenotify(struct vm_area_struct *vma) | /* Some shared mappigns will want the pages marked read-only to track write events. If so, we'll downgrade vm_page_prot to the private version (using protection_map without the VM_SHARED bit). */
int vma_wants_writenotify(struct vm_area_struct *vma) | {
unsigned int vm_flags = vma->vm_flags;
if ((vm_flags & (VM_WRITE|VM_SHARED)) != ((VM_WRITE|VM_SHARED)))
return 0;
if (vma->vm_ops && vma->vm_ops->page_mkwrite)
return 1;
if (pgprot_val(vma->vm_page_prot) !=
pgprot_val(vm_get_page_prot(vm_flags)))
return 0;
if (vm_flags & (VM_PFNMAP|VM_INSERTPAGE))
r... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This service is a checker handler for the UEFI Runtime Service SetVariable() */ | EFI_STATUS EFIAPI SetVariableCheckHandlerMor(IN CHAR16 *VariableName, IN EFI_GUID *VendorGuid, IN UINT32 Attributes, IN UINTN DataSize, IN VOID *Data) | /* This service is a checker handler for the UEFI Runtime Service SetVariable() */
EFI_STATUS EFIAPI SetVariableCheckHandlerMor(IN CHAR16 *VariableName, IN EFI_GUID *VendorGuid, IN UINT32 Attributes, IN UINTN DataSize, IN VOID *Data) | {
UINTN MorLockDataSize;
BOOLEAN MorLock;
EFI_STATUS Status;
if (!IsAnyMorVariable (VariableName, VendorGuid)) {
return EFI_SUCCESS;
}
MorLockDataSize = sizeof (MorLock);
Status = InternalGetVariable (
MEMORY_OVERWRITE_REQUEST_CONTROL_LOCK_NAME,
... | tianocore/edk2 | C++ | Other | 4,240 |
/* param base The LPI2C peripheral base address. param handle Pointer to the LPI2C slave driver handle. param callback User provided pointer to the asynchronous callback function. param userData User provided pointer to the application callback data. */ | void LPI2C_SlaveTransferCreateHandle(LPI2C_Type *base, lpi2c_slave_handle_t *handle, lpi2c_slave_transfer_callback_t callback, void *userData) | /* param base The LPI2C peripheral base address. param handle Pointer to the LPI2C slave driver handle. param callback User provided pointer to the asynchronous callback function. param userData User provided pointer to the application callback data. */
void LPI2C_SlaveTransferCreateHandle(LPI2C_Type *base, lpi2c_slav... | {
uint32_t instance;
assert(NULL != handle);
(void)memset(handle, 0, sizeof(*handle));
instance = LPI2C_GetInstance(base);
handle->callback = callback;
handle->userData = userData;
s_lpi2cSlaveHandle[instance] = handle;
s_lpi2cSlaveIsr = LPI2C_SlaveTransferHandleIRQ;
LPI2C_SlaveDisab... | eclipse-threadx/getting-started | C++ | Other | 310 |
/* Checks whether the specified PWR flag is set or not. */ | FlagStatus PWR_GetFlagStatus(uint8_t STS, uint32_t PWR_FLAG) | /* Checks whether the specified PWR flag is set or not. */
FlagStatus PWR_GetFlagStatus(uint8_t STS, uint32_t PWR_FLAG) | {
FlagStatus bitstatus = RESET;
assert_param(IS_PWR_GET_FLAG(PWR_FLAG));
if (STS == 1)
{
if ((PWR->STS1 & PWR_FLAG) != (uint32_t)RESET)
{
bitstatus = SET;
}
else
{
bitstatus = RESET;
}
}
else
{
if ((PWR->STS2 & PWR_FLAG) !=... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Get the ethernet device for a BPQ device */ | static struct net_device* bpq_get_ether_dev(struct net_device *dev) | /* Get the ethernet device for a BPQ device */
static struct net_device* bpq_get_ether_dev(struct net_device *dev) | {
struct bpqdev *bpq = netdev_priv(dev);
return bpq ? bpq->ethdev : NULL;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Set the execution state of the given engine. */ | static int lp5562_set_engine_exec_state(const struct device *dev, enum lp5562_led_sources engine, enum lp5562_engine_exec_states state) | /* Set the execution state of the given engine. */
static int lp5562_set_engine_exec_state(const struct device *dev, enum lp5562_led_sources engine, enum lp5562_engine_exec_states state) | {
int ret;
ret = lp5562_set_engine_reg(dev, engine, LP5562_ENABLE, state);
k_sleep(K_MSEC(1));
return ret;
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Clear the time-base counter reached its maximum value flag of selected channel. */ | void BPWM_ClearWrapAroundFlag(BPWM_T *bpwm, uint32_t u32ChannelNum) | /* Clear the time-base counter reached its maximum value flag of selected channel. */
void BPWM_ClearWrapAroundFlag(BPWM_T *bpwm, uint32_t u32ChannelNum) | {
(bpwm)->STATUS = BPWM_STATUS_CNTMAX0_Msk;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Refresh credential. This is a no-op for AUTH_NULL */ | static int nul_refresh(struct rpc_task *task) | /* Refresh credential. This is a no-op for AUTH_NULL */
static int nul_refresh(struct rpc_task *task) | {
set_bit(RPCAUTH_CRED_UPTODATE, &task->tk_msg.rpc_cred->cr_flags);
return 0;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Starts intermediate checksum computation.
Configures the CRC module for the specified CRC protocol. */ | static void CRC_SetRawProtocolConfig(CRC_Type *base, const crc_config_t *protocolConfig) | /* Starts intermediate checksum computation.
Configures the CRC module for the specified CRC protocol. */
static void CRC_SetRawProtocolConfig(CRC_Type *base, const crc_config_t *protocolConfig) | {
crc_module_config_t moduleConfig;
moduleConfig.polynomial = protocolConfig->polynomial;
moduleConfig.seed = protocolConfig->seed;
moduleConfig.readTranspose =
kCrcTransposeNone;
moduleConfig.writeTranspose = CRC_GetTransposeTypeFromReflectIn(protocolConfig->reflectIn);
module... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* dccp_feat_push_confirm - Add a Confirm entry to the FN list @fn_list: feature-negotiation list to add to @feat: one of dccp_feature_numbers @local: whether local (1) or remote (0) @feat_num is being confirmed @fval: pointer to NN/SP value to be inserted or NULL Returns 0 on success, a Reset code for further processi... | static int dccp_feat_push_confirm(struct list_head *fn_list, u8 feat, u8 local, dccp_feat_val *fval) | /* dccp_feat_push_confirm - Add a Confirm entry to the FN list @fn_list: feature-negotiation list to add to @feat: one of dccp_feature_numbers @local: whether local (1) or remote (0) @feat_num is being confirmed @fval: pointer to NN/SP value to be inserted or NULL Returns 0 on success, a Reset code for further processi... | {
struct dccp_feat_entry *new = dccp_feat_entry_new(fn_list, feat, local);
if (new == NULL)
return DCCP_RESET_CODE_TOO_BUSY;
new->feat_num = feat;
new->is_local = local;
new->state = FEAT_STABLE;
new->needs_confirm = 1;
new->empty_confirm = (fval == NULL);
new->val.nn = 0;
if (!new->e... | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Change the mode of the USB controller to OTG. */ | void USBOTGMode(uint32_t ui32Base) | /* Change the mode of the USB controller to OTG. */
void USBOTGMode(uint32_t ui32Base) | {
ASSERT(ui32Base == USB0_BASE);
HWREGB(ui32Base + USB_O_GPCS) = 0;
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* __vxge_hw_ring_abort - Returns the RxD This function terminates the RxDs of ring */ | enum vxge_hw_status __vxge_hw_ring_abort(struct __vxge_hw_ring *ring) | /* __vxge_hw_ring_abort - Returns the RxD This function terminates the RxDs of ring */
enum vxge_hw_status __vxge_hw_ring_abort(struct __vxge_hw_ring *ring) | {
void *rxdh;
struct __vxge_hw_channel *channel;
channel = &ring->channel;
for (;;) {
vxge_hw_channel_dtr_try_complete(channel, &rxdh);
if (rxdh == NULL)
break;
vxge_hw_channel_dtr_complete(channel);
if (ring->rxd_term)
ring->rxd_term(rxdh, VXGE_HW_RXD_STATE_POSTED,
channel->userdata);
vxge_hw_c... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Read several bytes from the scancode buffer without removing them. This function is called to see if there are enough bytes of scancode representing a single key. */ | EFI_STATUS GetScancodeBufHead(IN SCAN_CODE_QUEUE *Queue, IN UINTN Count, OUT UINT8 *Buf) | /* Read several bytes from the scancode buffer without removing them. This function is called to see if there are enough bytes of scancode representing a single key. */
EFI_STATUS GetScancodeBufHead(IN SCAN_CODE_QUEUE *Queue, IN UINTN Count, OUT UINT8 *Buf) | {
UINTN Index;
UINTN Pos;
if (GetScancodeBufCount (Queue) < Count) {
return EFI_NOT_READY;
}
for (Index = 0, Pos = Queue->Head; Index < Count; Index++, Pos = (Pos + 1) % KEYBOARD_SCAN_CODE_MAX_COUNT) {
Buf[Index] = Queue->Buffer[Pos];
}
return EFI_SUCCESS;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Do a system call from kernel instead of calling sys_execve so we end up with proper pt_regs. */ | int kernel_execve(const char *filename, char *const argv[], char *const envp[]) | /* Do a system call from kernel instead of calling sys_execve so we end up with proper pt_regs. */
int kernel_execve(const char *filename, char *const argv[], char *const envp[]) | {
long __res;
register long __g1 __asm__ ("g1") = __NR_execve;
register long __o0 __asm__ ("o0") = (long)(filename);
register long __o1 __asm__ ("o1") = (long)(argv);
register long __o2 __asm__ ("o2") = (long)(envp);
asm volatile ("t 0x6d\n\t"
"sub %%g0, %%o0, %0\n\t"
"movcc %%xcc, %%o0, %0\n\t"
... | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* This api used to reads interrupt status of any motion and high rate in the register 0x09. */ | BMG160_RETURN_FUNCTION_TYPE bmg160_get_intr_stat_reg_zero(u8 *v_stat0_data_u8) | /* This api used to reads interrupt status of any motion and high rate in the register 0x09. */
BMG160_RETURN_FUNCTION_TYPE bmg160_get_intr_stat_reg_zero(u8 *v_stat0_data_u8) | {
BMG160_RETURN_FUNCTION_TYPE comres = ERROR;
u8 v_data_u8 = BMG160_INIT_VALUE;
if (p_bmg160 == BMG160_NULL)
{
return E_BMG160_NULL_PTR;
}
else
{
comres = p_bmg160->BMG160_BUS_READ_FUNC
(p_bmg160->dev_addr,
BMG160_INTR_STAT_ZERO__REG, &v_d... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Returns: the length of the string in characters */ | glong g_utf8_strlen(const gchar *p, gssize max) | /* Returns: the length of the string in characters */
glong g_utf8_strlen(const gchar *p, gssize max) | {
glong len = 0;
const gchar *start = p;
g_return_val_if_fail (p != NULL || max == 0, 0);
if (max < 0)
{
while (*p)
{
p = g_utf8_next_char (p);
++len;
}
}
else
{
if (max == 0 || !*p)
return 0;
p = g_utf8_next_char (p);
while (p - ... | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* This function extracts the file size info from the FileHandle's EFI_FILE_INFO data. */ | EFI_STATUS EFIAPI ShellGetFileSize(IN SHELL_FILE_HANDLE FileHandle, OUT UINT64 *Size) | /* This function extracts the file size info from the FileHandle's EFI_FILE_INFO data. */
EFI_STATUS EFIAPI ShellGetFileSize(IN SHELL_FILE_HANDLE FileHandle, OUT UINT64 *Size) | {
return (FileFunctionMap.GetFileSize (FileHandle, Size));
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Fills each UART_InitStruct member with its default value: */ | void UART_ConfigStructInit(UART_CFG_Type *UART_InitStruct) | /* Fills each UART_InitStruct member with its default value: */
void UART_ConfigStructInit(UART_CFG_Type *UART_InitStruct) | {
UART_InitStruct->Baud_rate = 9600;
UART_InitStruct->Databits = UART_DATABIT_8;
UART_InitStruct->Parity = UART_PARITY_NONE;
UART_InitStruct->Stopbits = UART_STOPBIT_1;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* A single 'fd' number was written, in which case it must be for a socket of a supported family/protocol, and we use it as an nfsd listener. */ | static ssize_t __write_ports_addfd(char *buf) | /* A single 'fd' number was written, in which case it must be for a socket of a supported family/protocol, and we use it as an nfsd listener. */
static ssize_t __write_ports_addfd(char *buf) | {
char *mesg = buf;
int fd, err;
err = get_int(&mesg, &fd);
if (err != 0 || fd < 0)
return -EINVAL;
err = nfsd_create_serv();
if (err != 0)
return err;
err = lockd_up();
if (err != 0)
goto out;
err = svc_addsock(nfsd_serv, fd, buf, SIMPLE_TRANSACTION_LIMIT);
if (err < 0)
lockd_down();
out:
nfsd_serv-... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Allocates a new lookup result cache and initializes it properly. */ | struct nl_cache* flnl_result_alloc_cache(void) | /* Allocates a new lookup result cache and initializes it properly. */
struct nl_cache* flnl_result_alloc_cache(void) | {
return nl_cache_alloc(&fib_lookup_ops);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Take ownership of all the rx Descriptors. This function is called when there is fatal error in DMA transmission. When called it takes the ownership of all the rx descriptor in rx descriptor pool/queue from DMA. The function is same for both the ring mode and the chain mode DMA structures. */ | void synopGMAC_take_desc_ownership_rx(synopGMACdevice *gmacdev) | /* Take ownership of all the rx Descriptors. This function is called when there is fatal error in DMA transmission. When called it takes the ownership of all the rx descriptor in rx descriptor pool/queue from DMA. The function is same for both the ring mode and the chain mode DMA structures. */
void synopGMAC_take_des... | {
s32 i;
DmaDesc *desc;
desc = gmacdev->RxDesc;
for(i = 0; i < gmacdev->RxDescCount; i++){
if(synopGMAC_is_rx_desc_chained(desc)){
synopGMAC_take_desc_ownership(desc);
desc = (DmaDesc *)desc->data2;
}
else{
synopGMAC_take_desc_ownership(desc + ... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Inverts the grayscale values of the LCD display (Black <> white). */ | void halLcdReverse(void) | /* Inverts the grayscale values of the LCD display (Black <> white). */
void halLcdReverse(void) | {
LcdInitMacro[ 7 * 6 + 5 ] ^= BIT1;
halLcdSendCommand(&LcdInitMacro[ 7 * 6 ]);
} | apopple/Pandaboard-FreeRTOS | C++ | null | 25 |
/* msgbox_alloc_channel - alloc channel from msgbox @func when function as send, it act as tx_done when function as rev, it act as word reveive. */ | struct msg_channel* msgbox_alloc_channel_sx(struct messagebox *mb, int channel, enum msgbox_channel_direction dir, int(*func)(unsigned long, void *), void *data) | /* msgbox_alloc_channel - alloc channel from msgbox @func when function as send, it act as tx_done when function as rev, it act as word reveive. */
struct msg_channel* msgbox_alloc_channel_sx(struct messagebox *mb, int channel, enum msgbox_channel_direction dir, int(*func)(unsigned long, void *), void *data) | {
struct msg_channel *ch;
if (!mb || channel >= MSGBOX_MAX_QUEUE)
return 0;
ch = &mb->msg_handler[channel];
ch->mb = mb;
ch->channel = channel;
ch->data = data;
ch->dir = dir;
if (mb->channel_set_direction(mb, channel, dir))
return 0;
if (ch->dir == MSGBOX_CHANNEL_SEN... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* param base I2C base pointer. param handle pointer to i2c_slave_handle_t structure which stores the transfer state. */ | void I2C_SlaveTransferAbort(I2C_Type *base, i2c_slave_handle_t *handle) | /* param base I2C base pointer. param handle pointer to i2c_slave_handle_t structure which stores the transfer state. */
void I2C_SlaveTransferAbort(I2C_Type *base, i2c_slave_handle_t *handle) | {
assert(NULL != handle);
if (true == handle->isBusy)
{
I2C_DisableInterrupts(base, (uint32_t)kIrqFlags);
(void)memset(&handle->transfer, 0, sizeof(handle->transfer));
handle->isBusy = false;
}
} | ARMmbed/DAPLink | C++ | Apache License 2.0 | 2,140 |
/* The functions for inserting/removing us as a module. */ | static int __init tw_init(void) | /* The functions for inserting/removing us as a module. */
static int __init tw_init(void) | {
return serio_register_driver(&tw_drv);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Sets the interrupt status.
Valid values for ui32IntFlags are: */ | void am_hal_clkgen_int_set(uint32_t ui32Interrupt) | /* Sets the interrupt status.
Valid values for ui32IntFlags are: */
void am_hal_clkgen_int_set(uint32_t ui32Interrupt) | {
AM_REG(CLKGEN, INTSET) = ui32Interrupt;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Check for a pattern at the given place. Used to search bad block tables and good / bad block identifiers. Same as check_pattern, but no optional empty check. */ | static int check_short_pattern(uint8_t *buf, struct nand_bbt_descr *td) | /* Check for a pattern at the given place. Used to search bad block tables and good / bad block identifiers. Same as check_pattern, but no optional empty check. */
static int check_short_pattern(uint8_t *buf, struct nand_bbt_descr *td) | {
if (memcmp(buf + td->offs, td->pattern, td->len))
return -1;
return 0;
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Receives a character from the specified port.
This function replaces the original UARTCharNonBlockingGet() API and performs the same actions. A macro is provided in */ | long xUARTCharGetNonBlocking(unsigned long ulBase) | /* Receives a character from the specified port.
This function replaces the original UARTCharNonBlockingGet() API and performs the same actions. A macro is provided in */
long xUARTCharGetNonBlocking(unsigned long ulBase) | {
return UARTCharGetNonBlocking(ulBase);
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* API to assign the event handler function to be executed on occurrence of the selected event */ | XMC_SCU_STATUS_t XMC_SCU_INTERRUPT_SetEventHandler(XMC_SCU_INTERRUPT_EVENT_t event, XMC_SCU_INTERRUPT_EVENT_HANDLER_t handler) | /* API to assign the event handler function to be executed on occurrence of the selected event */
XMC_SCU_STATUS_t XMC_SCU_INTERRUPT_SetEventHandler(XMC_SCU_INTERRUPT_EVENT_t event, XMC_SCU_INTERRUPT_EVENT_HANDLER_t handler) | {
index++;
}
if (index == XMC_SCU_INTERRUPT_EVENT_MAX)
{
status = XMC_SCU_STATUS_ERROR;
}
else
{
event_handler_list[index] = handler;
status = XMC_SCU_STATUS_OK;
}
return (status);
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* USB port disabled callback function from the interrupt. */ | static uint8_t usbh_port_disabled(usbh_host *puhost) | /* USB port disabled callback function from the interrupt. */
static uint8_t usbh_port_disabled(usbh_host *puhost) | {
usbh_core.host.port_enabled = 0U;
return 0U;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Routines for managing client lists - These routines are for managing the list of auth'ed clients. */ | static struct agp_client* agp_find_client_in_controller(struct agp_controller *controller, pid_t id) | /* Routines for managing client lists - These routines are for managing the list of auth'ed clients. */
static struct agp_client* agp_find_client_in_controller(struct agp_controller *controller, pid_t id) | {
struct agp_client *client;
if (controller == NULL)
return NULL;
client = controller->clients;
while (client != NULL) {
if (client->pid == id)
return client;
client = client->next;
}
return NULL;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* USART Send Data Word with Blocking.
Blocks until the transmit data buffer becomes empty then writes the next data word for transmission. */ | void usart_send_blocking(uint32_t usart, uint8_t data) | /* USART Send Data Word with Blocking.
Blocks until the transmit data buffer becomes empty then writes the next data word for transmission. */
void usart_send_blocking(uint32_t usart, uint8_t data) | {
usart_wait_send_ready(usart);
usart_send(usart, data);
} | insane-adding-machines/unicore-mx | C++ | GNU General Public License v3.0 | 50 |
/* Receive a piece of data in non-blocking way. */ | static void FLEXIO_I2S_ReadNonBlocking(FLEXIO_I2S_Type *base, uint8_t bitWidth, uint8_t *rxData, size_t size) | /* Receive a piece of data in non-blocking way. */
static void FLEXIO_I2S_ReadNonBlocking(FLEXIO_I2S_Type *base, uint8_t bitWidth, uint8_t *rxData, size_t size) | {
uint32_t i = 0;
uint8_t j = 0;
uint8_t bytesPerWord = bitWidth / 8U;
uint32_t data = 0;
for (i = 0; i < size / bytesPerWord; i++)
{
data = (base->flexioBase->SHIFTBUFBIS[base->rxShifterIndex]);
for (j = 0; j < bytesPerWord; j++)
{
*rxData = (data >> (8U * j)... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* TIM_Base MSP De-Initialization This function freeze the hardware resources used in this example. */ | void HAL_TIM_Base_MspDeInit(TIM_HandleTypeDef *htim_base) | /* TIM_Base MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_TIM_Base_MspDeInit(TIM_HandleTypeDef *htim_base) | {
if(htim_base->Instance==TIM2)
{
__HAL_RCC_TIM2_CLK_DISABLE();
}
else if(htim_base->Instance==TIM11)
{
__HAL_RCC_TIM11_CLK_DISABLE();
}
else if(htim_base->Instance==TIM13)
{
__HAL_RCC_TIM13_CLK_DISABLE();
}
else if(htim_base->Instance==TIM14)
{
__HAL_RCC_TIM14_CLK_DISABLE();
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Put command in command queue, try to execute it. */ | static void tms380tr_exec_cmd(struct net_device *dev, unsigned short Command) | /* Put command in command queue, try to execute it. */
static void tms380tr_exec_cmd(struct net_device *dev, unsigned short Command) | {
struct net_local *tp = netdev_priv(dev);
tp->CMDqueue |= Command;
tms380tr_chk_outstanding_cmds(dev);
return;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Converts EFI_TIME to Epoch seconds (elapsed since 1970 JANUARY 01, 00:00:00 UTC). */ | STATIC UINTN EFIAPI EfiTimeToEpoch(IN EFI_TIME *Time) | /* Converts EFI_TIME to Epoch seconds (elapsed since 1970 JANUARY 01, 00:00:00 UTC). */
STATIC UINTN EFIAPI EfiTimeToEpoch(IN EFI_TIME *Time) | {
UINTN EpochDays;
UINTN EpochSeconds;
EpochDays = EfiGetEpochDays (Time);
EpochSeconds = (EpochDays * SEC_PER_DAY) +
((UINTN)Time->Hour * SEC_PER_HOUR) +
(Time->Minute * SEC_PER_MIN) + Time->Second;
return EpochSeconds;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* This callback is called by the PCI subsystem whenever a PCI bus error is detected. */ | static pci_ers_result_t ixgb_io_error_detected(struct pci_dev *pdev, enum pci_channel_state state) | /* This callback is called by the PCI subsystem whenever a PCI bus error is detected. */
static pci_ers_result_t ixgb_io_error_detected(struct pci_dev *pdev, enum pci_channel_state state) | {
struct net_device *netdev = pci_get_drvdata(pdev);
struct ixgb_adapter *adapter = netdev_priv(netdev);
netif_device_detach(netdev);
if (state == pci_channel_io_perm_failure)
return PCI_ERS_RESULT_DISCONNECT;
if (netif_running(netdev))
ixgb_down(adapter, true);
pci_disable_device(pdev);
return PCI_ERS_RESUL... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Copy pixels from SRAM to the screen.
Used to copy a large quantitative of data to the screen in one go. */ | void ili93xx_copy_raw_pixel_24bits_to_screen(const uint8_t *raw_pixels, uint32_t count) | /* Copy pixels from SRAM to the screen.
Used to copy a large quantitative of data to the screen in one go. */
void ili93xx_copy_raw_pixel_24bits_to_screen(const uint8_t *raw_pixels, uint32_t count) | {
ili93xx_color_t pixels;
Assert(count > 0);
if (g_uc_device_type == DEVICE_TYPE_ILI9325) {
LCD_IR(0);
LCD_IR(ILI9325_GRAM_DATA_REG);
} else if (g_uc_device_type == DEVICE_TYPE_ILI9341) {
LCD_IR(ILI9341_CMD_MEMORY_WRITE);
LCD_IR(0);
LCD_IR(ILI9341_CMD_WRITE_MEMORY_CONTINUE);
}
while (count--) {
pixels... | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* Decode a file name and make sure that the path contains no slashes or null bytes. */ | static __be32* decode_filename(__be32 *p, char **namp, unsigned int *lenp) | /* Decode a file name and make sure that the path contains no slashes or null bytes. */
static __be32* decode_filename(__be32 *p, char **namp, unsigned int *lenp) | {
char *name;
unsigned int i;
if ((p = xdr_decode_string_inplace(p, namp, lenp, NFS3_MAXNAMLEN)) != NULL) {
for (i = 0, name = *namp; i < *lenp; i++, name++) {
if (*name == '\0' || *name == '/')
return NULL;
}
}
return p;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Return the battery average current Note that current can be negative signed as well Or 0 if something fails. */ | static int bq27x00_battery_current(struct bq27x00_device_info *di) | /* Return the battery average current Note that current can be negative signed as well Or 0 if something fails. */
static int bq27x00_battery_current(struct bq27x00_device_info *di) | {
int ret;
int curr = 0;
int flags = 0;
ret = bq27x00_read(BQ27x00_REG_AI, &curr, 0, di);
if (ret) {
dev_err(di->dev, "error reading current\n");
return 0;
}
ret = bq27x00_read(BQ27x00_REG_FLAGS, &flags, 0, di);
if (ret < 0) {
dev_err(di->dev, "error reading flags\n");
return 0;
}
if ((flags & (1 << 7... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* regAdress: Address of the register that has to be updated data: Byte that will be written to the register check: If this is true, register content will be read after writing to check if update was successful return: 0 if byte was written successfully or -1 on fail */ | int16_t writeByte(uint8_t regAddress, uint8_t data) | /* regAdress: Address of the register that has to be updated data: Byte that will be written to the register check: If this is true, register content will be read after writing to check if update was successful return: 0 if byte was written successfully or -1 on fail */
int16_t writeByte(uint8_t regAddress, uint8_t da... | {
if (sensor_i2c_write(&(dps310_ctx.i2c), regAddress, &data, 1,
AOS_WAIT_FOREVER) == 0) {
return DPS310__SUCCEEDED;
} else {
return DPS310__FAIL_UNKNOWN;
}
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* Returns CR_OK upon successful completion, an error code otherwise. */ | enum CRStatus cr_rgb_set_from_name(CRRgb *a_this, const guchar *a_color_name) | /* Returns CR_OK upon successful completion, an error code otherwise. */
enum CRStatus cr_rgb_set_from_name(CRRgb *a_this, const guchar *a_color_name) | {
gulong i = 0;
enum CRStatus status = CR_OK;
g_return_val_if_fail (a_this && a_color_name, CR_BAD_PARAM_ERROR);
for (i = 0; i < sizeof (gv_standard_colors); i++) {
if (!strcmp (a_color_name, gv_standard_colors[i].name)) {
cr_rgb_set_from_rgb (a_th... | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Send GET_CID command to get CID from card. */ | static status_t SD_AllSendCid(sd_card_t *card) | /* Send GET_CID command to get CID from card. */
static status_t SD_AllSendCid(sd_card_t *card) | {
assert(card);
sdhc_transfer_t content = {0};
sdhc_command_t command = {0};
command.index = kSDMMC_AllSendCid;
command.argument = 0U;
command.responseType = kSDHC_ResponseTypeR2;
content.command = &command;
content.data = NULL;
if (kStatus_Success == card->host.transfer(card->host.b... | labapart/polymcu | C++ | null | 201 |
/* This function will set callback to be called when the network interface device status has been changed. */ | void netdev_set_status_callback(struct netdev *netdev, netdev_callback_fn status_callback) | /* This function will set callback to be called when the network interface device status has been changed. */
void netdev_set_status_callback(struct netdev *netdev, netdev_callback_fn status_callback) | {
RT_ASSERT(netdev);
RT_ASSERT(status_callback);
netdev->status_callback = status_callback;
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* param base CDOG peripheral base address. param add Value to be added. */ | void CDOG_Add256(CDOG_Type *base) | /* param base CDOG peripheral base address. param add Value to be added. */
void CDOG_Add256(CDOG_Type *base) | {
base->ADD256 = (secure_counter_t)0x1U;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Drives the sleep status instead of sleep change on INT pins (only if INT1_SLEEP_CHANGE or INT2_SLEEP_CHANGE bits are enabled).. */ | int32_t lsm6dso_act_pin_notification_set(lsm6dso_ctx_t *ctx, lsm6dso_sleep_status_on_int_t val) | /* Drives the sleep status instead of sleep change on INT pins (only if INT1_SLEEP_CHANGE or INT2_SLEEP_CHANGE bits are enabled).. */
int32_t lsm6dso_act_pin_notification_set(lsm6dso_ctx_t *ctx, lsm6dso_sleep_status_on_int_t val) | {
lsm6dso_tap_cfg0_t reg;
int32_t ret;
ret = lsm6dso_read_reg(ctx, LSM6DSO_TAP_CFG0, (uint8_t*)®, 1);
if (ret == 0) {
reg.sleep_status_on_int = (uint8_t)val;
ret = lsm6dso_write_reg(ctx, LSM6DSO_TAP_CFG0, (uint8_t*)®, 1);
}
return ret;
} | alexander-g-dean/ESF | C++ | null | 41 |
/* Reads a single byte from the EZRadio SPI port. */ | void ezradio_hal_SpiReadByte(uint8_t *readByte) | /* Reads a single byte from the EZRadio SPI port. */
void ezradio_hal_SpiReadByte(uint8_t *readByte) | {
SPIDRV_MReceiveB(ezradioSpiHandlePtr, readByte, 1);
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* Allow a kernel service to accept an incoming call, assuming the incoming call is still valid. */ | struct rxrpc_call* rxrpc_kernel_accept_call(struct socket *sock, unsigned long user_call_ID) | /* Allow a kernel service to accept an incoming call, assuming the incoming call is still valid. */
struct rxrpc_call* rxrpc_kernel_accept_call(struct socket *sock, unsigned long user_call_ID) | {
struct rxrpc_call *call;
_enter(",%lx", user_call_ID);
call = rxrpc_accept_call(rxrpc_sk(sock->sk), user_call_ID);
_leave(" = %p", call);
return call;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Translates a DMA handle into a pointer to a channel. */ | static DMA_Channel_t* HandleToChannel(DMA_Handle_t handle) | /* Translates a DMA handle into a pointer to a channel. */
static DMA_Channel_t* HandleToChannel(DMA_Handle_t handle) | {
int controllerIdx;
int channelIdx;
controllerIdx = CONTROLLER_FROM_HANDLE(handle);
channelIdx = CHANNEL_FROM_HANDLE(handle);
if ((controllerIdx > DMA_NUM_CONTROLLERS)
|| (channelIdx > DMA_NUM_CHANNELS)) {
return NULL;
}
return &gDMA.controller[controllerIdx].channel[channelIdx];
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Initialize PIO capture for the OV7740 image sensor communication. */ | static void pio_capture_init(Pio *const p_pio, uint32_t ul_id) | /* Initialize PIO capture for the OV7740 image sensor communication. */
static void pio_capture_init(Pio *const p_pio, uint32_t ul_id) | {
pmc_enable_periph_clk(ul_id);
p_pio->PIO_PCMR &= ~((uint32_t)PIO_PCMR_PCEN);
p_pio->PIO_PCIDR = PIO_PCIDR_RXBUFF;
p_pio->PIO_PCMR &= ~((uint32_t)PIO_PCMR_DSIZE_Msk);
p_pio->PIO_PCMR |= PIO_PCMR_DSIZE_WORD;
p_pio->PIO_PCMR &= ~((uint32_t)PIO_PCMR_ALWYS);
p_pio->PIO_PCMR &= ~((uint32_t)PIO_PCMR_HALFS);
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned. */ | UINTN EFIAPI UnicodeBSPrintAsciiFormat(OUT CHAR16 *StartOfBuffer, IN UINTN BufferSize, IN CONST CHAR8 *FormatString, IN BASE_LIST Marker) | /* If BufferSize is 0 or 1, then no output buffer is produced and 0 is returned. */
UINTN EFIAPI UnicodeBSPrintAsciiFormat(OUT CHAR16 *StartOfBuffer, IN UINTN BufferSize, IN CONST CHAR8 *FormatString, IN BASE_LIST Marker) | {
ASSERT_UNICODE_BUFFER (StartOfBuffer);
return mPrint2SProtocol->UnicodeBSPrintAsciiFormat (StartOfBuffer, BufferSize, FormatString, Marker);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Note the largest clock divider value of 0xffff corresponds to: (0xffff + 1) * 1000 / 108/2 MHz = 1,213,629.629... ns which fits in 21 bits, so we'll use unsigned int for time arguments. */ | static u16 count_to_clock_divider(unsigned int d) | /* Note the largest clock divider value of 0xffff corresponds to: (0xffff + 1) * 1000 / 108/2 MHz = 1,213,629.629... ns which fits in 21 bits, so we'll use unsigned int for time arguments. */
static u16 count_to_clock_divider(unsigned int d) | {
if (d > RXCLK_RCD + 1)
d = RXCLK_RCD;
else if (d < 2)
d = 1;
else
d--;
return (u16) d;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Set GPIO.
Clears GPIO by GPIO number according to MUX list */ | void gpio_clear(uint32_t gpio) | /* Set GPIO.
Clears GPIO by GPIO number according to MUX list */
void gpio_clear(uint32_t gpio) | {
uint32_t port = GPIO(gpio / 32);
GPIO_PCOR(port) = GPIO_OFFSET(gpio);
} | insane-adding-machines/unicore-mx | C++ | GNU General Public License v3.0 | 50 |
/* Sends the command to read either a 16- or 32-bit data word from remote CPU system address to a write-protected local CPU address. */ | uint16_t IPCLtoRDataRead_Protected(volatile tIpcController *psController, uint32_t ulAddress, void *pvData, uint16_t usLength, uint16_t bBlock, uint32_t ulResponseFlag) | /* Sends the command to read either a 16- or 32-bit data word from remote CPU system address to a write-protected local CPU address. */
uint16_t IPCLtoRDataRead_Protected(volatile tIpcController *psController, uint32_t ulAddress, void *pvData, uint16_t usLength, uint16_t bBlock, uint32_t ulResponseFlag) | {
uint16_t status;
tIpcMessage sMessage;
sMessage.ulcommand = IPC_DATA_READ_PROTECTED;
sMessage.uladdress = ulAddress;
sMessage.uldataw1 = (ulResponseFlag & 0xFFFF0000)|(uint32_t)usLength;
sMessage.uldataw2 = (uint32_t)pvData;
IpcRegs.IPCSET.all |= (ulResponseFlag & 0xFFFF0000);
status =... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Returns pointer to the node if successful, NULL otherwise. */ | struct pci_func* cpqhp_slot_find(u8 bus, u8 device, u8 index) | /* Returns pointer to the node if successful, NULL otherwise. */
struct pci_func* cpqhp_slot_find(u8 bus, u8 device, u8 index) | {
int found = -1;
struct pci_func *func;
func = cpqhp_slot_list[bus];
if ((func == NULL) || ((func->device == device) && (index == 0)))
return func;
if (func->device == device)
found++;
while (func->next != NULL) {
func = func->next;
if (func->device == device)
found++;
if (found == index)
return ... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* RTC interrupt handler. Clear the RTC interrupt flag and execute the callback function. */ | void RTCIntHandler(void) | /* RTC interrupt handler. Clear the RTC interrupt flag and execute the callback function. */
void RTCIntHandler(void) | {
unsigned long ulEventFlags;
ulEventFlags = xHWREG(RTC_SR);
if(g_pfnRTCHandlerCallbacks[0] != 0)
{
g_pfnRTCHandlerCallbacks[0](0, 0, ulEventFlags, 0);
}
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Returns the current DMAy Streamx FIFO filled level. */ | uint32_t DMA_GetFIFOStatus(DMA_Stream_TypeDef *DMAy_Streamx) | /* Returns the current DMAy Streamx FIFO filled level. */
uint32_t DMA_GetFIFOStatus(DMA_Stream_TypeDef *DMAy_Streamx) | {
uint32_t tmpreg = 0;
assert_param(IS_DMA_ALL_PERIPH(DMAy_Streamx));
tmpreg = (uint32_t)((DMAy_Streamx->FCR & DMA_SxFCR_FS));
return tmpreg;
} | MaJerle/stm32f429 | C++ | null | 2,036 |
/* Routines for managing each client's segment list - These routines handle adding and removing segments to each auth'ed client. */ | static struct agp_segment_priv* agp_find_seg_in_client(const struct agp_client *client, unsigned long offset, int size, pgprot_t page_prot) | /* Routines for managing each client's segment list - These routines handle adding and removing segments to each auth'ed client. */
static struct agp_segment_priv* agp_find_seg_in_client(const struct agp_client *client, unsigned long offset, int size, pgprot_t page_prot) | {
struct agp_segment_priv *seg;
int num_segments, i;
off_t pg_start;
size_t pg_count;
pg_start = offset / 4096;
pg_count = size / 4096;
seg = *(client->segments);
num_segments = client->num_segments;
for (i = 0; i < client->num_segments; i++) {
if ((seg[i].pg_start == pg_start) &&
(seg[i].pg_count == p... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Read available data from the read FIFO, as 8-bit data items. */ | uint32_t EPINonBlockingReadGet8(uint32_t ui32Base, uint32_t ui32Count, uint8_t *pui8Buf) | /* Read available data from the read FIFO, as 8-bit data items. */
uint32_t EPINonBlockingReadGet8(uint32_t ui32Base, uint32_t ui32Count, uint8_t *pui8Buf) | {
uint32_t ui32CountRead = 0;
ASSERT(ui32Base == EPI0_BASE);
ASSERT(ui32Count < 4096);
ASSERT(pui8Buf);
while (HWREG(ui32Base + EPI_O_RFIFOCNT) && ui32Count--)
{
*pui8Buf = (uint8_t)HWREG(ui32Base + EPI_O_READFIFO0);
pui8Buf++;
ui32CountRead++;
}
return (ui32Count... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Build register value of waveform for NEC one data bit. */ | static void fill_item_level(rmt_item32_t *item, int high_us, int low_us) | /* Build register value of waveform for NEC one data bit. */
static void fill_item_level(rmt_item32_t *item, int high_us, int low_us) | {
item->level0 = 1;
item->duration0 = (high_us) / 10 * RMT_TICK_10_US;
item->level1 = 0;
item->duration1 = (low_us) / 10 * RMT_TICK_10_US;
} | retro-esp32/RetroESP32 | C++ | Creative Commons Attribution Share Alike 4.0 International | 581 |
/* Write the Parameter Storage Area to the WaveLAN card's memory. */ | static void psa_write(unsigned long ioaddr, u16 hacr, int o, u8 *b, int n) | /* Write the Parameter Storage Area to the WaveLAN card's memory. */
static void psa_write(unsigned long ioaddr, u16 hacr, int o, u8 *b, int n) | {
int count = 0;
wv_16_off(ioaddr, hacr);
while (n-- > 0) {
outw(o, PIOR2(ioaddr));
o++;
outb(*b, PIOP2(ioaddr));
b++;
count = 0;
while ((count++ < 100) &&
(hasr_read(ioaddr) & HASR_PSA_BUSY)) mdelay(1);
}
wv_16_on(ioaddr, hacr);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This function adds an inode number to the inode array of the write-buffer. */ | void ubifs_wbuf_add_ino_nolock(struct ubifs_wbuf *wbuf, ino_t inum) | /* This function adds an inode number to the inode array of the write-buffer. */
void ubifs_wbuf_add_ino_nolock(struct ubifs_wbuf *wbuf, ino_t inum) | {
if (!wbuf->buf)
return;
spin_lock(&wbuf->lock);
if (wbuf->used)
wbuf->inodes[wbuf->next_ino++] = inum;
spin_unlock(&wbuf->lock);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* The caller can pass in *p if it wants to keep track of the most recent number of parity bits added. This allows the function to start the calculation at the last place. */ | static unsigned int calc_code_bit(unsigned int i, unsigned int *p_cache) | /* The caller can pass in *p if it wants to keep track of the most recent number of parity bits added. This allows the function to start the calculation at the last place. */
static unsigned int calc_code_bit(unsigned int i, unsigned int *p_cache) | {
unsigned int b, p = 0;
b = i + 1;
if (p_cache)
p = *p_cache;
b += p;
for (; (1 << p) < (b + 1); p++)
b++;
if (p_cache)
*p_cache = p;
return b;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Minimum value of absolute values of a floating-point vector. */ | void arm_absmin_f64(const float64_t *pSrc, uint32_t blockSize, float64_t *pResult, uint32_t *pIndex) | /* Minimum value of absolute values of a floating-point vector. */
void arm_absmin_f64(const float64_t *pSrc, uint32_t blockSize, float64_t *pResult, uint32_t *pIndex) | {
float64_t minVal, out;
uint32_t blkCnt, outIndex;
outIndex = 0U;
out = fabs(*pSrc++);
blkCnt = (blockSize - 1U);
while (blkCnt > 0U)
{
minVal = fabs(*pSrc++);
if (out > minVal)
{
out = minVal;
outIndex = blockSize - blkCnt;
}
blkCnt--;
}
*pResult = out;
*p... | STMicroelectronics/STM32CubeF4 | C++ | Other | 789 |
/* tlsv1_client_get_keys - Get master key and random data from TLS connection @conn: TLSv1 client connection data from tlsv1_client_init() @keys: Structure of key/random data (filled on success) Returns: 0 on success, -1 on failure */ | int tlsv1_client_get_keys(struct tlsv1_client *conn, struct tls_keys *keys) | /* tlsv1_client_get_keys - Get master key and random data from TLS connection @conn: TLSv1 client connection data from tlsv1_client_init() @keys: Structure of key/random data (filled on success) Returns: 0 on success, -1 on failure */
int tlsv1_client_get_keys(struct tlsv1_client *conn, struct tls_keys *keys) | {
os_memset(keys, 0, sizeof(*keys));
if (conn->state == CLIENT_HELLO)
return -1;
keys->client_random = conn->client_random;
keys->client_random_len = TLS_RANDOM_LEN;
if (conn->state != SERVER_HELLO) {
keys->server_random = conn->server_random;
keys->server_random_len = TLS_RANDOM_LEN;
keys->master_key = co... | retro-esp32/RetroESP32 | C++ | Creative Commons Attribution Share Alike 4.0 International | 581 |
/* get the response for the last received command */ | uint32_t sdio_response_get(uint32_t responsex) | /* get the response for the last received command */
uint32_t sdio_response_get(uint32_t responsex) | {
uint32_t resp_content = 0U;
switch(responsex){
case SDIO_RESPONSE0:
resp_content = SDIO_RESP0;
break;
case SDIO_RESPONSE1:
resp_content = SDIO_RESP1;
break;
case SDIO_RESPONSE2:
resp_content = SDIO_RESP2;
break;
case SDIO_RESPONSE3:
resp_... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.