mbed library sources
Fork of mbed-src by
targets/hal/TARGET_NXP/TARGET_LPC82X/rom_i2c_8xx.h@613:bc40b8d2aec4, 2015-08-20 (annotated)
- Committer:
- mbed_official
- Date:
- Thu Aug 20 10:45:13 2015 +0100
- Revision:
- 613:bc40b8d2aec4
- Parent:
- 337:6ed01c00b962
Synchronized with git revision 92ca8c7b60a283b6bb60eb65b183dac1599f0ade
Full URL: https://github.com/mbedmicro/mbed/commit/92ca8c7b60a283b6bb60eb65b183dac1599f0ade/
Nordic: update application start address in GCC linker script
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mbed_official | 337:6ed01c00b962 | 1 | /* |
mbed_official | 337:6ed01c00b962 | 2 | * @brief LPC8xx I2C ROM API declarations and functions |
mbed_official | 337:6ed01c00b962 | 3 | * |
mbed_official | 337:6ed01c00b962 | 4 | * @note |
mbed_official | 337:6ed01c00b962 | 5 | * Copyright(C) NXP Semiconductors, 2012 |
mbed_official | 337:6ed01c00b962 | 6 | * All rights reserved. |
mbed_official | 337:6ed01c00b962 | 7 | * |
mbed_official | 337:6ed01c00b962 | 8 | * @par |
mbed_official | 337:6ed01c00b962 | 9 | * Software that is described herein is for illustrative purposes only |
mbed_official | 337:6ed01c00b962 | 10 | * which provides customers with programming information regarding the |
mbed_official | 337:6ed01c00b962 | 11 | * LPC products. This software is supplied "AS IS" without any warranties of |
mbed_official | 337:6ed01c00b962 | 12 | * any kind, and NXP Semiconductors and its licensor disclaim any and |
mbed_official | 337:6ed01c00b962 | 13 | * all warranties, express or implied, including all implied warranties of |
mbed_official | 337:6ed01c00b962 | 14 | * merchantability, fitness for a particular purpose and non-infringement of |
mbed_official | 337:6ed01c00b962 | 15 | * intellectual property rights. NXP Semiconductors assumes no responsibility |
mbed_official | 337:6ed01c00b962 | 16 | * or liability for the use of the software, conveys no license or rights under any |
mbed_official | 337:6ed01c00b962 | 17 | * patent, copyright, mask work right, or any other intellectual property rights in |
mbed_official | 337:6ed01c00b962 | 18 | * or to any products. NXP Semiconductors reserves the right to make changes |
mbed_official | 337:6ed01c00b962 | 19 | * in the software without notification. NXP Semiconductors also makes no |
mbed_official | 337:6ed01c00b962 | 20 | * representation or warranty that such application will be suitable for the |
mbed_official | 337:6ed01c00b962 | 21 | * specified use without further testing or modification. |
mbed_official | 337:6ed01c00b962 | 22 | * |
mbed_official | 337:6ed01c00b962 | 23 | * @par |
mbed_official | 337:6ed01c00b962 | 24 | * Permission to use, copy, modify, and distribute this software and its |
mbed_official | 337:6ed01c00b962 | 25 | * documentation is hereby granted, under NXP Semiconductors' and its |
mbed_official | 337:6ed01c00b962 | 26 | * licensor's relevant copyrights in the software, without fee, provided that it |
mbed_official | 337:6ed01c00b962 | 27 | * is used in conjunction with NXP Semiconductors microcontrollers. This |
mbed_official | 337:6ed01c00b962 | 28 | * copyright, permission, and disclaimer notice must appear in all copies of |
mbed_official | 337:6ed01c00b962 | 29 | * this code. |
mbed_official | 337:6ed01c00b962 | 30 | */ |
mbed_official | 337:6ed01c00b962 | 31 | |
mbed_official | 337:6ed01c00b962 | 32 | #ifndef __ROM_I2C_8XX_H_ |
mbed_official | 337:6ed01c00b962 | 33 | #define __ROM_I2C_8XX_H_ |
mbed_official | 337:6ed01c00b962 | 34 | |
mbed_official | 337:6ed01c00b962 | 35 | #ifdef __cplusplus |
mbed_official | 337:6ed01c00b962 | 36 | extern "C" { |
mbed_official | 337:6ed01c00b962 | 37 | #endif |
mbed_official | 337:6ed01c00b962 | 38 | |
mbed_official | 337:6ed01c00b962 | 39 | /** @defgroup CHIP_I2CROM_8XX CHIP: LPC8xx I2C ROM API declarations and functions |
mbed_official | 337:6ed01c00b962 | 40 | * @ingroup CHIP_8XX_Drivers |
mbed_official | 337:6ed01c00b962 | 41 | * @{ |
mbed_official | 337:6ed01c00b962 | 42 | */ |
mbed_official | 337:6ed01c00b962 | 43 | |
mbed_official | 337:6ed01c00b962 | 44 | /** |
mbed_official | 337:6ed01c00b962 | 45 | * @brief LPC8xx I2C ROM driver handle structure |
mbed_official | 337:6ed01c00b962 | 46 | */ |
mbed_official | 337:6ed01c00b962 | 47 | typedef void *I2C_HANDLE_T; |
mbed_official | 337:6ed01c00b962 | 48 | |
mbed_official | 337:6ed01c00b962 | 49 | typedef uint32_t ErrorCode_t; |
mbed_official | 337:6ed01c00b962 | 50 | |
mbed_official | 337:6ed01c00b962 | 51 | /** |
mbed_official | 337:6ed01c00b962 | 52 | * @brief LPC8xx I2C ROM driver callback function |
mbed_official | 337:6ed01c00b962 | 53 | */ |
mbed_official | 337:6ed01c00b962 | 54 | typedef void (*I2C_CALLBK_T)(uint32_t err_code, uint32_t n); |
mbed_official | 337:6ed01c00b962 | 55 | |
mbed_official | 337:6ed01c00b962 | 56 | /** |
mbed_official | 337:6ed01c00b962 | 57 | * LPC8xx I2C ROM driver parameter structure |
mbed_official | 337:6ed01c00b962 | 58 | */ |
mbed_official | 337:6ed01c00b962 | 59 | typedef struct I2C_PARAM { |
mbed_official | 337:6ed01c00b962 | 60 | uint32_t num_bytes_send; /*!< No. of bytes to send */ |
mbed_official | 337:6ed01c00b962 | 61 | uint32_t num_bytes_rec; /*!< No. of bytes to receive */ |
mbed_official | 337:6ed01c00b962 | 62 | uint8_t *buffer_ptr_send; /*!< Pointer to send buffer */ |
mbed_official | 337:6ed01c00b962 | 63 | uint8_t *buffer_ptr_rec; /*!< Pointer to receive buffer */ |
mbed_official | 337:6ed01c00b962 | 64 | I2C_CALLBK_T func_pt; /*!< Callback function */ |
mbed_official | 337:6ed01c00b962 | 65 | uint8_t stop_flag; /*!< Stop flag */ |
mbed_official | 337:6ed01c00b962 | 66 | uint8_t dummy[3]; |
mbed_official | 337:6ed01c00b962 | 67 | } I2C_PARAM_T; |
mbed_official | 337:6ed01c00b962 | 68 | |
mbed_official | 337:6ed01c00b962 | 69 | /** |
mbed_official | 337:6ed01c00b962 | 70 | * LPC8xx I2C ROM driver result structure |
mbed_official | 337:6ed01c00b962 | 71 | */ |
mbed_official | 337:6ed01c00b962 | 72 | typedef struct I2C_RESULT { |
mbed_official | 337:6ed01c00b962 | 73 | uint32_t n_bytes_sent; /*!< No. of bytes sent */ |
mbed_official | 337:6ed01c00b962 | 74 | uint32_t n_bytes_recd; /*!< No. of bytes received */ |
mbed_official | 337:6ed01c00b962 | 75 | } I2C_RESULT_T; |
mbed_official | 337:6ed01c00b962 | 76 | |
mbed_official | 337:6ed01c00b962 | 77 | /** |
mbed_official | 337:6ed01c00b962 | 78 | * LPC8xx I2C ROM driver modes enum |
mbed_official | 337:6ed01c00b962 | 79 | */ |
mbed_official | 337:6ed01c00b962 | 80 | typedef enum CHIP_I2C_MODE { |
mbed_official | 337:6ed01c00b962 | 81 | IDLE, /*!< IDLE state */ |
mbed_official | 337:6ed01c00b962 | 82 | MASTER_SEND, /*!< Master send state */ |
mbed_official | 337:6ed01c00b962 | 83 | MASTER_RECEIVE, /*!< Master Receive state */ |
mbed_official | 337:6ed01c00b962 | 84 | SLAVE_SEND, /*!< Slave send state */ |
mbed_official | 337:6ed01c00b962 | 85 | SLAVE_RECEIVE /*!< Slave receive state */ |
mbed_official | 337:6ed01c00b962 | 86 | } CHIP_I2C_MODE_T; |
mbed_official | 337:6ed01c00b962 | 87 | |
mbed_official | 337:6ed01c00b962 | 88 | /** |
mbed_official | 337:6ed01c00b962 | 89 | * LPC8xx I2C ROM driver APIs structure |
mbed_official | 337:6ed01c00b962 | 90 | */ |
mbed_official | 337:6ed01c00b962 | 91 | typedef struct I2CD_API { |
mbed_official | 337:6ed01c00b962 | 92 | /*!< Interrupt Support Routine */ |
mbed_official | 337:6ed01c00b962 | 93 | void (*i2c_isr_handler)(I2C_HANDLE_T *handle); |
mbed_official | 337:6ed01c00b962 | 94 | |
mbed_official | 337:6ed01c00b962 | 95 | /*!< MASTER functions */ |
mbed_official | 337:6ed01c00b962 | 96 | ErrorCode_t (*i2c_master_transmit_poll)(I2C_HANDLE_T *handle, I2C_PARAM_T *param, I2C_RESULT_T *result); |
mbed_official | 337:6ed01c00b962 | 97 | ErrorCode_t (*i2c_master_receive_poll)(I2C_HANDLE_T *handle, I2C_PARAM_T *param, I2C_RESULT_T *result); |
mbed_official | 337:6ed01c00b962 | 98 | ErrorCode_t (*i2c_master_tx_rx_poll)(I2C_HANDLE_T *handle, I2C_PARAM_T *param, I2C_RESULT_T *result); |
mbed_official | 337:6ed01c00b962 | 99 | ErrorCode_t (*i2c_master_transmit_intr)(I2C_HANDLE_T *handle, I2C_PARAM_T *param, I2C_RESULT_T *result); |
mbed_official | 337:6ed01c00b962 | 100 | ErrorCode_t (*i2c_master_receive_intr)(I2C_HANDLE_T *handle, I2C_PARAM_T *param, I2C_RESULT_T *result); |
mbed_official | 337:6ed01c00b962 | 101 | ErrorCode_t (*i2c_master_tx_rx_intr)(I2C_HANDLE_T *handle, I2C_PARAM_T *param, I2C_RESULT_T *result); |
mbed_official | 337:6ed01c00b962 | 102 | |
mbed_official | 337:6ed01c00b962 | 103 | /*!< SLAVE functions */ |
mbed_official | 337:6ed01c00b962 | 104 | ErrorCode_t (*i2c_slave_receive_poll)(I2C_HANDLE_T *handle, I2C_PARAM_T *param, I2C_RESULT_T *result); |
mbed_official | 337:6ed01c00b962 | 105 | ErrorCode_t (*i2c_slave_transmit_poll)(I2C_HANDLE_T *handle, I2C_PARAM_T *param, I2C_RESULT_T *result); |
mbed_official | 337:6ed01c00b962 | 106 | ErrorCode_t (*i2c_slave_receive_intr)(I2C_HANDLE_T *handle, I2C_PARAM_T *param, I2C_RESULT_T *result); |
mbed_official | 337:6ed01c00b962 | 107 | ErrorCode_t (*i2c_slave_transmit_intr)(I2C_HANDLE_T *handle, I2C_PARAM_T *param, I2C_RESULT_T *result); |
mbed_official | 337:6ed01c00b962 | 108 | ErrorCode_t (*i2c_set_slave_addr)(I2C_HANDLE_T *handle, uint32_t slave_addr_0_3, uint32_t slave_mask_0_3); |
mbed_official | 337:6ed01c00b962 | 109 | |
mbed_official | 337:6ed01c00b962 | 110 | /*!< OTHER support functions */ |
mbed_official | 337:6ed01c00b962 | 111 | uint32_t (*i2c_get_mem_size)(void); |
mbed_official | 337:6ed01c00b962 | 112 | I2C_HANDLE_T * (*i2c_setup)( uint32_t i2c_base_addr, uint32_t * start_of_ram); |
mbed_official | 337:6ed01c00b962 | 113 | ErrorCode_t (*i2c_set_bitrate)(I2C_HANDLE_T *handle, uint32_t p_clk_in_hz, uint32_t bitrate_in_bps); |
mbed_official | 337:6ed01c00b962 | 114 | uint32_t (*i2c_get_firmware_version)(void); |
mbed_official | 337:6ed01c00b962 | 115 | CHIP_I2C_MODE_T (*i2c_get_status)(I2C_HANDLE_T *handle); |
mbed_official | 337:6ed01c00b962 | 116 | ErrorCode_t (*i2c_set_timeout)(I2C_HANDLE_T *handle, uint32_t timeout); |
mbed_official | 337:6ed01c00b962 | 117 | } I2CD_API_T; |
mbed_official | 337:6ed01c00b962 | 118 | |
mbed_official | 337:6ed01c00b962 | 119 | /** |
mbed_official | 337:6ed01c00b962 | 120 | * @} |
mbed_official | 337:6ed01c00b962 | 121 | */ |
mbed_official | 337:6ed01c00b962 | 122 | |
mbed_official | 337:6ed01c00b962 | 123 | #ifdef __cplusplus |
mbed_official | 337:6ed01c00b962 | 124 | } |
mbed_official | 337:6ed01c00b962 | 125 | #endif |
mbed_official | 337:6ed01c00b962 | 126 | |
mbed_official | 337:6ed01c00b962 | 127 | #endif /* __ROM_I2C_8XX_H_ */ |