Commit 415ecb66 authored by Martin Jeřábek's avatar Martin Jeřábek Committed by Martin Jeřábek

driver: add setting of interrupt mask

parent 8f587a0c
......@@ -210,6 +210,7 @@ static int ctucan_chip_start(struct net_device *ndev)
}
ctu_can_fd_int_ena(&priv->p, int_ena, int_msk);
ctu_can_fd_int_mask(&priv->p, int_ena, int_msk);
priv->can.state = CAN_STATE_ERROR_ACTIVE;
......@@ -679,6 +680,7 @@ static void ctucan_chip_stop(struct net_device *ndev)
/* Disable interrupts and disable can */
ctu_can_fd_int_ena(&priv->p, ena, mask);
ctu_can_fd_int_mask(&priv->p, ena, mask);
ctu_can_fd_enable(&priv->p, false);
priv->can.state = CAN_STATE_STOPPED;
}
......
......@@ -59,6 +59,12 @@ unsigned ctu_can_fd_read8(struct ctucanfd_priv *priv, enum ctu_can_fd_regs reg)
unsigned ctu_can_fd_read16(struct ctucanfd_priv *priv, enum ctu_can_fd_regs reg) {
return priv->read_reg(priv, (enum ctu_can_fd_regs)(reg & ~1)) >> (8 * (reg & 1));
}
void ctu_can_fd_write8(struct ctucanfd_priv *priv, enum ctu_can_fd_regs reg, uint8_t val) {
iowrite8(val, (uint8_t*)priv->mem_base + reg);
}
void ctu_can_fd_write16(struct ctucanfd_priv *priv, enum ctu_can_fd_regs reg, uint16_t val) {
iowrite16(val, (uint8_t*)priv->mem_base + reg);
}
int main(int argc, char *argv[])
......@@ -142,7 +148,10 @@ int main(int argc, char *argv[])
//struct can_ctrlmode ctrlmode = {CAN_CTRLMODE_FD, CAN_CTRLMODE_FD};
//ctu_can_fd_set_mode(priv, &ctrlmode);
ctu_can_fd_reset(priv);
printf("NOT RESETTING!\n");
//ctu_can_fd_reset(priv);
{
union ctu_can_fd_mode_command_status_settings mode;
......@@ -176,6 +185,8 @@ int main(int argc, char *argv[])
nom_timing.bitrate
);
priv->write_reg(priv, CTU_CAN_FD_INT_MASK_CLR, 0xffff);
priv->write_reg(priv, CTU_CAN_FD_INT_ENA_SET, 0xffff);
ctu_can_fd_set_nom_bittiming(priv, &nom_timing);
ctu_can_fd_rel_rx_buf(priv);
//ctu_can_fd_set_ret_limit(priv, true, 1);
......@@ -210,8 +221,10 @@ int main(int argc, char *argv[])
printf("%u RX frames, %u words", nrxf, rxsz);
printf(", status 0x%02hhx", ctu_can_fd_read8(priv, CTU_CAN_FD_STATUS));
printf(", settings 0x%02hhx", ctu_can_fd_read8(priv, CTU_CAN_FD_SETTINGS));
printf(", INT_STAT 0x%02hhx", ctu_can_fd_read8(priv, CTU_CAN_FD_INT_STAT));
printf(", CTU_CAN_FD_TX_STATUS 0x%02hx", ctu_can_fd_read16(priv, CTU_CAN_FD_TX_STATUS));
printf(", INT_STAT 0x%04hhx", ctu_can_fd_read16(priv, CTU_CAN_FD_INT_STAT));
printf(", CTU_CAN_FD_INT_ENA_SET 0x%04hx", priv->read_reg(priv, CTU_CAN_FD_INT_ENA_SET));
printf(", CTU_CAN_FD_INT_MASK_SET 0x%04hx", priv->read_reg(priv, CTU_CAN_FD_INT_MASK_SET));
printf(", CTU_CAN_FD_TX_STATUS 0x%04hx", priv->read_reg(priv, CTU_CAN_FD_TX_STATUS));
//printf(", CTU_CAN_FD_ERR_CAPT 0x%02hhx", ctu_can_fd_read8(priv, CTU_CAN_FD_ERR_CAPT));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment