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 |
|---|---|---|---|---|---|---|---|
/* Used for other setup which needs to be done late in the bring-up phase. */ | int misc_init_r(void) | /* Used for other setup which needs to be done late in the bring-up phase. */
int misc_init_r(void) | {
out32r(MPC107_EUMB_GCR, 0xa0000000);
while( in32r( MPC107_EUMB_GCR ) & 0x80000000 );
out32r( MPC107_EUMB_GCR, 0x20000000 );
while( in32r( MPC107_EUMB_IACKR ) != 0xff );
icache_enable();
return 0;
} | EmcraftSystems/u-boot | C++ | Other | 181 |
/* Enables or disables the TIMx's Hall sensor interface. */ | void TIM_SelectHallSensor(TIM_TypeDef *TIMx, FunctionalState NewState) | /* Enables or disables the TIMx's Hall sensor interface. */
void TIM_SelectHallSensor(TIM_TypeDef *TIMx, FunctionalState NewState) | {
assert_param(IS_TIM_LIST3_PERIPH(TIMx));
assert_param(IS_FUNCTIONAL_STATE(NewState));
if (NewState != DISABLE)
{
TIMx->CR2 |= TIM_CR2_TI1S;
}
else
{
TIMx->CR2 &= (uint16_t)~((uint16_t)TIM_CR2_TI1S);
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Sets or resets the analogue monitoring on VDD_SD12 Power source. */ | FLASH_Status FLASH_OB_VDD_SD12Config(uint8_t OB_VDD_SD12) | /* Sets or resets the analogue monitoring on VDD_SD12 Power source. */
FLASH_Status FLASH_OB_VDD_SD12Config(uint8_t OB_VDD_SD12) | {
FLASH_Status status = FLASH_COMPLETE;
assert_param(IS_OB_VDD_SD12(OB_VDD_SD12));
status = FLASH_WaitForLastOperation(FLASH_ER_PRG_TIMEOUT);
if(status == FLASH_COMPLETE)
{
FLASH->CR |= FLASH_CR_OPTPG;
OB->USER = OB_VDD_SD12 | 0x7F;
status = FLASH_WaitForLastOperation(FLASH_ER_PRG_TIMEOUT);
if(status != FLASH_TIMEOUT)
{
FLASH->CR &= ~FLASH_CR_OPTPG;
}
}
return status;
} | avem-labs/Avem | C++ | MIT License | 1,752 |
/* Returns the most recent received data by the LPUART peripheral. */ | uint8_t LPUART_ReceiveData(void) | /* Returns the most recent received data by the LPUART peripheral. */
uint8_t LPUART_ReceiveData(void) | {
return (uint8_t)(LPUART->DAT & (uint8_t)0xFF);
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* Waits for a packet from the Ethernet controller. */ | long EthernetPacketGet(unsigned long ulBase, unsigned char *pucBuf, long lBufLen) | /* Waits for a packet from the Ethernet controller. */
long EthernetPacketGet(unsigned long ulBase, unsigned char *pucBuf, long lBufLen) | {
ASSERT(ulBase == ETH_BASE);
ASSERT(pucBuf != 0);
ASSERT(lBufLen > 0);
while((HWREG(ulBase + MAC_O_NP) & MAC_NP_NPR_M) == 0)
{
}
return(EthernetPacketGetInternal(ulBase, pucBuf, lBufLen));
} | watterott/WebRadio | C++ | null | 71 |
/* More than one formsets may share the same browser storage, this function just get the first formset storage which share the browser storage. */ | FORMSET_STORAGE* GetFstStgFromBrsStg(IN BROWSER_STORAGE *Storage) | /* More than one formsets may share the same browser storage, this function just get the first formset storage which share the browser storage. */
FORMSET_STORAGE* GetFstStgFromBrsStg(IN BROWSER_STORAGE *Storage) | {
FORMSET_STORAGE *FormsetStorage;
LIST_ENTRY *Link;
LIST_ENTRY *FormsetLink;
FORM_BROWSER_FORMSET *FormSet;
BOOLEAN Found;
Found = FALSE;
FormsetStorage = NULL;
FormsetLink = GetFirstNode (&gBrowserFormSetList);
while (!IsNull (&gBrowserFormSetList, FormsetLink)) {
FormSet = FORM_BROWSER_FORMSET_FROM_LINK (FormsetLink);
FormsetLink = GetNextNode (&gBrowserFormSetList, FormsetLink);
Link = GetFirstNode (&FormSet->StorageListHead);
while (!IsNull (&FormSet->StorageListHead, Link)) {
FormsetStorage = FORMSET_STORAGE_FROM_LINK (Link);
Link = GetNextNode (&FormSet->StorageListHead, Link);
if (FormsetStorage->BrowserStorage == Storage) {
Found = TRUE;
break;
}
}
if (Found) {
break;
}
}
return Found ? FormsetStorage : NULL;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* xprt_lookup_rqst - find an RPC request corresponding to an XID @xprt: transport on which the original request was transmitted @xid: RPC XID of incoming reply */ | struct rpc_rqst* xprt_lookup_rqst(struct rpc_xprt *xprt, __be32 xid) | /* xprt_lookup_rqst - find an RPC request corresponding to an XID @xprt: transport on which the original request was transmitted @xid: RPC XID of incoming reply */
struct rpc_rqst* xprt_lookup_rqst(struct rpc_xprt *xprt, __be32 xid) | {
struct list_head *pos;
list_for_each(pos, &xprt->recv) {
struct rpc_rqst *entry = list_entry(pos, struct rpc_rqst, rq_list);
if (entry->rq_xid == xid)
return entry;
}
dprintk("RPC: xprt_lookup_rqst did not find xid %08x\n",
ntohl(xid));
xprt->stat.bad_xids++;
return NULL;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Function for processing the BLE_GAP_EVT_DISCONNECT event from the SoftDevice. */ | static void disconnect_process(ble_gap_evt_t *p_gap_evt) | /* Function for processing the BLE_GAP_EVT_DISCONNECT event from the SoftDevice. */
static void disconnect_process(ble_gap_evt_t *p_gap_evt) | {
pm_sec_error_code_t error = (p_gap_evt->params.disconnected.reason
== BLE_HCI_CONN_TERMINATED_DUE_TO_MIC_FAILURE)
? PM_CONN_SEC_ERROR_MIC_FAILURE : PM_CONN_SEC_ERROR_DISCONNECT;
link_secure_failure(p_gap_evt->conn_handle, error, BLE_GAP_SEC_STATUS_SOURCE_LOCAL);
} | labapart/polymcu | C++ | null | 201 |
/* IvSize must be 12, otherwise FALSE is returned. KeySize must be 16, 24 or 32, otherwise FALSE is returned. TagSize must be 12, 13, 14, 15, 16, otherwise FALSE is returned. If additional authenticated data verification fails, FALSE is returned. */ | BOOLEAN EFIAPI AeadAesGcmDecrypt(IN CONST UINT8 *Key, IN UINTN KeySize, IN CONST UINT8 *Iv, IN UINTN IvSize, IN CONST UINT8 *AData, IN UINTN ADataSize, IN CONST UINT8 *DataIn, IN UINTN DataInSize, IN CONST UINT8 *Tag, IN UINTN TagSize, OUT UINT8 *DataOut, OUT UINTN *DataOutSize) | /* IvSize must be 12, otherwise FALSE is returned. KeySize must be 16, 24 or 32, otherwise FALSE is returned. TagSize must be 12, 13, 14, 15, 16, otherwise FALSE is returned. If additional authenticated data verification fails, FALSE is returned. */
BOOLEAN EFIAPI AeadAesGcmDecrypt(IN CONST UINT8 *Key, IN UINTN KeySize, IN CONST UINT8 *Iv, IN UINTN IvSize, IN CONST UINT8 *AData, IN UINTN ADataSize, IN CONST UINT8 *DataIn, IN UINTN DataInSize, IN CONST UINT8 *Tag, IN UINTN TagSize, OUT UINT8 *DataOut, OUT UINTN *DataOutSize) | {
CALL_CRYPTO_SERVICE (AeadAesGcmDecrypt, (Key, KeySize, Iv, IvSize, AData, ADataSize, DataIn, DataInSize, Tag, TagSize, DataOut, DataOutSize), FALSE);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* BACnetAddressBinding ::= SEQUENCE { deviceObjectID BACnetObjectIdentifier deviceAddress BacnetAddress } */ | static guint fAddressBinding(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset) | /* BACnetAddressBinding ::= SEQUENCE { deviceObjectID BACnetObjectIdentifier deviceAddress BacnetAddress } */
static guint fAddressBinding(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset) | {
offset = fObjectIdentifier(tvb, pinfo, tree, offset);
return fAddress(tvb, pinfo, tree, offset);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* The Build() function is used to assemble a new packet from the original packet by replacing or deleting existing options or appending new options. This function does not change any state of the EFI DHCPv4 Protocol driver and can be used at any time. */ | EFI_STATUS EFIAPI EfiDhcp4Build(IN EFI_DHCP4_PROTOCOL *This, IN EFI_DHCP4_PACKET *SeedPacket, IN UINT32 DeleteCount, IN UINT8 *DeleteList OPTIONAL, IN UINT32 AppendCount, IN EFI_DHCP4_PACKET_OPTION *AppendList[] OPTIONAL, OUT EFI_DHCP4_PACKET **NewPacket) | /* The Build() function is used to assemble a new packet from the original packet by replacing or deleting existing options or appending new options. This function does not change any state of the EFI DHCPv4 Protocol driver and can be used at any time. */
EFI_STATUS EFIAPI EfiDhcp4Build(IN EFI_DHCP4_PROTOCOL *This, IN EFI_DHCP4_PACKET *SeedPacket, IN UINT32 DeleteCount, IN UINT8 *DeleteList OPTIONAL, IN UINT32 AppendCount, IN EFI_DHCP4_PACKET_OPTION *AppendList[] OPTIONAL, OUT EFI_DHCP4_PACKET **NewPacket) | {
if ((This == NULL) || (NewPacket == NULL)) {
return EFI_INVALID_PARAMETER;
}
if ((SeedPacket == NULL) || (SeedPacket->Dhcp4.Magik != DHCP_OPTION_MAGIC) ||
EFI_ERROR (DhcpValidateOptions (SeedPacket, NULL)))
{
return EFI_INVALID_PARAMETER;
}
if (((DeleteCount == 0) && (AppendCount == 0)) ||
((DeleteCount != 0) && (DeleteList == NULL)) ||
((AppendCount != 0) && (AppendList == NULL)))
{
return EFI_INVALID_PARAMETER;
}
return DhcpBuild (
SeedPacket,
DeleteCount,
DeleteList,
AppendCount,
AppendList,
NewPacket
);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* The pin(s) are specified using a bit-packed byte, where each bit that is set identifies the pin to be accessed, and where bit 0 of the byte represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on. */ | void GPIOPinWrite(unsigned long ulPort, unsigned char ucPins, unsigned char ucVal) | /* The pin(s) are specified using a bit-packed byte, where each bit that is set identifies the pin to be accessed, and where bit 0 of the byte represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on. */
void GPIOPinWrite(unsigned long ulPort, unsigned char ucPins, unsigned char ucVal) | {
ASSERT(GPIOBaseValid(ulPort));
HWREG(ulPort + (GPIO_O_DATA + (ucPins << 2))) = ucVal;
} | watterott/WebRadio | C++ | null | 71 |
/* Configure port to working with Gig PCS or don't. */ | static int gop_gpcs_mode_cfg(struct mvpp2_port *port, int en) | /* Configure port to working with Gig PCS or don't. */
static int gop_gpcs_mode_cfg(struct mvpp2_port *port, int en) | {
u32 val;
val = readl(port->base + MVPP2_GMAC_CTRL_2_REG);
if (en)
val |= MVPP2_GMAC_PCS_ENABLE_MASK;
else
val &= ~MVPP2_GMAC_PCS_ENABLE_MASK;
writel(val, port->base + MVPP2_GMAC_CTRL_2_REG);
return 0;
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* The notification that comes in contains a bitmap of (UWB_NUM_MAS / 8) bytes We convert that to our internal representation. */ | static int uwbd_evt_get_drp_avail(struct uwb_event *evt, unsigned long *bmp) | /* The notification that comes in contains a bitmap of (UWB_NUM_MAS / 8) bytes We convert that to our internal representation. */
static int uwbd_evt_get_drp_avail(struct uwb_event *evt, unsigned long *bmp) | {
struct device *dev = &evt->rc->uwb_dev.dev;
struct uwb_rc_evt_drp_avail *drp_evt;
int result = -EINVAL;
if (evt->notif.size < sizeof(*drp_evt)) {
dev_err(dev, "DRP Availability Change: Not enough "
"data to decode event [%zu bytes, %zu "
"needed]\n", evt->notif.size, sizeof(*drp_evt));
goto error;
}
drp_evt = container_of(evt->notif.rceb, struct uwb_rc_evt_drp_avail, rceb);
buffer_to_bmp(bmp, drp_evt->bmp, UWB_NUM_MAS/8);
result = 0;
error:
return result;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Open LIN mode on the specified UART.
The */ | void xUARTLINConfig(unsigned long ulBase, unsigned long ulBaud, unsigned long ulConfig) | /* Open LIN mode on the specified UART.
The */
void xUARTLINConfig(unsigned long ulBase, unsigned long ulBaud, unsigned long ulConfig) | {
xASSERT(UARTBaseValid(ulBase));
xASSERT((ulConfig&UART_CONFIG_BKFL_MASK)<16);
xUARTConfigSet(ulBase, ulBaud,
xUART_CONFIG_WLEN_8 |
xUART_CONFIG_STOP_1 |
xUART_CONFIG_PAR_NONE);
xUARTLINEnable(ulBase);
xHWREG(ulBase + UART_ALT_CSR) &= ~UART_ALT_CSR_LIN_BKFL_M;
xHWREG(ulBase + UART_ALT_CSR) |= ulConfig;
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Enabling hardware averaging increases the precision of the ADC at the cost of throughput. For example, enabling 4x oversampling reduces the throughput of a 250 k samples/second ADC to 62.5 k samples/second. */ | void ADCHardwareOversampleConfigure(uint32_t ui32Base, uint32_t ui32Factor) | /* Enabling hardware averaging increases the precision of the ADC at the cost of throughput. For example, enabling 4x oversampling reduces the throughput of a 250 k samples/second ADC to 62.5 k samples/second. */
void ADCHardwareOversampleConfigure(uint32_t ui32Base, uint32_t ui32Factor) | {
uint32_t ui32Value;
ASSERT((ui32Base == ADC0_BASE) || (ui32Base == ADC1_BASE));
ASSERT(((ui32Factor == 0) || (ui32Factor == 2) || (ui32Factor == 4) ||
(ui32Factor == 8) || (ui32Factor == 16) || (ui32Factor == 32) ||
(ui32Factor == 64)));
for (ui32Value = 0, ui32Factor >>= 1; ui32Factor;
ui32Value++, ui32Factor >>= 1)
{
}
HWREG(ui32Base + ADC_O_SAC) = ui32Value;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Check the status of the Tx buffer of the specified SPI port. */ | xtBoolean SPIIsTxFull(unsigned long ulBase) | /* Check the status of the Tx buffer of the specified SPI port. */
xtBoolean SPIIsTxFull(unsigned long ulBase) | {
xASSERT((ulBase == SPI0_BASE) || (ulBase == SPI1_BASE)||
(ulBase == SPI2_BASE)||(ulBase == SPI3_BASE) );
return ((xHWREG(ulBase + SPI_CNTRL) & SPI_CNTRL_TX_FULL)? xtrue : xfalse);
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* equivalent of memcpy() for early boot usage
Architectures that can't safely use the regular (optimized) memcpy very early during boot because e.g. hardware isn't yet sufficiently initialized may override this with their own safe implementation. */ | __boot_func void __weak z_early_memcpy(void *dst, const void *src, size_t n) | /* equivalent of memcpy() for early boot usage
Architectures that can't safely use the regular (optimized) memcpy very early during boot because e.g. hardware isn't yet sufficiently initialized may override this with their own safe implementation. */
__boot_func void __weak z_early_memcpy(void *dst, const void *src, size_t n) | {
(void) memcpy(dst, src, n);
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* pm8001_alloc_dev - find a empty pm8001_device @pm8001_ha: our hba card information */ | struct pm8001_device* pm8001_alloc_dev(struct pm8001_hba_info *pm8001_ha) | /* pm8001_alloc_dev - find a empty pm8001_device @pm8001_ha: our hba card information */
struct pm8001_device* pm8001_alloc_dev(struct pm8001_hba_info *pm8001_ha) | {
u32 dev;
for (dev = 0; dev < PM8001_MAX_DEVICES; dev++) {
if (pm8001_ha->devices[dev].dev_type == NO_DEVICE) {
pm8001_ha->devices[dev].id = dev;
return &pm8001_ha->devices[dev];
}
}
if (dev == PM8001_MAX_DEVICES) {
PM8001_FAIL_DBG(pm8001_ha,
pm8001_printk("max support %d devices, ignore ..\n",
PM8001_MAX_DEVICES));
}
return NULL;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Erase Command Function: MX25_SE Arguments: flash_address, 32 bit flash memory address Description: The SE instruction is for erasing the data of the chosen sector (4KB) to be "1". Return Message: FlashAddressInvalid, FlashIsBusy, FlashOperationSuccess, FlashTimeOut */ | ReturnMsg MX25_SE(uint32_t flash_address) | /* Erase Command Function: MX25_SE Arguments: flash_address, 32 bit flash memory address Description: The SE instruction is for erasing the data of the chosen sector (4KB) to be "1". Return Message: FlashAddressInvalid, FlashIsBusy, FlashOperationSuccess, FlashTimeOut */
ReturnMsg MX25_SE(uint32_t flash_address) | {
uint8_t addr_4byte_mode;
if( flash_address > FlashSize ) return FlashAddressInvalid;
if( IsFlashBusy() ) return FlashIsBusy;
if( IsFlash4Byte() )
addr_4byte_mode = TRUE;
else
addr_4byte_mode = FALSE;
MX25_WREN();
CS_Low();
SendByte( FLASH_CMD_SE, SIO );
SendFlashAddr( flash_address, SIO, addr_4byte_mode );
CS_High();
if( WaitFlashReady( SectorEraseCycleTime ) )
return FlashOperationSuccess;
else
return FlashTimeOut;
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* This function parses the IORT Root Complex node. */ | STATIC VOID DumpIortNodeRootComplex(IN UINT8 *Ptr, IN UINT16 Length, IN UINT32 MappingCount, IN UINT32 MappingOffset) | /* This function parses the IORT Root Complex node. */
STATIC VOID DumpIortNodeRootComplex(IN UINT8 *Ptr, IN UINT16 Length, IN UINT32 MappingCount, IN UINT32 MappingOffset) | {
ParseAcpi (
TRUE,
2,
"Root Complex Node",
Ptr,
Length,
PARSER_PARAMS (IortNodeRootComplexParser)
);
DumpIortNodeIdMappings (
Ptr + MappingOffset,
Length - MappingOffset,
MappingCount
);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* ADC MSP De-Initialization This function freeze the hardware resources used in this example. */ | void HAL_ADC_MspDeInit(ADC_HandleTypeDef *hadc) | /* ADC MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_ADC_MspDeInit(ADC_HandleTypeDef *hadc) | {
if(hadc->Instance==ADC1)
{
__HAL_RCC_ADC1_CLK_DISABLE();
HAL_GPIO_DeInit(GPIOA, GPIO_PIN_1);
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Select the given device on the SPI bus. */ | void usart_spi_select_device(volatile avr32_usart_t *p_usart, struct usart_spi_device *device) | /* Select the given device on the SPI bus. */
void usart_spi_select_device(volatile avr32_usart_t *p_usart, struct usart_spi_device *device) | {
UNUSED(device);
usart_spi_selectChip(p_usart);
} | memfault/zero-to-main | C++ | null | 200 |
/* uwb_rsv_state_str - return a string for a reservation state @state: the reservation state. */ | const char* uwb_rsv_state_str(enum uwb_rsv_state state) | /* uwb_rsv_state_str - return a string for a reservation state @state: the reservation state. */
const char* uwb_rsv_state_str(enum uwb_rsv_state state) | {
if (state < UWB_RSV_STATE_NONE || state >= UWB_RSV_STATE_LAST)
return "unknown";
return rsv_states[state];
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Add two quads. This is trivial since a one-bit carry from a single u_int addition x+y occurs if and only if the sum x+y is less than either x or y (the choice to compare with x or y is arbitrary). */ | quad_t __adddi3(quad_t a, quad_t b) | /* Add two quads. This is trivial since a one-bit carry from a single u_int addition x+y occurs if and only if the sum x+y is less than either x or y (the choice to compare with x or y is arbitrary). */
quad_t __adddi3(quad_t a, quad_t b) | {
union uu aa, bb, sum;
aa.q = a;
bb.q = b;
sum.ul[L] = aa.ul[L] + bb.ul[L];
sum.ul[H] = aa.ul[H] + bb.ul[H] + (sum.ul[L] < bb.ul[L]);
return sum.q;
} | labapart/polymcu | C++ | null | 201 |
/* State machine for state 5, Awaiting Call Acceptance State. The handling of the timer(s) is in file rose_timer.c Handling of state 0 and connection release is in af_rose.c. */ | static int rose_state5_machine(struct sock *sk, struct sk_buff *skb, int frametype) | /* State machine for state 5, Awaiting Call Acceptance State. The handling of the timer(s) is in file rose_timer.c Handling of state 0 and connection release is in af_rose.c. */
static int rose_state5_machine(struct sock *sk, struct sk_buff *skb, int frametype) | {
if (frametype == ROSE_CLEAR_REQUEST) {
rose_write_internal(sk, ROSE_CLEAR_CONFIRMATION);
rose_disconnect(sk, 0, skb->data[3], skb->data[4]);
rose_sk(sk)->neighbour->use--;
}
return 0;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* This gives us the DMA request input to the PL08x primecell which the peripheral described by the channel data will be routed to, possibly via a board/SoC specific external MUX. One important point to note here is that this does not depend on the physical channel. */ | static int pl08x_request_mux(struct pl08x_dma_chan *plchan) | /* This gives us the DMA request input to the PL08x primecell which the peripheral described by the channel data will be routed to, possibly via a board/SoC specific external MUX. One important point to note here is that this does not depend on the physical channel. */
static int pl08x_request_mux(struct pl08x_dma_chan *plchan) | {
const struct pl08x_platform_data *pd = plchan->host->pd;
int ret;
if (plchan->mux_use++ == 0 && pd->get_signal) {
ret = pd->get_signal(plchan->cd);
if (ret < 0) {
plchan->mux_use = 0;
return ret;
}
plchan->signal = ret;
}
return 0;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* restore_state - Load configuration of current chip @pl022: SSP driver private data structure */ | static void restore_state(struct pl022 *pl022) | /* restore_state - Load configuration of current chip @pl022: SSP driver private data structure */
static void restore_state(struct pl022 *pl022) | {
struct chip_data *chip = pl022->cur_chip;
writew(chip->cr0, SSP_CR0(pl022->virtbase));
writew(chip->cr1, SSP_CR1(pl022->virtbase));
writew(chip->dmacr, SSP_DMACR(pl022->virtbase));
writew(chip->cpsr, SSP_CPSR(pl022->virtbase));
writew(DISABLE_ALL_INTERRUPTS, SSP_IMSC(pl022->virtbase));
writew(CLEAR_ALL_INTERRUPTS, SSP_ICR(pl022->virtbase));
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* low level hrtimer wake routine. Because this runs in hardirq context we schedule a tasklet to do the real work. */ | enum hrtimer_restart kvm_s390_idle_wakeup(struct hrtimer *timer) | /* low level hrtimer wake routine. Because this runs in hardirq context we schedule a tasklet to do the real work. */
enum hrtimer_restart kvm_s390_idle_wakeup(struct hrtimer *timer) | {
struct kvm_vcpu *vcpu;
vcpu = container_of(timer, struct kvm_vcpu, arch.ckc_timer);
tasklet_schedule(&vcpu->arch.tasklet);
return HRTIMER_NORESTART;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* This function Clears the LCD Glass Text Zone. */ | void LCD_GLASS_ClearTextZone(void) | /* This function Clears the LCD Glass Text Zone. */
void LCD_GLASS_ClearTextZone(void) | {
while(LCD_GetFlagStatus(LCD_FLAG_UDR) != RESET)
{
}
LCD->RAM[LCD_RAMRegister_0] &= (uint32_t)0xFFE49A49;
LCD->RAM[LCD_RAMRegister_2] &= (uint32_t)0xFFE49249;
LCD->RAM[LCD_RAMRegister_8] &= (uint32_t)0xFFE00000;
LCD->RAM[LCD_RAMRegister_10] &= (uint32_t)0xFFE00000;
LCD->RAM[LCD_RAMRegister_12] &= (uint32_t)0xFFE00800;
LCD->RAM[LCD_RAMRegister_14] &= (uint32_t)0xFFE00000;
LCD_UpdateDisplayRequest();
} | avem-labs/Avem | C++ | MIT License | 1,752 |
/* called by the usb core when the device is removed from the system */ | static void ems_usb_disconnect(struct usb_interface *intf) | /* called by the usb core when the device is removed from the system */
static void ems_usb_disconnect(struct usb_interface *intf) | {
struct ems_usb *dev = usb_get_intfdata(intf);
usb_set_intfdata(intf, NULL);
if (dev) {
unregister_netdev(dev->netdev);
free_candev(dev->netdev);
unlink_all_urbs(dev);
usb_free_urb(dev->intr_urb);
kfree(dev->intr_in_buffer);
}
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* ipu_irq_status() - returns the current interrupt status of the specified IRQ. @irq: interrupt line to get status for. */ | bool ipu_irq_status(unsigned int irq) | /* ipu_irq_status() - returns the current interrupt status of the specified IRQ. @irq: interrupt line to get status for. */
bool ipu_irq_status(unsigned int irq) | {
struct ipu_irq_map *map = get_irq_chip_data(irq);
struct ipu_irq_bank *bank;
unsigned long lock_flags;
bool ret;
spin_lock_irqsave(&bank_lock, lock_flags);
bank = map->bank;
ret = bank && ipu_read_reg(bank->ipu, bank->status) &
(1UL << (map->source & 31));
spin_unlock_irqrestore(&bank_lock, lock_flags);
return ret;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Queries a handle to determine if it supports a specified protocol. */ | EFI_STATUS EFIAPI SmmHandleProtocol(IN EFI_HANDLE UserHandle, IN EFI_GUID *Protocol, OUT VOID **Interface) | /* Queries a handle to determine if it supports a specified protocol. */
EFI_STATUS EFIAPI SmmHandleProtocol(IN EFI_HANDLE UserHandle, IN EFI_GUID *Protocol, OUT VOID **Interface) | {
EFI_STATUS Status;
PROTOCOL_INTERFACE *Prot;
if (Protocol == NULL) {
return EFI_INVALID_PARAMETER;
}
if (Interface == NULL) {
return EFI_INVALID_PARAMETER;
} else {
*Interface = NULL;
}
Status = SmmValidateHandle (UserHandle);
if (EFI_ERROR (Status)) {
return Status;
}
Prot = SmmGetProtocolInterface (UserHandle, Protocol);
if (Prot == NULL) {
return EFI_UNSUPPORTED;
}
*Interface = Prot->Interface;
return EFI_SUCCESS;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Copy a String from one location to another without copying \0 */ | static void inqstrcpy(char *a, char *b) | /* Copy a String from one location to another without copying \0 */
static void inqstrcpy(char *a, char *b) | {
while (*a != (char)0)
*b++ = *a++;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This function replaces the original UARTConfigGet() API and performs the same actions. A macro is provided in */ | void UARTConfigGetExpClk(unsigned long ulBase, unsigned long ulUARTClk, unsigned long *pulBaud, unsigned long *pulConfig) | /* This function replaces the original UARTConfigGet() API and performs the same actions. A macro is provided in */
void UARTConfigGetExpClk(unsigned long ulBase, unsigned long ulUARTClk, unsigned long *pulBaud, unsigned long *pulConfig) | {
unsigned long ulInt, ulFrac;
ASSERT(UARTBaseValid(ulBase));
ulInt = HWREG(ulBase + UART_O_IBRD);
ulFrac = HWREG(ulBase + UART_O_FBRD);
*pulBaud = (ulUARTClk * 4) / ((64 * ulInt) + ulFrac);
if(HWREG(ulBase + UART_O_CTL) & UART_CTL_HSE)
{
*pulBaud *= 2;
}
*pulConfig = (HWREG(ulBase + UART_O_LCRH) &
(UART_LCRH_SPS | UART_LCRH_WLEN_M | UART_LCRH_STP2 |
UART_LCRH_EPS | UART_LCRH_PEN));
} | watterott/WebRadio | C++ | null | 71 |
/* Implementation notes: Special case single element list, unroll/inline the sorting of the first two elements. Some tail recursion is used since we iterate on the bottom-up solution of the problem (we start with a small sorted list and keep merging other lists of the same size to it). */ | static edge_t* sort_edges(edge_t *list, unsigned int level, edge_t **head_out) | /* Implementation notes: Special case single element list, unroll/inline the sorting of the first two elements. Some tail recursion is used since we iterate on the bottom-up solution of the problem (we start with a small sorted list and keep merging other lists of the same size to it). */
static edge_t* sort_edges(edge_t *list, unsigned int level, edge_t **head_out) | {
edge_t *head_other, *remaining;
unsigned int i;
head_other = list->next;
if (head_other == NULL) {
*head_out = list;
return NULL;
}
remaining = head_other->next;
if (list->x <= head_other->x) {
*head_out = list;
head_other->next = NULL;
} else {
*head_out = head_other;
head_other->prev = list->prev;
head_other->next = list;
list->prev = head_other;
list->next = NULL;
}
for (i = 0; i < level && remaining; i++) {
remaining = sort_edges (remaining, i, &head_other);
*head_out = merge_sorted_edges (*head_out, head_other);
}
return remaining;
} | xboot/xboot | C++ | MIT License | 779 |
/* See if field Day of an EFI_TIME is correct. */ | BOOLEAN DayValid(IN EFI_TIME *Time) | /* See if field Day of an EFI_TIME is correct. */
BOOLEAN DayValid(IN EFI_TIME *Time) | {
ASSERT (Time->Month >= 1);
ASSERT (Time->Month <= 12);
if ((Time->Day < 1) ||
(Time->Day > mDayOfMonth[Time->Month - 1]) ||
((Time->Month == 2) && (!IsLeapYear (Time) && (Time->Day > 28)))
)
{
return FALSE;
}
return TRUE;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Returns transpose type for CRC protocol reflect in parameter.
This functions helps to set writeTranspose member of crc_config_t structure. Reflect in is CRC protocol parameter. */ | static crc_transpose_type_t CRC_GetTransposeTypeFromReflectIn(bool enable) | /* Returns transpose type for CRC protocol reflect in parameter.
This functions helps to set writeTranspose member of crc_config_t structure. Reflect in is CRC protocol parameter. */
static crc_transpose_type_t CRC_GetTransposeTypeFromReflectIn(bool enable) | {
return ((enable) ? kCrcTransposeBitsAndBytes : kCrcTransposeBytes);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Writes an HMAC key to the digest registers in the SHA/MD5 module. */ | void SHAMD5HMACKeySet(uint32_t ui32Base, uint32_t *pui32Src) | /* Writes an HMAC key to the digest registers in the SHA/MD5 module. */
void SHAMD5HMACKeySet(uint32_t ui32Base, uint32_t *pui32Src) | {
uint32_t ui32Idx;
ASSERT(ui32Base == SHAMD5_BASE);
for(ui32Idx = 0; ui32Idx < 64; ui32Idx += 4)
{
HWREG(ui32Base + SHAMD5_O_ODIGEST_A + ui32Idx) = *pui32Src++;
}
HWREG(ui32Base + SHAMD5_O_MODE) |= (SHAMD5_MODE_HMAC_OUTER_HASH |
SHAMD5_MODE_HMAC_KEY_PROC |
SHAMD5_MODE_CLOSE_HASH);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* The GetBlockSize() function retrieves the size of the requested block. It also returns the number of additional blocks with the identical size. The GetBlockSize() function is used to retrieve the block map (see EFI_FIRMWARE_VOLUME_HEADER). */ | EFI_STATUS EFIAPI FvbProtocolGetBlockSize(IN CONST EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL *This, IN EFI_LBA Lba, OUT UINTN *BlockSize, OUT UINTN *NumberOfBlocks) | /* The GetBlockSize() function retrieves the size of the requested block. It also returns the number of additional blocks with the identical size. The GetBlockSize() function is used to retrieve the block map (see EFI_FIRMWARE_VOLUME_HEADER). */
EFI_STATUS EFIAPI FvbProtocolGetBlockSize(IN CONST EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL *This, IN EFI_LBA Lba, OUT UINTN *BlockSize, OUT UINTN *NumberOfBlocks) | {
EFI_FW_VOL_BLOCK_DEVICE *FvbDevice;
if (Lba >= EMU_FVB_NUM_TOTAL_BLOCKS) {
return EFI_INVALID_PARAMETER;
}
FvbDevice = FVB_DEVICE_FROM_THIS (This);
*BlockSize = FvbDevice->BlockSize;
*NumberOfBlocks = (UINTN)(EMU_FVB_NUM_TOTAL_BLOCKS - Lba);
return EFI_SUCCESS;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Functions prefixed with "h_" are protocol callbacks. They can be called from interrupt context. Return value of 0 means that request processing is still ongoing, while special error value of -EAGAIN means that current request is finished (and request processor should come back some time later). */ | static int h_mspro_block_req_init(struct memstick_dev *card, struct memstick_request **mrq) | /* Functions prefixed with "h_" are protocol callbacks. They can be called from interrupt context. Return value of 0 means that request processing is still ongoing, while special error value of -EAGAIN means that current request is finished (and request processor should come back some time later). */
static int h_mspro_block_req_init(struct memstick_dev *card, struct memstick_request **mrq) | {
struct mspro_block_data *msb = memstick_get_drvdata(card);
*mrq = &card->current_mrq;
card->next_request = msb->mrq_handler;
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* ADC MSP Initialization This function configures the hardware resources used in this example: */ | void HAL_ADC_MspInit(ADC_HandleTypeDef *hadc) | /* ADC MSP Initialization This function configures the hardware resources used in this example: */
void HAL_ADC_MspInit(ADC_HandleTypeDef *hadc) | {
GPIO_InitTypeDef GPIO_InitStruct;
ADCx_CLK_ENABLE();
ADCx_CHANNEL_GPIO_CLK_ENABLE();
GPIO_InitStruct.Pin = ADCx_CHANNEL_PIN;
GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(ADCx_CHANNEL_GPIO_PORT, &GPIO_InitStruct);
HAL_NVIC_SetPriority(ADCx_IRQn, 0, 0);
HAL_NVIC_EnableIRQ(ADCx_IRQn);
} | STMicroelectronics/STM32CubeF4 | C++ | Other | 789 |
/* Function for handling advertising events.
This function will be called for advertising events which are passed to the application. */ | static void on_adv_evt(ble_adv_evt_t ble_adv_evt) | /* Function for handling advertising events.
This function will be called for advertising events which are passed to the application. */
static void on_adv_evt(ble_adv_evt_t ble_adv_evt) | {
uint32_t err_code;
switch (ble_adv_evt)
{
case BLE_ADV_EVT_FAST:
err_code = bsp_indication_set(BSP_INDICATE_ADVERTISING);
APP_ERROR_CHECK(err_code);
break;
case BLE_ADV_EVT_IDLE:
sleep_mode_enter();
break;
default:
break;
}
} | labapart/polymcu | C++ | null | 201 |
/* Forces or releases High Speed APB (APB2) peripheral reset. */ | void RCC_EnableAPB2PeriphReset(uint32_t RCC_APB2Periph, FunctionalState Cmd) | /* Forces or releases High Speed APB (APB2) peripheral reset. */
void RCC_EnableAPB2PeriphReset(uint32_t RCC_APB2Periph, FunctionalState Cmd) | {
assert_param(IS_RCC_APB2_PERIPH(RCC_APB2Periph));
assert_param(IS_FUNCTIONAL_STATE(Cmd));
if (Cmd != DISABLE)
{
RCC->APB2PRST |= RCC_APB2Periph;
}
else
{
RCC->APB2PRST &= ~RCC_APB2Periph;
}
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* Initializes the watch dog, include time setting, mode register. */ | void watchdog_init(uint32_t timeout_ms) | /* Initializes the watch dog, include time setting, mode register. */
void watchdog_init(uint32_t timeout_ms) | {
WDG_InitTypeDef WDG_InitStruct;
u32 CountProcess;
u32 DivFacProcess;
WDG_Scalar(timeout_ms, &CountProcess, &DivFacProcess);
WDG_InitStruct.CountProcess = CountProcess;
WDG_InitStruct.DivFacProcess = DivFacProcess;
WDG_Init(&WDG_InitStruct);
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* The user Entry Point for module EmuBlockIo . The user code starts with this function. */ | EFI_STATUS EFIAPI InitializeEmuBlockIo(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable) | /* The user Entry Point for module EmuBlockIo . The user code starts with this function. */
EFI_STATUS EFIAPI InitializeEmuBlockIo(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable) | {
EFI_STATUS Status;
Status = EfiLibInstallAllDriverProtocols2 (
ImageHandle,
SystemTable,
&gEmuBlockIoDriverBinding,
ImageHandle,
&gEmuBlockIoComponentName,
&gEmuBlockIoComponentName2,
NULL,
NULL,
&gEmuBlockIoDriverDiagnostics,
&gEmuBlockIoDriverDiagnostics2
);
ASSERT_EFI_ERROR (Status);
return Status;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Internal functions. Lookup the record equal to in the btree given by cur. */ | STATIC int xfs_alloc_lookup_eq(struct xfs_btree_cur *cur, xfs_agblock_t bno, xfs_extlen_t len, int *stat) | /* Internal functions. Lookup the record equal to in the btree given by cur. */
STATIC int xfs_alloc_lookup_eq(struct xfs_btree_cur *cur, xfs_agblock_t bno, xfs_extlen_t len, int *stat) | {
cur->bc_rec.a.ar_startblock = bno;
cur->bc_rec.a.ar_blockcount = len;
return xfs_btree_lookup(cur, XFS_LOOKUP_EQ, stat);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Function for freeing a device instance allocated for bonded device. */ | static __INLINE ret_code_t device_instance_free(uint32_t device_index) | /* Function for freeing a device instance allocated for bonded device. */
static __INLINE ret_code_t device_instance_free(uint32_t device_index) | {
ret_code_t err_code;
pstorage_handle_t block_handle;
err_code = pstorage_block_identifier_get(&m_storage_handle, device_index, &block_handle);
if (err_code == NRF_SUCCESS)
{
DM_TRC("[DM]:[DI 0x%02X]: Freeing Instance.\r\n", device_index);
err_code = pstorage_clear(&block_handle, ALL_CONTEXT_SIZE);
if (err_code == NRF_SUCCESS)
{
peer_instance_init(device_index);
}
}
return err_code;
} | labapart/polymcu | C++ | null | 201 |
/* Clear the SPI interrupt flag of the specified SPI port. */ | void SPIIntFlagClear(unsigned long ulBase, unsigned long ulIntFlags) | /* Clear the SPI interrupt flag of the specified SPI port. */
void SPIIntFlagClear(unsigned long ulBase, unsigned long ulIntFlags) | {
xASSERT(ulBase == SPI0_BASE);
xHWREG(ulBase + SPI_SR) &= ~ulIntFlags;
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Allocates the number bytes specified by AllocationSize of a certain pool type, clears the buffer with zeros, and returns a pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there is not enough memory remaining to satisfy the request, then NULL is returned. */ | VOID* InternalAllocateZeroPool(IN EFI_MEMORY_TYPE PoolType, IN UINTN AllocationSize) | /* Allocates the number bytes specified by AllocationSize of a certain pool type, clears the buffer with zeros, and returns a pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there is not enough memory remaining to satisfy the request, then NULL is returned. */
VOID* InternalAllocateZeroPool(IN EFI_MEMORY_TYPE PoolType, IN UINTN AllocationSize) | {
VOID *Memory;
Memory = InternalAllocatePool (PoolType, AllocationSize);
if (Memory != NULL) {
Memory = ZeroMem (Memory, AllocationSize);
}
return Memory;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* USBH_MSC_InterfaceDeInit The function DeInit the Pipes used for the MSC class. */ | USBH_StatusTypeDef USBH_MSC_InterfaceDeInit(USBH_HandleTypeDef *phost) | /* USBH_MSC_InterfaceDeInit The function DeInit the Pipes used for the MSC class. */
USBH_StatusTypeDef USBH_MSC_InterfaceDeInit(USBH_HandleTypeDef *phost) | {
MSC_HandleTypeDef *MSC_Handle = phost->pActiveClass->pData;
if ( MSC_Handle->OutPipe)
{
USBH_ClosePipe(phost, MSC_Handle->OutPipe);
USBH_FreePipe (phost, MSC_Handle->OutPipe);
MSC_Handle->OutPipe = 0;
}
if ( MSC_Handle->InPipe)
{
USBH_ClosePipe(phost, MSC_Handle->InPipe);
USBH_FreePipe (phost, MSC_Handle->InPipe);
MSC_Handle->InPipe = 0;
}
if(phost->pActiveClass->pData)
{
USBH_free (phost->pActiveClass->pData);
phost->pActiveClass->pData = 0;
}
return USBH_OK;
} | micropython/micropython | C++ | Other | 18,334 |
/* HASH MSP De-Initialization This function freeze the hardware resources used in this example. */ | void HAL_HASH_MspDeInit(HASH_HandleTypeDef *hhash) | /* HASH MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_HASH_MspDeInit(HASH_HandleTypeDef *hhash) | {
__HAL_RCC_HASH2_CLK_DISABLE();
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Check the status of the Rx buffer of the specified SPI port. */ | xtBoolean xSPIIsRxFull(unsigned long ulBase) | /* Check the status of the Rx buffer of the specified SPI port. */
xtBoolean xSPIIsRxFull(unsigned long ulBase) | {
xASSERT((ulBase == SPI0_BASE) || (ulBase == SPI1_BASE)||
(ulBase == SPI2_BASE)||(ulBase == SPI3_BASE) );
return ((xHWREG(ulBase + SPI_STATUS) & SPI_STATUS_RX_FULL)? xtrue : xfalse);
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* sends the NPE the updated frame filter and default Ingress tagging */ | IX_ETH_DB_PRIVATE IxEthDBStatus ixEthDBIngressVlanModeUpdate(IxEthDBPortId portID) | /* sends the NPE the updated frame filter and default Ingress tagging */
IX_ETH_DB_PRIVATE IxEthDBStatus ixEthDBIngressVlanModeUpdate(IxEthDBPortId portID) | {
PortInfo *portInfo = &ixEthDBPortInfo[portID];
IxNpeMhMessage message;
IX_STATUS result;
FILL_SETRXTAGMODE_MSG(message, portID, portInfo->npeFrameFilter, portInfo->npeTaggingAction);
IX_ETHDB_SEND_NPE_MSG(IX_ETH_DB_PORT_ID_TO_NPE(portID), message, result);
return result;
} | EmcraftSystems/u-boot | C++ | Other | 181 |
/* @client: i2c device. @reg: the register to write to. @buf: raw data buffer to write. @len: length of the buffer to write */ | static int goodix_i2c_write(struct i2c_client *client, u16 reg, const u8 *buf, unsigned len) | /* @client: i2c device. @reg: the register to write to. @buf: raw data buffer to write. @len: length of the buffer to write */
static int goodix_i2c_write(struct i2c_client *client, u16 reg, const u8 *buf, unsigned len) | {
u8 *addr_buf;
struct i2c_msg msg;
int ret;
addr_buf = kmalloc(len + 2, GFP_KERNEL);
if (!addr_buf)
return -ENOMEM;
addr_buf[0] = reg >> 8;
addr_buf[1] = reg & 0xFF;
memcpy(&addr_buf[2], buf, len);
msg.flags = 0;
msg.addr = client->addr;
msg.buf = addr_buf;
msg.len = len + 2;
ret = i2c_transfer(client->adapter, &msg, 1);
kfree(addr_buf);
return ret < 0 ? ret : (ret != 1 ? -EIO : 0);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* this routine is used for miscellaneous IP-like checksums, mainly in icmp.c */ | __sum16 ip_compute_csum(const void *buff, int len) | /* this routine is used for miscellaneous IP-like checksums, mainly in icmp.c */
__sum16 ip_compute_csum(const void *buff, int len) | {
return csum_fold(csum_partial(buff,len,0));
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Return the length of received data.
@method UART_ReceiveDataLen */ | uint32_t UART_ReceiveDataLen(UART_TypeDef *UARTx) | /* Return the length of received data.
@method UART_ReceiveDataLen */
uint32_t UART_ReceiveDataLen(UART_TypeDef *UARTx) | {
_ASSERT(IS_UART(UARTx));
return (UARTx->STATUS.bit.RX_ITEMS_H << 16) + UARTx->STATUS.bit.RX_ITEMS_L;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* RETURNS: 0 if devres is found and freed, -ENOENT if not found. */ | int devres_destroy(struct device *dev, dr_release_t release, dr_match_t match, void *match_data) | /* RETURNS: 0 if devres is found and freed, -ENOENT if not found. */
int devres_destroy(struct device *dev, dr_release_t release, dr_match_t match, void *match_data) | {
void *res;
res = devres_remove(dev, release, match, match_data);
if (unlikely(!res))
return -ENOENT;
devres_free(res);
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Enable the data line drivers, for 8-bit host-to-peripheral communications. */ | static void parport_ip32_data_forward(struct parport *p) | /* Enable the data line drivers, for 8-bit host-to-peripheral communications. */
static void parport_ip32_data_forward(struct parport *p) | {
__parport_ip32_frob_control(p, DCR_DIR, 0);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* utf8len(s ]) --> number of characters that start in the range , or nil + current position if 's' is not well formed in that interval */ | static int utflen(lua_State *L) | /* utf8len(s ]) --> number of characters that start in the range , or nil + current position if 's' is not well formed in that interval */
static int utflen(lua_State *L) | {
const char *s1 = utf8_decode(s + posi, NULL);
if (s1 == NULL) {
lua_pushnil(L);
lua_pushinteger(L, posi + 1);
return 2;
}
posi = s1 - s;
n++;
}
lua_pushinteger(L, n);
return 1;
} | nodemcu/nodemcu-firmware | C++ | MIT License | 7,566 |
/* free half of the CallInfo structures not in use by a thread */ | void luaE_shrinkCI(lua_State *L) | /* free half of the CallInfo structures not in use by a thread */
void luaE_shrinkCI(lua_State *L) | {
luaM_free(L, ci->next);
L->nci--;
ci->next = next2;
next2->previous = ci;
ci = next2;
}
} | nodemcu/nodemcu-firmware | C++ | MIT License | 7,566 |
/* De-Initializes the I2S and DMA for the board. */ | __WEAKDEF void BSP_I2S_DeInit(void) | /* De-Initializes the I2S and DMA for the board. */
__WEAKDEF void BSP_I2S_DeInit(void) | {
DMA_TransCompleteIntCmd(BSP_WM8731_DMA_UNIT, (BSP_WM8731_DMA_SD_INT_CH | BSP_WM8731_DMA_SDIN_INT_CH), DISABLE);
(void)DMA_ChCmd(BSP_WM8731_DMA_UNIT, BSP_WM8731_DMA_SD_CH, DISABLE);
(void)DMA_ChCmd(BSP_WM8731_DMA_UNIT, BSP_WM8731_DMA_SDIN_CH, DISABLE);
I2S_FuncCmd(BSP_WM8731_I2S_UNIT, I2S_FUNC_RX | I2S_FUNC_TX, DISABLE);
I2S_SWReset(BSP_WM8731_I2S_UNIT, I2S_RST_TYPE_ALL);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Checks whether a command is allowed in Power Save mode. */ | static u8 is_command_allowed_in_ps(u16 cmd) | /* Checks whether a command is allowed in Power Save mode. */
static u8 is_command_allowed_in_ps(u16 cmd) | {
switch (cmd) {
case CMD_802_11_RSSI:
return 1;
default:
break;
}
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* If FileName is NULL, then ASSERT(). If FileName is not aligned on a 16-bit boundary, then ASSERT(). */ | EFI_DEVICE_PATH_PROTOCOL* EFIAPI FileDevicePath(IN EFI_HANDLE Device OPTIONAL, IN CONST CHAR16 *FileName) | /* If FileName is NULL, then ASSERT(). If FileName is not aligned on a 16-bit boundary, then ASSERT(). */
EFI_DEVICE_PATH_PROTOCOL* EFIAPI FileDevicePath(IN EFI_HANDLE Device OPTIONAL, IN CONST CHAR16 *FileName) | {
UINTN Size;
FILEPATH_DEVICE_PATH *FilePath;
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
EFI_DEVICE_PATH_PROTOCOL *FileDevicePath;
DevicePath = NULL;
Size = StrSize (FileName);
FileDevicePath = AllocatePool (Size + SIZE_OF_FILEPATH_DEVICE_PATH + END_DEVICE_PATH_LENGTH);
if (FileDevicePath != NULL) {
FilePath = (FILEPATH_DEVICE_PATH *)FileDevicePath;
FilePath->Header.Type = MEDIA_DEVICE_PATH;
FilePath->Header.SubType = MEDIA_FILEPATH_DP;
CopyMem (&FilePath->PathName, FileName, Size);
SetDevicePathNodeLength (&FilePath->Header, Size + SIZE_OF_FILEPATH_DEVICE_PATH);
SetDevicePathEndNode (NextDevicePathNode (&FilePath->Header));
if (Device != NULL) {
DevicePath = DevicePathFromHandle (Device);
}
DevicePath = AppendDevicePath (DevicePath, FileDevicePath);
FreePool (FileDevicePath);
}
return DevicePath;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Symmetrical Dequantization reference: Section 7.3.3 Expansion of Mantissas for Symmetrical Quantization Tables 7.19 to 7.23 */ | static int symmetric_dequant(int code, int levels) | /* Symmetrical Dequantization reference: Section 7.3.3 Expansion of Mantissas for Symmetrical Quantization Tables 7.19 to 7.23 */
static int symmetric_dequant(int code, int levels) | {
return ((code - (levels >> 1)) << 24) / levels;
} | DC-SWAT/DreamShell | C++ | null | 404 |
/* Returns: seconds elapsed as a floating point value, including any fractional part. */ | gdouble g_timer_elapsed(GTimer *timer, gulong *microseconds) | /* Returns: seconds elapsed as a floating point value, including any fractional part. */
gdouble g_timer_elapsed(GTimer *timer, gulong *microseconds) | {
gdouble total;
gint64 elapsed;
g_return_val_if_fail (timer != NULL, 0);
if (timer->active)
timer->end = g_get_monotonic_time ();
elapsed = timer->end - timer->start;
total = elapsed / 1e6;
if (microseconds)
*microseconds = elapsed % 1000000;
return total;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* This request retrieves the status of the specified Ethernet power management pattern filter from the device. */ | EFI_STATUS EFIAPI GetUsbRndisPowerFilter(IN EDKII_USB_ETHERNET_PROTOCOL *This, IN UINT16 Value, OUT BOOLEAN *PatternActive) | /* This request retrieves the status of the specified Ethernet power management pattern filter from the device. */
EFI_STATUS EFIAPI GetUsbRndisPowerFilter(IN EDKII_USB_ETHERNET_PROTOCOL *This, IN UINT16 Value, OUT BOOLEAN *PatternActive) | {
EFI_USB_DEVICE_REQUEST Request;
UINT32 TransStatus;
USB_RNDIS_DEVICE *UsbRndisDevice;
UsbRndisDevice = USB_RNDIS_DEVICE_FROM_THIS (This);
Request.RequestType = USB_ETHERNET_GET_REQ_TYPE;
Request.Request = GET_ETH_POWER_MANAGEMENT_PATTERN_FILTER_REQ;
Request.Value = Value;
Request.Index = UsbRndisDevice->NumOfInterface;
Request.Length = USB_ETH_POWER_FILTER_LENGTH;
return UsbRndisDevice->UsbIo->UsbControlTransfer (
UsbRndisDevice->UsbIo,
&Request,
EfiUsbDataIn,
USB_ETHERNET_TRANSFER_TIMEOUT,
PatternActive,
USB_ETH_POWER_FILTER_LENGTH,
&TransStatus
);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Convert 16bit integer in BCD encoding to decimal. */ | static gboolean convert_bcd_to_dec(guint16 bcd, guint16 *dec) | /* Convert 16bit integer in BCD encoding to decimal. */
static gboolean convert_bcd_to_dec(guint16 bcd, guint16 *dec) | {
gboolean rok = TRUE;
guint16 result = 0;
guint16 mult = 1;
while (bcd) {
if ((bcd & 0x0f) > 9)
rok = FALSE;
result += (bcd & 0x0f) * mult;
bcd >>= 4;
mult *= 10;
}
*dec = result;
return rok;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Returns NULL if no memory was available, else pointer to a list of ascbs. When this function returns, @num would be the number of SCBs which were not able to be allocated, 0 if all requested were able to be allocated. */ | struct asd_ascb* asd_ascb_alloc_list(struct asd_ha_struct *asd_ha, int *num, gfp_t gfp_flags) | /* Returns NULL if no memory was available, else pointer to a list of ascbs. When this function returns, @num would be the number of SCBs which were not able to be allocated, 0 if all requested were able to be allocated. */
struct asd_ascb* asd_ascb_alloc_list(struct asd_ha_struct *asd_ha, int *num, gfp_t gfp_flags) | {
struct asd_ascb *first = NULL;
for ( ; *num > 0; --*num) {
struct asd_ascb *ascb = asd_ascb_alloc(asd_ha, gfp_flags);
if (!ascb)
break;
else if (!first)
first = ascb;
else {
struct asd_ascb *last = list_entry(first->list.prev,
struct asd_ascb,
list);
list_add_tail(&ascb->list, &first->list);
last->scb->header.next_scb =
cpu_to_le64(((u64)ascb->dma_scb.dma_handle));
}
}
return first;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* __usb_get_extra_descriptor() finds a descriptor of specific type in the extra field of the interface and endpoint descriptor structs. */ | int __usb_get_extra_descriptor(char *buffer, unsigned size, unsigned char type, void **ptr) | /* __usb_get_extra_descriptor() finds a descriptor of specific type in the extra field of the interface and endpoint descriptor structs. */
int __usb_get_extra_descriptor(char *buffer, unsigned size, unsigned char type, void **ptr) | {
struct usb_descriptor_header *header;
while (size >= sizeof(struct usb_descriptor_header)) {
header = (struct usb_descriptor_header *)buffer;
if (header->bLength < 2) {
printk(KERN_ERR
"%s: bogus descriptor, type %d length %d\n",
usbcore_name,
header->bDescriptorType,
header->bLength);
return -1;
}
if (header->bDescriptorType == type) {
*ptr = header;
return 0;
}
buffer += header->bLength;
size -= header->bLength;
}
return -1;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* ks_inblk - read a block of data from QMU. This is called after sudo DMA mode enabled. @ks: The chip state @wptr: buffer address to save data @len: length in byte to read */ | static void ks_inblk(struct ks_net *ks, u16 *wptr, u32 len) | /* ks_inblk - read a block of data from QMU. This is called after sudo DMA mode enabled. @ks: The chip state @wptr: buffer address to save data @len: length in byte to read */
static void ks_inblk(struct ks_net *ks, u16 *wptr, u32 len) | {
len >>= 1;
while (len--)
*wptr++ = (u16)ioread16(ks->hw_addr);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* There's still some voodoo going on here, but it's a lot better than in the first incarnation of the driver where all we had was the raw numbers from the initialization sequence. */ | static int ltv350qv_write_reg(struct ltv350qv *lcd, u8 reg, u16 val) | /* There's still some voodoo going on here, but it's a lot better than in the first incarnation of the driver where all we had was the raw numbers from the initialization sequence. */
static int ltv350qv_write_reg(struct ltv350qv *lcd, u8 reg, u16 val) | {
struct spi_message msg;
struct spi_transfer index_xfer = {
.len = 3,
.cs_change = 1,
};
struct spi_transfer value_xfer = {
.len = 3,
};
spi_message_init(&msg);
lcd->buffer[0] = LTV_OPC_INDEX;
lcd->buffer[1] = 0x00;
lcd->buffer[2] = reg & 0x7f;
index_xfer.tx_buf = lcd->buffer;
spi_message_add_tail(&index_xfer, &msg);
lcd->buffer[4] = LTV_OPC_DATA;
lcd->buffer[5] = val >> 8;
lcd->buffer[6] = val;
value_xfer.tx_buf = lcd->buffer + 4;
spi_message_add_tail(&value_xfer, &msg);
return spi_sync(lcd->spi, &msg);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Decode and handle standard end point requests originating on the control end point. */ | static void prvHandleStandardEndPointRequest(xUSB_REQUEST *pxRequest) | /* Decode and handle standard end point requests originating on the control end point. */
static void prvHandleStandardEndPointRequest(xUSB_REQUEST *pxRequest) | {
switch( pxRequest->ucRequest )
{
case usbGET_STATUS_REQUEST:
case usbCLEAR_FEATURE_REQUEST:
case usbSET_FEATURE_REQUEST:
default: prvSendStall();
break;
}
} | apopple/Pandaboard-FreeRTOS | C++ | null | 25 |
/* If HmacMdContext is NULL, then return FALSE. If HmacValue is NULL, then return FALSE. */ | STATIC BOOLEAN HmacMdFinal(IN OUT VOID *HmacMdContext, OUT UINT8 *HmacValue) | /* If HmacMdContext is NULL, then return FALSE. If HmacValue is NULL, then return FALSE. */
STATIC BOOLEAN HmacMdFinal(IN OUT VOID *HmacMdContext, OUT UINT8 *HmacValue) | {
INT32 Ret;
if ((HmacMdContext == NULL) || (HmacValue == NULL)) {
return FALSE;
}
Ret = mbedtls_md_hmac_finish (HmacMdContext, HmacValue);
if (Ret != 0) {
return FALSE;
}
Ret = mbedtls_md_hmac_reset (HmacMdContext);
if (Ret != 0) {
return FALSE;
}
return TRUE;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* -EBADF : Invalid @fd file descriptor. -EINVAL : The @fd file descriptor is not an eventfd file. */ | struct file* eventfd_fget(int fd) | /* -EBADF : Invalid @fd file descriptor. -EINVAL : The @fd file descriptor is not an eventfd file. */
struct file* eventfd_fget(int fd) | {
struct file *file;
file = fget(fd);
if (!file)
return ERR_PTR(-EBADF);
if (file->f_op != &eventfd_fops) {
fput(file);
return ERR_PTR(-EINVAL);
}
return file;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This function will find an usb interface object. */ | uintf_t rt_usbd_find_interface(udevice_t device, rt_uint8_t value, ufunction_t *pfunc) | /* This function will find an usb interface object. */
uintf_t rt_usbd_find_interface(udevice_t device, rt_uint8_t value, ufunction_t *pfunc) | {
struct rt_list_node *i, *j;
ufunction_t func;
uintf_t intf;
LOG_D("rt_usbd_find_interface");
RT_ASSERT(device != RT_NULL);
RT_ASSERT(value < device->nr_intf);
for (i=device->curr_cfg->func_list.next;
i!=&device->curr_cfg->func_list; i=i->next)
{
func = (ufunction_t)rt_list_entry(i, struct ufunction, list);
for(j=func->intf_list.next; j!=&func->intf_list; j=j->next)
{
intf = (uintf_t)rt_list_entry(j, struct uinterface, list);
if(intf->intf_num == value)
{
if (pfunc != RT_NULL)
*pfunc = func;
return intf;
}
}
}
rt_kprintf("can't find interface %d\n", value);
return RT_NULL;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Deinitializes the EXTI peripheral registers to their default reset values. */ | void EXTI_DeInit(void) | /* Deinitializes the EXTI peripheral registers to their default reset values. */
void EXTI_DeInit(void) | {
EXTI->IMASK = 0x00000000;
EXTI->EMASK = 0x00000000;
EXTI->RT_CFG = 0x00000000;
EXTI->FT_CFG = 0x00000000;
EXTI->PEND = 0x000FFFFF;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* This function will initial FM3 Easy Kit board. */ | void rt_hw_board_init() | /* This function will initial FM3 Easy Kit board. */
void rt_hw_board_init() | {
SysTick_Config(SystemFrequency/RT_TICK_PER_SECOND);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Cleanup any internal state and resources that were allocated by the HwInfoParser. */ | EFI_STATUS EFIAPI HwInfoParserShutdown(IN HW_INFO_PARSER_HANDLE ParserHandle) | /* Cleanup any internal state and resources that were allocated by the HwInfoParser. */
EFI_STATUS EFIAPI HwInfoParserShutdown(IN HW_INFO_PARSER_HANDLE ParserHandle) | {
if (ParserHandle == NULL) {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
FreePool (ParserHandle);
return EFI_SUCCESS;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Allocates the number of 4KB pages of type EfiRuntimeServicesData and returns a pointer to the allocated buffer. The buffer returned is aligned on a 4KB boundary. If Pages is 0, then NULL is returned. If there is not enough memory remaining to satisfy the request, then NULL is returned. */ | VOID* EFIAPI AllocateRuntimePages(IN UINTN Pages) | /* Allocates the number of 4KB pages of type EfiRuntimeServicesData and returns a pointer to the allocated buffer. The buffer returned is aligned on a 4KB boundary. If Pages is 0, then NULL is returned. If there is not enough memory remaining to satisfy the request, then NULL is returned. */
VOID* EFIAPI AllocateRuntimePages(IN UINTN Pages) | {
return InternalAllocatePages (Pages, EfiRuntimeServicesData);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Remove the RX callback function. This function is usually invoked from the RX callback itself. Once the callback has resumed the application task, there is no need to invoke the callback again. */ | void EMAC_Clear_RxCb(void) | /* Remove the RX callback function. This function is usually invoked from the RX callback itself. Once the callback has resumed the application task, there is no need to invoke the callback again. */
void EMAC_Clear_RxCb(void) | {
AT91C_BASE_EMAC->EMAC_IDR = AT91C_EMAC_RCOMP;
rxTd.rxCb = (EMAC_RxCallback) 0;
} | apopple/Pandaboard-FreeRTOS | C++ | null | 25 |
/* Look up the instance of a policy handle value in whose range of frames the specified frame falls. */ | static pol_value* find_pol_handle(e_ctx_hnd *policy_hnd, guint32 frame, pol_hash_value **valuep) | /* Look up the instance of a policy handle value in whose range of frames the specified frame falls. */
static pol_value* find_pol_handle(e_ctx_hnd *policy_hnd, guint32 frame, pol_hash_value **valuep) | {
pol_hash_key key;
pol_value *pol;
memcpy(&key.policy_hnd, policy_hnd, sizeof(key.policy_hnd));
if ((*valuep = (pol_hash_value *)g_hash_table_lookup(pol_hash, &key))) {
for (pol = (*valuep)->list; pol != NULL; pol = pol->next) {
if (pol->first_frame <= frame &&
(pol->last_frame == 0 ||
pol->last_frame >= frame))
break;
}
return pol;
} else {
return NULL;
}
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* IDL long NetrLogonUasLogon( IDL wchar_t *ServerName, IDL wchar_t *UserName, IDL wchar_t *Workstation, IDL VALIDATION_UAS_INFO *info IDL ); */ | static int netlogon_dissect_netrlogonuaslogon_rqst(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) | /* IDL long NetrLogonUasLogon( IDL wchar_t *ServerName, IDL wchar_t *UserName, IDL wchar_t *Workstation, IDL VALIDATION_UAS_INFO *info IDL ); */
static int netlogon_dissect_netrlogonuaslogon_rqst(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) | {
offset = netlogon_dissect_LOGONSRV_HANDLE(tvb, offset,
pinfo, tree, di, drep);
offset = dissect_ndr_str_pointer_item(tvb, offset, pinfo, tree, di, drep,
NDR_POINTER_REF, "Account", hf_netlogon_acct_name, CB_STR_COL_INFO);
offset = dissect_ndr_str_pointer_item(tvb, offset, pinfo, tree, di, drep,
NDR_POINTER_REF, "Workstation", hf_netlogon_workstation, 0);
return offset;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Writes and returns a new value to DR4. This function is only available on IA-32 and x64. This writes a 32-bit value on IA-32 and a 64-bit value on x64. */ | UINTN EFIAPI AsmWriteDr4(IN UINTN Value) | /* Writes and returns a new value to DR4. This function is only available on IA-32 and x64. This writes a 32-bit value on IA-32 and a 64-bit value on x64. */
UINTN EFIAPI AsmWriteDr4(IN UINTN Value) | {
_asm {
mov eax, Value
_emit 0x0f
_emit 0x23
_emit 0xe0
}
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Registers an interrupt handler for the quadrature encoder interrupt. */ | void QEIIntRegister(unsigned long ulBase, void(*pfnHandler)(void)) | /* Registers an interrupt handler for the quadrature encoder interrupt. */
void QEIIntRegister(unsigned long ulBase, void(*pfnHandler)(void)) | {
unsigned long ulInt;
ASSERT((ulBase == QEI0_BASE) || (ulBase == QEI1_BASE));
ulInt = (ulBase == QEI0_BASE) ? INT_QEI0 : INT_QEI1;
IntRegister(ulInt, pfnHandler);
IntEnable(ulInt);
} | watterott/WebRadio | C++ | null | 71 |
/* The function is used to read Rx data from RX FIFO. */ | uint32_t SCUART_Read(SC_T *sc, uint8_t pu8RxBuf[], uint32_t u32ReadBytes) | /* The function is used to read Rx data from RX FIFO. */
uint32_t SCUART_Read(SC_T *sc, uint8_t pu8RxBuf[], uint32_t u32ReadBytes) | {
uint32_t u32Count;
for(u32Count = 0UL; u32Count < u32ReadBytes; u32Count++)
{
if(SCUART_GET_RX_EMPTY(sc))
{
break;
}
pu8RxBuf[u32Count] = (uint8_t)SCUART_READ(sc);
}
return u32Count;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* It updates the Ports handle stating the ending of RX phase. */ | void HW_IF_RX_Disable(uint8_t PortNum) | /* It updates the Ports handle stating the ending of RX phase. */
void HW_IF_RX_Disable(uint8_t PortNum) | {
Ports[PortNum].State = HAL_USBPD_PORT_STATE_READY;
if (Ports[PortNum].cbs.USBPD_HW_IF_ReceiveMessage != NULL)
{
__NOP();
}
} | st-one/X-CUBE-USB-PD | C++ | null | 110 |
/* strchr - Find the first occurrence of a character in a string @s: The string to be searched */ | char* strchr(const char *s, int c) | /* strchr - Find the first occurrence of a character in a string @s: The string to be searched */
char* strchr(const char *s, int c) | {
for (; *s != (char)c; ++s)
if (*s == '\0')
return NULL;
return (char *)s;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Check key buffer to get the key stroke status. */ | EFI_STATUS EFIAPI VirtualKeyboardCheckForKey(IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL *This) | /* Check key buffer to get the key stroke status. */
EFI_STATUS EFIAPI VirtualKeyboardCheckForKey(IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL *This) | {
VIRTUAL_KEYBOARD_DEV *VirtualKeyboardPrivate;
VirtualKeyboardPrivate = VIRTUAL_KEYBOARD_DEV_FROM_THIS (This);
return CheckQueue (&VirtualKeyboardPrivate->Queue);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Returns an async_cookie_t that may be used for checkpointing later. Note: This function may be called from atomic or non-atomic contexts. */ | async_cookie_t async_schedule(async_func_ptr *ptr, void *data) | /* Returns an async_cookie_t that may be used for checkpointing later. Note: This function may be called from atomic or non-atomic contexts. */
async_cookie_t async_schedule(async_func_ptr *ptr, void *data) | {
return __async_schedule(ptr, data, &async_running);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Start High Frequency Crystal Oscillator.
Oscillator needs to be running for the radio to work. */ | void clock_start_hfclk(bool wait) | /* Start High Frequency Crystal Oscillator.
Oscillator needs to be running for the radio to work. */
void clock_start_hfclk(bool wait) | {
periph_trigger_task(CLOCK_TASK_HFCLKSTART);
if (wait) {
while(!(CLOCK_HFCLKSTAT & CLOCK_HFCLKSTAT_STATE));
}
} | insane-adding-machines/unicore-mx | C++ | GNU General Public License v3.0 | 50 |
/* Set a new parent for an object. Its relative position will be the same. */ | void lv_obj_set_parent(lv_obj_t *obj, lv_obj_t *parent) | /* Set a new parent for an object. Its relative position will be the same. */
void lv_obj_set_parent(lv_obj_t *obj, lv_obj_t *parent) | {
if(obj->par == NULL) {
LV_LOG_WARN("Can't set the parent of a screen");
return;
}
if(parent == NULL) {
LV_LOG_WARN("Can't set parent == NULL to an object");
return;
}
lv_obj_invalidate(obj);
lv_point_t old_pos;
old_pos.x = lv_obj_get_x(obj);
old_pos.y = lv_obj_get_y(obj);
lv_obj_t * old_par = obj->par;
lv_ll_chg_list(&obj->par->child_ll, &parent->child_ll, obj);
obj->par = parent;
lv_obj_set_pos(obj, old_pos.x, old_pos.y);
old_par->signal_func(old_par, LV_SIGNAL_CHILD_CHG, NULL);
parent->signal_func(parent, LV_SIGNAL_CHILD_CHG, obj);
lv_obj_invalidate(obj);
} | RavenSystem/esp-homekit-devices | C++ | Other | 2,577 |
/* Kill the altpath contents of a da-state structure. */ | STATIC void xfs_da_state_kill_altpath(xfs_da_state_t *state) | /* Kill the altpath contents of a da-state structure. */
STATIC void xfs_da_state_kill_altpath(xfs_da_state_t *state) | {
int i;
for (i = 0; i < state->altpath.active; i++) {
if (state->altpath.blk[i].bp) {
if (state->altpath.blk[i].bp != state->path.blk[i].bp)
xfs_da_buf_done(state->altpath.blk[i].bp);
state->altpath.blk[i].bp = NULL;
}
}
state->altpath.active = 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Set boot source from LDROM or APROM after next software reset. */ | void FMC_SetBootSource(int32_t i32BootSrc) | /* Set boot source from LDROM or APROM after next software reset. */
void FMC_SetBootSource(int32_t i32BootSrc) | {
if (i32BootSrc) {
FMC->ISPCTL |= FMC_ISPCTL_BS_Msk;
} else {
FMC->ISPCTL &= ~FMC_ISPCTL_BS_Msk;
}
} | ARMmbed/DAPLink | C++ | Apache License 2.0 | 2,140 |
/* Programs the desired OPP value for the defined voltage rail. This should be called from board files if reconfiguration is desired. Returns 0 on success, negative error value on failure. */ | int k3_avs_set_opp(struct udevice *dev, int vdd_id, int opp_id) | /* Programs the desired OPP value for the defined voltage rail. This should be called from board files if reconfiguration is desired. Returns 0 on success, negative error value on failure. */
int k3_avs_set_opp(struct udevice *dev, int vdd_id, int opp_id) | {
struct k3_avs_privdata *priv = dev_get_priv(dev);
struct vd_data *vd;
vd = get_vd(priv, vdd_id);
if (!vd)
return -EINVAL;
return k3_avs_program_voltage(priv, vd, opp_id);
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* display a header line followed by a load of volume lines */ | static int afs_proc_cell_vlservers_show(struct seq_file *m, void *v) | /* display a header line followed by a load of volume lines */
static int afs_proc_cell_vlservers_show(struct seq_file *m, void *v) | {
struct in_addr *addr = v;
if (v == (struct in_addr *) 1) {
seq_puts(m, "ADDRESS\n");
return 0;
}
seq_printf(m, "%pI4\n", &addr->s_addr);
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Initializes the end address of the ST25DV areas with their default values (end of memory).
Needs the I2C Password presentation to be effective.. The ST25DV answers a NACK when setting the EndZone2 & EndZone3 to same value than respectively EndZone1 & EndZone2. These NACKs are ok. */ | int32_t BSP_NFCTAG_InitEndZone(uint32_t Instance) | /* Initializes the end address of the ST25DV areas with their default values (end of memory).
Needs the I2C Password presentation to be effective.. The ST25DV answers a NACK when setting the EndZone2 & EndZone3 to same value than respectively EndZone1 & EndZone2. These NACKs are ok. */
int32_t BSP_NFCTAG_InitEndZone(uint32_t Instance) | {
UNUSED(Instance);
return ST25DV_InitEndZone(&NfcTagObj);
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* get aligned address and the number of cachline to be invalied
example 2: addr = 0x104 (cacheline unaligned), size = 64 then head = 0x100, number of cache line to be invalidated = 1 + 64 / 32 = 3 which means range [0x100, 0x160) will be invalidated */ | static uint32_t get_n_cacheline(uint32_t addr, uint32_t size, uint32_t *p_head) | /* get aligned address and the number of cachline to be invalied
example 2: addr = 0x104 (cacheline unaligned), size = 64 then head = 0x100, number of cache line to be invalidated = 1 + 64 / 32 = 3 which means range [0x100, 0x160) will be invalidated */
static uint32_t get_n_cacheline(uint32_t addr, uint32_t size, uint32_t *p_head) | {
uint32_t n = 0;
uint32_t tail;
*p_head = CACHE_ALIGNED_ADDR(addr);
tail = addr + size + (CACHE_LINE_SIZE - 1);
tail = CACHE_ALIGNED_ADDR(tail);
n = (tail - *p_head) >> CACHE_LINE_SIZE_LOG2;
return n;
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* returns : mcu output on success : %-ETIMEDOUT on timeout */ | int jornada_ssp_byte(u8 byte) | /* returns : mcu output on success : %-ETIMEDOUT on timeout */
int jornada_ssp_byte(u8 byte) | {
int timeout = 400000;
u16 ret;
while ((GPLR & GPIO_GPIO10)) {
if (!--timeout) {
printk(KERN_WARNING "SSP: timeout while waiting for transmit\n");
return -ETIMEDOUT;
}
cpu_relax();
}
ret = jornada_ssp_reverse(byte) << 8;
ssp_write_word(ret);
ssp_read_word(&ret);
return jornada_ssp_reverse(ret);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Sets the register in the LCD controller to write commands to. */ | static EMSTATUS setNextReg(uint8_t reg) | /* Sets the register in the LCD controller to write commands to. */
static EMSTATUS setNextReg(uint8_t reg) | {
uint16_t data;
data = ((uint16_t) reg) << 1;
DVK_writeRegister( (uint16_t *) command_register, 0 );
DVK_writeRegister( (uint16_t *) command_register, data );
return DMD_OK;
} | 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.