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
|
|---|---|---|---|---|---|---|---|
/* Check that the last event is equal to the last passed event. */
|
uint8_t I2C_ReadEventStatus(I2C_T *i2c, I2C_EVENT_T i2cEvent)
|
/* Check that the last event is equal to the last passed event. */
uint8_t I2C_ReadEventStatus(I2C_T *i2c, I2C_EVENT_T i2cEvent)
|
{
uint32_t lastevent = 0;
uint32_t flag1 = 0, flag2 = 0;
flag1 = i2c->STS1 & 0x0000FFFF;
flag2 = i2c->STS2 & 0x0000FFFF;
flag2 = flag2 << 16;
lastevent = (flag1 | flag2) & 0x00FFFFFF;
if ((lastevent & i2cEvent) == i2cEvent)
{
return SUCCESS;
}
return ERROR;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Go to frame specified by currently selected protocol tree item. */
|
gboolean cf_goto_framenum(capture_file *cf)
|
/* Go to frame specified by currently selected protocol tree item. */
gboolean cf_goto_framenum(capture_file *cf)
|
{
header_field_info *hfinfo;
guint32 framenum;
if (cf->finfo_selected) {
hfinfo = cf->finfo_selected->hfinfo;
g_assert(hfinfo);
if (hfinfo->type == FT_FRAMENUM) {
framenum = fvalue_get_uinteger(&cf->finfo_selected->value);
if (framenum != 0)
return cf_goto_frame(cf, framenum);
}
}
return FALSE;
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Start the PWM of the PWM module. This function is to start the PWM of the PWM module. */
|
void xPWMStart(unsigned long ulBase, unsigned long ulChannel)
|
/* Start the PWM of the PWM module. This function is to start the PWM of the PWM module. */
void xPWMStart(unsigned long ulBase, unsigned long ulChannel)
|
{
(void) ulChannel;
xASSERT(ulBase == xPWM1_BASE);
xASSERT( (ulChannel == xPWM_CHANNEL0) ||
(ulChannel == xPWM_CHANNEL1) ||
(ulChannel == xPWM_CHANNEL2) ||
(ulChannel == xPWM_CHANNEL3) ||
(ulChannel == xPWM_CHANNEL4) ||
(ulChannel == xPWM_CHANNEL5) ||
(ulChannel == xPWM_CHANNEL6) );
xHWREG(ulBase + PWM_TCR) = TCR_CNT_EN | TCR_PWM_EN;
}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
/* Show spincollection.
This function draws all the spinners in a spincollection to the screen, together with an OK button at the bottom. It also draws an indicator arrow in front of the top spinner. */
|
void gfx_mono_spinctrl_spincollection_show(struct gfx_mono_spinctrl_spincollection *spinners)
|
/* Show spincollection.
This function draws all the spinners in a spincollection to the screen, together with an OK button at the bottom. It also draws an indicator arrow in front of the top spinner. */
void gfx_mono_spinctrl_spincollection_show(struct gfx_mono_spinctrl_spincollection *spinners)
|
{
uint8_t i;
struct gfx_mono_spinctrl *iterator;
gfx_mono_draw_filled_rect(0, 0, GFX_MONO_LCD_WIDTH, GFX_MONO_LCD_HEIGHT,
GFX_PIXEL_CLR);
if (spinners->number_of_spinners == 0) {
return;
}
iterator = spinners->collection;
for (i = 0; i < spinners->number_of_spinners; i++) {
gfx_mono_spinctrl_draw(iterator, true);
iterator = iterator->next;
}
gfx_mono_spinctrl_draw_button(true, false);
gfx_mono_spinctrl_draw_indicator(spinners->collection, true);
}
|
memfault/zero-to-main
|
C++
| null | 200
|
/* See mss_uart.h for details of how to use this function. */
|
void MSS_UART_set_rx_endian(mss_uart_instance_t *this_uart, mss_uart_endian_t endian)
|
/* See mss_uart.h for details of how to use this function. */
void MSS_UART_set_rx_endian(mss_uart_instance_t *this_uart, mss_uart_endian_t endian)
|
{
ASSERT((this_uart == &g_mss_uart0) || (this_uart == &g_mss_uart1));
ASSERT(MSS_UART_INVALID_ENDIAN > endian);
if(((this_uart == &g_mss_uart0) || (this_uart == &g_mss_uart1)) &&
(MSS_UART_INVALID_ENDIAN > endian))
{
((MSS_UART_LITTLEEND == endian) ? (clear_bit_reg8(&this_uart->hw_reg->MM1,E_MSB_RX)) :
(set_bit_reg8(&this_uart->hw_reg->MM1,E_MSB_RX)));
}
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* 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 GPIOPinTypeCAN(unsigned long ulPort, unsigned char ucPins)
|
/* The pin(s) are specified using a bit-packed byte, where each bit that is set identifies the pin to be accessed, and where bit 0 of the byte represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on. */
void GPIOPinTypeCAN(unsigned long ulPort, unsigned char ucPins)
|
{
ASSERT(GPIOBaseValid(ulPort));
GPIODirModeSet(ulPort, ucPins, GPIO_DIR_MODE_HW);
GPIOPadConfigSet(ulPort, ucPins, GPIO_STRENGTH_8MA, GPIO_PIN_TYPE_STD);
}
|
watterott/WebRadio
|
C++
| null | 71
|
/* Go and read the HTE register in order to find any error */
|
static u32 hte_check_errors(void)
|
/* Go and read the HTE register in order to find any error */
static u32 hte_check_errors(void)
|
{
return msg_port_read(HTE, 0x000200a7);
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* param base CMC peripheral base address. param config Pointer to the reset pin config structure. */
|
void CMC_ConfigResetPin(CMC_Type *base, const cmc_reset_pin_config_t *config)
|
/* param base CMC peripheral base address. param config Pointer to the reset pin config structure. */
void CMC_ConfigResetPin(CMC_Type *base, const cmc_reset_pin_config_t *config)
|
{
assert(config != NULL);
uint32_t reg = base->RPC;
if (config->lowpowerFilterEnable)
{
reg |= CMC_RPC_LPFEN_MASK;
}
else
{
reg &= ~CMC_RPC_LPFEN_MASK;
}
if (config->resetFilterEnable)
{
reg |= (CMC_RPC_FILTEN_MASK | CMC_RPC_FILTCFG(config->resetFilterWidth));
}
else
{
reg &= ~(CMC_RPC_FILTEN_MASK | CMC_RPC_FILTCFG_MASK);
}
base->RPC = reg;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* This exists in case the total device image is assembled lacking some of the embedded CPU images */
|
static void nsi_boot_warning(const char *func)
|
/* This exists in case the total device image is assembled lacking some of the embedded CPU images */
static void nsi_boot_warning(const char *func)
|
{
nsi_print_trace("%s: Attempted boot of CPU without image. "
"CPU shut down permanently\n", func);
}
|
zephyrproject-rtos/zephyr
|
C++
|
Apache License 2.0
| 9,573
|
/* Writes the data to PHY register at the offset. Assumes semaphore already acquired. */
|
s32 e1000e_write_phy_reg_igp_locked(struct e1000_hw *hw, u32 offset, u16 data)
|
/* Writes the data to PHY register at the offset. Assumes semaphore already acquired. */
s32 e1000e_write_phy_reg_igp_locked(struct e1000_hw *hw, u32 offset, u16 data)
|
{
return __e1000e_write_phy_reg_igp(hw, offset, data, true);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* The example of reading and writintg data of W25Xxx. */
|
void W25XxxReadWrite(void)
|
/* The example of reading and writintg data of W25Xxx. */
void W25XxxReadWrite(void)
|
{
xSysCtlClockSet(50000000, xSYSCTL_OSC_MAIN | xSYSCTL_XTAL_12MHZ);
W25XInit(10000);
if(0xEF14 == W25XIDcodeGet())
{
W25XChipErase();
W25XWrite(ucWriteData, 138, Length);
W25XRead(ucReadData, 138, Length);
}
}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
/* aac_nark_init - initialize an NEMER/ARK Split Bar card @dev: device to configure */
|
int aac_nark_init(struct aac_dev *dev)
|
/* aac_nark_init - initialize an NEMER/ARK Split Bar card @dev: device to configure */
int aac_nark_init(struct aac_dev *dev)
|
{
dev->a_ops.adapter_ioremap = aac_nark_ioremap;
dev->a_ops.adapter_comm = aac_rx_select_comm;
return _aac_rx_init(dev);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Shell command that dumps standard registers of TCPCs for all available USB-C ports. */
|
static int cmd_tcpc_dump(const struct shell *sh, size_t argc, char **argv)
|
/* Shell command that dumps standard registers of TCPCs for all available USB-C ports. */
static int cmd_tcpc_dump(const struct shell *sh, size_t argc, char **argv)
|
{
int ret = 0;
if (argc <= 1) {
DT_FOREACH_STATUS_OKAY(usb_c_connector, TCPC_DUMP_CONN_NODE);
} else {
const struct device *dev = device_get_binding(argv[1]);
if (dev != NULL) {
TCPC_DUMP_DEV(dev);
} else {
ret = -ENODEV;
}
}
return ret;
}
|
zephyrproject-rtos/zephyr
|
C++
|
Apache License 2.0
| 9,573
|
/* Update the KEK form base on the input file path info. */
|
BOOLEAN EFIAPI UpdateKEKFromFile(IN EFI_DEVICE_PATH_PROTOCOL *FilePath)
|
/* Update the KEK form base on the input file path info. */
BOOLEAN EFIAPI UpdateKEKFromFile(IN EFI_DEVICE_PATH_PROTOCOL *FilePath)
|
{
return UpdatePage (FilePath, FORMID_ENROLL_KEK_FORM);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Wait message into message buffer in basic mode. */
|
void CAN_WaitMsg(CAN_T *tCAN)
|
/* Wait message into message buffer in basic mode. */
void CAN_WaitMsg(CAN_T *tCAN)
|
{
tCAN->STATUS = 0x0ul;
while (1)
{
if (tCAN->IF[1].MCON & CAN_IF_MCON_NEWDAT_Msk)
{
break;
}
else
{
}
if (tCAN->STATUS & CAN_STATUS_RXOK_Msk)
{
}
else
{
}
if (tCAN->STATUS & CAN_STATUS_LEC_Msk)
{
}
else
{
}
}
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* USB Device Check Media Ready Parameters: None Return Value: TRUE - Success, FALSE - Error */
|
BOOL USBD_MSC_CheckMedia(void)
|
/* USB Device Check Media Ready Parameters: None Return Value: TRUE - Success, FALSE - Error */
BOOL USBD_MSC_CheckMedia(void)
|
{
USBD_MSC_MediaReadyEx = USBD_MSC_MediaReady;
if (!USBD_MSC_MediaReady) {
if (USBD_MSC_CBW.dDataLength) {
if ((USBD_MSC_CBW.bmFlags & 0x80) != 0) {
USBD_MSC_SetStallEP(usbd_msc_ep_bulkin | 0x80);
} else {
if (USBD_MSC_CSW.dDataResidue != BulkLen) {
USBD_MSC_SetStallEP(usbd_msc_ep_bulkout);
}
}
}
USBD_MSC_CSW.bStatus = CSW_CMD_FAILED;
USBD_MSC_SetCSW();
return (__FALSE);
}
return (__TRUE);
}
|
ARMmbed/DAPLink
|
C++
|
Apache License 2.0
| 2,140
|
/* Set a sensor device to low-power or standby mode. */
|
bool sensor_sleep(sensor_t *sensor, int arg)
|
/* Set a sensor device to low-power or standby mode. */
bool sensor_sleep(sensor_t *sensor, int arg)
|
{
return sensor_set_state(sensor, SENSOR_STATE_SLEEP);
}
|
memfault/zero-to-main
|
C++
| null | 200
|
/* pci_write_vpd - Write entry to Vital Product Data @dev: pci device struct @pos: offset in vpd space @count: number of bytes to write @buf: buffer containing write data */
|
ssize_t pci_write_vpd(struct pci_dev *dev, loff_t pos, size_t count, const void *buf)
|
/* pci_write_vpd - Write entry to Vital Product Data @dev: pci device struct @pos: offset in vpd space @count: number of bytes to write @buf: buffer containing write data */
ssize_t pci_write_vpd(struct pci_dev *dev, loff_t pos, size_t count, const void *buf)
|
{
if (!dev->vpd || !dev->vpd->ops)
return -ENODEV;
return dev->vpd->ops->write(dev, pos, count, buf);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Each protocol-specific driver should call this routine when its module is unloaded. */
|
void mpt_deregister(u8 cb_idx)
|
/* Each protocol-specific driver should call this routine when its module is unloaded. */
void mpt_deregister(u8 cb_idx)
|
{
if (cb_idx && (cb_idx < MPT_MAX_PROTOCOL_DRIVERS)) {
MptCallbacks[cb_idx] = NULL;
MptDriverClass[cb_idx] = MPTUNKNOWN_DRIVER;
MptEvHandlers[cb_idx] = NULL;
last_drv_idx++;
}
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* param base MCAN peripheral base address. param config The MCAN filter configuration. param filter The MCAN extended message ID filter element configuration. param idx The extended message ID filter element index. */
|
void MCAN_SetEXTFilterElement(CAN_Type *base, const mcan_frame_filter_config_t *config, const mcan_ext_filter_element_config_t *filter, uint8_t idx)
|
/* param base MCAN peripheral base address. param config The MCAN filter configuration. param filter The MCAN extended message ID filter element configuration. param idx The extended message ID filter element index. */
void MCAN_SetEXTFilterElement(CAN_Type *base, const mcan_frame_filter_config_t *config, const mcan_ext_filter_element_config_t *filter, uint8_t idx)
|
{
uint32_t *elementAddress = NULL;
elementAddress = (uint32_t *)(MCAN_GetMsgRAMBase(base) + config->address + idx * 8U);
(void)memcpy((void *)elementAddress, (const void *)filter, sizeof(mcan_ext_filter_element_config_t));
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Register the Service B.4 and all its Characteristics... */
|
void service_b_4_3_init(void)
|
/* Register the Service B.4 and all its Characteristics... */
void service_b_4_3_init(void)
|
{
bt_gatt_service_register(&service_b_4_3_svc);
}
|
zephyrproject-rtos/zephyr
|
C++
|
Apache License 2.0
| 9,573
|
/* The state holds the state to transition to, which may in fact be an acceptance of a BIOS requested state change. */
|
static int set_power_state(u_short what, u_short state)
|
/* The state holds the state to transition to, which may in fact be an acceptance of a BIOS requested state change. */
static int set_power_state(u_short what, u_short state)
|
{
u32 eax;
int err;
if (apm_bios_call_simple(APM_FUNC_SET_STATE, what, state, &eax, &err))
return err;
return APM_SUCCESS;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Clear all events.
Function clears all actually pending events */
|
static void nrf_drv_twis_clear_all_events(NRF_TWIS_Type *const p_reg)
|
/* Clear all events.
Function clears all actually pending events */
static void nrf_drv_twis_clear_all_events(NRF_TWIS_Type *const p_reg)
|
{
nrf_twis_event_clear(p_reg, NRF_TWIS_EVENT_STOPPED);
nrf_twis_event_clear(p_reg, NRF_TWIS_EVENT_ERROR);
nrf_twis_event_clear(p_reg, NRF_TWIS_EVENT_RXSTARTED);
nrf_twis_event_clear(p_reg, NRF_TWIS_EVENT_TXSTARTED);
nrf_twis_event_clear(p_reg, NRF_TWIS_EVENT_WRITE);
nrf_twis_event_clear(p_reg, NRF_TWIS_EVENT_READ);
}
|
labapart/polymcu
|
C++
| null | 201
|
/* 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 GPIOPinTypeQEI(uint32_t ui32Port, uint8_t ui8Pins)
|
/* 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 GPIOPinTypeQEI(uint32_t ui32Port, uint8_t ui8Pins)
|
{
ASSERT(_GPIOBaseValid(ui32Port));
GPIODirModeSet(ui32Port, ui8Pins, GPIO_DIR_MODE_HW);
GPIOPadConfigSet(ui32Port, ui8Pins, GPIO_STRENGTH_2MA,
GPIO_PIN_TYPE_STD_WPU);
}
|
feaser/openblt
|
C++
|
GNU General Public License v3.0
| 601
|
/* read a array type flag and add it to tree */
|
static void read_array_type(unsigned int *offset, tvbuff_t *tvb, proto_tree *etch_tree)
|
/* read a array type flag and add it to tree */
static void read_array_type(unsigned int *offset, tvbuff_t *tvb, proto_tree *etch_tree)
|
{
guint32 type_code;
type_code = tvb_get_guint8(tvb, *offset);
read_type(offset, tvb, etch_tree);
if (type_code == ETCH_TC_CUSTOM) {
read_type(offset, tvb, etch_tree);
proto_tree_add_item(etch_tree, hf_etch_value, tvb, *offset, 4,
ENC_BIG_ENDIAN);
(*offset) += 4;
}
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* get peripheral clock 1 ( UART, Timer, PWM ) */
|
static unsigned long perclk1_get_rate(struct clk *clk)
|
/* get peripheral clock 1 ( UART, Timer, PWM ) */
static unsigned long perclk1_get_rate(struct clk *clk)
|
{
return clk_get_rate(clk->parent) / (((__raw_readl(CCM_PCDR) &
CCM_PCDR_PCLK1_MASK) >> CCM_PCDR_PCLK1_OFFSET) + 1);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Determines whether the AD converter is busy or not. */
|
xtBoolean ADCBusy(unsigned long ulBase)
|
/* Determines whether the AD converter is busy or not. */
xtBoolean ADCBusy(unsigned long ulBase)
|
{
xASSERT(ulBase == ADC0_BASE);
return ((xHWREG(ulBase + ADC_SR) & ADC_SR_BUSY) ? xtrue : xfalse);
}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
/* This function is executed in case of error occurrence. */
|
static void Error_Handler(void)
|
/* This function is executed in case of error occurrence. */
static void Error_Handler(void)
|
{
BSP_LED_On(LED2);
while(1)
{
}
}
|
STMicroelectronics/STM32CubeF4
|
C++
|
Other
| 789
|
/* Returns the size of the Named Component node. */
|
STATIC UINT32 GetNamedComponentNodeSize(IN CONST CM_ARM_NAMED_COMPONENT_NODE *Node)
|
/* Returns the size of the Named Component node. */
STATIC UINT32 GetNamedComponentNodeSize(IN CONST CM_ARM_NAMED_COMPONENT_NODE *Node)
|
{
ASSERT (Node != NULL);
return (UINT32)(sizeof (EFI_ACPI_6_0_IO_REMAPPING_NAMED_COMP_NODE) +
(Node->IdMappingCount *
sizeof (EFI_ACPI_6_0_IO_REMAPPING_ID_TABLE)) +
ALIGN_VALUE (AsciiStrSize (Node->ObjectName), 4));
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Returns 1 for success, or < 0 on error. */
|
static int get_relfile(cmd_tbl_t *cmdtp, const char *file_path, unsigned long file_addr)
|
/* Returns 1 for success, or < 0 on error. */
static int get_relfile(cmd_tbl_t *cmdtp, const char *file_path, unsigned long file_addr)
|
{
size_t path_len;
char relfile[MAX_TFTP_PATH_LEN + 1];
char addr_buf[18];
int err;
err = get_bootfile_path(file_path, relfile, sizeof(relfile));
if (err < 0)
return err;
path_len = strlen(file_path);
path_len += strlen(relfile);
if (path_len > MAX_TFTP_PATH_LEN) {
printf("Base path too long (%s%s)\n", relfile, file_path);
return -ENAMETOOLONG;
}
strcat(relfile, file_path);
printf("Retrieving file: %s\n", relfile);
sprintf(addr_buf, "%lx", file_addr);
return do_getfile(cmdtp, relfile, addr_buf);
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* Change Logs: Date Author Notes spaceman first version */
|
static void bsp_clock_config(void)
|
/* Change Logs: Date Author Notes spaceman first version */
static void bsp_clock_config(void)
|
{
RemapVtorTable();
SystemClk_HSEInit(RCC_PLLMul_20);
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);
uint32_t sysclk = 0;
getSystemClock(&sysclk);
SysTick_Config(sysclk / RT_TICK_PER_SECOND);
SysTick->CTRL |= 0x00000004UL;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Add a buffer of the given length to the supplied HW and SW Rx descriptors. */
|
static int add_one_rx_buf(void *va, unsigned int len, struct rx_desc *d, struct rx_sw_desc *sd, unsigned int gen, struct pci_dev *pdev)
|
/* Add a buffer of the given length to the supplied HW and SW Rx descriptors. */
static int add_one_rx_buf(void *va, unsigned int len, struct rx_desc *d, struct rx_sw_desc *sd, unsigned int gen, struct pci_dev *pdev)
|
{
dma_addr_t mapping;
mapping = pci_map_single(pdev, va, len, PCI_DMA_FROMDEVICE);
if (unlikely(pci_dma_mapping_error(pdev, mapping)))
return -ENOMEM;
pci_unmap_addr_set(sd, dma_addr, mapping);
d->addr_lo = cpu_to_be32(mapping);
d->addr_hi = cpu_to_be32((u64) mapping >> 32);
wmb();
d->len_gen = cpu_to_be32(V_FLD_GEN1(gen));
d->gen2 = cpu_to_be32(V_FLD_GEN2(gen));
return 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* __check_agg_selection_timer - check if the selection timer has expired @port: the port we're looking at */
|
static int __check_agg_selection_timer(struct port *port)
|
/* __check_agg_selection_timer - check if the selection timer has expired @port: the port we're looking at */
static int __check_agg_selection_timer(struct port *port)
|
{
struct bonding *bond = __get_bond_by_port(port);
if (bond == NULL) {
return 0;
}
return BOND_AD_INFO(bond).agg_select_timer ? 1 : 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Refer to SD Physical Layer Simplified Spec 4.1 Section 4.7 for details. */
|
EFI_STATUS SdPeimVoltageCheck(IN SD_PEIM_HC_SLOT *Slot, IN UINT8 SupplyVoltage, IN UINT8 CheckPattern)
|
/* Refer to SD Physical Layer Simplified Spec 4.1 Section 4.7 for details. */
EFI_STATUS SdPeimVoltageCheck(IN SD_PEIM_HC_SLOT *Slot, IN UINT8 SupplyVoltage, IN UINT8 CheckPattern)
|
{
SD_COMMAND_BLOCK SdCmdBlk;
SD_STATUS_BLOCK SdStatusBlk;
SD_COMMAND_PACKET Packet;
EFI_STATUS Status;
ZeroMem (&SdCmdBlk, sizeof (SdCmdBlk));
ZeroMem (&SdStatusBlk, sizeof (SdStatusBlk));
ZeroMem (&Packet, sizeof (Packet));
Packet.SdCmdBlk = &SdCmdBlk;
Packet.SdStatusBlk = &SdStatusBlk;
Packet.Timeout = SD_TIMEOUT;
SdCmdBlk.CommandIndex = SD_SEND_IF_COND;
SdCmdBlk.CommandType = SdCommandTypeBcr;
SdCmdBlk.ResponseType = SdResponseTypeR7;
SdCmdBlk.CommandArgument = (SupplyVoltage << 8) | CheckPattern;
Status = SdPeimExecCmd (Slot, &Packet);
if (!EFI_ERROR (Status)) {
if (SdStatusBlk.Resp0 != SdCmdBlk.CommandArgument) {
return EFI_DEVICE_ERROR;
}
}
return Status;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* This function gets the device path associated with a mapping. */
|
CONST EFI_DEVICE_PATH_PROTOCOL* EFIAPI EfiShellGetDevicePathFromMap(IN CONST CHAR16 *Mapping)
|
/* This function gets the device path associated with a mapping. */
CONST EFI_DEVICE_PATH_PROTOCOL* EFIAPI EfiShellGetDevicePathFromMap(IN CONST CHAR16 *Mapping)
|
{
SHELL_MAP_LIST *MapListItem;
CHAR16 *NewName;
UINTN Size;
NewName = NULL;
Size = 0;
StrnCatGrow (&NewName, &Size, Mapping, 0);
if (Mapping[StrLen (Mapping)-1] != L':') {
StrnCatGrow (&NewName, &Size, L":", 0);
}
MapListItem = ShellCommandFindMapItem (NewName);
FreePool (NewName);
if (MapListItem != NULL) {
return (MapListItem->DevicePath);
}
return (NULL);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Set interface as duplicate if another is found on the same subnet. */
|
static void _mdns_dup_interface(tcpip_adapter_if_t tcpip_if)
|
/* Set interface as duplicate if another is found on the same subnet. */
static void _mdns_dup_interface(tcpip_adapter_if_t tcpip_if)
|
{
uint8_t i;
tcpip_adapter_if_t other_if = _mdns_get_other_if (tcpip_if);
for (i=0; i<MDNS_IP_PROTOCOL_MAX; i++) {
if (_mdns_server->interfaces[other_if].pcbs[i].pcb) {
if (_mdns_server->interfaces[tcpip_if].pcbs[i].pcb) {
_mdns_clear_pcb_tx_queue_head(tcpip_if, i);
_mdns_pcb_deinit(tcpip_if, i);
}
_mdns_server->interfaces[tcpip_if].pcbs[i].state = PCB_DUP;
_mdns_announce_pcb(other_if, i, NULL, 0, true);
}
}
}
|
retro-esp32/RetroESP32
|
C++
|
Creative Commons Attribution Share Alike 4.0 International
| 581
|
/* Called by nand_init_chip to initialize the board specific functions */
|
int board_nand_init(struct nand_chip *nand)
|
/* Called by nand_init_chip to initialize the board specific functions */
int board_nand_init(struct nand_chip *nand)
|
{
struct misc_regs *const misc_regs_p =
(struct misc_regs *)CONFIG_SPEAR_MISCBASE;
if (((readl(&misc_regs_p->auto_cfg_reg) & MISC_SOCCFGMSK) ==
MISC_SOCCFG30) ||
((readl(&misc_regs_p->auto_cfg_reg) & MISC_SOCCFGMSK) ==
MISC_SOCCFG31)) {
return spear_nand_init(nand);
}
return -1;
}
|
EmcraftSystems/u-boot
|
C++
|
Other
| 181
|
/* BACnetClientCOV ::= CHOICE { real-increment REAL, default-increment NULL } */
|
static guint fClientCOV(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset)
|
/* BACnetClientCOV ::= CHOICE { real-increment REAL, default-increment NULL } */
static guint fClientCOV(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset)
|
{
if (tvb_reported_length_remaining(tvb, offset) > 0) {
offset = fApplicationTypes(tvb, pinfo, tree, offset, "increment: ");
}
return offset;
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Send SELECT_CARD command to set the card enter or exit transfer state. */
|
static status_t MMC_SelectCard(mmc_card_t *card, bool isSelected)
|
/* Send SELECT_CARD command to set the card enter or exit transfer state. */
static status_t MMC_SelectCard(mmc_card_t *card, bool isSelected)
|
{
assert(card);
return SDMMC_SelectCard(card->host.base, card->host.transfer, card->relativeAddress, isSelected);
}
|
labapart/polymcu
|
C++
| null | 201
|
/* Switches blocks by programming the current one and initializing the next. */
|
static tFlashBlockInfo * FlashSwitchBlock(tFlashBlockInfo *block, blt_addr base_addr)
|
/* Switches blocks by programming the current one and initializing the next. */
static tFlashBlockInfo * FlashSwitchBlock(tFlashBlockInfo *block, blt_addr base_addr)
|
{
blt_addr last_block_base_addr;
last_block_base_addr = flashLayout[FLASH_LAST_SECTOR_IDX].sector_start + \
flashLayout[FLASH_LAST_SECTOR_IDX].sector_size - \
FLASH_WRITE_BLOCK_SIZE;
if (block == &bootBlockInfo)
{
block = &blockInfo;
}
else if (base_addr == last_block_base_addr)
{
block = &bootBlockInfo;
}
else
{
if (FlashWriteBlock(block) == BLT_FALSE)
{
return BLT_NULL;
}
}
if (FlashInitBlock(block, base_addr) == BLT_FALSE)
{
return BLT_NULL;
}
return block;
}
|
feaser/openblt
|
C++
|
GNU General Public License v3.0
| 601
|
/* Add a new head to a linked list */
|
void* lv_ll_ins_head(lv_ll_t *ll_p)
|
/* Add a new head to a linked list */
void* lv_ll_ins_head(lv_ll_t *ll_p)
|
{
lv_ll_node_t * n_new;
n_new = lv_mem_alloc(ll_p->n_size + LL_NODE_META_SIZE);
if(n_new != NULL) {
node_set_prev(ll_p, n_new, NULL);
node_set_next(ll_p, n_new, ll_p->head);
if(ll_p->head != NULL) {
node_set_prev(ll_p, ll_p->head, n_new);
}
ll_p->head = n_new;
if(ll_p->tail == NULL) {
ll_p->tail = n_new;
}
}
return n_new;
}
|
alibaba/AliOS-Things
|
C++
|
Apache License 2.0
| 4,536
|
/* Function for consuming a command queue element.
Function for consuming a command queue element, which has been fully processed. */
|
static void command_queue_element_consume(void)
|
/* Function for consuming a command queue element.
Function for consuming a command queue element, which has been fully processed. */
static void command_queue_element_consume(void)
|
{
cmd_queue_element_init(m_cmd_queue.rp);
--(m_cmd_queue.count);
if (++(m_cmd_queue.rp) == PSTORAGE_CMD_QUEUE_SIZE)
{
m_cmd_queue.rp = 0;
}
}
|
labapart/polymcu
|
C++
| null | 201
|
/* Program the PIO mode timings for the controller according to the pio clocking table. */
|
static void cs5520_set_piomode(struct ata_port *ap, struct ata_device *adev)
|
/* Program the PIO mode timings for the controller according to the pio clocking table. */
static void cs5520_set_piomode(struct ata_port *ap, struct ata_device *adev)
|
{
cs5520_set_timings(ap, adev, adev->pio_mode);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Compare two filename (fileName1,fileName2). If iCaseSenisivity = 1, comparision is case sensitivity (like strcmp) If iCaseSenisivity = 2, comparision is not case sensitivity (like strcmpi or strcasecmp) If iCaseSenisivity = 0, case sensitivity is defaut of your operating system (like 1 on Unix, 2 on Windows) */
|
int ZEXPORT unzStringFileNameCompare(const char *fileName1, const char *fileName2, int iCaseSensitivity)
|
/* Compare two filename (fileName1,fileName2). If iCaseSenisivity = 1, comparision is case sensitivity (like strcmp) If iCaseSenisivity = 2, comparision is not case sensitivity (like strcmpi or strcasecmp) If iCaseSenisivity = 0, case sensitivity is defaut of your operating system (like 1 on Unix, 2 on Windows) */
int ZEXPORT unzStringFileNameCompare(const char *fileName1, const char *fileName2, int iCaseSensitivity)
|
{
if (iCaseSensitivity==0)
iCaseSensitivity=CASESENSITIVITYDEFAULTVALUE;
if (iCaseSensitivity==1)
return strcmp(fileName1,fileName2);
return STRCMPCASENOSENTIVEFUNCTION(fileName1,fileName2);
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* This file is part of the Simba project. */
|
int mock_write_bmp280_module_init(int res)
|
/* This file is part of the Simba project. */
int mock_write_bmp280_module_init(int res)
|
{
harness_mock_write("bmp280_module_init()",
NULL,
0);
harness_mock_write("bmp280_module_init(): return (res)",
&res,
sizeof(res));
return (0);
}
|
eerimoq/simba
|
C++
|
Other
| 337
|
/* Configure LCDC DMA under flow mode and under flow error data . */
|
void LCDC_DMAUnderFlowConfig(LCDC_TypeDef *LCDCx, u32 DmaUnFlwMode, u32 ErrorData)
|
/* Configure LCDC DMA under flow mode and under flow error data . */
void LCDC_DMAUnderFlowConfig(LCDC_TypeDef *LCDCx, u32 DmaUnFlwMode, u32 ErrorData)
|
{
assert_param(IS_LCDC_ALL_PERIPH(LCDCx));
assert_param(IS_LCDC_DMA_DMA_UNDERFLOW_MODE(DmaUnFlwMode));
assert_param(ErrorData <= 0xFFFF);
LCDCx->LCDC_UNDFLW_CFG &= ~LCDC_UNDFLW_CFG_UNDMODE;
LCDCx->LCDC_UNDFLW_CFG |= DmaUnFlwMode;
if(DmaUnFlwMode==LCDC_DMAUNFW_OUTPUT_ERRORDATA) {
LCDCx->LCDC_UNDFLW_CFG &= ~LCDC_UNDFLW_CFG_ERROUTDATA;
LCDCx->LCDC_UNDFLW_CFG |= ErrorData;
}
}
|
alibaba/AliOS-Things
|
C++
|
Apache License 2.0
| 4,536
|
/* set an interrupt stub to jump to a handler */
|
void __init set_intr_stub(enum exception_code code, void *handler)
|
/* set an interrupt stub to jump to a handler */
void __init set_intr_stub(enum exception_code code, void *handler)
|
{
unsigned long addr;
u8 *vector = (u8 *)(CONFIG_INTERRUPT_VECTOR_BASE + code);
addr = (unsigned long) handler - (unsigned long) vector;
vector[0] = 0xdc;
vector[1] = addr;
vector[2] = addr >> 8;
vector[3] = addr >> 16;
vector[4] = addr >> 24;
vector[5] = 0xcb;
vector[6] = 0xcb;
vector[7] = 0xcb;
mn10300_dcache_flush_inv();
mn10300_icache_inv();
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Set the retransmit time of a neighbour table to the specified value */
|
void rtnl_neightbl_set_retrans_time(struct rtnl_neightbl *ntbl, uint64_t ms)
|
/* Set the retransmit time of a neighbour table to the specified value */
void rtnl_neightbl_set_retrans_time(struct rtnl_neightbl *ntbl, uint64_t ms)
|
{
ntbl->nt_parms.ntp_retrans_time = ms;
ntbl->nt_parms.ntp_mask |= NEIGHTBLPARM_ATTR_RETRANS_TIME;
ntbl->ce_mask |= NEIGHTBL_ATTR_PARMS;
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Gets the interrupt status.
This function returns timer interrupt status */
|
tmrHw_INTERRUPT_STATUS_e tmrHw_getInterruptStatus(tmrHw_ID_t timerId)
|
/* Gets the interrupt status.
This function returns timer interrupt status */
tmrHw_INTERRUPT_STATUS_e tmrHw_getInterruptStatus(tmrHw_ID_t timerId)
|
{
if (pTmrHw[timerId].InterruptStatus) {
return tmrHw_INTERRUPT_STATUS_SET;
} else {
return tmrHw_INTERRUPT_STATUS_UNSET;
}
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* bfin_check_altstatus - Read device alternate status reg @ap: port where the device is */
|
static u8 bfin_check_altstatus(struct ata_port *ap)
|
/* bfin_check_altstatus - Read device alternate status reg @ap: port where the device is */
static u8 bfin_check_altstatus(struct ata_port *ap)
|
{
void __iomem *base = (void __iomem *)ap->ioaddr.ctl_addr;
return read_atapi_register(base, ATA_REG_ALTSTATUS);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Restore's the kernel's fbcon mode, used for lastclose & panic paths. */
|
void drm_fb_helper_restore(void)
|
/* Restore's the kernel's fbcon mode, used for lastclose & panic paths. */
void drm_fb_helper_restore(void)
|
{
bool ret;
ret = drm_fb_helper_force_kernel_mode();
if (ret == true)
DRM_ERROR("Failed to restore crtc configuration\n");
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Make a new device known to the system. */
|
static int dasd_state_new_to_known(struct dasd_device *device)
|
/* Make a new device known to the system. */
static int dasd_state_new_to_known(struct dasd_device *device)
|
{
int rc;
dasd_get_device(device);
if (device->block) {
rc = dasd_alloc_queue(device->block);
if (rc) {
dasd_put_device(device);
return rc;
}
}
device->state = DASD_STATE_KNOWN;
return 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Setup the systick timer to generate the tick interrupts at the required frequency. */
|
static void start_sys_timer(void)
|
/* Setup the systick timer to generate the tick interrupts at the required frequency. */
static void start_sys_timer(void)
|
{
struct itimerval itimer, oitimer;
int us;
us = 1000000 / RT_TICK_PER_SECOND - 1;
TRACE("start system tick!\n");
if (0 != getitimer(TIMER_TYPE, &itimer))
{
TRACE("get timer failed.\n");
exit(EXIT_FAILURE);
}
itimer.it_interval.tv_sec = 0;
itimer.it_interval.tv_usec = us;
itimer.it_value.tv_sec = 0;
itimer.it_value.tv_usec = us;
if (0 != setitimer(TIMER_TYPE, &itimer, &oitimer))
{
TRACE("set timer failed.\n");
exit(EXIT_FAILURE);
}
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* This API sets the address of the register of Aux Mag sensor where the data to be read. */
|
uint16_t bma4_set_mag_read_addr(uint8_t mag_read_addr, struct bma4_dev *dev)
|
/* This API sets the address of the register of Aux Mag sensor where the data to be read. */
uint16_t bma4_set_mag_read_addr(uint8_t mag_read_addr, struct bma4_dev *dev)
|
{
uint16_t rslt = 0;
if (dev == NULL) {
rslt |= BMA4_E_NULL_PTR;
} else {
rslt |= bma4_write_regs(BMA4_AUX_RD_ADDR, &mag_read_addr, 1, dev);
}
return rslt;
}
|
arendst/Tasmota
|
C++
|
GNU General Public License v3.0
| 21,318
|
/* BSP clock initialize. Set board system clock 24Mhz. */
|
void rt_hw_board_clock_init(void)
|
/* BSP clock initialize. Set board system clock 24Mhz. */
void rt_hw_board_clock_init(void)
|
{
Sysctrl_SetRCHTrim(SysctrlRchFreq24MHz);
Sysctrl_ClkSourceEnable(SysctrlClkRCH, TRUE);
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Sends a command to the radio chip and gets a response */
|
uint8_t ezradio_comm_SendCmdGetResp(uint8_t cmdByteCount, uint8_t *pCmdData, uint8_t respByteCount, uint8_t *pRespData)
|
/* Sends a command to the radio chip and gets a response */
uint8_t ezradio_comm_SendCmdGetResp(uint8_t cmdByteCount, uint8_t *pCmdData, uint8_t respByteCount, uint8_t *pRespData)
|
{
ezradio_comm_SendCmd(cmdByteCount, pCmdData);
return ezradio_comm_GetResp(respByteCount, pRespData);
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* Replace the fs->{pwdmnt,pwd} with {mnt,dentry}. Put the old values. It can block. */
|
void set_fs_pwd(struct fs_struct *fs, struct path *path)
|
/* Replace the fs->{pwdmnt,pwd} with {mnt,dentry}. Put the old values. It can block. */
void set_fs_pwd(struct fs_struct *fs, struct path *path)
|
{
struct path old_pwd;
write_lock(&fs->lock);
old_pwd = fs->pwd;
fs->pwd = *path;
path_get(path);
write_unlock(&fs->lock);
if (old_pwd.dentry)
path_put(&old_pwd);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Gets channel specific user data.
This function returns user data specific to a DMA channel */
|
void* dmacHw_getChannelUserData(dmacHw_HANDLE_t handle)
|
/* Gets channel specific user data.
This function returns user data specific to a DMA channel */
void* dmacHw_getChannelUserData(dmacHw_HANDLE_t handle)
|
{
dmacHw_CBLK_t *pCblk = dmacHw_HANDLE_TO_CBLK(handle);
return pCblk->userData;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Print instructional text to help user execute the menu. */
|
static void menu_print_footer(const char *indent, const menu_t *menu)
|
/* Print instructional text to help user execute the menu. */
static void menu_print_footer(const char *indent, const menu_t *menu)
|
{
if (menu->footer)
printf("\n%s%s\n", indent, menu->footer);
else
printf("\n");
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* param base Pointer to the FLEXIO_UART_Type structure. param mask Status flag. The parameter can be any combination of the following values: arg kFLEXIO_UART_TxDataRegEmptyFlag arg kFLEXIO_UART_RxEmptyFlag arg kFLEXIO_UART_RxOverRunFlag */
|
void FLEXIO_UART_ClearStatusFlags(FLEXIO_UART_Type *base, uint32_t mask)
|
/* param base Pointer to the FLEXIO_UART_Type structure. param mask Status flag. The parameter can be any combination of the following values: arg kFLEXIO_UART_TxDataRegEmptyFlag arg kFLEXIO_UART_RxEmptyFlag arg kFLEXIO_UART_RxOverRunFlag */
void FLEXIO_UART_ClearStatusFlags(FLEXIO_UART_Type *base, uint32_t mask)
|
{
if ((mask & (uint32_t)kFLEXIO_UART_TxDataRegEmptyFlag) != 0U)
{
FLEXIO_ClearShifterStatusFlags(base->flexioBase, 1UL << base->shifterIndex[0]);
}
if ((mask & (uint32_t)kFLEXIO_UART_RxDataRegFullFlag) != 0U)
{
FLEXIO_ClearShifterStatusFlags(base->flexioBase, 1UL << base->shifterIndex[1]);
}
if ((mask & (uint32_t)kFLEXIO_UART_RxOverRunFlag) != 0U)
{
FLEXIO_ClearShifterErrorFlags(base->flexioBase, 1UL << base->shifterIndex[1]);
}
}
|
eclipse-threadx/getting-started
|
C++
|
Other
| 310
|
/* Main program entry point. This routine contains the overall program flow, including initial setup of all components and the main program loop. */
|
int main(void)
|
/* Main program entry point. This routine contains the overall program flow, including initial setup of all components and the main program loop. */
int main(void)
|
{
SetupHardware();
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
GlobalInterruptEnable();
for (;;)
{
TMC_Task();
USB_USBTask();
}
}
|
prusa3d/Prusa-Firmware-Buddy
|
C++
|
Other
| 1,019
|
/* If the conversion results in an overflow or an underflow condition, then Result is set to INT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */
|
RETURN_STATUS EFIAPI SafeUint64ToInt32(IN UINT64 Operand, OUT INT32 *Result)
|
/* If the conversion results in an overflow or an underflow condition, then Result is set to INT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */
RETURN_STATUS EFIAPI SafeUint64ToInt32(IN UINT64 Operand, OUT INT32 *Result)
|
{
RETURN_STATUS Status;
if (Result == NULL) {
return RETURN_INVALID_PARAMETER;
}
if (Operand <= MAX_INT32) {
*Result = (INT32)Operand;
Status = RETURN_SUCCESS;
} else {
*Result = INT32_ERROR;
Status = RETURN_BUFFER_TOO_SMALL;
}
return Status;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Input: buf: C string containing whitespace- separated positive or negative integer values representing NFS protocol versions to enable ("+n") or disable ("-n") size: non-zero length of C string in @buf Output: On success: status of zero or more protocol versions has been updated; passed-in buffer filled with ' */
|
static ssize_t write_versions(struct file *file, char *buf, size_t size)
|
/* Input: buf: C string containing whitespace- separated positive or negative integer values representing NFS protocol versions to enable ("+n") or disable ("-n") size: non-zero length of C string in @buf Output: On success: status of zero or more protocol versions has been updated; passed-in buffer filled with ' */
static ssize_t write_versions(struct file *file, char *buf, size_t size)
|
{
ssize_t rv;
mutex_lock(&nfsd_mutex);
rv = __write_versions(file, buf, size);
mutex_unlock(&nfsd_mutex);
return rv;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* fc_disc_stop() - Stop discovery for a given lport @lport: The local port that discovery should stop on */
|
void fc_disc_stop(struct fc_lport *lport)
|
/* fc_disc_stop() - Stop discovery for a given lport @lport: The local port that discovery should stop on */
void fc_disc_stop(struct fc_lport *lport)
|
{
struct fc_disc *disc = &lport->disc;
if (disc) {
cancel_delayed_work_sync(&disc->disc_work);
fc_disc_stop_rports(disc);
}
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Description: Gets a reference to the scsi_device and increments the use count of the underlying LLDD module. You must hold host_lock of the parent Scsi_Host or already have a reference when calling this. */
|
int scsi_device_get(struct scsi_device *sdev)
|
/* Description: Gets a reference to the scsi_device and increments the use count of the underlying LLDD module. You must hold host_lock of the parent Scsi_Host or already have a reference when calling this. */
int scsi_device_get(struct scsi_device *sdev)
|
{
if (sdev->sdev_state == SDEV_DEL)
return -ENXIO;
if (!get_device(&sdev->sdev_gendev))
return -ENXIO;
try_module_get(sdev->host->hostt->module);
return 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* If this interface is not supported, then ASSERT(). */
|
VOID EFIAPI Pkcs7FreeSigners(IN UINT8 *Certs)
|
/* If this interface is not supported, then ASSERT(). */
VOID EFIAPI Pkcs7FreeSigners(IN UINT8 *Certs)
|
{
CALL_VOID_CRYPTO_SERVICE (Pkcs7FreeSigners, (Certs));
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Given a virtual address retrieve the original memory region that the mapping is belonging to. */
|
static struct region_map* get_region_map(void *v_addr)
|
/* Given a virtual address retrieve the original memory region that the mapping is belonging to. */
static struct region_map* get_region_map(void *v_addr)
|
{
for (size_t reg = 0; reg < ARRAY_SIZE(map); reg++) {
if ((uintptr_t) v_addr >= map[reg].region.addr &&
(uintptr_t) v_addr < map[reg].region.addr + map[reg].region.size) {
return &map[reg];
}
}
return NULL;
}
|
zephyrproject-rtos/zephyr
|
C++
|
Apache License 2.0
| 9,573
|
/* The set source address hold transfer size. The source address hold or loop transfer size is when the DMA transfer data from source address (SA), if the loop size is 4, the DMA will read data from SA, SA + 1, SA + 2, SA + 3, then loop back to SA, SA + 1 ... and so on. */
|
static void fsl_chan_set_src_loop_size(struct fsl_dma_chan *fsl_chan, int size)
|
/* The set source address hold transfer size. The source address hold or loop transfer size is when the DMA transfer data from source address (SA), if the loop size is 4, the DMA will read data from SA, SA + 1, SA + 2, SA + 3, then loop back to SA, SA + 1 ... and so on. */
static void fsl_chan_set_src_loop_size(struct fsl_dma_chan *fsl_chan, int size)
|
{
switch (size) {
case 0:
DMA_OUT(fsl_chan, &fsl_chan->reg_base->mr,
DMA_IN(fsl_chan, &fsl_chan->reg_base->mr, 32) &
(~FSL_DMA_MR_SAHE), 32);
break;
case 1:
case 2:
case 4:
case 8:
DMA_OUT(fsl_chan, &fsl_chan->reg_base->mr,
DMA_IN(fsl_chan, &fsl_chan->reg_base->mr, 32) |
FSL_DMA_MR_SAHE | (__ilog2(size) << 14),
32);
break;
}
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Returns: TRUE if the @volume can be ejected. FALSE otherwise */
|
gboolean g_volume_can_eject(GVolume *volume)
|
/* Returns: TRUE if the @volume can be ejected. FALSE otherwise */
gboolean g_volume_can_eject(GVolume *volume)
|
{
GVolumeIface *iface;
g_return_val_if_fail (G_IS_VOLUME (volume), FALSE);
iface = G_VOLUME_GET_IFACE (volume);
if (iface->can_eject == NULL)
return FALSE;
return (* iface->can_eject) (volume);
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Determine the largest available block size.
Calculates the largest block which can be allocated by the Membag allocator if requested. Allocations larger than this amount are guaranteed to fail. */
|
size_t membag_get_largest_free_block_size(void)
|
/* Determine the largest available block size.
Calculates the largest block which can be allocated by the Membag allocator if requested. Allocations larger than this amount are guaranteed to fail. */
size_t membag_get_largest_free_block_size(void)
|
{
uint8_t i;
struct membag *largest_bag = NULL;
for (i = 0; i < ARRAY_LEN(membag_list); i++) {
if (membag_list[i].blocks_free == 0) {
continue;
}
if (!largest_bag ||
(largest_bag->block_size < membag_list[i].block_size)) {
largest_bag = &membag_list[i];
}
}
if (largest_bag) {
return largest_bag->block_size;
}
return 0;
}
|
memfault/zero-to-main
|
C++
| null | 200
|
/* Return stat information in bulk (by-inode) for the filesystem. Special case for non-sequential one inode bulkstat. */
|
int xfs_bulkstat_single(xfs_mount_t *mp, xfs_ino_t *lastinop, char __user *buffer, int *done)
|
/* Return stat information in bulk (by-inode) for the filesystem. Special case for non-sequential one inode bulkstat. */
int xfs_bulkstat_single(xfs_mount_t *mp, xfs_ino_t *lastinop, char __user *buffer, int *done)
|
{
int count;
int error;
xfs_ino_t ino;
int res;
ino = (xfs_ino_t)*lastinop;
error = xfs_bulkstat_one(mp, ino, buffer, sizeof(xfs_bstat_t),
NULL, 0, NULL, NULL, &res);
if (error) {
(*lastinop)--;
count = 1;
if (xfs_bulkstat(mp, lastinop, &count, xfs_bulkstat_one,
NULL, sizeof(xfs_bstat_t), buffer,
BULKSTAT_FG_IGET, done))
return error;
if (count == 0 || (xfs_ino_t)*lastinop != ino)
return error == EFSCORRUPTED ?
XFS_ERROR(EINVAL) : error;
else
return 0;
}
*done = 0;
return 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Author: Artem Bityutskiy (Битюцкий Артём) ubi_dump_flash - dump a region of flash. @ubi: UBI device description object @pnum: the physical eraseblock number to dump @offset: the starting offset within the physical eraseblock to dump @len: the length of the region to dump */
|
void ubi_dump_flash(struct ubi_device *ubi, int pnum, int offset, int len)
|
/* Author: Artem Bityutskiy (Битюцкий Артём) ubi_dump_flash - dump a region of flash. @ubi: UBI device description object @pnum: the physical eraseblock number to dump @offset: the starting offset within the physical eraseblock to dump @len: the length of the region to dump */
void ubi_dump_flash(struct ubi_device *ubi, int pnum, int offset, int len)
|
{
int err;
size_t read;
void *buf;
loff_t addr = (loff_t)pnum * ubi->peb_size + offset;
buf = vmalloc(len);
if (!buf)
return;
err = mtd_read(ubi->mtd, addr, len, &read, buf);
if (err && err != -EUCLEAN) {
ubi_err(ubi, "err %d while reading %d bytes from PEB %d:%d, read %zd bytes",
err, len, pnum, offset, read);
goto out;
}
ubi_msg(ubi, "dumping %d bytes of data from PEB %d, offset %d",
len, pnum, offset);
print_hex_dump("", DUMP_PREFIX_OFFSET, 32, 1, buf, len, 1);
out:
vfree(buf);
return;
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* @bmp_itr: pointer to bitmap (can be declared with DECLARE_BITMAP) @buffer: pointer to buffer containing bitmap data in big endian format (MSB first) @buffer_size:number of bytes with which bitmap should be initialized */
|
static void buffer_to_bmp(unsigned long *bmp_itr, void *_buffer, size_t buffer_size)
|
/* @bmp_itr: pointer to bitmap (can be declared with DECLARE_BITMAP) @buffer: pointer to buffer containing bitmap data in big endian format (MSB first) @buffer_size:number of bytes with which bitmap should be initialized */
static void buffer_to_bmp(unsigned long *bmp_itr, void *_buffer, size_t buffer_size)
|
{
u8 *buffer = _buffer;
size_t itr, len;
unsigned long val;
itr = 0;
while (itr < buffer_size) {
len = buffer_size - itr >= sizeof(val) ?
sizeof(val) : buffer_size - itr;
val = get_val(buffer, itr, len);
bmp_itr[itr / sizeof(val)] = val;
itr += sizeof(val);
}
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Write status register 1 byte Returns negative if error occurred. */
|
static int write_sr(struct m25p_spifi *flash, u8 val)
|
/* Write status register 1 byte Returns negative if error occurred. */
static int write_sr(struct m25p_spifi *flash, u8 val)
|
{
return spifi_opcode_write(flash, OPCODE_WRSR, &val, 1);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Created on: Oct 27, 2021 Author: jiangyuanyuan Configure pins as Analog Input Output EVENT_OUT EXTI */
|
void MY_I2C_Init(void)
|
/* Created on: Oct 27, 2021 Author: jiangyuanyuan Configure pins as Analog Input Output EVENT_OUT EXTI */
void MY_I2C_Init(void)
|
{
GPIO_InitTypeDef GPIO_InitStruct = {0};
__HAL_RCC_GPIO_CLK_ENABLE();
GPIO_InitStruct.Pin = GPIO_PIN_7 | GPIO_PIN_8;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT;
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_2, GPIO_PIN_SET);
}
|
pikasTech/PikaPython
|
C++
|
MIT License
| 1,403
|
/* This function implements the StrLwr() service of the EFI_UNICODE_COLLATION_PROTOCOL. */
|
static void EFIAPI efi_str_lwr(struct efi_unicode_collation_protocol *this, u16 *string)
|
/* This function implements the StrLwr() service of the EFI_UNICODE_COLLATION_PROTOCOL. */
static void EFIAPI efi_str_lwr(struct efi_unicode_collation_protocol *this, u16 *string)
|
{
EFI_ENTRY("%p, %ls", this, string);
for (; *string; ++string)
*string = utf_to_lower(*string);
EFI_EXIT(EFI_SUCCESS);
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* Description: This is the IPv6 hashing function for the node interface table, it returns the bucket number for the given IP address. */
|
static unsigned int sel_netnode_hashfn_ipv6(const struct in6_addr *addr)
|
/* Description: This is the IPv6 hashing function for the node interface table, it returns the bucket number for the given IP address. */
static unsigned int sel_netnode_hashfn_ipv6(const struct in6_addr *addr)
|
{
return (addr->s6_addr32[3] & (SEL_NETNODE_HASH_SIZE - 1));
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Indicate that the current shell or script should exit. */
|
VOID EFIAPI ShellCommandRegisterExit(IN BOOLEAN ScriptOnly, IN CONST UINT64 ErrorCode)
|
/* Indicate that the current shell or script should exit. */
VOID EFIAPI ShellCommandRegisterExit(IN BOOLEAN ScriptOnly, IN CONST UINT64 ErrorCode)
|
{
mExitRequested = (BOOLEAN)(!mExitRequested);
if (mExitRequested) {
mExitScript = ScriptOnly;
} else {
mExitScript = FALSE;
}
mExitCode = ErrorCode;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* NOTE: This assumes the chip address is 64-bit aligned. */
|
static int ipath_read_umem64(struct ipath_devdata *dd, void __user *uaddr, const void __iomem *caddr, size_t count)
|
/* NOTE: This assumes the chip address is 64-bit aligned. */
static int ipath_read_umem64(struct ipath_devdata *dd, void __user *uaddr, const void __iomem *caddr, size_t count)
|
{
const u64 __iomem *reg_addr = caddr;
const u64 __iomem *reg_end = reg_addr + (count / sizeof(u64));
int ret;
if (reg_addr < dd->ipath_kregbase || reg_end > dd->ipath_kregend) {
ret = -EINVAL;
goto bail;
}
while (reg_addr < reg_end) {
u64 data = readq(reg_addr);
if (copy_to_user(uaddr, &data, sizeof(u64))) {
ret = -EFAULT;
goto bail;
}
reg_addr++;
uaddr += sizeof(u64);
}
ret = 0;
bail:
return ret;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Check if 2 events contain the same information. We do not compare private data but at this moment that isn't a problem for any know fsnotify listeners. */
|
static bool event_compare(struct fsnotify_event *old, struct fsnotify_event *new)
|
/* Check if 2 events contain the same information. We do not compare private data but at this moment that isn't a problem for any know fsnotify listeners. */
static bool event_compare(struct fsnotify_event *old, struct fsnotify_event *new)
|
{
if ((old->mask == new->mask) &&
(old->to_tell == new->to_tell) &&
(old->data_type == new->data_type) &&
(old->name_len == new->name_len)) {
switch (old->data_type) {
case (FSNOTIFY_EVENT_INODE):
if (!old->name_len ||
!strcmp(old->file_name, new->file_name))
return true;
break;
case (FSNOTIFY_EVENT_PATH):
if ((old->path.mnt == new->path.mnt) &&
(old->path.dentry == new->path.dentry))
return true;
break;
case (FSNOTIFY_EVENT_NONE):
if (old->mask & FS_Q_OVERFLOW)
return true;
else if (old->mask & FS_IN_IGNORED)
return false;
return false;
};
}
return false;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Checks whether the specified FLASH flag is set or not. */
|
FlagStatus FLASH_GetFlagStatus(uint32_t FLASH_FLAG)
|
/* Checks whether the specified FLASH flag is set or not. */
FlagStatus FLASH_GetFlagStatus(uint32_t FLASH_FLAG)
|
{
FlagStatus bitstatus = RESET;
assert_param(IS_FLASH_GET_FLAG(FLASH_FLAG));
if ((FLASH->SR & FLASH_FLAG) != (uint32_t)RESET)
{
bitstatus = SET;
}
else
{
bitstatus = RESET;
}
return bitstatus;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* The size register holds the number of 8 bit bytes to transfer between bram and the icap (or icap to bram). */
|
static void buffer_icap_set_size(void __iomem *base_address, u32 data)
|
/* The size register holds the number of 8 bit bytes to transfer between bram and the icap (or icap to bram). */
static void buffer_icap_set_size(void __iomem *base_address, u32 data)
|
{
out_be32(base_address + XHI_SIZE_REG_OFFSET, data);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Enable a module clock derived from the PBB clock. */
|
void sysclk_enable_pbb_module(unsigned int index)
|
/* Enable a module clock derived from the PBB clock. */
void sysclk_enable_pbb_module(unsigned int index)
|
{
unsigned int pbus_id = 0;
irqflags_t flags;
if (index == SYSCLK_AES)
pbus_id = 1;
flags = cpu_irq_save();
if (!sysclk_bus_refcount[pbus_id])
sysclk_enable_hsb_module(2 + (4 * pbus_id));
sysclk_bus_refcount[pbus_id]++;
cpu_irq_restore(flags);
sysclk_priv_enable_module(AVR32_PM_CLK_GRP_PBB, index);
}
|
memfault/zero-to-main
|
C++
| null | 200
|
/* Called when we want to mark the current iclog as being ready to sync to disk. */
|
STATIC void xlog_state_want_sync(xlog_t *log, xlog_in_core_t *iclog)
|
/* Called when we want to mark the current iclog as being ready to sync to disk. */
STATIC void xlog_state_want_sync(xlog_t *log, xlog_in_core_t *iclog)
|
{
assert_spin_locked(&log->l_icloglock);
if (iclog->ic_state == XLOG_STATE_ACTIVE) {
xlog_state_switch_iclogs(log, iclog, 0);
} else {
ASSERT(iclog->ic_state &
(XLOG_STATE_WANT_SYNC|XLOG_STATE_IOERROR));
}
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Basically this function is a NOP since it will never be called, unless I implement the DC21041 SROM functions. There's no need since the existing code will be satisfactory for all boards. */
|
static int dc21041_infoleaf(struct net_device *dev)
|
/* Basically this function is a NOP since it will never be called, unless I implement the DC21041 SROM functions. There's no need since the existing code will be satisfactory for all boards. */
static int dc21041_infoleaf(struct net_device *dev)
|
{
return DE4X5_AUTOSENSE_MS;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Set the ADC MUX to the specified values. We do NOT do any checking of the values passed, since we assume that the relevant *_select_input function has done that for us. */
|
static void waveartist_set_adc_mux(wavnc_info *devc, char left_dev, char right_dev)
|
/* Set the ADC MUX to the specified values. We do NOT do any checking of the values passed, since we assume that the relevant *_select_input function has done that for us. */
static void waveartist_set_adc_mux(wavnc_info *devc, char left_dev, char right_dev)
|
{
unsigned int reg_08, reg_09;
reg_08 = waveartist_cmd1_r(devc, WACMD_GET_LEVEL | 0x0800);
reg_09 = waveartist_cmd1_r(devc, WACMD_GET_LEVEL | 0x0900);
reg_08 = (reg_08 & ~0x3f) | right_dev << 3 | left_dev;
waveartist_cmd3(devc, WACMD_SET_MIXER, reg_08, reg_09);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* System clock peripheral aon enable.
Use this function to enable system clock peripheral aon. */
|
enum status_code system_clock_peripheral_aon_enable(enum system_peripheral_aon peripheral_aon)
|
/* System clock peripheral aon enable.
Use this function to enable system clock peripheral aon. */
enum status_code system_clock_peripheral_aon_enable(enum system_peripheral_aon peripheral_aon)
|
{
switch (peripheral_aon) {
case PERIPHERAL_AON_SLEEP_TIMER:
AON_GP_REGS0->AON_MISC_CTRL.reg |= \
AON_GP_REGS_AON_MISC_CTRL_AON_SLEEP_TIMER_CLK_EN;
break;
case PERIPHERAL_AON_PD:
AON_GP_REGS0->AON_MISC_CTRL.reg |= \
AON_GP_REGS_AON_MISC_CTRL_AON_EXT_32KHZ_OUT_EN;
break;
default:
return STATUS_ERR_INVALID_ARG;
}
return STATUS_OK;
}
|
memfault/zero-to-main
|
C++
| null | 200
|
/* dead roots are old snapshots that need to be deleted. This allocates a dirty root struct and adds it into the list of dead roots that need to be deleted */
|
int btrfs_add_dead_root(struct btrfs_root *root)
|
/* dead roots are old snapshots that need to be deleted. This allocates a dirty root struct and adds it into the list of dead roots that need to be deleted */
int btrfs_add_dead_root(struct btrfs_root *root)
|
{
mutex_lock(&root->fs_info->trans_mutex);
list_add(&root->root_list, &root->fs_info->dead_roots);
mutex_unlock(&root->fs_info->trans_mutex);
return 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* The software interrupt instruction (SWI) is used for entering Supervisor mode, usually to request a particular supervisor function. */
|
void rt_hw_trap_swi(struct rt_hw_register *regs)
|
/* The software interrupt instruction (SWI) is used for entering Supervisor mode, usually to request a particular supervisor function. */
void rt_hw_trap_swi(struct rt_hw_register *regs)
|
{
rt_hw_show_register(regs);
rt_kprintf("software interrupt\n");
rt_hw_cpu_shutdown();
}
|
pikasTech/PikaPython
|
C++
|
MIT License
| 1,403
|
/* wifi stat recv thread for RTOS
run with RTOS */
|
void _MX_WIFI_RecvThread(THREAD_CONTEXT_TYPE context)
|
/* wifi stat recv thread for RTOS
run with RTOS */
void _MX_WIFI_RecvThread(THREAD_CONTEXT_TYPE context)
|
{
MX_WIFIObject_t *Obj = wifi_obj_get();
if (NULL != Obj)
{
while (true)
{
(void)MX_WIFI_IO_YIELD(Obj, 500);
}
}
THREAD_TERMINATE();
}
|
eclipse-threadx/getting-started
|
C++
|
Other
| 310
|
/* Return amount of bytes we can take at this offset */
|
static int linear_mergeable_bvec(struct request_queue *q, struct bvec_merge_data *bvm, struct bio_vec *biovec)
|
/* Return amount of bytes we can take at this offset */
static int linear_mergeable_bvec(struct request_queue *q, struct bvec_merge_data *bvm, struct bio_vec *biovec)
|
{
mddev_t *mddev = q->queuedata;
dev_info_t *dev0;
unsigned long maxsectors, bio_sectors = bvm->bi_size >> 9;
sector_t sector = bvm->bi_sector + get_start_sect(bvm->bi_bdev);
rcu_read_lock();
dev0 = which_dev(mddev, sector);
maxsectors = dev0->end_sector - sector;
rcu_read_unlock();
if (maxsectors < bio_sectors)
maxsectors = 0;
else
maxsectors -= bio_sectors;
if (maxsectors <= (PAGE_SIZE >> 9 ) && bio_sectors == 0)
return biovec->bv_len;
if (maxsectors > (1 << (31-9)))
return 1<<31;
return maxsectors << 9;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* USBD_CtlContinueSendData continue sending data on the ctl pipe. */
|
USBD_StatusTypeDef USBD_CtlContinueSendData(USBD_HandleTypeDef *pdev, uint8_t *pbuf, uint16_t len)
|
/* USBD_CtlContinueSendData continue sending data on the ctl pipe. */
USBD_StatusTypeDef USBD_CtlContinueSendData(USBD_HandleTypeDef *pdev, uint8_t *pbuf, uint16_t len)
|
{
USBD_LL_Transmit(pdev, 0x00U, pbuf, len);
return USBD_OK;
}
|
feaser/openblt
|
C++
|
GNU General Public License v3.0
| 601
|
/* Return Value: TRUE if interrupt is disable; otherwise FALSE */
|
BOOL MACbIsIntDisable(DWORD_PTR dwIoBase)
|
/* Return Value: TRUE if interrupt is disable; otherwise FALSE */
BOOL MACbIsIntDisable(DWORD_PTR dwIoBase)
|
{
DWORD dwData;
VNSvInPortD(dwIoBase + MAC_REG_IMR, &dwData);
if (dwData != 0)
return FALSE;
return TRUE;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* If list elements contain dynamically-allocated memory, you should either use g_slist_free_full() or free them manually first. */
|
void g_slist_free(GSList *list)
|
/* If list elements contain dynamically-allocated memory, you should either use g_slist_free_full() or free them manually first. */
void g_slist_free(GSList *list)
|
{
g_slice_free_chain (GSList, list, next);
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* If clock slaved to SPDIF-IN, setting runtime rate to the detected external rate */
|
static void qtet_spdif_in_open(struct snd_ice1712 *ice, struct snd_pcm_substream *substream)
|
/* If clock slaved to SPDIF-IN, setting runtime rate to the detected external rate */
static void qtet_spdif_in_open(struct snd_ice1712 *ice, struct snd_pcm_substream *substream)
|
{
struct qtet_spec *spec = ice->spec;
struct snd_pcm_runtime *runtime = substream->runtime;
int rate;
if (qtet_get_spdif_master_type(ice) != EXT_SPDIF_TYPE)
return;
rate = snd_ak4113_external_rate(spec->ak4113);
if (rate >= runtime->hw.rate_min && rate <= runtime->hw.rate_max) {
runtime->hw.rate_min = rate;
runtime->hw.rate_max = rate;
}
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Execute FMC_ISPCMD_READ_64 command to read a double-word from flash. */
|
int32_t FMC_Read_64(uint32_t u32addr, uint32_t *u32data0, uint32_t *u32data1)
|
/* Execute FMC_ISPCMD_READ_64 command to read a double-word from flash. */
int32_t FMC_Read_64(uint32_t u32addr, uint32_t *u32data0, uint32_t *u32data1)
|
{
int32_t ret = 0;
FMC->ISPCMD = FMC_ISPCMD_READ_64;
FMC->ISPADDR = u32addr;
FMC->ISPDAT = 0x0UL;
FMC->ISPTRG = FMC_ISPTRG_ISPGO_Msk;
while (FMC->ISPSTS & FMC_ISPSTS_ISPBUSY_Msk) { }
if (FMC->ISPSTS & FMC_ISPSTS_ISPFF_Msk) {
FMC->ISPSTS |= FMC_ISPSTS_ISPFF_Msk;
ret = -1;
} else {
*u32data0 = FMC->MPDAT0;
*u32data1 = FMC->MPDAT1;
}
return ret;
}
|
ARMmbed/DAPLink
|
C++
|
Apache License 2.0
| 2,140
|
/* Chipset Ide Driver EntryPoint function. It follows the standard EFI driver model. It's called by StartImage() of DXE Core. */
|
EFI_STATUS EFIAPI InitializeIdeControllerDriver(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
|
/* Chipset Ide Driver EntryPoint function. It follows the standard EFI driver model. It's called by StartImage() of DXE Core. */
EFI_STATUS EFIAPI InitializeIdeControllerDriver(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
|
{
EFI_STATUS Status;
Status = EfiLibInstallDriverBindingComponentName2 (
ImageHandle,
SystemTable,
&gIdeControllerDriverBinding,
ImageHandle,
&gIdeControllerComponentName,
&gIdeControllerComponentName2
);
ASSERT_EFI_ERROR (Status);
return Status;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Roll from one trans in the sequence of PERMANENT transactions to the next: permanent transactions are only flushed out when committed with XFS_TRANS_RELEASE_LOG_RES, but we still want as soon as possible to let chunks of it go to the log. So we commit the chunk we've been working on and get a new transaction to continue. */
|
int xfs_trans_roll(struct xfs_trans **tpp, struct xfs_inode *dp)
|
/* Roll from one trans in the sequence of PERMANENT transactions to the next: permanent transactions are only flushed out when committed with XFS_TRANS_RELEASE_LOG_RES, but we still want as soon as possible to let chunks of it go to the log. So we commit the chunk we've been working on and get a new transaction to continue. */
int xfs_trans_roll(struct xfs_trans **tpp, struct xfs_inode *dp)
|
{
struct xfs_trans *trans;
unsigned int logres, count;
int error;
trans = *tpp;
xfs_trans_log_inode(trans, dp, XFS_ILOG_CORE);
logres = trans->t_log_res;
count = trans->t_log_count;
*tpp = xfs_trans_dup(trans);
error = xfs_trans_commit(trans, 0);
if (error)
return (error);
trans = *tpp;
xfs_log_ticket_put(trans->t_ticket);
error = xfs_trans_reserve(trans, 0, logres, 0,
XFS_TRANS_PERM_LOG_RES, count);
if (error)
return error;
xfs_trans_ijoin(trans, dp, XFS_ILOCK_EXCL);
xfs_trans_ihold(trans, dp);
return 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* tps65217_voltage_update() - Function to change a voltage level, as this is a multi-step process. @dc_cntrl_reg: DC voltage control register to change. @volt_sel: New value for the voltage register */
|
int tps65217_voltage_update(uchar dc_cntrl_reg, uchar volt_sel)
|
/* tps65217_voltage_update() - Function to change a voltage level, as this is a multi-step process. @dc_cntrl_reg: DC voltage control register to change. @volt_sel: New value for the voltage register */
int tps65217_voltage_update(uchar dc_cntrl_reg, uchar volt_sel)
|
{
if ((dc_cntrl_reg != TPS65217_DEFDCDC1) &&
(dc_cntrl_reg != TPS65217_DEFDCDC2) &&
(dc_cntrl_reg != TPS65217_DEFDCDC3))
return 1;
if (tps65217_reg_write(TPS65217_PROT_LEVEL_2, dc_cntrl_reg, volt_sel,
TPS65217_MASK_ALL_BITS))
return 1;
if (tps65217_reg_write(TPS65217_PROT_LEVEL_2, TPS65217_DEFSLEW,
TPS65217_DCDC_GO, TPS65217_DCDC_GO))
return 1;
return 0;
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
|
static u16 ath9k_hw_fbin2freq(u8 fbin, bool is2GHz)
|
/* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
static u16 ath9k_hw_fbin2freq(u8 fbin, bool is2GHz)
|
{
if (fbin == AR5416_BCHAN_UNUSED)
return fbin;
return (u16) ((is2GHz) ? (2300 + fbin) : (4800 + 5 * fbin));
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.