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 |
|---|---|---|---|---|---|---|---|
/* This API gets the output for activity feature. */ | uint16_t bma423_activity_output(uint8_t *activity, struct bma4_dev *dev) | /* This API gets the output for activity feature. */
uint16_t bma423_activity_output(uint8_t *activity, struct bma4_dev *dev) | {
uint8_t data = 0;
uint16_t rslt = BMA4_OK;
if (dev != NULL) {
if (dev->chip_id == BMA423_CHIP_ID) {
rslt = bma4_read_regs(BMA4_ACTIVITY_OUT_ADDR, &data, 1, dev);
if (rslt == BMA4_OK)
*activity = data;
} else {
rslt = BMA4_E_INVALID_SENSOR;
}
} else {
rslt = BMA4_E_NULL_PTR;
}
return rslt;
} | arendst/Tasmota | C++ | GNU General Public License v3.0 | 21,318 |
/* Change Logs: Date Author Notes Bernard first version from QiuYi implementation */ | void rt_hw_show_memory(rt_uint32_t addr, rt_uint32_t size) | /* Change Logs: Date Author Notes Bernard first version from QiuYi implementation */
void rt_hw_show_memory(rt_uint32_t addr, rt_uint32_t size) | {
int i = 0, j =0;
RT_ASSERT(addr);
addr = addr & ~0xF;
size = 4*((size + 3)/4);
while(i < size)
{
rt_kprintf("0x%08x: ", addr );
for(j=0; j<4; j++)
{
rt_kprintf("0x%08x ", *(rt_uint32_t *)addr);
addr += 4;
i++;
}
rt_kprintf("\n");
}
return;
} | armink/FreeModbus_Slave-Master-RTT-STM32 | C++ | Other | 1,477 |
/* add data to the start of a buffer */ | void* skb_push(sk_buff *p, unsigned int len) | /* add data to the start of a buffer */
void* skb_push(sk_buff *p, unsigned int len) | {
p->data -= len;
p->len += len;
if (p->data < p->head)
printf("%s: failed", __FUNCTION__);
return p->data;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Can be used to emulate code execution time. */ | void posix_cpu_hold(uint32_t usec_to_waste) | /* Can be used to emulate code execution time. */
void posix_cpu_hold(uint32_t usec_to_waste) | {
uint64_t time_start;
int64_t to_wait = usec_to_waste;
while (to_wait > 0) {
time_start = nsi_hws_get_time();
hwtimer_wake_in_time(time_start + to_wait);
posix_change_cpu_state_and_wait(true);
to_wait -= nsi_hws_get_time() - time_start;
posix_irq_handler();
}
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* param base SAI base pointer. param handle SAI eDMA handle pointer. param count Bytes count sent by SAI. retval kStatus_Success Succeed get the transfer count. retval kStatus_NoTransferInProgress There is no non-blocking transaction in progress. */ | status_t SAI_TransferGetSendCountEDMA(I2S_Type *base, sai_edma_handle_t *handle, size_t *count) | /* param base SAI base pointer. param handle SAI eDMA handle pointer. param count Bytes count sent by SAI. retval kStatus_Success Succeed get the transfer count. retval kStatus_NoTransferInProgress There is no non-blocking transaction in progress. */
status_t SAI_TransferGetSendCountEDMA(I2S_Type *base, sai_edma_handle_t *handle, size_t *count) | {
assert(handle);
status_t status = kStatus_Success;
if (handle->state != kSAI_Busy)
{
status = kStatus_NoTransferInProgress;
}
else
{
*count = (handle->transferSize[handle->queueDriver] -
(uint32_t)handle->nbytes *
EDMA_GetRemainingMajorLoopCount(handle->dmaHandle->base, handle->dmaHandle->channel));
}
return status;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Set the display top left drawing limit.
Use this function to set the top left limit of the drawing limit box. */ | void ili93xx_set_top_left_limit(ili93xx_coord_t x, ili93xx_coord_t y) | /* Set the display top left drawing limit.
Use this function to set the top left limit of the drawing limit box. */
void ili93xx_set_top_left_limit(ili93xx_coord_t x, ili93xx_coord_t y) | {
limit_start_x = x;
limit_start_y = y;
ili93xx_send_draw_limits(false);
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* sets the port maximum Tx frame size
This function is fully documented in the main header file, IxEthDB.h. */ | IX_ETH_DB_PUBLIC IxEthDBStatus ixEthDBFilteringPortMaximumTxFrameSizeSet(IxEthDBPortId portID, UINT32 maximumTxFrameSize) | /* sets the port maximum Tx frame size
This function is fully documented in the main header file, IxEthDB.h. */
IX_ETH_DB_PUBLIC IxEthDBStatus ixEthDBFilteringPortMaximumTxFrameSizeSet(IxEthDBPortId portID, UINT32 maximumTxFrameSize) | {
IX_ETH_DB_CHECK_PORT_EXISTS(portID);
IX_ETH_DB_CHECK_SINGLE_NPE(portID);
if (!ixEthDBPortInfo[portID].initialized)
{
return IX_ETH_DB_PORT_UNINITIALIZED;
}
if (ixEthDBPortDefinitions[portID].type == IX_ETH_NPE)
{
if ((maximumTxFrameSize < IX_ETHDB_MIN_NPE_FRAME_SIZE) ||
(maximumTxFrameSize > IX_ETHDB_MAX_NPE_FRAME_SIZE))
{
return IX_ETH_DB_INVALID_ARG;
}
}
else
{
return IX_ETH_DB_NO_PERMISSION;
}
ixEthDBPortInfo[portID].maxTxFrameSize = maximumTxFrameSize;
return ixEthDBPortFrameLengthsUpdate(portID);
} | EmcraftSystems/u-boot | C++ | Other | 181 |
/* If the requested operation results in an overflow or an underflow condition, then Result is set to INT64_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */ | RETURN_STATUS EFIAPI SafeInt64Add(IN INT64 Augend, IN INT64 Addend, OUT INT64 *Result) | /* If the requested operation results in an overflow or an underflow condition, then Result is set to INT64_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */
RETURN_STATUS EFIAPI SafeInt64Add(IN INT64 Augend, IN INT64 Addend, OUT INT64 *Result) | {
RETURN_STATUS Status;
if (Result == NULL) {
return RETURN_INVALID_PARAMETER;
}
if (((Addend > 0) && (Augend > (MAX_INT64 - Addend))) ||
((Addend < 0) && (Augend < (MIN_INT64 - Addend))))
{
*Result = INT64_ERROR;
Status = RETURN_BUFFER_TOO_SMALL;
} else {
*Result = Augend + Addend;
Status = RETURN_SUCCESS;
}
return Status;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* This service removes the handler associated with DispatchHandle so that it will no longer be called in response to a software SMI. */ | EFI_STATUS EFIAPI SmmSwDispatch2UnRegister(IN CONST EFI_SMM_SW_DISPATCH2_PROTOCOL *This, IN EFI_HANDLE DispatchHandle) | /* This service removes the handler associated with DispatchHandle so that it will no longer be called in response to a software SMI. */
EFI_STATUS EFIAPI SmmSwDispatch2UnRegister(IN CONST EFI_SMM_SW_DISPATCH2_PROTOCOL *This, IN EFI_HANDLE DispatchHandle) | {
EFI_SMM_SW_DISPATCH2_CONTEXT *Context;
Context = FindContextByDispatchHandle (DispatchHandle);
ASSERT (Context != NULL);
if (Context != NULL) {
RemoveEntryList (&Context->Link);
gSmst->SmmFreePool (Context);
}
return EFI_SUCCESS;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Q7 softmax function.
The relative output will be different here. But mathematically, the gradient will be the same with a log(2) scaling factor. */ | void arm_softmax_q7(const q7_t *vec_in, const uint16_t dim_vec, q7_t *p_out) | /* Q7 softmax function.
The relative output will be different here. But mathematically, the gradient will be the same with a log(2) scaling factor. */
void arm_softmax_q7(const q7_t *vec_in, const uint16_t dim_vec, q7_t *p_out) | {
q31_t sum;
int16_t i;
uint8_t shift;
q15_t base;
base = -128;
for (i = 0; i < dim_vec; i++)
{
if (vec_in[i] > base)
{
base = vec_in[i];
}
}
base = base - (1 << 3);
sum = 0;
for (i = 0; i < dim_vec; i++)
{
shift = (uint8_t)__USAT(vec_in[i] - base, 3);
sum += 0x1 << shift;
}
int output_base = (1 << 20) / sum;
for (i = 0; i < dim_vec; i++)
{
shift = (uint8_t)__USAT(13 + base - vec_in[i], 5);
p_out[i] = (q7_t)__SSAT((output_base >> shift), 8);
}
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* Assemble the address part of a command for AT45 devices in non-power-of-two page size mode. */ | static void at45_build_address(struct atmel_spi_flash *asf, u8 *cmd, u32 offset) | /* Assemble the address part of a command for AT45 devices in non-power-of-two page size mode. */
static void at45_build_address(struct atmel_spi_flash *asf, u8 *cmd, u32 offset) | {
unsigned long page_addr;
unsigned long byte_addr;
unsigned long page_size;
unsigned int page_shift;
page_shift = asf->params->l2_page_size;
page_size = (1 << page_shift) + (1 << (page_shift - 5));
page_shift++;
page_addr = offset / page_size;
byte_addr = offset % page_size;
cmd[0] = page_addr >> (16 - page_shift);
cmd[1] = page_addr << (page_shift - 8) | (byte_addr >> 8);
cmd[2] = byte_addr;
} | EmcraftSystems/u-boot | C++ | Other | 181 |
/* Configure the mode and trigger source of a sample sequence. */ | void xADCConfigure(unsigned long ulBase, unsigned long ulMode, unsigned long ulTrigger) | /* Configure the mode and trigger source of a sample sequence. */
void xADCConfigure(unsigned long ulBase, unsigned long ulMode, unsigned long ulTrigger) | {
unsigned long ulConfig;
xASSERT(ulBase == xADC0_BASE);
xASSERT(ulMode == xADC_MODE_SCAN_SINGLE_CYCLE);
xASSERT((ulTrigger == ADC_TRIGGER_PROCESSOR) ||
(ulTrigger == (xADC_TRIGGER_EXT_PD2 |
xADC_TRIGGER_EXT_FALLING_EDGE)) ||
(ulTrigger == (xADC_TRIGGER_EXT_PD2 |
xADC_TRIGGER_EXT_RISING_EDGE))
);
ulConfig = ulMode | ulTrigger;
xHWREG(ulBase + ADC_CR) &= ~(ADC_CR_TRGEN | ADC_CR_TRGCOND_FALLING);
xHWREG(ulBase + ADC_CR) |= ulConfig;
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* ipath_eeprom_read - receives bytes from the eeprom via I2C @dd: the infinipath device @eeprom_offset: address to read from @buffer: where to store result @len: number of bytes to receive */ | int ipath_eeprom_read(struct ipath_devdata *dd, u8 eeprom_offset, void *buff, int len) | /* ipath_eeprom_read - receives bytes from the eeprom via I2C @dd: the infinipath device @eeprom_offset: address to read from @buffer: where to store result @len: number of bytes to receive */
int ipath_eeprom_read(struct ipath_devdata *dd, u8 eeprom_offset, void *buff, int len) | {
int ret;
ret = mutex_lock_interruptible(&dd->ipath_eep_lock);
if (!ret) {
ret = ipath_eeprom_internal_read(dd, eeprom_offset, buff, len);
mutex_unlock(&dd->ipath_eep_lock);
}
return ret;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Checks whether the specified interrupt has occurred or not. */ | uint8_t ADC_ReadIntFlag(ADC_INT_FLAG_T flag) | /* Checks whether the specified interrupt has occurred or not. */
uint8_t ADC_ReadIntFlag(ADC_INT_FLAG_T flag) | {
uint8_t intEnable;
uint8_t intStatus;
intEnable = (uint8_t)(ADC->INT& (uint32_t)flag);
intStatus = (uint8_t)(ADC->STS & (uint32_t)(flag & 0xff));
if (intEnable && intStatus)
{
return SET;
}
return RESET;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* USB Device Remote Wakeup Configuration Function Parameters: cfg: Device Enable/Disable Return Value: None */ | void USBD_WakeUpCfg(BOOL cfg) | /* USB Device Remote Wakeup Configuration Function Parameters: cfg: Device Enable/Disable Return Value: None */
void USBD_WakeUpCfg(BOOL cfg) | {
if (cfg) {
} else {
UDPHS->UDPHS_CTRL &= ~UDPHS_CTRL_REWAKEUP;
UDPHS->UDPHS_IEN &= ~UDPHS_IEN_UPSTR_RES;
}
} | ARMmbed/DAPLink | C++ | Apache License 2.0 | 2,140 |
/* IDL typedef struct { IDL bool SensitiveDataFlag; IDL long DataLength; IDL char *SensitiveData; IDL } USER_PRIVATE_INFO; */ | static int netlogon_dissect_SENSITIVE_DATA(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) | /* IDL typedef struct { IDL bool SensitiveDataFlag; IDL long DataLength; IDL char *SensitiveData; IDL } USER_PRIVATE_INFO; */
static int netlogon_dissect_SENSITIVE_DATA(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) | {
guint32 data_len;
if(di->conformant_run){
return offset;
}
offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, di, drep,
hf_netlogon_sensitive_data_len, &data_len);
proto_tree_add_item(tree, hf_netlogon_sensitive_data, tvb, offset,
data_len, ENC_NA);
offset += data_len;
return offset;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* scsi_strcpy_devinfo: called from scsi_dev_info_list_add to copy into devinfo vendor and model strings. */ | static void scsi_strcpy_devinfo(char *name, char *to, size_t to_length, char *from, int compatible) | /* scsi_strcpy_devinfo: called from scsi_dev_info_list_add to copy into devinfo vendor and model strings. */
static void scsi_strcpy_devinfo(char *name, char *to, size_t to_length, char *from, int compatible) | {
size_t from_length;
from_length = strlen(from);
strncpy(to, from, min(to_length, from_length));
if (from_length < to_length) {
if (compatible) {
to[from_length] = '\0';
} else {
strncpy(&to[from_length], spaces,
to_length - from_length);
}
}
if (from_length > to_length)
printk(KERN_WARNING "%s: %s string '%s' is too long\n",
__func__, name, from);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Set I2C frequency.
In addition to Standard (100kHz) and Fast (400kHz) modes this peripheral also supports 250kHz mode. */ | void i2c_set_frequency(uint32_t i2c, uint32_t freq) | /* Set I2C frequency.
In addition to Standard (100kHz) and Fast (400kHz) modes this peripheral also supports 250kHz mode. */
void i2c_set_frequency(uint32_t i2c, uint32_t freq) | {
I2C_FREQUENCY(i2c) = freq;
} | libopencm3/libopencm3 | C++ | GNU General Public License v3.0 | 2,931 |
/* rpc_force_rebind - force transport to check that remote port is unchanged @clnt: client to rebind */ | void rpc_force_rebind(struct rpc_clnt *clnt) | /* rpc_force_rebind - force transport to check that remote port is unchanged @clnt: client to rebind */
void rpc_force_rebind(struct rpc_clnt *clnt) | {
if (clnt->cl_autobind)
xprt_clear_bound(clnt->cl_xprt);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Insert a node IP6_ADDRESS_INFO to an IP6 interface. */ | VOID Ip6AddAddr(IN OUT IP6_INTERFACE *IpIf, IN IP6_ADDRESS_INFO *AddrInfo) | /* Insert a node IP6_ADDRESS_INFO to an IP6 interface. */
VOID Ip6AddAddr(IN OUT IP6_INTERFACE *IpIf, IN IP6_ADDRESS_INFO *AddrInfo) | {
InsertHeadList (&IpIf->AddressList, &AddrInfo->Link);
IpIf->AddressCount++;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Add netlink and netfilter netlink headers to netlink message */ | int nfnlmsg_put(struct nl_msg *msg, uint32_t pid, uint32_t seq, uint8_t subsys_id, uint8_t type, int flags, uint8_t family, uint16_t res_id) | /* Add netlink and netfilter netlink headers to netlink message */
int nfnlmsg_put(struct nl_msg *msg, uint32_t pid, uint32_t seq, uint8_t subsys_id, uint8_t type, int flags, uint8_t family, uint16_t res_id) | {
struct nlmsghdr *nlh;
nlh = nlmsg_put(msg, pid, seq, NFNLMSG_TYPE(subsys_id, type), 0, flags);
if (nlh == NULL)
return -NLE_MSGSIZE;
return nfnlmsg_append(msg, family, res_id);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Send query command to EC to get the proper event number */ | int ec_query_event_num(void) | /* Send query command to EC to get the proper event number */
int ec_query_event_num(void) | {
return ec_query_seq(CMD_GET_EVENT_NUM);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Wait until the card becomes ready to accept a command via the command register. This tells us nothing about the completion status of any pending commands and takes very little time at all. */ | static void mc32_ready_poll(struct net_device *dev) | /* Wait until the card becomes ready to accept a command via the command register. This tells us nothing about the completion status of any pending commands and takes very little time at all. */
static void mc32_ready_poll(struct net_device *dev) | {
int ioaddr = dev->base_addr;
while(!(inb(ioaddr+HOST_STATUS)&HOST_STATUS_CRR));
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Returns 0 on success, something else on failure. */ | int sdl_init_video(void) | /* Returns 0 on success, something else on failure. */
int sdl_init_video(void) | {
return SDL_Init(SDL_INIT_VIDEO);
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Command response callback function for sd_ble_gattc_characteristics_discover BLE command.
Callback for decoding the command response return code. */ | static uint32_t gattc_characteristics_discover_rsp_dec(const uint8_t *p_buffer, uint16_t length) | /* Command response callback function for sd_ble_gattc_characteristics_discover BLE command.
Callback for decoding the command response return code. */
static uint32_t gattc_characteristics_discover_rsp_dec(const uint8_t *p_buffer, uint16_t length) | {
uint32_t result_code;
const uint32_t err_code = ble_gattc_characteristics_discover_rsp_dec(p_buffer,
length,
&result_code);
APP_ERROR_CHECK(err_code);
return result_code;
} | labapart/polymcu | C++ | null | 201 |
/* param base XRDC2 peripheral base address. param memSlot The memory slot to operate. param enable True to enable, false to disable. */ | void XRDC2_EnableMemSlotExclAccessLock(XRDC2_Type *base, xrdc2_mem_slot_t memSlot, bool enable) | /* param base XRDC2 peripheral base address. param memSlot The memory slot to operate. param enable True to enable, false to disable. */
void XRDC2_EnableMemSlotExclAccessLock(XRDC2_Type *base, xrdc2_mem_slot_t memSlot, bool enable) | {
if (enable)
{
base->MSCI_MSAC_WK[(uint32_t)memSlot].MSC_MSAC_W1 = XRDC2_EAL_UNLOCKED;
}
else
{
base->MSCI_MSAC_WK[(uint32_t)memSlot].MSC_MSAC_W1 = XRDC2_EAL_DISABLE_UNTIL_RESET;
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* If the driver core informs the DMA layer if a driver grabs a device we don't need to preallocate the protection domains anymore. For now we have to. */ | static void prealloc_protection_domains(void) | /* If the driver core informs the DMA layer if a driver grabs a device we don't need to preallocate the protection domains anymore. For now we have to. */
static void prealloc_protection_domains(void) | {
struct pci_dev *dev = NULL;
struct dma_ops_domain *dma_dom;
u16 devid;
while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) {
if (!check_device(&dev->dev))
continue;
if (domain_for_device(&dev->dev))
continue;
devid = get_device_id(&dev->dev);
dma_dom = dma_ops_domain_alloc();
if (!dma_dom)
continue;
init_unity_mappings_for_device(dma_dom, devid);
dma_dom->target_dev = devid;
attach_device(&dev->dev, &dma_dom->domain);
list_add_tail(&dma_dom->list, &iommu_pd_list);
}
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* NOTE: there's no dissector here, just registration routines to set up the dissector table for the Force10 OUI. */ | void proto_register_force10_oui(void) | /* NOTE: there's no dissector here, just registration routines to set up the dissector table for the Force10 OUI. */
void proto_register_force10_oui(void) | {
static hf_register_info hf[] = {
{ &hf_llc_force10_pid,
{ "PID", "llc.force10_pid", FT_UINT16, BASE_HEX,
VALS(force10_pid_vals), 0x0, NULL, HFILL }
}
};
llc_add_oui(OUI_FORCE10, "llc.force10_pid", "LLC FORCE10 OUI PID", hf, -1);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* @wss: local WSS to which neighbor wants to connect @dev_addr: neighbor's address @wssid: neighbor's WSSID - must be same as our WSS's WSSID @tag: neighbor's WSS tag used to identify frames transmitted by it @virt_addr: neighbor's virtual EUI-48 */ | static int wlp_wss_activate_connection(struct wlp *wlp, struct wlp_wss *wss, struct uwb_dev_addr *dev_addr, struct wlp_uuid *wssid, u8 *tag, struct uwb_mac_addr *virt_addr) | /* @wss: local WSS to which neighbor wants to connect @dev_addr: neighbor's address @wssid: neighbor's WSSID - must be same as our WSS's WSSID @tag: neighbor's WSS tag used to identify frames transmitted by it @virt_addr: neighbor's virtual EUI-48 */
static int wlp_wss_activate_connection(struct wlp *wlp, struct wlp_wss *wss, struct uwb_dev_addr *dev_addr, struct wlp_uuid *wssid, u8 *tag, struct uwb_mac_addr *virt_addr) | {
struct device *dev = &wlp->rc->uwb_dev.dev;
int result = 0;
if (!memcmp(wssid, &wss->wssid, sizeof(*wssid))) {
result = wlp_eda_update_node(&wlp->eda, dev_addr, wss,
(void *) virt_addr->data, *tag,
WLP_WSS_CONNECTED);
if (result < 0)
dev_err(dev, "WLP: Unable to update EDA cache "
"with new connected neighbor information.\n");
} else {
dev_err(dev, "WLP: Neighbor does not have matching WSSID.\n");
result = -EINVAL;
}
return result;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Returns : OK if disable interrupt succeeded, others if failed. */ | s32 interrupt_disable(u32 intno) | /* Returns : OK if disable interrupt succeeded, others if failed. */
s32 interrupt_disable(u32 intno) | {
return intc_disable_interrupt(intno);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* ‘G XX...’ Writes the new values received into the input buffer to the general registers */ | VOID EFIAPI WriteGeneralRegisters(IN EFI_SYSTEM_CONTEXT SystemContext, IN CHAR8 *InBuffer) | /* ‘G XX...’ Writes the new values received into the input buffer to the general registers */
VOID EFIAPI WriteGeneralRegisters(IN EFI_SYSTEM_CONTEXT SystemContext, IN CHAR8 *InBuffer) | {
UINTN i;
CHAR8 *InBufPtr;
UINTN MinLength;
UINTN RegisterCount = MaxRegisterCount ();
MinLength = (RegisterCount * 8) + 1;
if (AsciiStrLen (InBuffer) < MinLength) {
SendError (GDB_EBADBUFSIZE);
return;
}
InBufPtr = &InBuffer[1];
for (i = 0; i < RegisterCount; i++) {
InBufPtr = BasicWriteRegister (SystemContext, i, InBufPtr);
}
SendSuccess ();
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Calculates a 32-bit CRC value over the specified data. */ | LIBOPENBLT_EXPORT uint32_t BltUtilCrc32Calculate(uint8_t const *data, uint32_t len) | /* Calculates a 32-bit CRC value over the specified data. */
LIBOPENBLT_EXPORT uint32_t BltUtilCrc32Calculate(uint8_t const *data, uint32_t len) | {
uint32_t result = 0;
assert(data != NULL);
assert(len > 0);
if ( (data != NULL) && (len > 0) )
{
result = UtilChecksumCrc32Calculate(data, len);
}
return result;
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* Intialises the XHCI host controller and allocates the necessary data structures */ | int usb_lowlevel_init(int index, enum usb_init_type init, void **controller) | /* Intialises the XHCI host controller and allocates the necessary data structures */
int usb_lowlevel_init(int index, enum usb_init_type init, void **controller) | {
struct xhci_hccr *hccr;
struct xhci_hcor *hcor;
struct xhci_ctrl *ctrl;
int ret;
*controller = NULL;
if (xhci_hcd_init(index, &hccr, (struct xhci_hcor **)&hcor) != 0)
return -ENODEV;
if (xhci_reset(hcor) != 0)
return -ENODEV;
ctrl = &xhcic[index];
ctrl->hccr = hccr;
ctrl->hcor = hcor;
ret = xhci_lowlevel_init(ctrl);
if (ret) {
ctrl->hccr = NULL;
ctrl->hcor = NULL;
} else {
*controller = &xhcic[index];
}
return ret;
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Initializes ACLK, MCLK, SMCLK outputs on P11.0, P11.1, and P11.2, respectively. */ | void halBoardOutputSystemClock(void) | /* Initializes ACLK, MCLK, SMCLK outputs on P11.0, P11.1, and P11.2, respectively. */
void halBoardOutputSystemClock(void) | {
CLK_PORT_DIR |= 0x07;
CLK_PORT_SEL |= 0x07;
} | apopple/Pandaboard-FreeRTOS | C++ | null | 25 |
/* Updates the EEPROM checksum by reading/adding each word of the EEPROM up to the checksum. Then calculates the EEPROM checksum and writes the value to the EEPROM. */ | s32 e1000e_update_nvm_checksum_generic(struct e1000_hw *hw) | /* Updates the EEPROM checksum by reading/adding each word of the EEPROM up to the checksum. Then calculates the EEPROM checksum and writes the value to the EEPROM. */
s32 e1000e_update_nvm_checksum_generic(struct e1000_hw *hw) | {
s32 ret_val;
u16 checksum = 0;
u16 i, nvm_data;
for (i = 0; i < NVM_CHECKSUM_REG; i++) {
ret_val = e1000_read_nvm(hw, i, 1, &nvm_data);
if (ret_val) {
e_dbg("NVM Read Error while updating checksum.\n");
return ret_val;
}
checksum += nvm_data;
}
checksum = (u16) NVM_SUM - checksum;
ret_val = e1000_write_nvm(hw, NVM_CHECKSUM_REG, 1, &checksum);
if (ret_val)
e_dbg("NVM Write Error while updating checksum.\n");
return ret_val;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* @wm: WM97xx device to configure @mode: WM97XX_PRP value to configure while suspended */ | void wm97xx_set_suspend_mode(struct wm97xx *wm, u16 mode) | /* @wm: WM97xx device to configure @mode: WM97XX_PRP value to configure while suspended */
void wm97xx_set_suspend_mode(struct wm97xx *wm, u16 mode) | {
wm->suspend_mode = mode;
device_init_wakeup(&wm->input_dev->dev, mode != 0);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* ReportStatusCode() messages will no longer be forwarded to the Callback function. */ | EFI_STATUS EFIAPI Unregister(IN EFI_MM_RSC_HANDLER_CALLBACK Callback) | /* ReportStatusCode() messages will no longer be forwarded to the Callback function. */
EFI_STATUS EFIAPI Unregister(IN EFI_MM_RSC_HANDLER_CALLBACK Callback) | {
LIST_ENTRY *Link;
MM_RSC_HANDLER_CALLBACK_ENTRY *CallbackEntry;
if (Callback == NULL) {
return EFI_INVALID_PARAMETER;
}
for (Link = GetFirstNode (&mCallbackListHead); !IsNull (&mCallbackListHead, Link); Link = GetNextNode (&mCallbackListHead, Link)) {
CallbackEntry = CR (Link, MM_RSC_HANDLER_CALLBACK_ENTRY, Node, MM_RSC_HANDLER_CALLBACK_ENTRY_SIGNATURE);
if (CallbackEntry->RscHandlerCallback == Callback) {
RemoveEntryList (&CallbackEntry->Node);
FreePool (CallbackEntry);
return EFI_SUCCESS;
}
}
return EFI_NOT_FOUND;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* param base PDM base pointer param handle PDM eDMA handle pointer. param count Bytes count received by PDM. retval kStatus_Success Succeed get the transfer count. retval kStatus_NoTransferInProgress There is no non-blocking transaction in progress. */ | status_t PDM_TransferGetReceiveCountEDMA(PDM_Type *base, pdm_edma_handle_t *handle, size_t *count) | /* param base PDM base pointer param handle PDM eDMA handle pointer. param count Bytes count received by PDM. retval kStatus_Success Succeed get the transfer count. retval kStatus_NoTransferInProgress There is no non-blocking transaction in progress. */
status_t PDM_TransferGetReceiveCountEDMA(PDM_Type *base, pdm_edma_handle_t *handle, size_t *count) | {
assert(handle != NULL);
*count = handle->receivedBytes;
return kStatus_Success;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Enable selected CLKGEN Interrupts.
Use this function to enable the interrupts. */ | void am_hal_clkgen_int_enable(uint32_t ui32Interrupt) | /* Enable selected CLKGEN Interrupts.
Use this function to enable the interrupts. */
void am_hal_clkgen_int_enable(uint32_t ui32Interrupt) | {
AM_REG(CLKGEN, INTEN) |= ui32Interrupt;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Get one character from STDIO - used by the libc. */ | int getchar(void) | /* Get one character from STDIO - used by the libc. */
int getchar(void) | {
char c;
uart_stdio_read(&c, 1);
return c;
} | labapart/polymcu | C++ | null | 201 |
/* The current version is just a wrapper for LibTomMath library, so struct bignum is just typecast to mp_int. bignum_init - Allocate memory for bignum Returns: Pointer to allocated bignum or NULL on failure */ | struct bignum* bignum_init(void) | /* The current version is just a wrapper for LibTomMath library, so struct bignum is just typecast to mp_int. bignum_init - Allocate memory for bignum Returns: Pointer to allocated bignum or NULL on failure */
struct bignum* bignum_init(void) | {
struct bignum *n = (struct bignum *)os_zalloc(sizeof(mp_int));
if (n == NULL)
return NULL;
if (mp_init((mp_int *) n) != MP_OKAY) {
os_free(n);
n = NULL;
}
return n;
} | retro-esp32/RetroESP32 | C++ | Creative Commons Attribution Share Alike 4.0 International | 581 |
/* Change Logs: Date Author Notes SummerGift first version */ | int main(void) | /* Change Logs: Date Author Notes SummerGift first version */
int main(void) | {
rt_uint16_t led = rt_pin_get("PB.13");
rt_pin_mode(led, PIN_MODE_OUTPUT);
while (1)
{
rt_pin_write(led, PIN_HIGH);
rt_thread_mdelay(500);
rt_pin_write(led, PIN_LOW);
rt_thread_mdelay(500);
}
return RT_EOK;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* map virtual single (contiguous) pointer to h/w descriptor pointer */ | static void map_single_talitos_ptr(struct device *dev, struct talitos_ptr *talitos_ptr, unsigned short len, void *data, unsigned char extent, enum dma_data_direction dir) | /* map virtual single (contiguous) pointer to h/w descriptor pointer */
static void map_single_talitos_ptr(struct device *dev, struct talitos_ptr *talitos_ptr, unsigned short len, void *data, unsigned char extent, enum dma_data_direction dir) | {
dma_addr_t dma_addr = dma_map_single(dev, data, len, dir);
talitos_ptr->len = cpu_to_be16(len);
to_talitos_ptr(talitos_ptr, dma_addr);
talitos_ptr->j_extent = extent;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Returns a pointer to the new device, or NULL. */ | struct spi_device* spi_alloc_device(struct spi_master *master) | /* Returns a pointer to the new device, or NULL. */
struct spi_device* spi_alloc_device(struct spi_master *master) | {
struct spi_device *spi;
struct device *dev = master->dev.parent;
if (!spi_master_get(master))
return NULL;
spi = kzalloc(sizeof *spi, GFP_KERNEL);
if (!spi) {
dev_err(dev, "cannot alloc spi_device\n");
spi_master_put(master);
return NULL;
}
spi->master = master;
spi->dev.parent = dev;
spi->dev.bus = &spi_bus_type;
spi->dev.release = spidev_release;
device_initialize(&spi->dev);
return spi;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This function is used to read data from the flash. */ | HAL_StatusTypeDef HAL_FLASH_Read(uint32_t addr, uint8_t *buf, uint32_t len) | /* This function is used to read data from the flash. */
HAL_StatusTypeDef HAL_FLASH_Read(uint32_t addr, uint8_t *buf, uint32_t len) | {
int err;
if (((addr & (INSIDE_FLS_BASE_ADDR - 1)) >= getFlashDensity()) || (len == 0) || (buf == NULL))
{
return HAL_ERROR;
}
__HAL_LOCK(&pFlash);
flashRead(addr, buf, len);
err = HAL_OK;
__HAL_UNLOCK(&pFlash);
return err;
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* Try to read a data sample for every channel. */ | static int32_t cn0503_update_code(struct cn0503_dev *dev, bool *code_rdy) | /* Try to read a data sample for every channel. */
static int32_t cn0503_update_code(struct cn0503_dev *dev, bool *code_rdy) | {
int32_t ret;
uint16_t byte_count;
uint8_t no_data_samples = 0;
int8_t i;
*code_rdy = false;
ret = adpd410x_get_fifo_bytecount(dev->adpd4100_handler, &byte_count);
if(ret != SUCCESS)
return FAILURE;
for(i = 0; i < dev->active_slots; i++) {
if(dev->two_channel_slots & (1 << i))
no_data_samples += 2 * dev->data_sizes[i];
else
no_data_samples += dev->data_sizes[i];
}
if(byte_count < no_data_samples)
return SUCCESS;
*code_rdy = true;
return adpd410x_get_data(dev->adpd4100_handler, dev->data_channel);
} | analogdevicesinc/EVAL-ADICUP3029 | C++ | Other | 36 |
/* This function returns a code that indicates whether the scan should continue (LPT_SCAN_CONTINUE), whether the LEB properties should be added to the tree in main memory (LPT_SCAN_ADD), or whether the scan should stop (LPT_SCAN_STOP). */ | static int scan_dirty_idx_cb(struct ubifs_info *c, const struct ubifs_lprops *lprops, int in_tree, struct scan_data *data) | /* This function returns a code that indicates whether the scan should continue (LPT_SCAN_CONTINUE), whether the LEB properties should be added to the tree in main memory (LPT_SCAN_ADD), or whether the scan should stop (LPT_SCAN_STOP). */
static int scan_dirty_idx_cb(struct ubifs_info *c, const struct ubifs_lprops *lprops, int in_tree, struct scan_data *data) | {
int ret = LPT_SCAN_CONTINUE;
if (lprops->flags & LPROPS_TAKEN)
return LPT_SCAN_CONTINUE;
if (!in_tree && valuable(c, lprops))
ret |= LPT_SCAN_ADD;
if (!(lprops->flags & LPROPS_INDEX))
return ret;
if (lprops->free + lprops->dirty < c->min_idx_node_sz)
return ret;
data->lnum = lprops->lnum;
return LPT_SCAN_ADD | LPT_SCAN_STOP;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* RETURN VALUES: 0 - success. -ENOSPC - insufficient disk resources. -EIO - i/o error. */ | static int diAllocAG(struct inomap *, int, bool, struct inode *) | /* RETURN VALUES: 0 - success. -ENOSPC - insufficient disk resources. -EIO - i/o error. */
static int diAllocAG(struct inomap *, int, bool, struct inode *) | {
int rc, addext, numfree, numinos;
numfree = imap->im_agctl[agno].numfree;
numinos = imap->im_agctl[agno].numinos;
if (numfree > numinos) {
jfs_error(ip->i_sb, "diAllocAG: numfree > numinos");
return -EIO;
}
if (dir)
addext = (numfree < 64 ||
(numfree < 256
&& ((numfree * 100) / numinos) <= 20));
else
addext = (numfree == 0);
if (addext) {
if ((rc = diAllocExt(imap, agno, ip)) != -ENOSPC)
return (rc);
}
return (diAllocIno(imap, agno, ip));
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Sets the DMA channel to use for a given endpoint. */ | void USBEndpointDMAChannel(uint32_t ui32Base, uint32_t ui32Endpoint, uint32_t ui32Channel) | /* Sets the DMA channel to use for a given endpoint. */
void USBEndpointDMAChannel(uint32_t ui32Base, uint32_t ui32Endpoint, uint32_t ui32Channel) | {
uint32_t ui32Mask;
ASSERT(ui32Base == USB0_BASE);
ASSERT((ui32Endpoint == USB_EP_1) || (ui32Endpoint == USB_EP_2) ||
(ui32Endpoint == USB_EP_3) || (ui32Endpoint == USB_EP_4) ||
(ui32Endpoint == USB_EP_5) || (ui32Endpoint == USB_EP_6) ||
(ui32Endpoint == USB_EP_7));
ui32Mask = (uint32_t)0xf << (ui32Channel * 4);
ui32Mask = HWREG(ui32Base + USB_O_DMASEL) & (~ui32Mask);
ui32Mask |= ((uint32_t)USBEPToIndex(ui32Endpoint)) << (ui32Channel * 4);
HWREG(ui32Base + USB_O_DMASEL) = ui32Mask;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Allocates the number of 4KB pages of a certain memory type 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* InternalAllocatePages(IN EFI_MEMORY_TYPE MemoryType, IN UINTN Pages) | /* Allocates the number of 4KB pages of a certain memory type 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* InternalAllocatePages(IN EFI_MEMORY_TYPE MemoryType, IN UINTN Pages) | {
EFI_STATUS Status;
EFI_PHYSICAL_ADDRESS Memory;
if (Pages == 0) {
return NULL;
}
return gEmuThunk->Valloc (Pages * EFI_PAGE_SIZE);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Rationale: code calling task_setscheduler, task_setioprio, and task_setnice, assumes that . if capable(cap_sys_nice), then those actions should be allowed . if not capable(cap_sys_nice), but acting on your own processes, then those actions should be allowed This is insufficient now since you can call code without suid, but yet with increased caps. So we check for increased caps on the target process. */ | static int cap_safe_nice(struct task_struct *p) | /* Rationale: code calling task_setscheduler, task_setioprio, and task_setnice, assumes that . if capable(cap_sys_nice), then those actions should be allowed . if not capable(cap_sys_nice), but acting on your own processes, then those actions should be allowed This is insufficient now since you can call code without suid, but yet with increased caps. So we check for increased caps on the target process. */
static int cap_safe_nice(struct task_struct *p) | {
int is_subset;
rcu_read_lock();
is_subset = cap_issubset(__task_cred(p)->cap_permitted,
current_cred()->cap_permitted);
rcu_read_unlock();
if (!is_subset && !capable(CAP_SYS_NICE))
return -EPERM;
return 0;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Returns 3-element vector of accelerometer data in body frame with gravity removed. */ | inv_error_t inv_get_linear_accel(long *data) | /* Returns 3-element vector of accelerometer data in body frame with gravity removed. */
inv_error_t inv_get_linear_accel(long *data) | {
long gravity[3];
if (data != NULL)
{
inv_get_accel_set(data, NULL, NULL);
inv_get_gravity(gravity);
data[0] -= gravity[0] >> 14;
data[1] -= gravity[1] >> 14;
data[2] -= gravity[2] >> 14;
return INV_SUCCESS;
}
else {
return INV_ERROR_INVALID_PARAMETER;
}
} | Luos-io/luos_engine | C++ | MIT License | 496 |
/* Get the help text for an internal command. */ | CHAR16* ShellCommandGetInternalCommandHelp(IN CONST CHAR16 *CommandString) | /* Get the help text for an internal command. */
CHAR16* ShellCommandGetInternalCommandHelp(IN CONST CHAR16 *CommandString) | {
SHELL_COMMAND_INTERNAL_LIST_ENTRY *Node;
ASSERT (CommandString != NULL);
for ( Node = (SHELL_COMMAND_INTERNAL_LIST_ENTRY *)GetFirstNode (&mCommandList.Link)
; !IsNull (&mCommandList.Link, &Node->Link)
; Node = (SHELL_COMMAND_INTERNAL_LIST_ENTRY *)GetNextNode (&mCommandList.Link, &Node->Link)
)
{
ASSERT (Node->CommandString != NULL);
if (gUnicodeCollation->StriColl (
gUnicodeCollation,
(CHAR16 *)CommandString,
Node->CommandString
) == 0
)
{
return (HiiGetString (Node->HiiHandle, Node->ManFormatHelp, NULL));
}
}
return (NULL);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Reads and returns the current value of DR1. 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 AsmReadDr1(VOID) | /* Reads and returns the current value of DR1. 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 AsmReadDr1(VOID) | {
__asm {
mov eax, dr1
}
} | tianocore/edk2 | C++ | Other | 4,240 |
/* This shouldn't be used directly ouside of the VFS. It does not guarantee that the filesystem will stay r/w, just that it is right */ | int __mnt_is_readonly(struct vfsmount *mnt) | /* This shouldn't be used directly ouside of the VFS. It does not guarantee that the filesystem will stay r/w, just that it is right */
int __mnt_is_readonly(struct vfsmount *mnt) | {
if (mnt->mnt_flags & MNT_READONLY)
return 1;
if (mnt->mnt_sb->s_flags & MS_RDONLY)
return 1;
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Update CPU-local rcu_data state to record the newly noticed grace period. This is used both when we started the grace period and when we notice that someone else started the grace period. The caller must hold the ->lock of the leaf rcu_node structure corresponding to the current CPU, and must have irqs disabled. */ | static void __note_new_gpnum(struct rcu_state *rsp, struct rcu_node *rnp, struct rcu_data *rdp) | /* Update CPU-local rcu_data state to record the newly noticed grace period. This is used both when we started the grace period and when we notice that someone else started the grace period. The caller must hold the ->lock of the leaf rcu_node structure corresponding to the current CPU, and must have irqs disabled. */
static void __note_new_gpnum(struct rcu_state *rsp, struct rcu_node *rnp, struct rcu_data *rdp) | {
if (rdp->gpnum != rnp->gpnum) {
rdp->qs_pending = 1;
rdp->passed_quiesc = 0;
rdp->gpnum = rnp->gpnum;
}
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Get Sector Number Parameter: adr: Sector Address Return Value: Sector Number */ | unsigned long GetSecNum(unsigned long adr) | /* Get Sector Number Parameter: adr: Sector Address Return Value: Sector Number */
unsigned long GetSecNum(unsigned long adr) | {
n = 0x07 + (n >> 3);
}
return (n);
} | labapart/polymcu | C++ | null | 201 |
/* initializes the memory pools used by the ethernet database component
Initializes the hash table node, mac descriptor and mac tree node pools. Called at initialization time by ixEthDBInit(). */ | IX_ETH_DB_PUBLIC void ixEthDBInitMemoryPools(void) | /* initializes the memory pools used by the ethernet database component
Initializes the hash table node, mac descriptor and mac tree node pools. Called at initialization time by ixEthDBInit(). */
IX_ETH_DB_PUBLIC void ixEthDBInitMemoryPools(void) | {
int local_index;
ixOsalMutexInit(&nodePoolLock);
for (local_index = 0 ; local_index < NODE_POOL_SIZE ; local_index++)
{
HashNode *freeNode = &nodePoolArea[local_index];
freeNode->nextFree = nodePool;
nodePool = freeNode;
}
ixOsalMutexInit(&macPoolLock);
for (local_index = 0 ; local_index < MAC_POOL_SIZE ; local_index++)
{
MacDescriptor *freeDescriptor = &macPoolArea[local_index];
freeDescriptor->nextFree = macPool;
macPool = freeDescriptor;
}
ixOsalMutexInit(&treePoolLock);
for (local_index = 0 ; local_index < TREE_POOL_SIZE ; local_index++)
{
MacTreeNode *freeNode = &treePoolArea[local_index];
freeNode->nextFree = treePool;
treePool = freeNode;
}
} | EmcraftSystems/u-boot | C++ | Other | 181 |
/* Tell if it's the last area of the refreshing process. Can be called from */ | LV_ATTRIBUTE_FLUSH_READY bool lv_disp_flush_is_last(lv_disp_drv_t *disp_drv) | /* Tell if it's the last area of the refreshing process. Can be called from */
LV_ATTRIBUTE_FLUSH_READY bool lv_disp_flush_is_last(lv_disp_drv_t *disp_drv) | {
return disp_drv->draw_buf->flushing_last;
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* Draws a string using the supplied font data. */ | void ssd1306DrawString(uint16_t x, uint16_t y, char *text, struct FONT_DEF font) | /* Draws a string using the supplied font data. */
void ssd1306DrawString(uint16_t x, uint16_t y, char *text, struct FONT_DEF font) | {
volatile uint8_t l;
for (l = 0; l < strlen(text); l++)
{
ssd1306DrawChar(x + (l * (font.u8Width + 1)), y, text[l], font);
}
} | microbuilder/LPC11U_LPC13U_CodeBase | C++ | Other | 54 |
/* call on unmount. flush all journal trans, release all alloc'd ram */ | int journal_release(struct reiserfs_transaction_handle *th, struct super_block *sb) | /* call on unmount. flush all journal trans, release all alloc'd ram */
int journal_release(struct reiserfs_transaction_handle *th, struct super_block *sb) | {
return do_journal_release(th, sb, 0);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This function decodes @fid as long as it has one of the well-known Linux filehandle types and calls @get_inode on it to retrieve the inode for the */ | struct dentry* generic_fh_to_parent(struct super_block *sb, struct fid *fid, int fh_len, int fh_type, struct inode *(*get_inode)(struct super_block *sb, u64 ino, u32 gen)) | /* This function decodes @fid as long as it has one of the well-known Linux filehandle types and calls @get_inode on it to retrieve the inode for the */
struct dentry* generic_fh_to_parent(struct super_block *sb, struct fid *fid, int fh_len, int fh_type, struct inode *(*get_inode)(struct super_block *sb, u64 ino, u32 gen)) | {
struct inode *inode = NULL;
if (fh_len <= 2)
return NULL;
switch (fh_type) {
case FILEID_INO32_GEN_PARENT:
inode = get_inode(sb, fid->i32.parent_ino,
(fh_len > 3 ? fid->i32.parent_gen : 0));
break;
}
return d_obtain_alias(inode);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* cpuidle_remove_driver_sysfs - removes driver-specific sysfs attributes @device: the target device */ | void cpuidle_remove_state_sysfs(struct cpuidle_device *device) | /* cpuidle_remove_driver_sysfs - removes driver-specific sysfs attributes @device: the target device */
void cpuidle_remove_state_sysfs(struct cpuidle_device *device) | {
int i;
for (i = 0; i < device->state_count; i++)
cpuidle_free_state_kobj(device, i);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* brief Aborts the slave non-blocking transfers. note This API could be called at any time to stop slave for handling the bus events. param base The LPI2C peripheral base address. param handle Pointer to #lpi2c_slave_handle_t structure which stores the transfer state. retval #kStatus_Success retval #kStatus_LPI2C_Idle */ | void LPI2C_SlaveTransferAbort(LPI2C_Type *base, lpi2c_slave_handle_t *handle) | /* brief Aborts the slave non-blocking transfers. note This API could be called at any time to stop slave for handling the bus events. param base The LPI2C peripheral base address. param handle Pointer to #lpi2c_slave_handle_t structure which stores the transfer state. retval #kStatus_Success retval #kStatus_LPI2C_Idle */
void LPI2C_SlaveTransferAbort(LPI2C_Type *base, lpi2c_slave_handle_t *handle) | {
assert(handle);
if (handle->isBusy)
{
LPI2C_SlaveDisableInterrupts(base, kSlaveIrqFlags);
base->STAR = LPI2C_STAR_TXNACK_MASK;
memset(&handle->transfer, 0, sizeof(handle->transfer));
handle->isBusy = false;
}
} | nanoframework/nf-interpreter | C++ | MIT License | 293 |
/* This function deletes Device Path package from a package list node. This is a internal function. */ | EFI_STATUS RemoveDevicePathPackage(IN HII_DATABASE_PRIVATE_DATA *Private, IN EFI_HII_HANDLE Handle, IN OUT HII_DATABASE_PACKAGE_LIST_INSTANCE *PackageList) | /* This function deletes Device Path package from a package list node. This is a internal function. */
EFI_STATUS RemoveDevicePathPackage(IN HII_DATABASE_PRIVATE_DATA *Private, IN EFI_HII_HANDLE Handle, IN OUT HII_DATABASE_PACKAGE_LIST_INSTANCE *PackageList) | {
EFI_STATUS Status;
UINT8 *Package;
EFI_HII_PACKAGE_HEADER Header;
Package = PackageList->DevicePathPkg;
if (Package == NULL) {
return EFI_SUCCESS;
}
Status = InvokeRegisteredFunction (
Private,
EFI_HII_DATABASE_NOTIFY_REMOVE_PACK,
(VOID *)Package,
EFI_HII_PACKAGE_DEVICE_PATH,
Handle
);
if (EFI_ERROR (Status)) {
return Status;
}
CopyMem (&Header, Package, sizeof (EFI_HII_PACKAGE_HEADER));
PackageList->PackageListHdr.PackageLength -= Header.Length;
FreePool (Package);
PackageList->DevicePathPkg = NULL;
return EFI_SUCCESS;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Set the order of descriptors within the group are processed when restoring register values. */ | static void SSARC_SetGroupRestoreOrder(SSARC_LP_Type *base, uint8_t groupID, ssarc_save_restore_order_t order) | /* Set the order of descriptors within the group are processed when restoring register values. */
static void SSARC_SetGroupRestoreOrder(SSARC_LP_Type *base, uint8_t groupID, ssarc_save_restore_order_t order) | {
assert(groupID < SSARC_LP_DESC_CTRL0_COUNT);
if (order == kSSARC_ProcessFromStartToEnd)
{
base->GROUPS[groupID].DESC_CTRL0 &= ~SSARC_LP_DESC_CTRL0_RT_ORDER_MASK;
}
else
{
base->GROUPS[groupID].DESC_CTRL0 |= SSARC_LP_DESC_CTRL0_RT_ORDER_MASK;
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* DMAMUX Clear DMA Request Synchronization Overrun Interrupt Flag.
Clear DMA Request Synchronization Overrun Interrupt for given DMA channel */ | void dmamux_clear_dma_request_sync_overrun(uint32_t dmamux, uint8_t channel) | /* DMAMUX Clear DMA Request Synchronization Overrun Interrupt Flag.
Clear DMA Request Synchronization Overrun Interrupt for given DMA channel */
void dmamux_clear_dma_request_sync_overrun(uint32_t dmamux, uint8_t channel) | {
DMAMUX_CFR(dmamux) = DMAMUX_CFR_CSOF(channel);
} | libopencm3/libopencm3 | C++ | GNU General Public License v3.0 | 2,931 |
/* sc6000_dma_to_softcfg - Decode dma number into cfg code. */ | static __devinit unsigned char sc6000_dma_to_softcfg(int dma) | /* sc6000_dma_to_softcfg - Decode dma number into cfg code. */
static __devinit unsigned char sc6000_dma_to_softcfg(int dma) | {
unsigned char val = 0;
switch (dma) {
case 0:
val = 1;
break;
case 1:
val = 2;
break;
case 3:
val = 3;
break;
default:
break;
}
return val;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* STLM75 Device' OS/INT pin callback.
\breif GPIO External interrupt handler. */ | unsigned long UserCallback(void *pvCBData, unsigned long ulEvent, unsigned long ulMsgParam, void *pvMsgData) | /* STLM75 Device' OS/INT pin callback.
\breif GPIO External interrupt handler. */
unsigned long UserCallback(void *pvCBData, unsigned long ulEvent, unsigned long ulMsgParam, void *pvMsgData) | {
float fTemp,fTos,fThys;
int i;
fTemp = STLM75TempRead(&Dev1);
fTos = STLM75LimitRead(&Dev1, 1);
fThys = STLM75LimitRead(&Dev1, 0);
if(fTemp > fTos)
{
for(i=0; ucTemp1[i]!=0; i++)
UartPrintfChar(ucTemp1[i]);
}
else if(fTemp < fThys)
{
for(i=0; ucTemp2[i]!=0; i++)
UartPrintfChar(ucTemp1[i]);
}
return 0;
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Enable Receive CRC error interrupt @rmtoll IER RXBERIE LL_SWPMI_EnableIT_RXBER. */ | void LL_SWPMI_EnableIT_RXBER(SWPMI_TypeDef *SWPMIx) | /* Enable Receive CRC error interrupt @rmtoll IER RXBERIE LL_SWPMI_EnableIT_RXBER. */
void LL_SWPMI_EnableIT_RXBER(SWPMI_TypeDef *SWPMIx) | {
SET_BIT(SWPMIx->IER, SWPMI_IER_RXBERIE);
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* ZigBee Device Profile dissector for the simple descriptor */ | void dissect_zbee_zdp_req_simple_desc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) | /* ZigBee Device Profile dissector for the simple descriptor */
void dissect_zbee_zdp_req_simple_desc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) | {
guint offset = 0;
guint16 device;
guint8 endpt;
device = zbee_parse_uint(tree, hf_zbee_zdp_device, tvb, &offset, sizeof(guint16), NULL);
endpt = zbee_parse_uint(tree, hf_zbee_zdp_endpoint, tvb, &offset, sizeof(guint8), NULL);
zbee_append_info(tree, pinfo, ", Device: 0x%04x, Endpoint: %d", device, endpt);
zdp_dump_excess(tvb, offset, pinfo, tree);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). If StartBit is greater than 15, then ASSERT(). If EndBit is greater than 15, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */ | UINT16 EFIAPI PciBitFieldAnd16(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT16 AndData) | /* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). If StartBit is greater than 15, then ASSERT(). If EndBit is greater than 15, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */
UINT16 EFIAPI PciBitFieldAnd16(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT16 AndData) | {
return PciExpressBitFieldAnd16 (Address, StartBit, EndBit, AndData);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Read/Modify/Write a byte on the display controller.
This function will read the byte from the display controller (or the framebuffer if we cannot read directly from the controller) and do a mask operation on the byte according to the pixel operation selected by the color argument and the pixel mask provided. */ | void gfx_mono_st7565r_mask_byte(gfx_coord_t page, gfx_coord_t column, gfx_mono_color_t pixel_mask, gfx_mono_color_t color) | /* Read/Modify/Write a byte on the display controller.
This function will read the byte from the display controller (or the framebuffer if we cannot read directly from the controller) and do a mask operation on the byte according to the pixel operation selected by the color argument and the pixel mask provided. */
void gfx_mono_st7565r_mask_byte(gfx_coord_t page, gfx_coord_t column, gfx_mono_color_t pixel_mask, gfx_mono_color_t color) | {
gfx_mono_color_t temp = gfx_mono_get_byte(page, column);
switch (color) {
case GFX_PIXEL_SET:
temp |= pixel_mask;
break;
case GFX_PIXEL_CLR:
temp &= ~pixel_mask;
break;
case GFX_PIXEL_XOR:
temp ^= pixel_mask;
break;
default:
break;
}
gfx_mono_put_byte(page, column, temp);
} | memfault/zero-to-main | C++ | null | 200 |
/* If the volume is damaged because of an interrupted update this function just returns immediately with %-EBADF error code. */ | int ubi_leb_read(struct ubi_volume_desc *desc, int lnum, char *buf, int offset, int len, int check) | /* If the volume is damaged because of an interrupted update this function just returns immediately with %-EBADF error code. */
int ubi_leb_read(struct ubi_volume_desc *desc, int lnum, char *buf, int offset, int len, int check) | {
struct ubi_volume *vol = desc->vol;
struct ubi_device *ubi = vol->ubi;
int err, vol_id = vol->vol_id;
dbg_gen("read %d bytes from LEB %d:%d:%d", len, vol_id, lnum, offset);
err = leb_read_sanity_check(desc, lnum, offset, len);
if (err < 0)
return err;
if (len == 0)
return 0;
err = ubi_eba_read_leb(ubi, vol, lnum, buf, offset, len, check);
if (err && mtd_is_eccerr(err) && vol->vol_type == UBI_STATIC_VOLUME) {
ubi_warn(ubi, "mark volume %d as corrupted", vol_id);
vol->corrupted = 1;
}
return err;
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* The common function cache current active TpmInterfaceType when needed. */ | EFI_STATUS InternalTpm2DeviceLibDTpmCommonConstructor(VOID) | /* The common function cache current active TpmInterfaceType when needed. */
EFI_STATUS InternalTpm2DeviceLibDTpmCommonConstructor(VOID) | {
TPM2_PTP_INTERFACE_TYPE PtpInterface;
UINT8 IdleByPass;
if (PcdGet8 (PcdActiveTpmInterfaceType) == 0xFF) {
PtpInterface = Tpm2GetPtpInterface ((VOID *)(UINTN)PcdGet64 (PcdTpmBaseAddress));
PcdSet8S (PcdActiveTpmInterfaceType, PtpInterface);
}
if ((PcdGet8 (PcdActiveTpmInterfaceType) == Tpm2PtpInterfaceCrb) && (PcdGet8 (PcdCRBIdleByPass) == 0xFF)) {
IdleByPass = Tpm2GetIdleByPass ((VOID *)(UINTN)PcdGet64 (PcdTpmBaseAddress));
PcdSet8S (PcdCRBIdleByPass, IdleByPass);
}
return EFI_SUCCESS;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* iis3dhhc_trigger_set - link external trigger to event data ready */ | int iis3dhhc_trigger_set(const struct device *dev, const struct sensor_trigger *trig, sensor_trigger_handler_t handler) | /* iis3dhhc_trigger_set - link external trigger to event data ready */
int iis3dhhc_trigger_set(const struct device *dev, const struct sensor_trigger *trig, sensor_trigger_handler_t handler) | {
struct iis3dhhc_data *iis3dhhc = dev->data;
const struct iis3dhhc_config *config = dev->config;
int16_t raw[3];
if (!config->int_gpio.port) {
return -ENOTSUP;
}
if (trig->chan == SENSOR_CHAN_ACCEL_XYZ) {
iis3dhhc->handler_drdy = handler;
iis3dhhc->trig_drdy = trig;
if (handler) {
iis3dhhc_acceleration_raw_get(iis3dhhc->ctx, raw);
return iis3dhhc_enable_int(dev, PROPERTY_ENABLE);
} else {
return iis3dhhc_enable_int(dev, PROPERTY_DISABLE);
}
}
return -ENOTSUP;
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* param src USB HS does not care about the clock source, here must be ref kCLOCK_UsbSrcUnused. param freq USB HS does not care about the clock source, so this parameter is ignored. retval true The clock is set successfully. retval false The clock source is invalid to get proper USB HS clock. */ | bool CLOCK_EnableUsbhs1Clock(clock_usb_src_t src, uint32_t freq) | /* param src USB HS does not care about the clock source, here must be ref kCLOCK_UsbSrcUnused. param freq USB HS does not care about the clock source, so this parameter is ignored. retval true The clock is set successfully. retval false The clock source is invalid to get proper USB HS clock. */
bool CLOCK_EnableUsbhs1Clock(clock_usb_src_t src, uint32_t freq) | {
uint32_t i = 0;
CCM->CCGR6 |= CCM_CCGR6_CG0_MASK;
USB2->USBCMD |= USBHS_USBCMD_RST_MASK;
for (i = 0; i < 400000U; i++)
{
__ASM("nop");
}
PMU->REG_3P0 = (PMU->REG_3P0 & (~PMU_REG_3P0_OUTPUT_TRG_MASK)) |
(PMU_REG_3P0_OUTPUT_TRG(0x17) | PMU_REG_3P0_ENABLE_LINREG_MASK);
return true;
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* Fills each GPIO_InitStruct member with its default value. */ | void GPIO_StructInit(GPIO_InitTypeDef *GPIO_InitStruct) | /* Fills each GPIO_InitStruct member with its default value. */
void GPIO_StructInit(GPIO_InitTypeDef *GPIO_InitStruct) | {
GPIO_InitStruct->GPIO_Pin = GPIO_Pin_All;
GPIO_InitStruct->GPIO_Speed = GPIO_Speed_2MHz;
GPIO_InitStruct->GPIO_Mode = GPIO_Mode_IN_FLOATING;
} | gcallipo/RadioDSP-Stm32f103 | C++ | Common Creative - Attribution 3.0 | 51 |
/* On success, returns true; the lock should be later released with cgroup_unlock(). On failure returns false with no lock held. */ | bool cgroup_lock_live_group(struct cgroup *cgrp) | /* On success, returns true; the lock should be later released with cgroup_unlock(). On failure returns false with no lock held. */
bool cgroup_lock_live_group(struct cgroup *cgrp) | {
mutex_lock(&cgroup_mutex);
if (cgroup_is_removed(cgrp)) {
mutex_unlock(&cgroup_mutex);
return false;
}
return true;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Clear the Hash registers for the mac address pointed by AddressPtr. */ | void XEmacPs_ClearHash(XEmacPs *InstancePtr) | /* Clear the Hash registers for the mac address pointed by AddressPtr. */
void XEmacPs_ClearHash(XEmacPs *InstancePtr) | {
Xil_AssertVoid(InstancePtr != NULL);
Xil_AssertVoid(InstancePtr->IsReady == (u32)XIL_COMPONENT_IS_READY);
XEmacPs_WriteReg(InstancePtr->Config.BaseAddress,
XEMACPS_HASHL_OFFSET, 0x0U);
XEmacPs_WriteReg(InstancePtr->Config.BaseAddress,
XEMACPS_HASHH_OFFSET, 0x0U);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Remove front event from internal queue.
This function will remove the front event from the internal queue. This function will be called once an event has been processed. That way, the event will live in the queue while being processed, hence no copying of data required. */ | static void win_pop_front_event(void) | /* Remove front event from internal queue.
This function will remove the front event from the internal queue. This function will be called once an event has been processed. That way, the event will live in the queue while being processed, hence no copying of data required. */
static void win_pop_front_event(void) | {
irqflags_t iflags;
if (win_event_queue.front == win_event_queue.end) {
win_event_queue.front = win_event_queue.start;
} else {
++(win_event_queue.front);
}
iflags = cpu_irq_save();
++(win_event_queue.free);
--(win_event_queue.used);
cpu_irq_restore(iflags);
} | memfault/zero-to-main | C++ | null | 200 |
/* This API configure the source of data(filter & pre-filter) for any-motion interrupt. */ | static int8_t config_any_motion_src(const struct bmi160_acc_any_mot_int_cfg *any_motion_int_cfg, const struct bmi160_dev *dev) | /* This API configure the source of data(filter & pre-filter) for any-motion interrupt. */
static int8_t config_any_motion_src(const struct bmi160_acc_any_mot_int_cfg *any_motion_int_cfg, const struct bmi160_dev *dev) | {
int8_t rslt;
uint8_t data = 0;
uint8_t temp = 0;
rslt = bmi160_get_regs(BMI160_INT_DATA_1_ADDR, &data, 1, dev);
if (rslt == BMI160_OK)
{
temp = data & ~BMI160_MOTION_SRC_INT_MASK;
data = temp | ((any_motion_int_cfg->anymotion_data_src << 7) & BMI160_MOTION_SRC_INT_MASK);
rslt = bmi160_set_regs(BMI160_INT_DATA_1_ADDR, &data, 1, dev);
}
return rslt;
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* Start a new MMC custom command request for a host, and wait for the command to complete. Does not attempt to parse the response. */ | void mmc_wait_for_req(struct mmc_host *host, struct mmc_request *mrq) | /* Start a new MMC custom command request for a host, and wait for the command to complete. Does not attempt to parse the response. */
void mmc_wait_for_req(struct mmc_host *host, struct mmc_request *mrq) | {
DECLARE_COMPLETION_ONSTACK(complete);
mrq->done_data = &complete;
mrq->done = mmc_wait_done;
mmc_start_request(host, mrq);
wait_for_completion(&complete);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Compute the AML NameString/path size from NameString information (Root, ParentPrefix, SegCount). */ | UINT32 EFIAPI AmlComputeNameStringSize(IN UINT32 Root, IN UINT32 ParentPrefix, IN UINT32 SegCount) | /* Compute the AML NameString/path size from NameString information (Root, ParentPrefix, SegCount). */
UINT32 EFIAPI AmlComputeNameStringSize(IN UINT32 Root, IN UINT32 ParentPrefix, IN UINT32 SegCount) | {
UINT32 TotalSize;
if (!AmlIsNameString (Root, ParentPrefix, SegCount)) {
ASSERT (0);
return 0;
}
TotalSize = Root + ParentPrefix;
TotalSize += (SegCount == 0) ? 1 : (SegCount * AML_NAME_SEG_SIZE);
TotalSize += (SegCount > 2) ? 2 : ((SegCount == 2) ? 1 : 0);
return TotalSize;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* "memset" on IO memory space. This needs to be optimized. */ | void _memset_io(volatile void __iomem *dst, int c, size_t count) | /* "memset" on IO memory space. This needs to be optimized. */
void _memset_io(volatile void __iomem *dst, int c, size_t count) | {
while (count) {
count--;
writeb(c, dst);
dst++;
}
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* @ldev: Log device to check @rec: Log record to check */ | static bool log_passes_filters(struct log_device *ldev, struct log_rec *rec) | /* @ldev: Log device to check @rec: Log record to check */
static bool log_passes_filters(struct log_device *ldev, struct log_rec *rec) | {
struct log_filter *filt;
if (list_empty(&ldev->filter_head)) {
if (rec->level > gd->default_log_level)
return false;
return true;
}
list_for_each_entry(filt, &ldev->filter_head, sibling_node) {
if (rec->level > filt->max_level)
continue;
if ((filt->flags & LOGFF_HAS_CAT) &&
!log_has_cat(filt->cat_list, rec->cat))
continue;
if (filt->file_list &&
!log_has_file(filt->file_list, rec->file))
continue;
return true;
}
return false;
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* This function is used for getting the count of block I/O devices that one specific block driver detects. To the PEI ATAPI driver, it returns the number of all the detected ATAPI devices it detects during the enumeration process. To the PEI legacy floppy driver, it returns the number of all the legacy devices it finds during its enumeration process. If no device is detected, then the function will return zero. */ | EFI_STATUS EFIAPI AtapiGetNumberOfBlockDevices2(IN EFI_PEI_SERVICES **PeiServices, IN EFI_PEI_RECOVERY_BLOCK_IO2_PPI *This, OUT UINTN *NumberBlockDevices) | /* This function is used for getting the count of block I/O devices that one specific block driver detects. To the PEI ATAPI driver, it returns the number of all the detected ATAPI devices it detects during the enumeration process. To the PEI legacy floppy driver, it returns the number of all the legacy devices it finds during its enumeration process. If no device is detected, then the function will return zero. */
EFI_STATUS EFIAPI AtapiGetNumberOfBlockDevices2(IN EFI_PEI_SERVICES **PeiServices, IN EFI_PEI_RECOVERY_BLOCK_IO2_PPI *This, OUT UINTN *NumberBlockDevices) | {
EFI_STATUS Status;
ATAPI_BLK_IO_DEV *AtapiBlkIoDev;
AtapiBlkIoDev = PEI_RECOVERY_ATAPI_FROM_BLKIO2_THIS (This);
Status = AtapiGetNumberOfBlockDevices (
PeiServices,
&AtapiBlkIoDev->AtapiBlkIo,
NumberBlockDevices
);
return Status;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Returns CR_OK upon succesful completion, an error code otherwise */ | enum CRStatus cr_parser_get_tknzr(CRParser *a_this, CRTknzr **a_tknzr) | /* Returns CR_OK upon succesful completion, an error code otherwise */
enum CRStatus cr_parser_get_tknzr(CRParser *a_this, CRTknzr **a_tknzr) | {
g_return_val_if_fail (a_this && PRIVATE (a_this)
&& a_tknzr, CR_BAD_PARAM_ERROR);
*a_tknzr = PRIVATE (a_this)->tknzr;
return CR_OK;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* IOC stop called from bfa_stop(). Called only when driver is unloaded for this instance. */ | void bfa_iocfc_stop(struct bfa_s *bfa) | /* IOC stop called from bfa_stop(). Called only when driver is unloaded for this instance. */
void bfa_iocfc_stop(struct bfa_s *bfa) | {
bfa->iocfc.action = BFA_IOCFC_ACT_STOP;
bfa->rme_process = BFA_FALSE;
bfa_ioc_disable(&bfa->ioc);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Get slider status.
Returns whether or not the slider is currently being manipulated by pointer events, i.e., it is moving. */ | bool wtk_slider_is_moving(struct wtk_slider const *slider) | /* Get slider status.
Returns whether or not the slider is currently being manipulated by pointer events, i.e., it is moving. */
bool wtk_slider_is_moving(struct wtk_slider const *slider) | {
Assert(slider);
return slider->state == WTK_SLIDER_MOVING;
} | memfault/zero-to-main | C++ | null | 200 |
/* bcm_rx_changed - create a RX_CHANGED notification due to changed content */ | static void bcm_rx_changed(struct bcm_op *op, struct can_frame *data) | /* bcm_rx_changed - create a RX_CHANGED notification due to changed content */
static void bcm_rx_changed(struct bcm_op *op, struct can_frame *data) | {
struct bcm_msg_head head;
op->frames_filtered++;
if (op->frames_filtered > ULONG_MAX/100)
op->frames_filtered = op->frames_abs = 0;
data->can_dlc &= (BCM_CAN_DLC_MASK|RX_RECV);
head.opcode = RX_CHANGED;
head.flags = op->flags;
head.count = op->count;
head.ival1 = op->ival1;
head.ival2 = op->ival2;
head.can_id = op->can_id;
head.nframes = 1;
bcm_send_to_user(op, &head, data, 1);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). If StartBit is greater than 31, then ASSERT(). If EndBit is greater than 31, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). */ | UINT32 EFIAPI PciExpressBitFieldRead32(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit) | /* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). If StartBit is greater than 31, then ASSERT(). If EndBit is greater than 31, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). */
UINT32 EFIAPI PciExpressBitFieldRead32(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit) | {
if (Address >= mSmmPciExpressLibPciExpressBaseSize) {
return (UINT32)-1;
}
return MmioBitFieldRead32 (
GetPciExpressAddress (Address),
StartBit,
EndBit
);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Event handler for the library USB Configuration Changed event. */ | void EVENT_USB_Device_ConfigurationChanged(void) | /* Event handler for the library USB Configuration Changed event. */
void EVENT_USB_Device_ConfigurationChanged(void) | {
HID_Device_ConfigureEndpoints(&Keyboard_HID_Interface);
USB_Device_EnableSOFEvents();
} | prusa3d/Prusa-Firmware-Buddy | C++ | Other | 1,019 |
/* Clear USI UART RX DMA dummy flag . */ | void USI_UARTRxClearDMADummyFlag(USI_TypeDef *USIx) | /* Clear USI UART RX DMA dummy flag . */
void USI_UARTRxClearDMADummyFlag(USI_TypeDef *USIx) | {
USIx->UART_RXDMA_FLOW_CTRL |= USI_UART_RXDMA_DUMMY_FLAG;
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* If an interrupt occurs before the timeout period elapses, this function returns zero immediately. If it times out, it returns one. An error code less than zero indicates an error (most likely a pending signal), and the calling code should finish what it's doing as soon as it can. */ | int parport_wait_event(struct parport *port, signed long timeout) | /* If an interrupt occurs before the timeout period elapses, this function returns zero immediately. If it times out, it returns one. An error code less than zero indicates an error (most likely a pending signal), and the calling code should finish what it's doing as soon as it can. */
int parport_wait_event(struct parport *port, signed long timeout) | {
int ret;
struct timer_list timer;
if (!port->physport->cad->timeout)
return 1;
init_timer_on_stack(&timer);
timer.expires = jiffies + timeout;
timer.function = timeout_waiting_on_port;
port_from_cookie[port->number % PARPORT_MAX] = port;
timer.data = port->number;
add_timer (&timer);
ret = down_interruptible (&port->physport->ieee1284.irq);
if (!del_timer_sync(&timer) && !ret)
ret = 1;
destroy_timer_on_stack(&timer);
return ret;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Displays a maximum of 20 char on the LCD. */ | void LCD_DisplayStringLine(uint16_t Line, uint8_t *ptr) | /* Displays a maximum of 20 char on the LCD. */
void LCD_DisplayStringLine(uint16_t Line, uint8_t *ptr) | {
uint32_t i = 0;
uint16_t refcolumn = 0;
int16_t deltacolumn;
refcolumn = 319;
deltacolumn = -LCD_Currentfonts->Width;
while ((*ptr != 0) & (i < 320/LCD_Currentfonts->Width))
{
LCD_DisplayChar(Line, refcolumn, *ptr);
refcolumn += deltacolumn;
ptr++;
i++;
}
} | avem-labs/Avem | C++ | MIT License | 1,752 |
/* Setup a directory entry of an array of SHORT or SSHORT and write the associated indirect values. */ | static int TIFFWriteShortArray(TIFF *, TIFFDataType, ttag_t, TIFFDirEntry *, uint32, uint16 *) | /* Setup a directory entry of an array of SHORT or SSHORT and write the associated indirect values. */
static int TIFFWriteShortArray(TIFF *, TIFFDataType, ttag_t, TIFFDirEntry *, uint32, uint16 *) | {
dir->tdir_tag = tag;
dir->tdir_type = (short) type;
dir->tdir_count = n;
if (n <= 2) {
if (tif->tif_header.tiff_magic == TIFF_BIGENDIAN) {
dir->tdir_offset = (uint32) ((long) v[0] << 16);
if (n == 2)
dir->tdir_offset |= v[1] & 0xffff;
} else {
dir->tdir_offset = v[0] & 0xffff;
if (n == 2)
dir->tdir_offset |= (long) v[1] << 16;
}
return (1);
} else
return (TIFFWriteData(tif, dir, (char*) v));
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* Allocate a memory block from a memory pool. */ | void* osPoolAlloc(osPoolId pool_id) | /* Allocate a memory block from a memory pool. */
void* osPoolAlloc(osPoolId pool_id) | {
osPoolDef_t *osPool = (osPoolDef_t *)pool_id;
void *ptr;
if (k_mem_slab_alloc((struct k_mem_slab *)(osPool->pool),
&ptr, TIME_OUT) == 0) {
return ptr;
} else {
return NULL;
}
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* WritePropertyMultiple-Request ::= SEQUENCE { listOfWriteAccessSpecifications SEQUENCE OF WriteAccessSpecification } */ | static guint fWritePropertyMultipleRequest(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset) | /* WritePropertyMultiple-Request ::= SEQUENCE { listOfWriteAccessSpecifications SEQUENCE OF WriteAccessSpecification } */
static guint fWritePropertyMultipleRequest(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset) | {
if (offset >= tvb_reported_length(tvb))
return offset;
col_set_writable(pinfo->cinfo, COL_INFO, FALSE);
return fWriteAccessSpecification(tvb, pinfo, tree, offset);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Enables IWDG (write access to IWDG_PR and IWDG_RLR registers disabled). */ | void IWDG_Enable(void) | /* Enables IWDG (write access to IWDG_PR and IWDG_RLR registers disabled). */
void IWDG_Enable(void) | {
IWDG->KR = KR_KEY_Enable;
} | gcallipo/RadioDSP-Stm32f103 | C++ | Common Creative - Attribution 3.0 | 51 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.