git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1191 35acf78f-673a-0410-8e92-d51de3d6d3f4

master
gdisirio 2009-09-27 18:17:17 +00:00
parent 4c8314f804
commit ee0d07151a
6 changed files with 12 additions and 10 deletions

View File

@ -65,7 +65,7 @@ void macObjectInit(MACDriver *macp) {
* @note This function must be invoked only with the driver in the stopped
* state. If invoked on an active interface then it is ignored.
*/
void macSetAddress(MACDriver *macp, uint8_t *p) {
void macSetAddress(MACDriver *macp, const uint8_t *p) {
mac_lld_set_address(macp, p);
}
@ -91,8 +91,8 @@ MACTransmitDescriptor *macWaitTransmitDescriptor(MACDriver *macp,
systime_t time) {
MACTransmitDescriptor *tdp;
while ((time > 0) &&
(tdp = max_lld_get_transmit_descriptor(macp, size)) == NULL) {
while (((tdp = max_lld_get_transmit_descriptor(macp, size)) == NULL) &&
(time > 0)) {
chSysLock();
systime_t now = chTimeNow();
if (chSemWaitTimeoutS(&tdsem, time) == RDY_TIMEOUT) {
@ -140,8 +140,8 @@ MACReceiveDescriptor *macWaitReceiveDescriptor(MACDriver *macp,
systime_t time) {
MACReceiveDescriptor *rdp;
while ((time > 0) &&
(rdp = max_lld_get_receive_descriptor(macp, szp)) == NULL) {
while (((rdp = max_lld_get_receive_descriptor(macp, szp)) == NULL) &&
(time > 0)) {
chSysLock();
systime_t now = chTimeNow();
if (chSemWaitTimeoutS(&rdsem, time) == RDY_TIMEOUT) {

View File

@ -60,7 +60,7 @@ extern "C" {
#endif
void macInit(void);
void macObjectInit(MACDriver *macp);
void macSetAddress(MACDriver *macp, uint8_t *p);
void macSetAddress(MACDriver *macp, const uint8_t *p);
void macStart(MACDriver *macp);
void macStop(MACDriver *macp);
MACTransmitDescriptor *macWaitTransmitDescriptor(MACDriver *macp,

View File

@ -120,6 +120,7 @@ CH_IRQ_HANDLER(irq_handler) {
void mac_lld_init(void) {
unsigned i;
phyInit();
macObjectInit(&MAC1);
/*
@ -183,6 +184,7 @@ void mac_lld_init(void) {
/*
* Interrupt configuration.
*/
AT91C_BASE_EMAC->EMAC_IER = AT91C_EMAC_RCOMP | AT91C_EMAC_TCOMP;
AIC_ConfigureIT(AT91C_ID_EMAC,
AT91C_AIC_SRCTYPE_INT_HIGH_LEVEL | EMAC_INTERRUPT_PRIORITY,
irq_handler);
@ -198,7 +200,7 @@ void mac_lld_init(void) {
* used. The MAC address must be aligned with the most significant
* byte first.
*/
void mac_lld_set_address(MACDriver *macp, uint8_t *p) {
void mac_lld_set_address(MACDriver *macp, const uint8_t *p) {
AT91C_BASE_EMAC->EMAC_SA1L = (AT91_REG)((p[2] << 24) | (p[3] << 16) |
(p[4] << 8) | p[5]);

View File

@ -134,7 +134,7 @@ extern MACDriver MAC1;
extern "C" {
#endif
void mac_lld_init(void);
void mac_lld_set_address(MACDriver *macp, uint8_t *p);
void mac_lld_set_address(MACDriver *macp, const uint8_t *p);
MACTransmitDescriptor *max_lld_get_transmit_descriptor(MACDriver *macp,
size_t size);
void mac_lld_release_transmit_descriptor(MACDriver *macp,

View File

@ -42,7 +42,7 @@ void mac_lld_init(void) {
* this parameter is set to @p NULL then a system default MAC is
* used.
*/
void mac_lld_set_address(MACDriver *macp, uint8_t *p) {
void mac_lld_set_address(MACDriver *macp, const uint8_t *p) {
}

View File

@ -75,7 +75,7 @@ typedef struct {
extern "C" {
#endif
void mac_lld_init(void);
void mac_lld_set_address(MACDriver *macp, uint8_t *p);
void mac_lld_set_address(MACDriver *macp, const uint8_t *p);
MACTransmitDescriptor *max_lld_get_transmit_descriptor(MACDriver *macp,
size_t size);
void mac_lld_release_transmit_descriptor(MACDriver *macp,