mirror of https://github.com/ARMmbed/mbed-os.git
Fix frequency function of CAN driver.
Until now, when the frequency function of CAN driver was executed, signal no output, and the frequency could not be changed. Since there was an error in the frequency changing procedure I modified it.pull/3348/head
parent
c57427f77f
commit
cea27724d7
|
@ -581,6 +581,7 @@ void can_free(can_t *obj) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int can_frequency(can_t *obj, int f) {
|
int can_frequency(can_t *obj, int f) {
|
||||||
|
__IO uint32_t *dmy_cfcc;
|
||||||
int retval = 0;
|
int retval = 0;
|
||||||
|
|
||||||
if (f <= 1000000) {
|
if (f <= 1000000) {
|
||||||
|
@ -590,6 +591,12 @@ int can_frequency(can_t *obj, int f) {
|
||||||
can_set_frequency(obj, f);
|
can_set_frequency(obj, f);
|
||||||
/* set Channel Communication mode */
|
/* set Channel Communication mode */
|
||||||
can_set_channel_mode(obj->ch, CH_COMM);
|
can_set_channel_mode(obj->ch, CH_COMM);
|
||||||
|
/* restore CFE bit since it is cleared */
|
||||||
|
/* Use send/receive FIFO buffer */
|
||||||
|
dmy_cfcc = CFCC_TBL[obj->ch][CAN_SEND];
|
||||||
|
*dmy_cfcc |= 0x01;
|
||||||
|
dmy_cfcc = CFCC_TBL[obj->ch][CAN_RECV];
|
||||||
|
*dmy_cfcc |= 0x01;
|
||||||
retval = 1;
|
retval = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -598,6 +598,7 @@ void can_free(can_t *obj) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int can_frequency(can_t *obj, int f) {
|
int can_frequency(can_t *obj, int f) {
|
||||||
|
__IO uint32_t *dmy_cfcc;
|
||||||
int retval = 0;
|
int retval = 0;
|
||||||
|
|
||||||
if (f <= 1000000) {
|
if (f <= 1000000) {
|
||||||
|
@ -607,6 +608,12 @@ int can_frequency(can_t *obj, int f) {
|
||||||
can_set_frequency(obj, f);
|
can_set_frequency(obj, f);
|
||||||
/* set Channel Communication mode */
|
/* set Channel Communication mode */
|
||||||
can_set_channel_mode(obj->ch, CH_COMM);
|
can_set_channel_mode(obj->ch, CH_COMM);
|
||||||
|
/* restore CFE bit since it is cleared */
|
||||||
|
/* Use send/receive FIFO buffer */
|
||||||
|
dmy_cfcc = CFCC_TBL[obj->ch][CAN_SEND];
|
||||||
|
*dmy_cfcc |= 0x01;
|
||||||
|
dmy_cfcc = CFCC_TBL[obj->ch][CAN_RECV];
|
||||||
|
*dmy_cfcc |= 0x01;
|
||||||
retval = 1;
|
retval = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue