From: Nathael Pajani Date: Tue, 27 Sep 2016 20:54:07 +0000 (+0200) Subject: Comments update X-Git-Url: http://git.techno-innov.fr/?a=commitdiff_plain;h=0b4f5bc7c82996b09d1048a35e768263251cf02d;p=soft%2Flpc122x%2Fcore Comments update --- diff --git a/drivers/i2c.c b/drivers/i2c.c index 191b6d4..f26437c 100644 --- a/drivers/i2c.c +++ b/drivers/i2c.c @@ -282,12 +282,6 @@ void I2C_0_Handler(void) * RETURN VALUE * Upon successfull completion, returns the number of bytes read. On error, returns a negative * integer equivalent to errors from glibc. - * -EBADFD : Device not initialized (-77) - * -EBUSY : Device or ressource Busy or Arbitration lost (-16) - * -EAGAIN : Device already in use (-11) - * -EINVAL : Invalid argument (no cmd_buf, or no inbuff when count > 0) (-22) - * -EREMOTEIO : Device did not acknowledge (-121) - * -EIO : Bad one: Illegal start or stop, or illegal state in i2c state machine (-5) */ int i2c_read(const void *cmd_buf, size_t cmd_size, const void* ctrl_buf, void* inbuff, size_t count) { @@ -369,12 +363,6 @@ int i2c_read(const void *cmd_buf, size_t cmd_size, const void* ctrl_buf, void* i * RETURN VALUE * Upon successfull completion, returns the number of bytes written. On error, returns a negative * integer equivalent to errors from glibc. - * -EBADFD : Device not initialized - * -EBUSY : Device or ressource Busy or Arbitration lost - * -EAGAIN : Device already in use - * -EINVAL : Invalid argument (buf) - * -EREMOTEIO : Device did not acknowledge - * -EIO : Bad one: Illegal start or stop, or illegal state in i2c state machine */ int i2c_write(const void *buf, size_t count, const void* ctrl_buf) { diff --git a/drivers/serial.c b/drivers/serial.c index 8dcaac4..b41a2da 100644 --- a/drivers/serial.c +++ b/drivers/serial.c @@ -96,6 +96,7 @@ static void uart_check_rx(struct uart_device* uart, uint32_t intr) uart->regs->func.buffer = data; } } + /* FIXME : handle RX erors */ } static void uart_check_tx(struct uart_device* uart, uint32_t intr) diff --git a/extdrv/eeprom.c b/extdrv/eeprom.c index 7b48b97..9306f0b 100644 --- a/extdrv/eeprom.c +++ b/extdrv/eeprom.c @@ -28,6 +28,10 @@ #include "drivers/i2c.h" #include "extdrv/eeprom.h" +/* FIXME : All of this will have to be re-written with an eeprom definition structure + * This will have the address, bus number, and eeprom type, in order to remove the static + * variables and hardcoded bus number from this code. + */ /***************************************************************************** */ /* Read and Write for eeprom */ @@ -108,13 +112,6 @@ int get_eeprom_type(uint8_t eeprom_addr) * RETURN VALUE * Upon successfull completion, returns the number of bytes read. On error, returns a negative * integer equivalent to errors from glibc. - * -EFAULT : address above eeprom size - * -EBADFD : Device not initialized - * -EBUSY : Device or ressource Busy or Arbitration lost - * -EAGAIN : Device already in use - * -EINVAL : Invalid argument (buf) - * -EREMOTEIO : Device did not acknowledge - * -EIO : Bad one: Illegal start or stop, or illegal state in i2c state machine */ #define CMD_BUF_SIZE 4 int eeprom_read(uint8_t eeprom_addr, uint32_t offset, void *buf, size_t count) @@ -156,13 +153,6 @@ int eeprom_read(uint8_t eeprom_addr, uint32_t offset, void *buf, size_t count) * RETURN VALUE * Upon successfull completion, returns the number of bytes written. On error, returns a negative * integer equivalent to errors from glibc. - * -EFAULT : address above eeprom size - * -EBADFD : Device not initialized - * -EBUSY : Device or ressource Busy or Arbitration lost - * -EAGAIN : Device already in use - * -EINVAL : Invalid argument (buf) - * -EREMOTEIO : Device did not acknowledge - * -EIO : Bad one: Illegal start or stop, or illegal state in i2c state machine */ #define CMD_SIZE_SMALL 2 #define CMD_SIZE_BIG 3 diff --git a/extdrv/tmp101_temp_sensor.c b/extdrv/tmp101_temp_sensor.c index e8ecd69..e0f9d90 100644 --- a/extdrv/tmp101_temp_sensor.c +++ b/extdrv/tmp101_temp_sensor.c @@ -88,12 +88,6 @@ int tmp101_convert_to_deci_degrees(uint16_t raw) * Return value(s): * Upon successfull completion, returns 0 and the temperature read is placed in the * provided integers. On error, returns a negative integer equivalent to errors from glibc. - * -EBADFD : I2C not initialized - * -EBUSY : Device or ressource Busy or Arbitration lost - * -EINVAL : Invalid argument (buf) - * -ENODEV : No such device - * -EREMOTEIO : Device did not acknowledge : Any device present ? - * -EIO : Bad one: Illegal start or stop, or illegal state in i2c state machine */ #define CMD_BUF_SIZE 3 int tmp101_sensor_read(struct tmp101_sensor_config* conf, uint16_t* raw, int* deci_degrees) @@ -137,12 +131,6 @@ int tmp101_sensor_read(struct tmp101_sensor_config* conf, uint16_t* raw, int* de * Return value : * Upon successfull completion, returns 0. On error, returns a negative integer * equivalent to errors from glibc. - * -EBADFD : I2C not initialized - * -EBUSY : Device or ressource Busy or Arbitration lost - * -EINVAL : Invalid argument (buf) - * -ENODEV : No such device - * -EREMOTEIO : Device did not acknowledge : Any device present ? - * -EIO : Bad one: Illegal start or stop, or illegal state in i2c state machine */ #define CONF_BUF_SIZE 4 int tmp101_sensor_config(struct tmp101_sensor_config* conf) diff --git a/include/core/iap.h b/include/core/iap.h index 10c9872..40f3542 100644 --- a/include/core/iap.h +++ b/include/core/iap.h @@ -33,9 +33,11 @@ * of the micro-controller (for bootloaders, drivers, loadable RTOS tasks, ....) */ +/*******************************************************************************/ +/* Direct access to IAP function */ /* Erase some pages from the user information block. - * Page numbers may be 0, 1 or 2 for the LPC1224. + * Page numbers may be 0, 1 or 2 for the LPC122x. * Provide the same page number as start and end to erase a single page. * Of course, end page number MUST be higher than (or equal to) start page number. * There is no way to erase only parts of a page. diff --git a/include/core/system.h b/include/core/system.h index 3130134..88a9897 100644 --- a/include/core/system.h +++ b/include/core/system.h @@ -70,7 +70,7 @@ void system_brown_out_detection_config(uint32_t level); #define FREQ_SEL_IRC FREQ_SEL_12MHz /* Main clock config - * We use external crystal and PLL0 + * We use internal RC and PLL0 * Note that during PLL lock wait we are running on internal RC */ void clock_config(uint32_t freq_sel); diff --git a/include/drivers/gpio.h b/include/drivers/gpio.h index 4477064..5ca197f 100644 --- a/include/drivers/gpio.h +++ b/include/drivers/gpio.h @@ -64,6 +64,8 @@ struct lpc_gpio #define LPC_GPIO_REGS(x) ((struct lpc_gpio *) (LPC_AHB_BASE + (0x10000 * (x)))) + +/***************************************************************************** */ /* Public access to GPIO setup */ #define GPIO_DIR_IN 0 @@ -77,26 +79,11 @@ enum gpio_interrupt_senses { LEVEL_LOW, }; -/* GPIO Interrupts */ -/* Add a callback on a GPIO interrupt. - * This call will configure the GPIO (call to config_pio()), set it as input and - * activate the interrupt on the given 'sense' event. use the gpio_interrupt_senses - * enum for 'sense' values. - * The callback will receive the pin number as argument (but not the port number). - * Note : - * The interrupt hanlers are not efficient if the pin is not a low numbered one (require - * 32 shifts + test for pin number 31). - * Use them if you place the signals generating interrupts on low numbered pins. - * When possible, get in touch with the people doing the electronic design, or change - * the handlers in drivers/gpio.c - */ -int set_gpio_callback(void (*callback) (uint32_t), const struct pio* gpio, uint8_t sense); -void remove_gpio_callback(const struct pio* gpio); - /* GPIO Activation */ void gpio_on(void); + void gpio_off(void); #define gpio_dir_in(gpio) \ @@ -146,4 +133,24 @@ static inline uint32_t gpio_read(const struct pio gpio) void config_gpio(const struct pio* gpio, uint32_t mode, uint8_t dir, uint8_t ini_val); +/* GPIO Interrupts */ +/* Add a callback on a GPIO interrupt. + * This call will configure the GPIO (call to config_pio()), set it as input and + * activate the interrupt on the given 'sense' event. use the gpio_interrupt_senses + * enum for 'sense' values. + * The callback will receive the pin number as argument (but not the port number). + * Note : + * The interrupt hanlers are not efficient if the pin is not a low numbered one (require + * 32 shifts + test for pin number 31). + * Use them if you place the signals generating interrupts on low numbered pins. + * When possible, get in touch with the people doing the electronic design, or change + * the handlers in drivers/gpio.c + */ +int set_gpio_callback(void (*callback) (uint32_t), const struct pio* gpio, uint8_t sense); + +void remove_gpio_callback(const struct pio* gpio); + + + + #endif /* DRIVERS_GPIO_H */ diff --git a/include/extdrv/cc1101.h b/include/extdrv/cc1101.h index 20a93e4..3a50a13 100644 --- a/include/extdrv/cc1101.h +++ b/include/extdrv/cc1101.h @@ -12,8 +12,6 @@ * @author TI CC1101 library developed by Athanassios Mavrogeorgiadis (tmav Electronics) * as template based on TI C8051 SOURCE CODE swrc021f * - * @section LICENSE - * * Copyright (c) 2010 ARM Limited * * Permission is hereby granted, free of charge, to any person obtaining a copy @@ -34,10 +32,6 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * - * @section DESCRIPTION - * - * CC1101 Low-Power Sub-1 GHz RF Transceiver CC1101. - * * Datasheet: * * http://focus.ti.com/lit/ds/swrs061f/swrs061f.pdf diff --git a/include/extdrv/eeprom.h b/include/extdrv/eeprom.h index 81aa4a8..27f079f 100644 --- a/include/extdrv/eeprom.h +++ b/include/extdrv/eeprom.h @@ -26,6 +26,8 @@ #include "lib/stdint.h" +/* FIXME : All of this will have to be re-written with an eeprom definition structure */ + /***************************************************************************** */ /* Read and Write for system eeprom */ /***************************************************************************** */ @@ -36,13 +38,6 @@ * RETURN VALUE * Upon successfull completion, returns the number of bytes read. On error, returns a negative * integer equivalent to errors from glibc. - * -EFAULT : address above eeprom size - * -EBADFD : Device not initialized - * -EBUSY : Device or ressource Busy or Arbitration lost - * -EAGAIN : Device already in use - * -EINVAL : Invalid argument (buf) - * -EREMOTEIO : Device did not acknowledge - * -EIO : Bad one: Illegal start or stop, or illegal state in i2c state machine */ int eeprom_read(uint8_t eeprom_addr, uint32_t offset, void *buf, size_t count); @@ -53,13 +48,6 @@ int eeprom_read(uint8_t eeprom_addr, uint32_t offset, void *buf, size_t count); * RETURN VALUE * Upon successfull completion, returns the number of bytes written. On error, returns a negative * integer equivalent to errors from glibc. - * -EFAULT : address above eeprom size - * -EBADFD : Device not initialized - * -EBUSY : Device or ressource Busy or Arbitration lost - * -EAGAIN : Device already in use - * -EINVAL : Invalid argument (buf) - * -EREMOTEIO : Device did not acknowledge - * -EIO : Bad one: Illegal start or stop, or illegal state in i2c state machine */ int eeprom_write(uint8_t eeprom_addr, uint32_t offset, const void *buf, size_t count); diff --git a/include/extdrv/tmp101_temp_sensor.h b/include/extdrv/tmp101_temp_sensor.h index 6633b9e..6fd6ec3 100644 --- a/include/extdrv/tmp101_temp_sensor.h +++ b/include/extdrv/tmp101_temp_sensor.h @@ -1,5 +1,5 @@ /**************************************************************************** - * extdrv/temp.h + * extdrv/tmp101_temp_sensor.h * * * Copyright 2012 Nathael Pajani @@ -66,7 +66,6 @@ struct tmp101_sensor_config { /* Check the sensor presence, return 1 if found * This is a basic check, it could be anything with the same address ... - * addr: the sensor address on most significant bits. */ int tmp101_probe_sensor(struct tmp101_sensor_config* conf); @@ -87,12 +86,6 @@ int tmp101_convert_to_deci_degrees(uint16_t raw); * Upon successfull completion, returns 0 and the temperature read is placed in the * provided integer(s). On error, returns a negative integer equivalent to errors from * glibc. - * -EBADFD : I2C not initialized - * -EBUSY : Device or ressource Busy or Arbitration lost - * -EINVAL : Invalid argument (buf) - * -ENODEV : No such device - * -EREMOTEIO : Device did not acknowledge : Any device present ? - * -EIO : Bad one: Illegal start or stop, or illegal state in i2c state machine */ int tmp101_sensor_read(struct tmp101_sensor_config* conf, uint16_t* raw, int* deci_degrees); @@ -106,12 +99,6 @@ int tmp101_sensor_read(struct tmp101_sensor_config* conf, uint16_t* raw, int* de * Return value: * Upon successfull completion, returns 0. On error, returns a negative integer * equivalent to errors from glibc. - * -EBADFD : I2C not initialized - * -EBUSY : Device or ressource Busy or Arbitration lost - * -EINVAL : Invalid argument (buf) - * -ENODEV : No such device - * -EREMOTEIO : Device did not acknowledge : Any device present ? - * -EIO : Bad one: Illegal start or stop, or illegal state in i2c state machine */ int tmp101_sensor_config(struct tmp101_sensor_config* conf); diff --git a/include/extdrv/ws2812.h b/include/extdrv/ws2812.h index f0d606b..03f619d 100644 --- a/include/extdrv/ws2812.h +++ b/include/extdrv/ws2812.h @@ -88,13 +88,7 @@ int ws2812_send_frame(uint16_t nb_leds); */ int ws2812_set_pixel(uint16_t pixel_num, uint8_t red, uint8_t green, uint8_t blue); -/* Read the value of a pixel (led) color from the data buffer (frame) - * The returned value is the last value set using ws2812_set_pixel(), but not - * necessarily the actual color of the led if ws2812_send_frame() has not been - * called with a big enough value. It is the value that would be set when using - * ws2812_send_frame() with 0 or with a value equal to or above the pixel number - * in the ws2812_get_pixel() call. - */ +/* Get a pixel (led) color from the data buffer */ int ws2812_get_pixel(uint16_t pixel_num, uint8_t* red, uint8_t* green, uint8_t* blue); /* Clear the internal data buffer. */