Use BIT macro
Mostly done with the cocci script. macro.h was then added manually.
This commit is contained in:
committed by
Jeremy Soller
parent
9a3ecba010
commit
720af4b2b0
@ -59,7 +59,7 @@ static struct Fan __code FAN = {
|
||||
|
||||
void peci_init(void) {
|
||||
// Allow PECI pin to be used
|
||||
GCR2 |= (1 << 4);
|
||||
GCR2 |= BIT(4);
|
||||
|
||||
// Set frequency to 1MHz
|
||||
HOCTL2R = 0x01;
|
||||
@ -76,7 +76,7 @@ int peci_wr_pkg_config(uint8_t index, uint16_t param, uint32_t data) {
|
||||
HOSTAR = HOSTAR;
|
||||
|
||||
// Enable PECI, clearing data fifo's, enable AW_FCS
|
||||
HOCTLR = (1 << 5) | (1 << 3) | (1 << 1);
|
||||
HOCTLR = BIT(5) | BIT(3) | BIT(1);
|
||||
// Set address to default
|
||||
HOTRADDR = 0x30;
|
||||
// Set write length
|
||||
@ -106,7 +106,7 @@ int peci_wr_pkg_config(uint8_t index, uint16_t param, uint32_t data) {
|
||||
while (HOSTAR & 1) {}
|
||||
|
||||
int status = (int)HOSTAR;
|
||||
if (status & (1 << 1)) {
|
||||
if (status & BIT(1)) {
|
||||
int cc = (int)HORDDR;
|
||||
if (cc & 0x80) {
|
||||
return -cc;
|
||||
@ -137,7 +137,7 @@ uint8_t peci_get_fan_duty(void) {
|
||||
HOSTAR = HOSTAR;
|
||||
|
||||
// Enable PECI, clearing data fifo's
|
||||
HOCTLR = (1 << 5) | (1 << 3);
|
||||
HOCTLR = BIT(5) | BIT(3);
|
||||
// Set address to default
|
||||
HOTRADDR = 0x30;
|
||||
// Set write length
|
||||
@ -152,7 +152,7 @@ uint8_t peci_get_fan_duty(void) {
|
||||
// Wait for completion
|
||||
while (HOSTAR & 1) {}
|
||||
|
||||
if (HOSTAR & (1 << 1)) {
|
||||
if (HOSTAR & BIT(1)) {
|
||||
// Use result if finished successfully
|
||||
uint8_t low = HORDDR;
|
||||
uint8_t high = HORDDR;
|
||||
|
Reference in New Issue
Block a user