Changes to standard types.
This commit is contained in:
parent
f398e56048
commit
fefe56d913
|
@ -142,7 +142,7 @@ cc1020_on(void)
|
||||||
} else {
|
} else {
|
||||||
cc1020_off();
|
cc1020_off();
|
||||||
}
|
}
|
||||||
return true;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -303,8 +303,8 @@ interrupt(UART0RX_VECTOR) cc1020_rxhandler(void)
|
||||||
u8_t b3;
|
u8_t b3;
|
||||||
};
|
};
|
||||||
struct {
|
struct {
|
||||||
UINT16 i1;
|
uint16_t i1;
|
||||||
UINT16 i2;
|
uint16_t i2;
|
||||||
};
|
};
|
||||||
} shiftbuf;
|
} shiftbuf;
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,7 @@ Berlin, 2007
|
||||||
void
|
void
|
||||||
infomem_read(void *buffer, unsigned int offset, unsigned char size)
|
infomem_read(void *buffer, unsigned int offset, unsigned char size)
|
||||||
{
|
{
|
||||||
UINT8 *address = (UINT8 *) INFOMEM_START + offset;
|
uint8_t *address = (uint8_t *) INFOMEM_START + offset;
|
||||||
memcpy(buffer, address, size);
|
memcpy(buffer, address, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,17 +68,17 @@ bool
|
||||||
infomem_write(unsigned int offset, unsigned char count, ...)
|
infomem_write(unsigned int offset, unsigned char count, ...)
|
||||||
{
|
{
|
||||||
char backup[INFOMEM_BLOCK_SIZE];
|
char backup[INFOMEM_BLOCK_SIZE];
|
||||||
UINT8 *buffer;
|
uint8_t *buffer;
|
||||||
UINT16 i;
|
uint16_t i;
|
||||||
UINT8 *flash;
|
uint8_t *flash;
|
||||||
va_list argp;
|
va_list argp;
|
||||||
UINT16 size;
|
uint16_t size;
|
||||||
UINT8 *data;
|
uint8_t *data;
|
||||||
|
|
||||||
if (offset > (2 * INFOMEM_BLOCK_SIZE))
|
if (offset > (2 * INFOMEM_BLOCK_SIZE))
|
||||||
return false;
|
return FALSE;
|
||||||
|
|
||||||
flash = (UINT8 *) INFOMEM_START + offset;
|
flash = (uint8_t *) INFOMEM_START + offset;
|
||||||
|
|
||||||
_DINT();
|
_DINT();
|
||||||
|
|
||||||
|
@ -88,10 +88,10 @@ infomem_write(unsigned int offset, unsigned char count, ...)
|
||||||
// merge backup with new data
|
// merge backup with new data
|
||||||
va_start(argp, count);
|
va_start(argp, count);
|
||||||
|
|
||||||
buffer = (UINT8 *) backup;
|
buffer = (uint8_t *) backup;
|
||||||
for (i = 0; i < count; i++) {
|
for (i = 0; i < count; i++) {
|
||||||
data = va_arg(argp, UINT8*);
|
data = va_arg(argp, uint8_t*);
|
||||||
size = va_arg(argp, UINT16);
|
size = va_arg(argp, uint16_t);
|
||||||
memcpy(buffer, data, size);
|
memcpy(buffer, data, size);
|
||||||
buffer += size;
|
buffer += size;
|
||||||
}
|
}
|
||||||
|
@ -108,7 +108,7 @@ infomem_write(unsigned int offset, unsigned char count, ...)
|
||||||
|
|
||||||
// write flash
|
// write flash
|
||||||
FCTL1 = FWKEY + WRT;
|
FCTL1 = FWKEY + WRT;
|
||||||
buffer = (UINT8 *) backup;
|
buffer = (uint8_t *) backup;
|
||||||
for (i = 0; i < INFOMEM_BLOCK_SIZE; i++) {
|
for (i = 0; i < INFOMEM_BLOCK_SIZE; i++) {
|
||||||
*flash++ = *buffer++;
|
*flash++ = *buffer++;
|
||||||
}
|
}
|
||||||
|
@ -117,5 +117,5 @@ infomem_write(unsigned int offset, unsigned char count, ...)
|
||||||
FCTL3 = FWKEY + LOCK;
|
FCTL3 = FWKEY + LOCK;
|
||||||
|
|
||||||
_EINT();
|
_EINT();
|
||||||
return true;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,7 +75,7 @@ spi_init(void)
|
||||||
uart_set_speed(UART_MODE_SPI, 0x02, 0x00, 0x00);
|
uart_set_speed(UART_MODE_SPI, 0x02, 0x00, 0x00);
|
||||||
}
|
}
|
||||||
|
|
||||||
UINT8
|
uint8_t_t
|
||||||
spi_rx(void)
|
spi_rx(void)
|
||||||
{
|
{
|
||||||
UART_RESET_RX();
|
UART_RESET_RX();
|
||||||
|
@ -85,7 +85,7 @@ spi_rx(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
spi_tx(register const UINT8 c)
|
spi_tx(register const uint8_t_t c)
|
||||||
{
|
{
|
||||||
UART_RESET_RX();
|
UART_RESET_RX();
|
||||||
UART_TX = c;
|
UART_TX = c;
|
||||||
|
@ -93,10 +93,10 @@ spi_tx(register const UINT8 c)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
spi_read(void *pDestination, const UINT16 size, const bool incDest)
|
spi_read(void *pDestination, const uint16_t size, const bool incDest)
|
||||||
{
|
{
|
||||||
register UINT8 *p = (UINT8 *) pDestination;
|
register uint8_t *p = (uint8_t *) pDestination;
|
||||||
register UINT16 i;
|
register uint16_t i;
|
||||||
|
|
||||||
for (i = size; i > 0; i--) {
|
for (i = size; i > 0; i--) {
|
||||||
*p = spi_rx();
|
*p = spi_rx();
|
||||||
|
@ -106,11 +106,11 @@ spi_read(void *pDestination, const UINT16 size, const bool incDest)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
spi_write(const void *pSource, const UINT16 size, const UINT8 startToken,
|
spi_write(const void *pSource, const uint16_t size, const uint8_t startToken,
|
||||||
const bool incSource)
|
const bool incSource)
|
||||||
{
|
{
|
||||||
register unsigned char *p = (unsigned char *) pSource;
|
register unsigned char *p = (unsigned char *) pSource;
|
||||||
register UINT16 i;
|
register uint16_t i;
|
||||||
|
|
||||||
spi_tx(startToken);
|
spi_tx(startToken);
|
||||||
for (i = size; i > 0; i--) {
|
for (i = size; i > 0; i--) {
|
||||||
|
@ -121,9 +121,9 @@ spi_write(const void *pSource, const UINT16 size, const UINT8 startToken,
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
spi_idle(register const UINT16 clocks)
|
spi_idle(register const uint16_t clocks)
|
||||||
{
|
{
|
||||||
register UINT16 i;
|
register uint16_t i;
|
||||||
|
|
||||||
for (i = 0; i < clocks; i++) {
|
for (i = 0; i < clocks; i++) {
|
||||||
UART_RESET_RX();
|
UART_RESET_RX();
|
||||||
|
@ -132,16 +132,16 @@ spi_idle(register const UINT16 clocks)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
UINT8
|
bool
|
||||||
spi_wait_token(const UINT8 token, const UINT16 timeout)
|
spi_wait_token(const uint8_t token, const uint16_t timeout)
|
||||||
{
|
{
|
||||||
UINT16 i;
|
uint16_t i;
|
||||||
UINT8 rx;
|
uint8_t rx;
|
||||||
|
|
||||||
for (i = 0; i < timeout; i++) {
|
for (i = 0; i < timeout; i++) {
|
||||||
rx = spi_rx();
|
rx = spi_rx();
|
||||||
if (rx == token)
|
if (rx == token)
|
||||||
return true;
|
return TRUE;
|
||||||
}
|
}
|
||||||
return false;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,16 +75,16 @@ void spi_init(void);
|
||||||
void spi_enable(void);
|
void spi_enable(void);
|
||||||
|
|
||||||
/// Receive one byte from SPI
|
/// Receive one byte from SPI
|
||||||
UINT8 spi_rx(void);
|
uint8_t spi_rx(void);
|
||||||
|
|
||||||
/// Send one byte to SPI
|
/// Send one byte to SPI
|
||||||
void spi_tx(const UINT8 c);
|
void spi_tx(const uint8_t c);
|
||||||
|
|
||||||
/// Read a number of bytes from SPI
|
/// Read a number of bytes from SPI
|
||||||
void spi_read(void *pDestination, const UINT16 size, const bool incDest);
|
void spi_read(void *pDestination, const uint16_t size, const bool incDest);
|
||||||
|
|
||||||
#if SPI_DMA_WRITE
|
#if SPI_DMA_WRITE
|
||||||
extern UINT8 spi_dma_lock;
|
extern uint8_t spi_dma_lock;
|
||||||
#endif
|
#endif
|
||||||
#if SPI_DMA_READ || SPI_DMA_WRITE
|
#if SPI_DMA_READ || SPI_DMA_WRITE
|
||||||
void spi_dma_wait();
|
void spi_dma_wait();
|
||||||
|
@ -93,14 +93,14 @@ void spi_dma_wait();
|
||||||
#if SPI_WRITE
|
#if SPI_WRITE
|
||||||
/// Write a number of bytes to SPI
|
/// Write a number of bytes to SPI
|
||||||
void spi_write(const void *pSource,
|
void spi_write(const void *pSource,
|
||||||
const UINT16 size,
|
const uint16_t size,
|
||||||
const UINT8 startToken, const bool incSource);
|
const uint8_t startToken, const bool incSource);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/// Wait a number of clock cycles
|
/// Wait a number of clock cycles
|
||||||
void spi_idle(const UINT16 clocks);
|
void spi_idle(const uint16_t clocks);
|
||||||
|
|
||||||
/// Read chars until token is received
|
/// Read chars until token is received
|
||||||
UINT8 spi_wait_token(const UINT8 token, const UINT16 timeout);
|
bool spi_wait_token(const uint8_t token, const uint16_t timeout);
|
||||||
|
|
||||||
#endif /*SPI_H_ */
|
#endif /*SPI_H_ */
|
||||||
|
|
Loading…
Reference in a new issue