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 |
|---|---|---|---|---|---|---|---|
/* Enables or disables the specified DMAy Streamx interrupts. */ | void DMA_ITConfig(DMA_Stream_TypeDef *DMAy_Streamx, uint32_t DMA_IT, FunctionalState NewState) | /* Enables or disables the specified DMAy Streamx interrupts. */
void DMA_ITConfig(DMA_Stream_TypeDef *DMAy_Streamx, uint32_t DMA_IT, FunctionalState NewState) | {
assert_param(IS_DMA_ALL_PERIPH(DMAy_Streamx));
assert_param(IS_DMA_CONFIG_IT(DMA_IT));
assert_param(IS_FUNCTIONAL_STATE(NewState));
if ((DMA_IT & DMA_IT_FE) != 0)
{
if (NewState != DISABLE)
{
DMAy_Streamx->FCR |= (uint32_t)DMA_IT_FE;
}
else
{
DMAy_Streamx->FCR &= ~(uint3... | MaJerle/stm32f429 | C++ | null | 2,036 |
/* Handler for INT1, rising edge interrupt. In INT1, it will trigger INT2. */ | static void Int1Handler(uint32_t ul_id, uint32_t ul_mask) | /* Handler for INT1, rising edge interrupt. In INT1, it will trigger INT2. */
static void Int1Handler(uint32_t ul_id, uint32_t ul_mask) | {
if (PIN_PUSHBUTTON_1_ID != ul_id || PIN_PUSHBUTTON_1_MASK != ul_mask)
return;
pio_disable_interrupt(PIN_PUSHBUTTON_1_PIO, PIN_PUSHBUTTON_1_MASK);
puts("===================================================\r");
puts("Enter _Int1Handler.\r");
gpio_set_pin_low(LED0_GPIO);
delay_ticks(2000);
gpio_set_pin_high(LED... | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* Removes an interrupt handler for a GPIO port. */ | void GPIOIntUnregister(uint32_t ui32Port) | /* Removes an interrupt handler for a GPIO port. */
void GPIOIntUnregister(uint32_t ui32Port) | {
uint32_t ui32Int;
ASSERT(_GPIOBaseValid(ui32Port));
ui32Int = _GPIOIntNumberGet(ui32Port);
ASSERT(ui32Int != 0);
IntDisable(ui32Int);
IntUnregister(ui32Int);
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* Called by iput() when the inode reference count reached zero and the inode is not hashed anywhere. Used to clear anything that needs to be, before the inode is completely destroyed and put on the inode free list. We use this to drop out reference to the lower inode. */ | static void ecryptfs_clear_inode(struct inode *inode) | /* Called by iput() when the inode reference count reached zero and the inode is not hashed anywhere. Used to clear anything that needs to be, before the inode is completely destroyed and put on the inode free list. We use this to drop out reference to the lower inode. */
static void ecryptfs_clear_inode(struct inode ... | {
iput(ecryptfs_inode_to_lower(inode));
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Delete all objects in list 'p' until (but not including) object 'limit'. */ | static void deletelist(lua_State *L, GCObject *p, GCObject *limit) | /* Delete all objects in list 'p' until (but not including) object 'limit'. */
static void deletelist(lua_State *L, GCObject *p, GCObject *limit) | {
GCObject *next = p->next;
freeobj(L, p);
p = next;
}
} | Nicholas3388/LuaNode | C++ | Other | 1,055 |
/* TIM_PWM MSP De-Initialization This function freeze the hardware resources used in this example. */ | void HAL_TIM_PWM_MspDeInit(TIM_HandleTypeDef *htim_pwm) | /* TIM_PWM MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_TIM_PWM_MspDeInit(TIM_HandleTypeDef *htim_pwm) | {
if(htim_pwm->Instance==TIM2)
{
__HAL_RCC_TIM2_CLK_DISABLE();
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* parse_tree_node - returns a device entry in the iotree @parent: the parent node in the tree @index: the current BC index @modpath: the hardware_path struct to match a device against */ | static struct device * parse_tree_node(struct device *parent, int index, struct hardware_path *modpath) | /* parse_tree_node - returns a device entry in the iotree @parent: the parent node in the tree @index: the current BC index @modpath: the hardware_path struct to match a device against */
static struct device * parse_tree_node(struct device *parent, int index, struct hardware_path *modpath) | {
struct parse_tree_data d = {
.index = index,
.modpath = modpath,
};
struct recurse_struct recurse_data = {
.obj = &d,
.fn = check_parent,
};
if (device_for_each_child(parent, &recurse_data, descend_children));
return d.dev;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* s3c_hsotg_ep_dequeue - dequeue given endpoint @ep: The endpoint to dequeue. @req: The request to be removed from a queue. */ | static int s3c_hsotg_ep_dequeue(struct usb_ep *ep, struct usb_request *req) | /* s3c_hsotg_ep_dequeue - dequeue given endpoint @ep: The endpoint to dequeue. @req: The request to be removed from a queue. */
static int s3c_hsotg_ep_dequeue(struct usb_ep *ep, struct usb_request *req) | {
struct s3c_hsotg_req *hs_req = our_req(req);
struct s3c_hsotg_ep *hs_ep = our_ep(ep);
struct s3c_hsotg *hs = hs_ep->parent;
unsigned long flags;
dev_info(hs->dev, "ep_dequeue(%p,%p)\n", ep, req);
spin_lock_irqsave(&hs->lock, flags);
if (!on_list(hs_ep, hs_req)) {
spin_unlock_irqrestore(&hs->lock, flags);
r... | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Sets the radio in reception mode with Max LNA gain for the given time. */ | void RadioRxBoosted(uint32_t timeout) | /* Sets the radio in reception mode with Max LNA gain for the given time. */
void RadioRxBoosted(uint32_t timeout) | {
SX126xSetDioIrqParams( IRQ_RADIO_ALL,
IRQ_RADIO_ALL,
IRQ_RADIO_NONE,
IRQ_RADIO_NONE );
if( RxContinuous == true )
{
SX126xSetRxBoosted( 0xFFFFFF );
}
else
{
SX126xSetRxBoosted( RxTimeout << 6 );
... | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* Trim the packet to fit in [Start, End), and update the per packet information. */ | VOID Ip4TrimPacket(IN OUT NET_BUF *Packet, IN INTN Start, IN INTN End) | /* Trim the packet to fit in [Start, End), and update the per packet information. */
VOID Ip4TrimPacket(IN OUT NET_BUF *Packet, IN INTN Start, IN INTN End) | {
IP4_CLIP_INFO *Info;
INTN Len;
Info = IP4_GET_CLIP_INFO (Packet);
ASSERT (Info->Start + Info->Length == Info->End);
ASSERT ((Info->Start < End) && (Start < Info->End));
if (Info->Start < Start) {
Len = Start - Info->Start;
NetbufTrim (Packet, (UINT32)Len, NET_BUF_HEAD);
Info->Start ... | tianocore/edk2 | C++ | Other | 4,240 |
/* Puts the processor into sleep mode.
This function places the processor into sleep mode; it will not return until the processor returns to run mode. */ | void xSysCtlSleep(void) | /* Puts the processor into sleep mode.
This function places the processor into sleep mode; it will not return until the processor returns to run mode. */
void xSysCtlSleep(void) | {
xHWREG(xSYSCTL_BASE) &= ~xSYSCTL_SLEEPDEEP;
xCPUwfi();
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Remove a given timestamp from the list of timeouts. */ | static void multi_deltimeout(struct Curl_easy *data, expire_id eid) | /* Remove a given timestamp from the list of timeouts. */
static void multi_deltimeout(struct Curl_easy *data, expire_id eid) | {
struct curl_llist_element *e;
struct curl_llist *timeoutlist = &data->state.timeoutlist;
for(e = timeoutlist->head; e; e = e->next) {
struct time_node *n = (struct time_node *)e->ptr;
if(n->eid == eid) {
Curl_llist_remove(timeoutlist, e, NULL);
return;
}
}
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* Apply a mask (repeated if shorter than message) as XOR to each byte. */ | static int crypto_mask(lua_State *L) | /* Apply a mask (repeated if shorter than message) as XOR to each byte. */
static int crypto_mask(lua_State *L) | {
int len, mask_len, i;
const char* msg = luaL_checklstring(L, 1, &len);
const char* mask = luaL_checklstring(L, 2, &mask_len);
luaL_Buffer b;
if(mask_len <= 0)
return luaL_error(L, "invalid argument: mask");
luaL_buffinit(L, &b);
for (i = 0; i < len; i++) {
luaL_addchar(&b, msg[i] ^ mask[i % mask... | nodemcu/nodemcu-firmware | C++ | MIT License | 7,566 |
/* Read a list of stringified IOR's from a named file, convert to IOR's and store in object key hash */ | static void read_IOR_strings_from_file(const gchar *name, int max_iorlen) | /* Read a list of stringified IOR's from a named file, convert to IOR's and store in object key hash */
static void read_IOR_strings_from_file(const gchar *name, int max_iorlen) | {
if (errno == EACCES)
report_open_failure(name, errno, FALSE);
return;
}
buf = (guchar *)wmem_alloc0(wmem_packet_scope(), max_iorlen+1);
while ((len = giop_getline(fp, buf, max_iorlen+1)) > 0) {
my_offset = 0;
ior_val_len = string_to_IOR(buf, len, &out);
if (ior_val_len>0) {
tvb =... | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* This function allows a caller to extract the current configuration for one or more named elements from the target driver. */ | EFI_STATUS EFIAPI Tcg2ExtractConfig(IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, IN CONST EFI_STRING Request, OUT EFI_STRING *Progress, OUT EFI_STRING *Results) | /* This function allows a caller to extract the current configuration for one or more named elements from the target driver. */
EFI_STATUS EFIAPI Tcg2ExtractConfig(IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, IN CONST EFI_STRING Request, OUT EFI_STRING *Progress, OUT EFI_STRING *Results) | {
if ((Progress == NULL) || (Results == NULL)) {
return EFI_INVALID_PARAMETER;
}
*Progress = Request;
return EFI_NOT_FOUND;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Master sends single byte through the I2Cx peripheral to detect slave device. */ | int32_t I2C_MasterSendNullData_TimeOut(I2C_TypeDef *I2Cx, int32_t address, uint32_t timeout_ms) | /* Master sends single byte through the I2Cx peripheral to detect slave device. */
int32_t I2C_MasterSendNullData_TimeOut(I2C_TypeDef *I2Cx, int32_t address, uint32_t timeout_ms) | {
uint8_t I2CTemp = (uint8_t)(address<<1);
I2C_MasterSendNullData(I2Cx, &I2CTemp, 0, 1, 0);
DelayMs(timeout_ms);
if(I2C_GetRawINT(I2Cx) & BIT_IC_RAW_INTR_STAT_TX_ABRT) {
I2C_ClearAllINT(I2Cx);
DelayUs(100);
I2C_Cmd(I2Cx, DISABLE);
I2C_Cmd(I2Cx, ENABLE);
return CSI... | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* Instruction TLB Fault @ Instruction TLB vector Refer to SDM Vol2 Table 5-6 & 8-1 */ | void itlb_fault(struct kvm_vcpu *vcpu, u64 vadr) | /* Instruction TLB Fault @ Instruction TLB vector Refer to SDM Vol2 Table 5-6 & 8-1 */
void itlb_fault(struct kvm_vcpu *vcpu, u64 vadr) | {
set_ifa_itir_iha(vcpu, vadr, 1, 1, 1);
inject_guest_interruption(vcpu, IA64_INST_TLB_VECTOR);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Returns the most recent received data by the SPIx/I2Sx peripheral. */ | uint8_t SPI_ReceiveData8(SPI_TypeDef *SPIx) | /* Returns the most recent received data by the SPIx/I2Sx peripheral. */
uint8_t SPI_ReceiveData8(SPI_TypeDef *SPIx) | {
uint32_t spixbase = 0x00;
spixbase = (uint32_t)SPIx;
spixbase += 0x0C;
return *(__IO uint8_t *) spixbase;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* LPTIM MSP Initialization This function configures the hardware resources used in this example. */ | void HAL_LPTIM_MspInit(LPTIM_HandleTypeDef *hlptim) | /* LPTIM MSP Initialization This function configures the hardware resources used in this example. */
void HAL_LPTIM_MspInit(LPTIM_HandleTypeDef *hlptim) | {
RCC_PeriphCLKInitTypeDef PeriphClkInit = {0};
if(hlptim->Instance==LPTIM1)
{
PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_LPTIM1;
PeriphClkInit.Lptim1ClockSelection = RCC_LPTIM1CLKSOURCE_PCLK;
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit) != HAL_OK)
{
Error_Handler();
}
__HAL... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* XPC's heartbeat code will never call this function and xpc_partition_up() at the same time. Nor will it ever make multiple calls to either function at the same time. */ | void xpc_partition_going_down(struct xpc_partition *part, enum xp_retval reason) | /* XPC's heartbeat code will never call this function and xpc_partition_up() at the same time. Nor will it ever make multiple calls to either function at the same time. */
void xpc_partition_going_down(struct xpc_partition *part, enum xp_retval reason) | {
unsigned long irq_flags;
int ch_number;
struct xpc_channel *ch;
dev_dbg(xpc_chan, "deactivating partition %d, reason=%d\n",
XPC_PARTID(part), reason);
if (!xpc_part_ref(part)) {
return;
}
for (ch_number = 0; ch_number < part->nchannels; ch_number++) {
ch = &part->channels[ch_number];
xpc_msgqueue_ref(c... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* The socket is being shut down and we're asked to drop messages that were queued for recvmsg. The caller has unbound the socket so the receive path won't queue any more incoming fragments or messages on the socket. */ | void rds_clear_recv_queue(struct rds_sock *rs) | /* The socket is being shut down and we're asked to drop messages that were queued for recvmsg. The caller has unbound the socket so the receive path won't queue any more incoming fragments or messages on the socket. */
void rds_clear_recv_queue(struct rds_sock *rs) | {
struct sock *sk = rds_rs_to_sk(rs);
struct rds_incoming *inc, *tmp;
unsigned long flags;
write_lock_irqsave(&rs->rs_recv_lock, flags);
list_for_each_entry_safe(inc, tmp, &rs->rs_recv_queue, i_item) {
rds_recv_rcvbuf_delta(rs, sk, inc->i_conn->c_lcong,
-be32_to_cpu(inc->i_hdr.h_len),
inc->i_... | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* UART MSP Initialization This function configures the hardware resources used in this example. */ | void HAL_UART_MspInit(UART_HandleTypeDef *huart) | /* UART MSP Initialization This function configures the hardware resources used in this example. */
void HAL_UART_MspInit(UART_HandleTypeDef *huart) | {
GPIO_InitTypeDef GPIO_InitStruct = {0};
RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0};
if(huart->Instance==USART6)
{
PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_USART6;
PeriphClkInitStruct.Usart6ClockSelection = RCC_USART6CLKSOURCE_PCLK2;
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkI... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Find the data source for a specified field, and return a pointer to the data in it. Returns NULL if the data is out of bounds. */ | static const guint8 * get_field_data(GSList *src_list, field_info *fi) | /* Find the data source for a specified field, and return a pointer to the data in it. Returns NULL if the data is out of bounds. */
static const guint8 * get_field_data(GSList *src_list, field_info *fi) | {
GSList *src_le;
tvbuff_t *src_tvb;
gint length, tvbuff_length;
struct data_source *src;
for (src_le = src_list; src_le != NULL; src_le = src_le->next) {
src = (struct data_source *)src_le->data;
src_tvb = get_data_source_tvb(src);
if (fi->ds_tvb == src_tvb) {
... | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* On certain platforms, we have to allocate an interrupt as well... */ | int request_dma(unsigned int chan, const char *device_id) | /* On certain platforms, we have to allocate an interrupt as well... */
int request_dma(unsigned int chan, const char *device_id) | {
dma_t *dma = dma_channel(chan);
int ret;
if (!dma)
goto bad_dma;
if (xchg(&dma->lock, 1) != 0)
goto busy;
dma->device_id = device_id;
dma->active = 0;
dma->invalid = 1;
ret = 0;
if (dma->d_ops->request)
ret = dma->d_ops->request(chan, dma);
if (ret)
xchg(&dma->lock, 0);
return ret;
bad_dma:
p... | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Disable the MMC Rx interrupt. The MMC rx interrupts are masked out as per the mask specified. */ | void synopGMAC_disable_mmc_rx_interrupt(synopGMACdevice *gmacdev, u32 mask) | /* Disable the MMC Rx interrupt. The MMC rx interrupts are masked out as per the mask specified. */
void synopGMAC_disable_mmc_rx_interrupt(synopGMACdevice *gmacdev, u32 mask) | {
synopGMACSetBits(gmacdev->MacBase,GmacMmcIntrMaskRx,mask);
return;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* This function erases physical eraseblock 'pnum', and writes the erase counter header to it. This function should only be used on UBI device initialization stages, when the EBA unit had not been yet initialized. This function returns zero in case of success and a negative error code in case of failure. */ | int ubi_scan_erase_peb(struct ubi_device *ubi, const struct ubi_scan_info *si, int pnum, int ec) | /* This function erases physical eraseblock 'pnum', and writes the erase counter header to it. This function should only be used on UBI device initialization stages, when the EBA unit had not been yet initialized. This function returns zero in case of success and a negative error code in case of failure. */
int ubi_sc... | {
int err;
struct ubi_ec_hdr *ec_hdr;
if ((long long)ec >= UBI_MAX_ERASECOUNTER) {
ubi_err("erase counter overflow at PEB %d, EC %d", pnum, ec);
return -EINVAL;
}
ec_hdr = kzalloc(ubi->ec_hdr_alsize, GFP_KERNEL);
if (!ec_hdr)
return -ENOMEM;
ec_hdr->ec = cpu_to_be64(ec);
err = ubi_io_sync_erase(ubi, pnum,... | EmcraftSystems/u-boot | C++ | Other | 181 |
/* CLI command used to interact with the application parameters. */ | int32_t cn0503_defparam_route(struct cn0503_dev *dev, uint8_t *arg) | /* CLI command used to interact with the application parameters. */
int32_t cn0503_defparam_route(struct cn0503_dev *dev, uint8_t *arg) | {
extern uint8_t uart_current_line[100];
if (uart_current_line[4] == '?')
return cn0503_defparam_get(dev, arg);
else
return cn0503_defparam_set(dev, arg);
} | analogdevicesinc/EVAL-ADICUP3029 | C++ | Other | 36 |
/* If @ub is NULL, dump the lockstate to the console. */ | static int gfs2_dump_lockstate(struct gfs2_sbd *sdp) | /* If @ub is NULL, dump the lockstate to the console. */
static int gfs2_dump_lockstate(struct gfs2_sbd *sdp) | {
struct gfs2_glock *gl;
struct hlist_node *h;
unsigned int x;
int error = 0;
for (x = 0; x < GFS2_GL_HASH_SIZE; x++) {
read_lock(gl_lock_addr(x));
hlist_for_each_entry(gl, h, &gl_hash_table[x].hb_list, gl_list) {
if (gl->gl_sbd != sdp)
continue;
error = dump_glock(NULL, gl);
if (error)
break;... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Configures system clock after wake-up from STOP: enable HSI, PLL and select PLL as system clock source. */ | static void SYSCLKConfig_STOP(void) | /* Configures system clock after wake-up from STOP: enable HSI, PLL and select PLL as system clock source. */
static void SYSCLKConfig_STOP(void) | {
RCC_ClkInitTypeDef RCC_ClkInitStruct;
RCC_OscInitTypeDef RCC_OscInitStruct;
uint32_t pFLatency = 0;
HAL_RCC_GetOscConfig(&RCC_OscInitStruct);
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;
RCC_OscInitStruct.HSIState = RCC_HSI_ON;
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
RCC_OscInitStru... | STMicroelectronics/STM32CubeF4 | C++ | Other | 789 |
/* Disable the wdt interrupt.
This function disablee the interrupt. */ | void am_hal_wdt_int_disable(void) | /* Disable the wdt interrupt.
This function disablee the interrupt. */
void am_hal_wdt_int_disable(void) | {
AM_REG(WDT, INTEN) &= ~AM_REG_WDT_INTSET_WDT_M;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* This function is meant to be used by either the SW manual IRQ raising or by HW which wants the IRQ to be raised in one delta cycle from now */ | void hw_irq_ctrl_set_irq(unsigned int irq) | /* This function is meant to be used by either the SW manual IRQ raising or by HW which wants the IRQ to be raised in one delta cycle from now */
void hw_irq_ctrl_set_irq(unsigned int irq) | {
hw_irq_ctrl_irq_raise_prefix(irq);
if ((irqs_locked == false) || (lock_ignore)) {
irq_ctrl_timer = nsi_hws_get_time();
nsi_hws_find_next_event();
}
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Remove one pre-fetched key out of the FIFO buffer. */ | BOOLEAN EfiKeyFiFoRemoveOneKey(TERMINAL_DEV *TerminalDevice, EFI_INPUT_KEY *Output) | /* Remove one pre-fetched key out of the FIFO buffer. */
BOOLEAN EfiKeyFiFoRemoveOneKey(TERMINAL_DEV *TerminalDevice, EFI_INPUT_KEY *Output) | {
UINT8 Head;
Head = TerminalDevice->EfiKeyFiFo->Head;
ASSERT (Head < FIFO_MAX_NUMBER + 1);
if (IsEfiKeyFiFoEmpty (TerminalDevice)) {
Output->ScanCode = SCAN_NULL;
Output->UnicodeChar = 0;
return FALSE;
}
CopyMem (Output, &TerminalDevice->EfiKeyFiFo->Data[Head], sizeof (EFI_INPUT_KEY));
Te... | tianocore/edk2 | C++ | Other | 4,240 |
/* If Length is greater than (MAX_ADDRESS - Address + 1), then ASSERT(). */ | VOID* EFIAPI WriteBackDataCacheRange(IN VOID *Address, IN UINTN Length) | /* If Length is greater than (MAX_ADDRESS - Address + 1), then ASSERT(). */
VOID* EFIAPI WriteBackDataCacheRange(IN VOID *Address, IN UINTN Length) | {
ASSERT (Length <= MAX_ADDRESS - (UINTN)Address + 1);
return Address;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* VmbusChannelSetEvent - Trigger an event notification on the specified channel. */ | static void VmbusChannelSetEvent(struct vmbus_channel *channel) | /* VmbusChannelSetEvent - Trigger an event notification on the specified channel. */
static void VmbusChannelSetEvent(struct vmbus_channel *channel) | {
struct hv_monitor_page *monitorPage;
DPRINT_ENTER(VMBUS);
if (Channel->OfferMsg.MonitorAllocated) {
set_bit(Channel->OfferMsg.ChildRelId & 31,
(unsigned long *) gVmbusConnection.SendInterruptPage +
(Channel->OfferMsg.ChildRelId >> 5));
monitorPage = gVmbusConnection.MonitorPages;
monitorPage++;
set_b... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* USB Device MSC Set Command Status Wrapper Callback Parameters: None Return Value: None */ | void USBD_MSC_SetCSW(void) | /* USB Device MSC Set Command Status Wrapper Callback Parameters: None Return Value: None */
void USBD_MSC_SetCSW(void) | {
USBD_MSC_CSW.dSignature = MSC_CSW_Signature;
USBD_WriteEP(usbd_msc_ep_bulkin | 0x80, (U8 *)&USBD_MSC_CSW, sizeof(USBD_MSC_CSW));
BulkStage = MSC_BS_CSW;
} | ARMmbed/DAPLink | C++ | Apache License 2.0 | 2,140 |
/* param base CDOG peripheral base address. param add Value to be added. */ | void CDOG_Add16(CDOG_Type *base) | /* param base CDOG peripheral base address. param add Value to be added. */
void CDOG_Add16(CDOG_Type *base) | {
base->ADD16 = (secure_counter_t)0x1U;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* This file is part of the Simba project. */ | int mock_write_sem_module_init(int res) | /* This file is part of the Simba project. */
int mock_write_sem_module_init(int res) | {
harness_mock_write("sem_module_init()",
NULL,
0);
harness_mock_write("sem_module_init(): return (res)",
&res,
sizeof(res));
return (0);
} | eerimoq/simba | C++ | Other | 337 |
/* returns: 0 on success Negative error code on failure */ | static int overlay_adjust_node_phandles(void *fdto, int node, uint32_t delta) | /* returns: 0 on success Negative error code on failure */
static int overlay_adjust_node_phandles(void *fdto, int node, uint32_t delta) | {
int child;
int ret;
ret = overlay_phandle_add_offset(fdto, node, "phandle", delta);
if (ret && ret != -FDT_ERR_NOTFOUND)
return ret;
ret = overlay_phandle_add_offset(fdto, node, "linux,phandle", delta);
if (ret && ret != -FDT_ERR_NOTFOUND)
return ret;
fdt_for_each_subnode(child, fdto, node) {
ret = overl... | xboot/xboot | C++ | MIT License | 779 |
/* Transmit a frame (9 bits) to the LCD over SPI. */ | static void nokia6100fb_spi_frame(struct spi_device *s, unsigned char *h) | /* Transmit a frame (9 bits) to the LCD over SPI. */
static void nokia6100fb_spi_frame(struct spi_device *s, unsigned char *h) | {
struct spi_message m;
struct spi_transfer x;
spi_message_init(&m);
memset(&x, 0, sizeof(x));
x.tx_buf = h;
x.rx_buf = NULL;
x.len = 2;
spi_message_add_tail(&x, &m);
spi_sync(s, &m);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Returns: (nullable) (transfer full): a #GWin32RegistryKey or NULL if can't be opened. Free with g_object_unref(). */ | GWin32RegistryKey* g_win32_registry_key_new(const gchar *path, GError **error) | /* Returns: (nullable) (transfer full): a #GWin32RegistryKey or NULL if can't be opened. Free with g_object_unref(). */
GWin32RegistryKey* g_win32_registry_key_new(const gchar *path, GError **error) | {
g_return_val_if_fail (path != NULL, NULL);
return g_initable_new (G_TYPE_WIN32_REGISTRY_KEY,
NULL,
error,
"path",
path,
NULL);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Read PHY register. Return 1 if successfully, 0 if timeout. */ | unsigned char EMAC_ReadPhy(unsigned char PhyAddress, unsigned char Address, unsigned int *pValue, unsigned int retry) | /* Read PHY register. Return 1 if successfully, 0 if timeout. */
unsigned char EMAC_ReadPhy(unsigned char PhyAddress, unsigned char Address, unsigned int *pValue, unsigned int retry) | {
AT91C_BASE_EMAC->EMAC_MAN = (AT91C_EMAC_SOF & (0x01 << 30))
| (AT91C_EMAC_CODE & (2 << 16))
| (AT91C_EMAC_RW & (2 << 28))
| (AT91C_EMAC_PHYA & ((PhyAddress & 0x1f) << 23))
| (AT91C_EMAC_REGA & (... | apopple/Pandaboard-FreeRTOS | C++ | null | 25 |
/* Checks if all CPUs (except Blocked & Disabled) have checked in for this SMI run */ | BOOLEAN AllCpusInSmmExceptBlockedDisabled(VOID) | /* Checks if all CPUs (except Blocked & Disabled) have checked in for this SMI run */
BOOLEAN AllCpusInSmmExceptBlockedDisabled(VOID) | {
UINT32 BlockedCount;
UINT32 DisabledCount;
BlockedCount = 0;
DisabledCount = 0;
ASSERT (SmmCpuSyncGetArrivedCpuCount (mSmmMpSyncData->SyncContext) <= mNumberOfCpus);
if (SmmCpuSyncGetArrivedCpuCount (mSmmMpSyncData->SyncContext) == mNumberOfCpus) {
return TRUE;
}
GetSmmDelayedBlockedDisabledCou... | tianocore/edk2 | C++ | Other | 4,240 |
/* Expand maximum payload size of a netlink message */ | int nlmsg_expand(struct nl_msg *n, size_t newlen) | /* Expand maximum payload size of a netlink message */
int nlmsg_expand(struct nl_msg *n, size_t newlen) | {
void *tmp;
if (newlen <= n->nm_size)
return -NLE_INVAL;
tmp = realloc(n->nm_nlh, newlen);
if (tmp == NULL)
return -NLE_NOMEM;
n->nm_nlh = tmp;
n->nm_size = newlen;
return 0;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* State and contents of ur devices can be changed by class D users issuing CP commands such as PURGE or TRANSFER, while the Linux guest is suspended. Also the Linux guest might be logged off, which causes all active spool files to be closed. So we cannot guarantee that spool files are still the same when the Linux gue... | static int ur_pm_suspend(struct ccw_device *cdev) | /* State and contents of ur devices can be changed by class D users issuing CP commands such as PURGE or TRANSFER, while the Linux guest is suspended. Also the Linux guest might be logged off, which causes all active spool files to be closed. So we cannot guarantee that spool files are still the same when the Linux gue... | {
struct urdev *urd = dev_get_drvdata(&cdev->dev);
TRACE("ur_pm_suspend: cdev=%p\n", cdev);
if (urd->open_flag) {
pr_err("Unit record device %s is busy, %s refusing to "
"suspend.\n", dev_name(&cdev->dev), ur_banner);
return -EBUSY;
}
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Writes an HMAC key to the digest registers in the SHA/MD5 module. */ | void SHAMD5HMACKeySet(uint32_t ui32Base, uint8_t *pui8Src) | /* Writes an HMAC key to the digest registers in the SHA/MD5 module. */
void SHAMD5HMACKeySet(uint32_t ui32Base, uint8_t *pui8Src) | {
uint32_t ui32Idx;
ASSERT(ui32Base == SHAMD5_BASE);
for(ui32Idx = 0; ui32Idx < 64; ui32Idx += 4)
{
HWREG(ui32Base + SHAMD5_O_ODIGEST_A + ui32Idx) =
* ((uint32_t *)(pui8Src + ui32Idx));
}
HWREG(ui32Base + SHAMD5_O_MODE) |= (SHAMD5_MODE_HMAC_OUTE... | micropython/micropython | C++ | Other | 18,334 |
/* Set I2C Programmable Filter Factor of the specified I2C port.
The */ | void I2CGlitchFilterSet(unsigned long ulBase, unsigned char ucFilter) | /* Set I2C Programmable Filter Factor of the specified I2C port.
The */
void I2CGlitchFilterSet(unsigned long ulBase, unsigned char ucFilter) | {
xASSERT((ulBase == I2C0_BASE) || ((ulBase == I2C1_BASE)));
xASSERT((ulBase >= 0) && ((ulBase <= 31)));
xHWREGB(ulBase + I2C_FLT) &= ~I2C_FLT_FLT_M;
xHWREGB(ulBase + I2C_FLT) |= ucFilter;
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Detach the iSCSI connection from the session it belongs to. */ | VOID IScsiDetatchConnection(IN OUT ISCSI_CONNECTION *Conn) | /* Detach the iSCSI connection from the session it belongs to. */
VOID IScsiDetatchConnection(IN OUT ISCSI_CONNECTION *Conn) | {
RemoveEntryList (&Conn->Link);
Conn->Session->NumConns--;
Conn->Session = NULL;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* This function will set network interface device DHCP status. @NOTE it can only be called in the network interface device driver. */ | void netdev_low_level_set_dhcp_status(struct netdev *netdev, bool is_enable) | /* This function will set network interface device DHCP status. @NOTE it can only be called in the network interface device driver. */
void netdev_low_level_set_dhcp_status(struct netdev *netdev, bool is_enable) | {
if (netdev && netdev_is_dhcp_enabled(netdev) != is_enable)
{
if (is_enable)
{
netdev->flags |= NETDEV_FLAG_DHCP;
}
else
{
netdev->flags &= ~NETDEV_FLAG_DHCP;
}
if (netdev->status_callback)
{
netdev->status_call... | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* Note: The SP805 Watchdog Timer supports locking of its registers, i.e. it inhibits all writes to avoid rogue software accidentally corrupting their contents. */ | STATIC VOID SP805Unlock(VOID) | /* Note: The SP805 Watchdog Timer supports locking of its registers, i.e. it inhibits all writes to avoid rogue software accidentally corrupting their contents. */
STATIC VOID SP805Unlock(VOID) | {
if (MmioRead32 (SP805_WDOG_LOCK_REG) == SP805_WDOG_LOCK_IS_LOCKED) {
MmioWrite32 (SP805_WDOG_LOCK_REG, SP805_WDOG_SPECIAL_UNLOCK_CODE);
}
} | tianocore/edk2 | C++ | Other | 4,240 |
/* param base The EMVSIM peripheral address. param context A pointer to a smart card driver context structure. retval kStatus_SMARTCARD_Success The transmit abort was successful. retval kStatus_SMARTCARD_NoTransmitInProgress No transmission is currently in progress. */ | status_t SMARTCARD_EMVSIM_AbortTransfer(EMVSIM_Type *base, smartcard_context_t *context) | /* param base The EMVSIM peripheral address. param context A pointer to a smart card driver context structure. retval kStatus_SMARTCARD_Success The transmit abort was successful. retval kStatus_SMARTCARD_NoTransmitInProgress No transmission is currently in progress. */
status_t SMARTCARD_EMVSIM_AbortTransfer(EMVSIM_Ty... | {
if ((NULL == context))
{
return kStatus_SMARTCARD_InvalidInput;
}
context->abortTransfer = true;
if ((!context->xIsBusy))
{
return kStatus_SMARTCARD_NoTransferInProgress;
}
if (kSMARTCARD_Receive == context->direction)
{
smartcard_emvsim_CompleteReceiveData(... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Updates the x output duty cycle in edge aligned modes (left and right aligned) */ | IFX_STATIC void IfxCcu6_PwmHl_updateEdgeAligned(IfxCcu6_PwmHl *driver, Ifx_TimerValue *tOn) | /* Updates the x output duty cycle in edge aligned modes (left and right aligned) */
IFX_STATIC void IfxCcu6_PwmHl_updateEdgeAligned(IfxCcu6_PwmHl *driver, Ifx_TimerValue *tOn) | {
IfxCcu6_PwmHl_setOnTime(driver, tOn);
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* Remove one or more consecutive backslashes starting from the second character of a given Unicode string. */ | CHAR16* ExcludeTrailingBackslashes(IN CHAR16 *String) | /* Remove one or more consecutive backslashes starting from the second character of a given Unicode string. */
CHAR16* ExcludeTrailingBackslashes(IN CHAR16 *String) | {
CHAR16 *TempString;
switch (*(String + 1)) {
case L'\\':
break;
case L'\0':
default:
String++;
goto Exit;
}
TempString = String;
while (*TempString != L'\0' && *TempString == L'\\') {
TempString++;
}
if (TempString - 1 > String) {
ReplaceLeft (String + 1, TempStrin... | tianocore/edk2 | C++ | Other | 4,240 |
/* Enables or disables simultaneously the two DAC channels software triggers. */ | void DAC_DualSoftwareTriggerCmd(FunctionalState NewState) | /* Enables or disables simultaneously the two DAC channels software triggers. */
void DAC_DualSoftwareTriggerCmd(FunctionalState NewState) | {
assert_param(IS_FUNCTIONAL_STATE(NewState));
if (NewState != DISABLE)
{
DAC->SWTRIGR |= DUAL_SWTRIG_SET ;
}
else
{
DAC->SWTRIGR &= DUAL_SWTRIG_RESET;
}
} | gcallipo/RadioDSP-Stm32f103 | C++ | Common Creative - Attribution 3.0 | 51 |
/* receive file_info from server. This operation is patched for the compatibility with ameba. */ | u32 recv_file_info_from_server(u8 *Recvbuf, u32 len, int socket) | /* receive file_info from server. This operation is patched for the compatibility with ameba. */
u32 recv_file_info_from_server(u8 *Recvbuf, u32 len, int socket) | {
int read_bytes = 0;
u32 TempLen;
u8 * buf;
buf = Recvbuf;
TempLen = len;
while(TempLen > 0) {
read_bytes = lwip_read(socket, buf, TempLen);
if(read_bytes < 0){
printf("\n\r[%s] read socket failed\n", __FUNCTION__);
goto error;
}
if(read_bytes == 0) {
break;
}
TempLen -= read_bytes;
buf +=... | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* Set maximum transmission length in number of bytes. */ | void radio_set_maxlen(uint8_t maxlen) | /* Set maximum transmission length in number of bytes. */
void radio_set_maxlen(uint8_t maxlen) | {
uint32_t reg_pcnf1 = RADIO_PCNF1;
reg_pcnf1 &= ~RADIO_PCNF1_MAXLEN_MASK;
RADIO_PCNF1 = reg_pcnf1 | RADIO_PCNF1_MAXLEN_MASKED(maxlen);
} | libopencm3/libopencm3 | C++ | GNU General Public License v3.0 | 2,931 |
/* All the following routines are board specific hardware operations. */ | static void stli_ecpinit(struct stlibrd *brdp) | /* All the following routines are board specific hardware operations. */
static void stli_ecpinit(struct stlibrd *brdp) | {
unsigned long memconf;
outb(ECP_ATSTOP, (brdp->iobase + ECP_ATCONFR));
udelay(10);
outb(ECP_ATDISABLE, (brdp->iobase + ECP_ATCONFR));
udelay(100);
memconf = (brdp->memaddr & ECP_ATADDRMASK) >> ECP_ATADDRSHFT;
outb(memconf, (brdp->iobase + ECP_ATMEMAR));
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Before you start, select your target, on the right of the "Load" button */ | int main(void) | /* Before you start, select your target, on the right of the "Load" button */
int main(void) | {
if (TM_DELAY_Time() >= 200) {
TM_DELAY_SetTime(0);
TM_DISCO_LedToggle(LED_GREEN);
i++;
if (i == 20) {
i = 0;
TM_LOWPOWER_StopUntilInterrupt();
TM_DISCO_LedToggle(LED_RED);
}
}
}
} | MaJerle/stm32f429 | C++ | null | 2,036 |
/* Reads single word data result of Local to Remote IPC command */ | uint16_t IPCLiteLtoRGetResult(void *pvData, uint16_t usLength, uint32_t ulStatusFlag) | /* Reads single word data result of Local to Remote IPC command */
uint16_t IPCLiteLtoRGetResult(void *pvData, uint16_t usLength, uint32_t ulStatusFlag) | {
uint16_t returnStatus;
if (IpcRegs.IPCFLG.all & ulStatusFlag)
{
returnStatus = STATUS_FAIL;
}
else
{
if (usLength == IPC_LENGTH_16_BITS)
{
*(uint16_t *)pvData = IpcRegs.IPCREMOTEREPLY;
}
else if (usLength == IPC_LENGTH_32_BITS)
{
... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* pm_runtime_enable - Enable run-time PM of a device. @dev: Device to handle. */ | void pm_runtime_enable(struct device *dev) | /* pm_runtime_enable - Enable run-time PM of a device. @dev: Device to handle. */
void pm_runtime_enable(struct device *dev) | {
unsigned long flags;
spin_lock_irqsave(&dev->power.lock, flags);
if (dev->power.disable_depth > 0)
dev->power.disable_depth--;
else
dev_warn(dev, "Unbalanced %s!\n", __func__);
spin_unlock_irqrestore(&dev->power.lock, flags);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* USB Device HID Set Protocol Request Callback Called automatically on USB Device HID Set Protocol Request Parameters: None Return Value: TRUE - Success, FALSE - Error */ | BOOL USBD_HID_SetProtocol(void) | /* USB Device HID Set Protocol Request Callback Called automatically on USB Device HID Set Protocol Request Parameters: None Return Value: TRUE - Success, FALSE - Error */
BOOL USBD_HID_SetProtocol(void) | {
usbd_hid_set_protocol(USBD_SetupPacket.wValueL);
return (__TRUE);
} | ARMmbed/DAPLink | C++ | Apache License 2.0 | 2,140 |
/* Disable any unicast packet filtered by the MAC address recognition to be a wake-up frame. */ | void ETH_DisableGlobalUnicastWakeUp(void) | /* Disable any unicast packet filtered by the MAC address recognition to be a wake-up frame. */
void ETH_DisableGlobalUnicastWakeUp(void) | {
ETH->PMTCTRLSTS_B.GUN = RESET;
ETH_Delay(ETH_REG_WRITE_DELAY);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* pdc2027x_exit - Called before this module unloaded from the kernel */ | static void __exit pdc2027x_exit(void) | /* pdc2027x_exit - Called before this module unloaded from the kernel */
static void __exit pdc2027x_exit(void) | {
pci_unregister_driver(&pdc2027x_pci_driver);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* The caller must either have a ref on the inode or must have set I_WILL_FREE. */ | int write_inode_now(struct inode *inode, int sync) | /* The caller must either have a ref on the inode or must have set I_WILL_FREE. */
int write_inode_now(struct inode *inode, int sync) | {
int ret;
struct writeback_control wbc = {
.nr_to_write = LONG_MAX,
.sync_mode = sync ? WB_SYNC_ALL : WB_SYNC_NONE,
.range_start = 0,
.range_end = LLONG_MAX,
};
if (!mapping_cap_writeback_dirty(inode->i_mapping))
wbc.nr_to_write = 0;
might_sleep();
spin_lock(&inode_lock);
ret = writeback_single_inode(... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Quick check whether there are still any locks, blocks or shares on a given file. */ | static int nlm_file_inuse(struct nlm_file *file) | /* Quick check whether there are still any locks, blocks or shares on a given file. */
static int nlm_file_inuse(struct nlm_file *file) | {
struct inode *inode = nlmsvc_file_inode(file);
struct file_lock *fl;
if (file->f_count || !list_empty(&file->f_blocks) || file->f_shares)
return 1;
for (fl = inode->i_flock; fl; fl = fl->fl_next) {
if (fl->fl_lmops == &nlmsvc_lock_operations)
return 1;
}
file->f_locks = 0;
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Read the beginning address of the last written data. */ | void* exFLASH_ReadEE(u32 page_address, u16 len) | /* Read the beginning address of the last written data. */
void* exFLASH_ReadEE(u32 page_address, u16 len) | {
u16* ptr = exFLASH_Locate(page_address, len);
return (ptr == 0) ? 0 : (ptr - len / 2);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* This function gets the value of the PHY registers through the MII interface. */ | int imx_enet_mii_read(volatile hw_enet_t *enet_reg, unsigned char phy_addr, unsigned char reg_addr, unsigned short int *value) | /* This function gets the value of the PHY registers through the MII interface. */
int imx_enet_mii_read(volatile hw_enet_t *enet_reg, unsigned char phy_addr, unsigned char reg_addr, unsigned short int *value) | {
unsigned long waiting = ENET_MII_TIMEOUT;
if (enet_reg->EIR.U & ENET_EVENT_MII) {
enet_reg->EIR.U = ENET_EVENT_MII;
}
enet_reg->MMFR.U = ENET_MII_READ(phy_addr, reg_addr);
while (1) {
if (enet_reg->EIR.U & ENET_EVENT_MII) {
enet_reg->EIR.U = ENET_EVENT_MII;
... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Returns the seriliazed font family. The caller has to free it using g_free(). */ | guchar* cr_font_family_to_string(CRFontFamily *a_this, gboolean a_walk_font_family_list) | /* Returns the seriliazed font family. The caller has to free it using g_free(). */
guchar* cr_font_family_to_string(CRFontFamily *a_this, gboolean a_walk_font_family_list) | {
enum CRStatus status = CR_OK;
guchar *result = NULL;
GString *stringue = NULL;
if (!a_this) {
result = g_strdup ("NULL");
g_return_val_if_fail (result, NULL);
return result;
}
status = cr_font_family_to_string_real (a_this... | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Callback from the network layer to allow driver statistics to be resynchronized with hardware collected state. In the case of the velocity we need to pull the MIB counters from the hardware into the counters before letting the network layer display them. */ | static struct net_device_stats* velocity_get_stats(struct net_device *dev) | /* Callback from the network layer to allow driver statistics to be resynchronized with hardware collected state. In the case of the velocity we need to pull the MIB counters from the hardware into the counters before letting the network layer display them. */
static struct net_device_stats* velocity_get_stats(struct ... | {
struct velocity_info *vptr = netdev_priv(dev);
if (!netif_running(dev))
return &dev->stats;
spin_lock_irq(&vptr->lock);
velocity_update_hw_mibs(vptr);
spin_unlock_irq(&vptr->lock);
dev->stats.rx_packets = vptr->mib_counter[HW_MIB_ifRxAllPkts];
dev->stats.rx_errors = vptr->mib_counter[HW_MIB_ifRxErrorPkts];
... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This function must be called with the hvcsd->lock held. */ | static int hvcs_partner_connect(struct hvcs_struct *hvcsd) | /* This function must be called with the hvcsd->lock held. */
static int hvcs_partner_connect(struct hvcs_struct *hvcsd) | {
int retval;
unsigned int unit_address = hvcsd->vdev->unit_address;
retval = hvcs_register_connection(unit_address,
hvcsd->p_partition_ID,
hvcsd->p_unit_address);
if (!retval) {
hvcsd->connected = 1;
return 0;
} else if (retval != -EINVAL)
return retval;
if (hvcs_get_pi(hvcsd))
return -ENOMEM;
if ... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Returns information about the random number generation implementation. */ | EFI_STATUS EFIAPI RngGetInfo(IN EFI_RNG_PROTOCOL *This, IN OUT UINTN *RNGAlgorithmListSize, OUT EFI_RNG_ALGORITHM *RNGAlgorithmList) | /* Returns information about the random number generation implementation. */
EFI_STATUS EFIAPI RngGetInfo(IN EFI_RNG_PROTOCOL *This, IN OUT UINTN *RNGAlgorithmListSize, OUT EFI_RNG_ALGORITHM *RNGAlgorithmList) | {
UINTN RequiredSize;
if ((This == NULL) || (RNGAlgorithmListSize == NULL)) {
return EFI_INVALID_PARAMETER;
}
RequiredSize = RNG_ALGORITHM_COUNT * sizeof (EFI_RNG_ALGORITHM);
if (*RNGAlgorithmListSize < RequiredSize) {
*RNGAlgorithmListSize = RequiredSize;
return EFI_BUFFER_TOO_SMALL;
}
if (R... | tianocore/edk2 | C++ | Other | 4,240 |
/* Writes a 16-bit value in the descriptor buffer */ | sl_status_t sl_usbd_core_write_16b_to_descriptor_buf(uint16_t val) | /* Writes a 16-bit value in the descriptor buffer */
sl_status_t sl_usbd_core_write_16b_to_descriptor_buf(uint16_t val) | {
sli_usbd_device_t *p_dev;
sl_status_t status;
p_dev = &usbd_ptr->device;
status = *(p_dev->desc_buf_status_ptr);
if (status == SL_STATUS_OK) {
uint8_t buf[2u];
buf[0u] = (uint8_t)(val & 0xFFu);
buf[1u] = (uint8_t)((val >> 8u) & 0xFFu);
usbd_core_write_to_descriptor_buf(p_dev, &buf[0u... | nanoframework/nf-interpreter | C++ | MIT License | 293 |
/* Clear specified feature on a given hub port. */ | EFI_STATUS PeiHubClearPortFeature(IN EFI_PEI_SERVICES **PeiServices, IN PEI_USB_IO_PPI *UsbIoPpi, IN UINT8 Port, IN UINT8 Value) | /* Clear specified feature on a given hub port. */
EFI_STATUS PeiHubClearPortFeature(IN EFI_PEI_SERVICES **PeiServices, IN PEI_USB_IO_PPI *UsbIoPpi, IN UINT8 Port, IN UINT8 Value) | {
EFI_USB_DEVICE_REQUEST DeviceRequest;
ZeroMem (&DeviceRequest, sizeof (EFI_USB_DEVICE_REQUEST));
DeviceRequest.RequestType = USB_HUB_CLEAR_FEATURE_PORT_REQ_TYPE;
DeviceRequest.Request = USB_HUB_CLEAR_FEATURE_PORT;
DeviceRequest.Value = Value;
DeviceRequest.Index = Port;
return UsbIoPpi-... | tianocore/edk2 | C++ | Other | 4,240 |
/* root_hub_string is used by each host controller's root hub code, so that they're identified consistently throughout the system. */ | static int usb_root_hub_string(int id, int serial, char *type, __u8 *data, int len) | /* root_hub_string is used by each host controller's root hub code, so that they're identified consistently throughout the system. */
static int usb_root_hub_string(int id, int serial, char *type, __u8 *data, int len) | {
char buf [30];
if (id == 0) {
*data++ = 4; *data++ = 3;
*data++ = 0; *data++ = 0;
return 4;
} else if (id == 1) {
sprintf (buf, "%#x", serial);
} else if (id == 2) {
sprintf (buf, "USB %s Root Hub", type);
} else
return 0;
ascii2utf (buf, data + 2, len - 2);
data [0] = 2 + strlen(buf) * 2;
data... | EmcraftSystems/u-boot | C++ | Other | 181 |
/* Set idal buffer to ccw of a request. */ | void raw3270_request_set_idal(struct raw3270_request *rq, struct idal_buffer *ib) | /* Set idal buffer to ccw of a request. */
void raw3270_request_set_idal(struct raw3270_request *rq, struct idal_buffer *ib) | {
rq->ccw.cda = __pa(ib->data);
rq->ccw.count = ib->size;
rq->ccw.flags |= CCW_FLAG_IDA;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* sends a piece of data in non-blocking way. */ | static void SAI_WriteNonBlocking(I2S_Type *base, uint32_t channel, uint32_t bitWidth, uint8_t *buffer, uint32_t size) | /* sends a piece of data in non-blocking way. */
static void SAI_WriteNonBlocking(I2S_Type *base, uint32_t channel, uint32_t bitWidth, uint8_t *buffer, uint32_t size) | {
uint32_t i = 0;
uint8_t j = 0;
uint8_t bytesPerWord = bitWidth / 8U;
uint32_t data = 0;
uint32_t temp = 0;
for (i = 0; i < size / bytesPerWord; i++)
{
for (j = 0; j < bytesPerWord; j++)
{
temp = (uint32_t)(*buffer);
data |= (temp << (8U * j));
... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Gets the number of wait states of flash read accesses. */ | uint32_t flashcalw_get_wait_state(void) | /* Gets the number of wait states of flash read accesses. */
uint32_t flashcalw_get_wait_state(void) | {
return (HFLASHC->FLASHCALW_FCR & FLASHCALW_FCR_FWS ? 1 : 0);
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* Returns TRUE if the machine type of PE/COFF image is supported. Supported does not mean the image can be executed it means the PE/COFF loader supports loading and relocating of the image type. It's up to the caller to support the entry point. */ | BOOLEAN PeCoffLoaderImageFormatSupported(IN UINT16 Machine) | /* Returns TRUE if the machine type of PE/COFF image is supported. Supported does not mean the image can be executed it means the PE/COFF loader supports loading and relocating of the image type. It's up to the caller to support the entry point. */
BOOLEAN PeCoffLoaderImageFormatSupported(IN UINT16 Machine) | {
if ((Machine == IMAGE_FILE_MACHINE_RISCV64) ||
(Machine == IMAGE_FILE_MACHINE_ARM64) ||
(Machine == IMAGE_FILE_MACHINE_X64))
{
return TRUE;
}
return FALSE;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Set the Rx values normally modified by IBC in IB1.2 mode to default values, as gotten from selected column of init table. */ | static int set_rxeq_vals(struct ipath_devdata *dd, int vsel) | /* Set the Rx values normally modified by IBC in IB1.2 mode to default values, as gotten from selected column of init table. */
static int set_rxeq_vals(struct ipath_devdata *dd, int vsel) | {
int ret;
int ridx;
int cnt = ARRAY_SIZE(rxeq_init_vals);
for (ridx = 0; ridx < cnt; ++ridx) {
int elt, reg, val, loc;
elt = rxeq_init_vals[ridx].rdesc & 0xF;
reg = rxeq_init_vals[ridx].rdesc >> 4;
loc = EPB_LOC(0, elt, reg);
val = rxeq_init_vals[ridx].rdata[vsel];
ret = ibsd_mod_allchnls(dd, loc, val,... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Get the total number of package and package ID in the platform. */ | UINT32 CpuCacheInfoGetNumberOfPackages(IN CPUID_PROCESSOR_INFO *ProcessorInfo, IN UINTN NumberOfProcessors, IN OUT UINT32 *Package) | /* Get the total number of package and package ID in the platform. */
UINT32 CpuCacheInfoGetNumberOfPackages(IN CPUID_PROCESSOR_INFO *ProcessorInfo, IN UINTN NumberOfProcessors, IN OUT UINT32 *Package) | {
UINTN ProcessorIndex;
UINT32 PackageIndex;
UINT32 PackageCount;
UINT32 CurrentPackage;
PackageCount = 0;
for (ProcessorIndex = 0; ProcessorIndex < NumberOfProcessors; ProcessorIndex++) {
CurrentPackage = ProcessorInfo[ProcessorIndex].Package;
for (PackageIndex = 0; PackageIndex < PackageCount... | tianocore/edk2 | C++ | Other | 4,240 |
/* Returns 0 if current has the requested access, error code otherwise */ | static int smack_shm_associate(struct shmid_kernel *shp, int shmflg) | /* Returns 0 if current has the requested access, error code otherwise */
static int smack_shm_associate(struct shmid_kernel *shp, int shmflg) | {
int may;
may = smack_flags_to_may(shmflg);
return smk_curacc_shm(shp, may);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Get the touch screen Xn and Yn positions values in multi-touch mode. */ | int32_t SX8651_GetMultiTouchState(SX8651_Object_t *pObj, SX8651_MultiTouch_State_t *State) | /* Get the touch screen Xn and Yn positions values in multi-touch mode. */
int32_t SX8651_GetMultiTouchState(SX8651_Object_t *pObj, SX8651_MultiTouch_State_t *State) | {
(void)(pObj);
(void)(State);
return SX8651_OK;
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* Get packet delay correlation probability of netem qdisc. */ | int rtnl_netem_get_delay_correlation(struct rtnl_qdisc *qdisc) | /* Get packet delay correlation probability of netem qdisc. */
int rtnl_netem_get_delay_correlation(struct rtnl_qdisc *qdisc) | {
struct rtnl_netem *netem;
netem = netem_qdisc(qdisc);
if (netem && (netem->qnm_mask & SCH_NETEM_ATTR_DELAY_CORR))
return netem->qnm_corr.nmc_delay;
else
return -NLE_NOATTR;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Output: the smallest integer x such that 2^x > steps */ | static int sqsteps2shift(double steps_sq) | /* Output: the smallest integer x such that 2^x > steps */
static int sqsteps2shift(double steps_sq) | {
int r;
frexp (MAX (1.0, steps_sq), &r);
return (r + 1) >> 1;
} | xboot/xboot | C++ | MIT License | 779 |
/* Find a NAND timing value that is rounded as appropriate.
This function determines the NAND Timing parameter which is given in units of GPMI cycles. The GPMI period is used to determine how many cycles fit into the NAND parameter, rounding up or down as appropriate. */ | uint32_t gpmi_find_cycles_rounded(uint64_t u32NandTime_ns, uint32_t u32GpmiPeriod_ns) | /* Find a NAND timing value that is rounded as appropriate.
This function determines the NAND Timing parameter which is given in units of GPMI cycles. The GPMI period is used to determine how many cycles fit into the NAND parameter, rounding up or down as appropriate. */
uint32_t gpmi_find_cycles_rounded(uint64_t u32N... | {
return (u32NandTime_ns + (u32GpmiPeriod_ns>>1)) / u32GpmiPeriod_ns;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Registers the callback function that this server calls, whenever it received a PDU containing a function code not currently supported. With the aid of this callback function the user can implement support for new function codes. */ | void TbxMbServerSetCallbackCustomFunction(tTbxMbServer channel, tTbxMbServerCustomFunction callback) | /* Registers the callback function that this server calls, whenever it received a PDU containing a function code not currently supported. With the aid of this callback function the user can implement support for new function codes. */
void TbxMbServerSetCallbackCustomFunction(tTbxMbServer channel, tTbxMbServerCustomFu... | {
TBX_ASSERT((channel != NULL) && (callback != NULL));
if ((channel != NULL) && (callback != NULL))
{
tTbxMbServerCtx * serverCtx = (tTbxMbServerCtx *)channel;
TBX_ASSERT(serverCtx->type == TBX_MB_SERVER_CONTEXT_TYPE);
TbxCriticalSectionEnter();
serverCtx->customFunctionFcn = callback;
TbxCrit... | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* Called by the driver when there's room for more data. If we have more packets to send, we send them here. */ | static void irtty_write_wakeup(struct tty_struct *tty) | /* Called by the driver when there's room for more data. If we have more packets to send, we send them here. */
static void irtty_write_wakeup(struct tty_struct *tty) | {
struct sirtty_cb *priv = tty->disc_data;
IRDA_ASSERT(priv != NULL, return;);
IRDA_ASSERT(priv->magic == IRTTY_MAGIC, return;);
clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags);
if (priv->dev)
sirdev_write_complete(priv->dev);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* If Length is greater than (MAX_ADDRESS - Address + 1), then ASSERT(). */ | VOID* EFIAPI WriteBackInvalidateDataCacheRange(IN VOID *Address, IN UINTN Length) | /* If Length is greater than (MAX_ADDRESS - Address + 1), then ASSERT(). */
VOID* EFIAPI WriteBackInvalidateDataCacheRange(IN VOID *Address, IN UINTN Length) | {
ASSERT (Length <= MAX_ADDRESS - (UINTN)Address + 1);
return Address;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* XDR encode functions There must be an encoding function for void results so svc_process will work properly. */ | int nfs3svc_encode_voidres(struct svc_rqst *rqstp, __be32 *p, void *dummy) | /* XDR encode functions There must be an encoding function for void results so svc_process will work properly. */
int nfs3svc_encode_voidres(struct svc_rqst *rqstp, __be32 *p, void *dummy) | {
return xdr_ressize_check(rqstp, p);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This function returns the string of Redfish service version. */ | EFI_STATUS RedfishGetServiceVersion(IN REDFISH_SERVICE RedfishService, OUT CHAR8 **ServiceVersionStr) | /* This function returns the string of Redfish service version. */
EFI_STATUS RedfishGetServiceVersion(IN REDFISH_SERVICE RedfishService, OUT CHAR8 **ServiceVersionStr) | {
redfishService *Redfish;
CHAR8 **KeysArray;
UINTN KeysNum;
if ((RedfishService == NULL) || (ServiceVersionStr == NULL)) {
return EFI_INVALID_PARAMETER;
}
Redfish = (redfishService *)RedfishService;
if (Redfish->versions == NULL) {
return EFI_INVALID_PARAMETER;
}
KeysArra... | tianocore/edk2 | C++ | Other | 4,240 |
/* Invoked when PCI Express bus unloads or AER probe fails. */ | static void aer_remove(struct pcie_device *dev) | /* Invoked when PCI Express bus unloads or AER probe fails. */
static void aer_remove(struct pcie_device *dev) | {
struct aer_rpc *rpc = get_service_data(dev);
if (rpc) {
if (rpc->isr)
free_irq(dev->irq, dev);
wait_event(rpc->wait_release, rpc->prod_idx == rpc->cons_idx);
aer_delete_rootport(rpc);
set_service_data(dev, NULL);
}
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Before you start, select your target, on the right of the "Load" button */ | int main(void) | /* Before you start, select your target, on the right of the "Load" button */
int main(void) | {
c = TM_USART_Getc(USART1);
if (c) {
TM_USART_Putc(USART1, c);
}
}
} | MaJerle/stm32f429 | C++ | null | 2,036 |
/* The event process routine when the DHCPv4 service binding protocol is installed in the system. */ | VOID EFIAPI Ip4Config2OnDhcp4SbInstalled(IN EFI_EVENT Event, IN VOID *Context) | /* The event process routine when the DHCPv4 service binding protocol is installed in the system. */
VOID EFIAPI Ip4Config2OnDhcp4SbInstalled(IN EFI_EVENT Event, IN VOID *Context) | {
IP4_CONFIG2_INSTANCE *Instance;
Instance = (IP4_CONFIG2_INSTANCE *)Context;
if ((Instance->Dhcp4Handle != NULL) || (Instance->Policy != Ip4Config2PolicyDhcp)) {
return;
}
Ip4StartAutoConfig (Instance);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Reads and returns the current value of DR4. This function is only available on IA-32 and x64. This returns a 32-bit value on IA-32 and a 64-bit value on x64. */ | UINTN EFIAPI AsmReadDr4(VOID) | /* Reads and returns the current value of DR4. This function is only available on IA-32 and x64. This returns a 32-bit value on IA-32 and a 64-bit value on x64. */
UINTN EFIAPI AsmReadDr4(VOID) | {
__asm {
_emit 0x0f
_emit 0x21
_emit 0xe0
}
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Initialize TRNG Interface. 1. Initializes the resources needed for the TRNG interface 2.registers event callback function. */ | trng_handle_t csi_trng_initialize(int32_t idx, trng_event_cb_t cb_event) | /* Initialize TRNG Interface. 1. Initializes the resources needed for the TRNG interface 2.registers event callback function. */
trng_handle_t csi_trng_initialize(int32_t idx, trng_event_cb_t cb_event) | {
if (idx < 0 || idx >= CONFIG_TRNG_NUM) {
return NULL;
}
uint32_t base = 0u;
int32_t real_idx = target_get_trng(idx, &base);
if (real_idx != idx) {
return NULL;
}
ck_trng_priv_t *trng_priv = &trng_handle[idx];
trng_priv->base = base;
trng_reg = (ck_trng_reg_t *)(trng... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Higher order allocations also allow the placement of more objects in a slab and thereby reduce object handling overhead. If the user has requested a higher mininum order then we start with that one instead of the smallest order which will fit the object. */ | static int slab_order(int size, int min_objects, int max_order, int fract_leftover) | /* Higher order allocations also allow the placement of more objects in a slab and thereby reduce object handling overhead. If the user has requested a higher mininum order then we start with that one instead of the smallest order which will fit the object. */
static int slab_order(int size, int min_objects, int max_o... | {
int order;
int rem;
int min_order = slub_min_order;
if ((PAGE_SIZE << min_order) / size > MAX_OBJS_PER_PAGE)
return get_order(size * MAX_OBJS_PER_PAGE) - 1;
for (order = max(min_order,
fls(min_objects * size - 1) - PAGE_SHIFT);
order <= max_order; order++) {
unsigned long slab_size = PAGE_SIZE << orde... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This function inserts command node to cmdfreeq after cleans it. Requires priv->driver_lock held. */ | static void __lbtf_cleanup_and_insert_cmd(struct lbtf_private *priv, struct cmd_ctrl_node *cmdnode) | /* This function inserts command node to cmdfreeq after cleans it. Requires priv->driver_lock held. */
static void __lbtf_cleanup_and_insert_cmd(struct lbtf_private *priv, struct cmd_ctrl_node *cmdnode) | {
if (!cmdnode)
return;
cmdnode->callback = NULL;
cmdnode->callback_arg = 0;
memset(cmdnode->cmdbuf, 0, LBS_CMD_BUFFER_SIZE);
list_add_tail(&cmdnode->list, &priv->cmdfreeq);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Get next queue for service. Unless we have a queue preemption, we'll simply select the first cfqq in the service tree. */ | static struct cfq_queue* cfq_get_next_queue(struct cfq_data *cfqd) | /* Get next queue for service. Unless we have a queue preemption, we'll simply select the first cfqq in the service tree. */
static struct cfq_queue* cfq_get_next_queue(struct cfq_data *cfqd) | {
struct cfq_rb_root *service_tree =
service_tree_for(cfqd->serving_group, cfqd->serving_prio,
cfqd->serving_type);
if (!cfqd->rq_queued)
return NULL;
if (!service_tree)
return NULL;
if (RB_EMPTY_ROOT(&service_tree->rb))
return NULL;
return cfq_rb_first(service_tree);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Produce the DynamicCommand protocol to handle "tftp" command. */ | EFI_STATUS EFIAPI TftpCommandInitialize(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable) | /* Produce the DynamicCommand protocol to handle "tftp" command. */
EFI_STATUS EFIAPI TftpCommandInitialize(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable) | {
EFI_STATUS Status;
mTftpHiiHandle = InitializeHiiPackage (ImageHandle);
if (mTftpHiiHandle == NULL) {
return EFI_ABORTED;
}
Status = gBS->InstallProtocolInterface (
&ImageHandle,
&gEfiShellDynamicCommandProtocolGuid,
EFI_NATIVE_INTERFACE,
... | tianocore/edk2 | C++ | Other | 4,240 |
/* The IT821x has a single timing register for MWDMA and for PIO operations. As we flip back and forth we have to reload the clock. */ | static int it821x_dma_end(ide_drive_t *drive) | /* The IT821x has a single timing register for MWDMA and for PIO operations. As we flip back and forth we have to reload the clock. */
static int it821x_dma_end(ide_drive_t *drive) | {
ide_hwif_t *hwif = drive->hwif;
struct it821x_dev *itdev = ide_get_hwifdata(hwif);
int ret = ide_dma_end(drive);
u8 unit = drive->dn & 1;
if(itdev->mwdma[unit] != MWDMA_OFF)
it821x_program(drive, itdev->pio[unit]);
return ret;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Write a data to the slave when the bus is idle, and waiting for all bus transmiton complete.(Write Step1)
This function is always used in thread mode. */ | unsigned long xI2CMasterWriteS1(unsigned long ulBase, unsigned char ucSlaveAddr, unsigned char ucData, xtBoolean bEndTransmition) | /* Write a data to the slave when the bus is idle, and waiting for all bus transmiton complete.(Write Step1)
This function is always used in thread mode. */
unsigned long xI2CMasterWriteS1(unsigned long ulBase, unsigned char ucSlaveAddr, unsigned char ucData, xtBoolean bEndTransmition) | {
unsigned long ulStatus;
xASSERT((ulBase == I2C0_BASE) || (ulBase == I2C1_BASE));
xASSERT(!(ucSlaveAddr & 0x80));
xI2CMasterWriteRequestS1(ulBase, ucSlaveAddr, ucData, xfalse);
while (!(xHWREG(ulBase + I2C_O_CON) & I2C_CON_SI));
ulStatus = xHWREG(ulBase + I2C_O_STATUS) & I2C_STATUS_M;
if(!(... | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.