本文整理汇总了C++中LO函数的典型用法代码示例。如果您正苦于以下问题:C++ LO函数的具体用法?C++ LO怎么用?C++ LO使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了LO函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: make_condition_modifier
static int make_condition_modifier(struct iforce* iforce,
struct resource* mod_chunk, int no_alloc,
__u16 rsat, __u16 lsat, __s16 rk, __s16 lk, u16 db, __s16 center)
{
unsigned char data[10];
if (!no_alloc) {
mutex_lock(&iforce->mem_mutex);
if (allocate_resource(&(iforce->device_memory), mod_chunk, 8,
iforce->device_memory.start, iforce->device_memory.end, 2L,
NULL, NULL)) {
mutex_unlock(&iforce->mem_mutex);
return -ENOSPC;
}
mutex_unlock(&iforce->mem_mutex);
}
data[0] = LO(mod_chunk->start);
data[1] = HI(mod_chunk->start);
data[2] = (100 * rk) >> 15;
data[3] = (100 * lk) >> 15;
center = (500 * center) >> 15;
data[4] = LO(center);
data[5] = HI(center);
db = (1000 * db) >> 16;
data[6] = LO(db);
data[7] = HI(db);
data[8] = (100 * rsat) >> 16;
data[9] = (100 * lsat) >> 16;
iforce_send_packet(iforce, FF_CMD_CONDITION, data);
iforce_dump_packet("condition", FF_CMD_CONDITION, data);
return 0;
}
示例2: make_condition_modifier
static int make_condition_modifier(struct iforce* iforce,
struct resource* mod_chunk, int no_alloc,
__u16 rsat, __u16 lsat, __s16 rk, __s16 lk, u16 db, __s16 center)
{
unsigned char data[10];
if (!no_alloc) {
mutex_lock(&iforce->mem_mutex);
if (allocate_resource(&(iforce->device_memory), mod_chunk, 8,
iforce->device_memory.start, iforce->device_memory.end, 2L,
NULL, NULL)) {
mutex_unlock(&iforce->mem_mutex);
return -ENOSPC;
}
mutex_unlock(&iforce->mem_mutex);
}
data[0] = LO(mod_chunk->start);
data[1] = HI(mod_chunk->start);
data[2] = (100 * rk) >> 15; /* Dangerous: the sign is extended by gcc on plateforms providing an arith shift */
data[3] = (100 * lk) >> 15; /* This code is incorrect on cpus lacking arith shift */
center = (500 * center) >> 15;
data[4] = LO(center);
data[5] = HI(center);
db = (1000 * db) >> 16;
data[6] = LO(db);
data[7] = HI(db);
data[8] = (100 * rsat) >> 16;
data[9] = (100 * lsat) >> 16;
iforce_send_packet(iforce, FF_CMD_CONDITION, data);
iforce_dump_packet("condition", FF_CMD_CONDITION, data);
return 0;
}
示例3: usart_init
void usart_init(void)
{
UBRR0L = LO(BAUDDIVIDER);
UBRR0H = HI(BAUDDIVIDER);
UCSR0B = 1<<RXEN0|1<<TXEN0|1<<RXCIE0|1<<TXCIE0;
UCSR0C = 1<<UCSZ00|1<<UCSZ01;
usart_rx_wp = 0;
usart_rx_rp = 0;
usart_tx_wp = 0;
usart_tx_rp = 0;
}
示例4: ads_read
void ads_read(uint8_t chip, sample_data* sample){
ads_select(chip);
uint8_t* buf=(uint8_t*)sample;
uint8_t* end=(uint8_t*)(sample+(sizeof(sample_data)));
while(buf != end){
*(buf++)=spi_send(0x00);
}
for(uint8_t i=0; i<4; i++){
uint16_t tmp = ((LO(sample->ch[i])<<8) | (HI(sample->ch[i])));
sample->ch[i] = tmp;
}
ads_deselect();
}
示例5: stlink2_write_and_read_byte
int stlink2_write_and_read_byte(programmer_t *pgm, unsigned char byte, unsigned int start) {
unsigned char buf[4], start2[2];
pack_int16(start, start2);
stlink2_cmd(pgm, 0xf40b, 7,
0x00, 0x01,
0x00, 0x00,
HI(start), LO(start),
byte);
usleep(2000);
stlink2_get_status(pgm);
stlink2_cmd(pgm, 0xf40c, 0);
return(msg_recv_int8(pgm));
}
示例6: make_envelope_modifier
static int make_envelope_modifier(struct iforce* iforce,
struct resource* mod_chunk, int no_alloc,
u16 attack_duration, __s16 initial_level,
u16 fade_duration, __s16 final_level)
{
unsigned char data[8];
attack_duration = TIME_SCALE(attack_duration);
fade_duration = TIME_SCALE(fade_duration);
if (!no_alloc) {
mutex_lock(&iforce->mem_mutex);
if (allocate_resource(&(iforce->device_memory), mod_chunk, 0x0e,
iforce->device_memory.start, iforce->device_memory.end, 2L,
NULL, NULL)) {
mutex_unlock(&iforce->mem_mutex);
return -ENOSPC;
}
mutex_unlock(&iforce->mem_mutex);
}
data[0] = LO(mod_chunk->start);
data[1] = HI(mod_chunk->start);
data[2] = LO(attack_duration);
data[3] = HI(attack_duration);
data[4] = HI(initial_level);
data[5] = LO(fade_duration);
data[6] = HI(fade_duration);
data[7] = HI(final_level);
iforce_send_packet(iforce, FF_CMD_ENVELOPE, data);
return 0;
}
示例7: RunRTOS
//RTOS Запуск системного таймера
inline void RunRTOS (void)
{
// TCCR2A = 1 << WGM21 | 4 << CS20; // Freq = CK/64 - Установить режим и предделитель
// Автосброс после достижения регистра сравнения
TCCR2B |= (1<<CS22);
TCCR2B &= ~((1<<CS21) | (1<<CS20));
TCCR2B |= (1<<WGM22);
TCNT2 = 0; // Установить начальное значение счётчиков
OCR2B = LO(TimerDivider); // Установить значение в регистр сравнения
//TIMSK2 = 0 << TOIE0 | 1<<OCF2A | 0<<TOIE0; // Разрешаем прерывание RTOS - запуск ОС
TIMSK2 = 1 << TOIE2;
sei();
}
示例8: InitAll
inline void InitAll(void)
{
//InitUSART
UBRRL = LO(bauddivider);
UBRRH = HI(bauddivider);
UCSRA = 0;
UCSRB = 1<<RXEN|1<<TXEN|0<<RXCIE|0<<TXCIE;
UCSRC = 1<<URSEL|1<<UCSZ0|1<<UCSZ1;
//InitPort
LED_DDR |= 1<<LED1|1<<LED2|1<<LED3|1<<I_L|1<<I_C;
}
示例9: SpiSetUp
long SpiSetUp(unsigned char *pUserBuffer, unsigned short usLength)
{
size_t tx_len = (usLength & 1) ? usLength : usLength +1;
pUserBuffer[0] = WRITE;
pUserBuffer[1] = HI(tx_len);
pUserBuffer[2] = LO(tx_len);
pUserBuffer[3] = 0;
pUserBuffer[4] = 0;
tSLInformation.solicitedResponse = 1; // We are doing a write
sSpiInformation.pTxPacket = pUserBuffer;
sSpiInformation.usTxPacketLength = usLength;
tx_len += SPI_HEADER_SIZE;
return tx_len;
}
示例10: stub
//---------------------------------------------------------------------------------------------
void stub(void)//заглушка для проверки
{
unsigned int CRC=0;
TransferBuf[0]=ADRESS_DEV;
TransferBuf[1]=0x3;//read reg
TransferBuf[2]=0x2;
TransferBuf[3]=0x1;
TransferBuf[4]=0x1;
//TransferBuf[5]=0x1;
CRC=CRC16(&TransferBuf,5);
TransferBuf[5]=HI(CRC);
TransferBuf[6]=LO(CRC);
buf_len=0x7;
}
示例11: HI
/**
Инициализировать UART
*/
void UART::init(void) {
// задаем скорость UART
UBRRH = HI(BAUDRATE_DIVIDER);
UBRRL = LO(BAUDRATE_DIVIDER);
UCSRA = 0;
// включаем трансмиттер и ресивер
UCSRB = 1 << TXEN | 1 << RXEN | 1 << RXCIE;
// контроль четности: нет
// стоп бит: 1
// размер кадра 8 бит
UCSRC = (1 << URSEL) | (1 << UCSZ0) | (1 << UCSZ1);
receiver.init();
}
示例12: remote_ahci_get_num_blocks
static void remote_ahci_get_num_blocks(ddf_fun_t *fun, void *iface,
ipc_callid_t callid, ipc_call_t *call)
{
const ahci_iface_t *ahci_iface = (ahci_iface_t *) iface;
if (ahci_iface->get_num_blocks == NULL) {
async_answer_0(callid, ENOTSUP);
return;
}
uint64_t blocks;
const int ret = ahci_iface->get_num_blocks(fun, &blocks);
if (ret != EOK)
async_answer_0(callid, ret);
else
async_answer_2(callid, EOK, HI(blocks), LO(blocks));
}
示例13: ahci_write_blocks
int ahci_write_blocks(async_sess_t *sess, uint64_t blocknum, size_t count,
void* buf)
{
async_exch_t *exch = async_exchange_begin(sess);
if (!exch)
return EINVAL;
aid_t req = async_send_4(exch, DEV_IFACE_ID(AHCI_DEV_IFACE),
IPC_M_AHCI_WRITE_BLOCKS, HI(blocknum), LO(blocknum), count, NULL);
async_share_out_start(exch, buf, AS_AREA_READ | AS_AREA_WRITE);
async_exchange_end(exch);
sysarg_t rc;
async_wait_for(req, &rc);
return rc;
}
示例14: ToString
inline std::string ToString(const Direction& d) {
std::stringstream sst;
std::stringstream sst2;
unsigned short hi = HI(d);
unsigned short lo = LO(d);
if ((hi & 1) == 1) {
sst << "X";
sst2 << (((lo & 1) == 1) ? "P" : "M");
}
if ((hi & 2) == 2) {
sst << "Y";
sst2 << (((lo & 2) == 2) ? "P" : "M");
}
if ((hi & 4) == 4) {
sst << "Z";
sst2 << (((lo & 4) == 4) ? "P" : "M");
}
sst << "_" << sst2.str();
return sst.str();
}
示例15: cdrom_helper
void cdrom_helper(unsigned char *req_buf, unsigned char *transfer_buf,
unsigned int dos_transfer_buf)
{
unsigned int Sector_plus_150,Sector;
struct cdrom_msf cdrom_msf;
struct cdrom_subchnl cdrom_subchnl;
struct cdrom_tochdr cdrom_tochdr;
struct cdrom_tocentry cdrom_tocentry;
struct cdrom_volctrl cdrom_volctrl;
int n, err;
cdrom_subchnl.cdsc_format = CDROM_MSF;
IndexCd=(int)((HI(ax) & 0xC0)>>6);
HI(ax) = HI(ax) & 0x3F;
if ((cdu33a) && (cdrom_fd < 0)) {
cdrom_fd = open (path_cdrom, O_RDONLY | O_NONBLOCK);
if (cdrom_fd < 0) {
switch (HI(ax)) {
case 0x09: /* media changed request */
LO(bx) = 1; /* media changed */
LO(ax) = 0;
return;
case 0x0A: /* device status request */
LWORD(ebx) = audio_status.status | 0x800; /* no disc */
LO(ax) = 0;
return;
}
LO(ax) = 1; /* for other requests return with error */
return ;
}
}
switch (HI(ax)) {
case 0x01: /* NOTE: you can't see XA data disks if bit 10 of status
* is cleared, MSCDEX will test it and skip XA entries!
* Actually the entries skipped must have this pattern:
* xxxx1xxx xxxxxxxx 0x58 0x41
* and the mscdex 2.25 code is:
* test word ptr [bx+1Eh],400h
* jz [check for XA]
* [return 0 = valid entry]
* [check for XA]
* ...
* cmp word ptr es:[bx+6],4158h 'XA'
* jne [return 0]
* mov ax,es:[bx+4]
* and ax,8
* [return ax]
*/
audio_status.status = 0x00000710; /* see function 0x0A below */
audio_status.paused_bit = 0;
audio_status.media_changed = 0;
audio_status.volume0 = 0xFF;
audio_status.volume1 = 0xFF;
audio_status.volume2 = 0;
audio_status.volume3 = 0;
audio_status.outchan0 = 0;
audio_status.outchan1 = 1;
audio_status.outchan2 = 2;
audio_status.outchan3 = 3;
cdrom_fd = open (path_cdrom, O_RDONLY | O_NONBLOCK);
err = errno;
if (cdrom_fd < 0) {
C_printf("CDROM: cdrom open (%s) failed: %s\n",
path_cdrom, strerror(err));
LO(ax) = 0;
if ((err == EIO) || (err==ENOMEDIUM)) {
/* drive which cannot be opened if no
disc is inserted! */
cdu33a = 1;
if (! eject_allowed)
LO(ax) = 1; /* no disk in drive */
}
else LO(ax) = 1; /* no cdrom drive installed */
if (! eject_allowed)
LO(ax) = 1; /* no disk in drive */
}
else {
LO(ax) = 0;
if (! eject_allowed) {
if (ioctl (cdrom_fd, CDROMREADTOCHDR, &cdrom_tochdr))
if (ioctl (cdrom_fd, CDROMREADTOCHDR, &cdrom_tochdr))
LO(ax) = 1;
}
}
break;
case 0x02: /* read long */
if (eject_allowed && ioctl (cdrom_fd, CDROMSUBCHNL, &cdrom_subchnl) && errno != ENOTTY) {
audio_status.media_changed = 1;
if (ioctl (cdrom_fd, CDROMSUBCHNL, &cdrom_subchnl)) {
/* no disc in drive */
LO(ax) = 1;
break;
}
//.........这里部分代码省略.........