diff --git a/firmware/ec/common/inc/ocmp_wrappers/ocmp_at45db.h b/firmware/ec/common/inc/ocmp_wrappers/ocmp_at45db.h index 09ce80d751..f4c521b54d 100644 --- a/firmware/ec/common/inc/ocmp_wrappers/ocmp_at45db.h +++ b/firmware/ec/common/inc/ocmp_wrappers/ocmp_at45db.h @@ -10,10 +10,10 @@ #ifndef COMMON_INC_OCMP_WRAPPERS_OCMP_FLASH_H_ #define COMMON_INC_OCMP_WRAPPERS_OCMP_FLASH_H_ -#define PAYLOAD_SIZE 47 #define FRAME_SIZE 64 +#define LAST_MSG_FLAG 0 #define NEXT_MSG_FLAG_POS 17 #define NEXT_MSG_FLAG 1 -#define LAST_MSG_FLAG 0 +#define PAYLOAD_SIZE 47 #endif /* COMMON_INC_OCMP_WRAPPERS_OCMP_FLASH_H_ */ diff --git a/firmware/ec/common/inc/ocmp_wrappers/ocmp_eeprom_cat24c04.h b/firmware/ec/common/inc/ocmp_wrappers/ocmp_eeprom_cat24c04.h index 0804259e02..23b87aa742 100644 --- a/firmware/ec/common/inc/ocmp_wrappers/ocmp_eeprom_cat24c04.h +++ b/firmware/ec/common/inc/ocmp_wrappers/ocmp_eeprom_cat24c04.h @@ -13,11 +13,11 @@ SCHEMA_IMPORT bool SYS_post_get_results(void **getpostResult); SCHEMA_IMPORT bool SYS_post_enable(void **postActivate); +SCHEMA_IMPORT const Driver_fxnTable AT45DB641E_fxnTable; SCHEMA_IMPORT const Driver_fxnTable CAT24C04_gbc_sid_fxnTable; SCHEMA_IMPORT const Driver_fxnTable CAT24C04_gbc_inv_fxnTable; SCHEMA_IMPORT const Driver_fxnTable CAT24C04_sdr_inv_fxnTable; SCHEMA_IMPORT const Driver_fxnTable CAT24C04_fe_inv_fxnTable; -SCHEMA_IMPORT const Driver_fxnTable AT45DB641E_fxnTable; static const Driver CAT24C04_gbc_sid = { .name = "EEPROM", diff --git a/firmware/ec/platform/oc-sdr/schema/schema.c b/firmware/ec/platform/oc-sdr/schema/schema.c index 08a5065a05..18f0eb05e1 100644 --- a/firmware/ec/platform/oc-sdr/schema/schema.c +++ b/firmware/ec/platform/oc-sdr/schema/schema.c @@ -274,7 +274,7 @@ const Component sys_schema[] = { {} }, .driver_cfg = &gbc_spi_flash_memory, - .ssHookSet = &(SSHookSet){ + .ssHookSet = &(SSHookSet) { .postInitFxn = (ssHook_Cb)sys_post_init, }, }, diff --git a/firmware/ec/src/Board.h b/firmware/ec/src/Board.h index 551d82422f..8da425355a 100644 --- a/firmware/ec/src/Board.h +++ b/firmware/ec/src/Board.h @@ -46,9 +46,9 @@ extern "C" { #define Board_initEMAC OC_CONNECT1_initEMAC #define Board_initGeneral OC_CONNECT1_initGeneral -#define Board_initSPI OC_CONNECT1_initSPI #define Board_initGPIO OC_CONNECT1_initGPIO #define Board_initI2C OC_CONNECT1_initI2C +#define Board_initSPI OC_CONNECT1_initSPI #define Board_initUART OC_CONNECT1_initUART #define Board_initUSB OC_CONNECT1_initUSB #define Board_initWatchdog OC_CONNECT1_initWatchdog diff --git a/firmware/ec/src/devices/at45db.c b/firmware/ec/src/devices/at45db.c index 599f1b2c16..5953d4cc3b 100644 --- a/firmware/ec/src/devices/at45db.c +++ b/firmware/ec/src/devices/at45db.c @@ -18,23 +18,22 @@ #include "inc/common/global_header.h" #include "inc/global/OC_CONNECT1.h" -#define AT45DB_MANFACTURE_ID 0x1F -#define AT45DB_DEVICE_ID 0x0028 -#define AT45DB_READY 0x80 /* AT45DB Ready Value */ -#define AT45DB_STATUS_OPCODE 0xD7 -#define AT45DB_PAGE_ERASE_OPCODE 0x81 -#define AT45DB_PAGE_RD_OPCODE 0xD2 -#define AT45DB_SRAM_BUFF2_WR_OPCODE 0x87 -#define AT45DB_PAGE_WR_OPCODE 0x86 -#define AT45DB_DEVID_RD_OPCODE 0x9F - -#define AT45DB_STATUS_OPCODE_WR_COUNT 1 -#define AT45DB_DEVID_OPCODE_WR_COUNT 1 -#define AT45DB_ERASE_OPCODE_WR_COUNT 4 #define AT45DB_DATA_WR_OPCODE_WR_COUNT 4 #define AT45DB_DATA_RD_OPCODE_WR_COUNT 8 -#define AT45DB_STATUS_RD_BYTES 1 +#define AT45DB_DEVICE_ID 0x0028 #define AT45DB_DEVID_RD_BYTES 2 +#define AT45DB_DEVID_RD_OPCODE 0x9F +#define AT45DB_DEVID_OPCODE_WR_COUNT 1 +#define AT45DB_ERASE_OPCODE_WR_COUNT 4 +#define AT45DB_MANFACTURE_ID 0x1F +#define AT45DB_PAGE_ERASE_OPCODE 0x81 +#define AT45DB_PAGE_RD_OPCODE 0xD2 +#define AT45DB_PAGE_WR_OPCODE 0x86 +#define AT45DB_READY 0x80 /* AT45DB Ready Value */ +#define AT45DB_SRAM_BUFF2_WR_OPCODE 0x87 +#define AT45DB_STATUS_OPCODE 0xD7 +#define AT45DB_STATUS_OPCODE_WR_COUNT 1 +#define AT45DB_STATUS_RD_BYTES 1 #define waitForReady(dev) \ while (!(AT45DB_READY & at45db_readStatusRegister(dev))); @@ -216,7 +215,7 @@ ReturnStatus at45db_data_write(AT45DB_Dev *dev, uint8_t *data, uint32_t data_siz status = AT45DB_write_reg(dev, &txBuffer, data, byte, data_size, AT45DB_DATA_WR_OPCODE_WR_COUNT); - if(status == RETURN_OK){ + if(status == RETURN_OK) { waitForReady(dev); txBuffer[0] = AT45DB_PAGE_WR_OPCODE; /* opcode to Push the data from AT45DB SRAM Buffer2 to the page */ diff --git a/firmware/ec/src/devices/spibus.c b/firmware/ec/src/devices/spibus.c index 112ba986bd..4c4d692b19 100644 --- a/firmware/ec/src/devices/spibus.c +++ b/firmware/ec/src/devices/spibus.c @@ -18,13 +18,13 @@ #include "drivers/OcGpio.h" #include "inc/common/spibus.h" #include "inc/global/OC_CONNECT1.h" -#include -#include -#include -#include -#include #include #include +#include +#include +#include +#include +#include #include #include #include diff --git a/firmware/ec/src/filesystem/fs_wrapper.c b/firmware/ec/src/filesystem/fs_wrapper.c index ba520f061e..5c1ce5ce4b 100644 --- a/firmware/ec/src/filesystem/fs_wrapper.c +++ b/firmware/ec/src/filesystem/fs_wrapper.c @@ -15,29 +15,29 @@ #include "Board.h" #include "common/inc/global/Framework.h" #include "common/inc/global/ocmp_frame.h" -#include "inc/utils/util.h" -#include "inc/global/OC_CONNECT1.h" +#include "inc/common/bigbrother.h" #include "inc/common/global_header.h" #include "inc/devices/at45db.h" -#include "inc/common/bigbrother.h" +#include "inc/global/OC_CONNECT1.h" +#include "inc/utils/util.h" #include "src/filesystem/fs_wrapper.h" +#include "src/filesystem/lfs.h" #include #include -#include "src/filesystem/lfs.h" +#include +#include #include #include #include #include -#include -#include -#define FRAME_SIZE 64 -#define READ_SIZE 256 -#define WRITE_SIZE 256 -#define PAGE_SIZE 256 #define BLOCK_SIZE 256 #define BLOCK_COUNT 32768 +#define FRAME_SIZE 64 #define LOOK_AHEAD 256 +#define PAGE_SIZE 256 +#define READ_SIZE 256 +#define WRITE_SIZE 256 static Queue_Struct fsRxMsg; static Queue_Struct fsTxMsg; @@ -60,7 +60,7 @@ lfs_file_t file; int block_device_read(const struct lfs_config *cfg, lfs_block_t block, lfs_off_t off, void *buffer, lfs_size_t size) { - if(at45db_data_read(cfg->context, buffer, size, off, block) != RETURN_OK){ + if(at45db_data_read(cfg->context, buffer, size, off, block) != RETURN_OK) { return LFS_ERR_IO; } @@ -101,7 +101,7 @@ int block_device_write(const struct lfs_config *cfg, lfs_block_t block, *****************************************************************************/ int block_device_erase(const struct lfs_config *cfg, lfs_block_t block) { - if(at45db_erasePage(cfg->context, block) != RETURN_OK){ + if(at45db_erasePage(cfg->context, block) != RETURN_OK) { return LFS_ERR_IO; } @@ -120,7 +120,7 @@ int block_device_erase(const struct lfs_config *cfg, lfs_block_t block) *****************************************************************************/ int block_device_sync(const struct lfs_config *cfg) { - if(at45db_readStatusRegister(cfg->context) != RETURN_OK){ + if(at45db_readStatusRegister(cfg->context) != RETURN_OK) { return LFS_ERR_IO; } @@ -141,7 +141,7 @@ int fileSize(const char *path) { uint32_t fileSize = 0; - if(lfs_file_open(&lfs, &file, path, LFS_O_RDONLY) == LFS_ERR_OK){ + if(lfs_file_open(&lfs, &file, path, LFS_O_RDONLY) == LFS_ERR_OK) { LOGGER_DEBUG("FS:: File open successfully \n"); } fileSize = lfs_file_size(&lfs, &file); @@ -168,7 +168,7 @@ bool fileWrite(const char *path, uint8_t *pMsg, uint32_t size ) if(lfs_file_write(&lfs, &file, pMsg, size) == size) { LOGGER_DEBUG("FS:: File written successfully \n"); } - if(lfs_file_close(&lfs, &file) == LFS_ERR_OK){ + if(lfs_file_close(&lfs, &file) == LFS_ERR_OK) { LOGGER_DEBUG("FS:: File closed successfully \n"); } @@ -246,12 +246,12 @@ void fs_init(UArg arg0, UArg arg1) }; int err = lfs_mount(&lfs, &cfg); - if (err){ + if (err) { lfs_format(&lfs, &cfg); lfs_mount(&lfs, &cfg); } - if(!err){ + if(!err) { LOGGER_DEBUG("FS:: Filesystem mounted successfully \n"); } diff --git a/firmware/ec/src/filesystem/fs_wrapper.h b/firmware/ec/src/filesystem/fs_wrapper.h index 3f44a1a641..611ff0e34e 100644 --- a/firmware/ec/src/filesystem/fs_wrapper.h +++ b/firmware/ec/src/filesystem/fs_wrapper.h @@ -13,9 +13,9 @@ #include "common/inc/global/post_frame.h" -extern Semaphore_Handle semFilesysMsg; extern Queue_Handle fsRxMsgQueue; extern Queue_Handle fsTxMsgQueue; +extern Semaphore_Handle semFilesysMsg; int fileSize(const char *path); void fs_init(UArg arg0, UArg arg1); diff --git a/firmware/ec/src/filesystem/lfs.h b/firmware/ec/src/filesystem/lfs.h index 4fd3b21fdb..8668d3908b 100644 --- a/firmware/ec/src/filesystem/lfs.h +++ b/firmware/ec/src/filesystem/lfs.h @@ -8,8 +8,8 @@ #ifndef LFS_H #define LFS_H -#include #include +#include /* Type definitions */ typedef uint32_t lfs_size_t; diff --git a/firmware/ec/src/main.c b/firmware/ec/src/main.c index 3615d5e57d..d2e8a5b11d 100644 --- a/firmware/ec/src/main.c +++ b/firmware/ec/src/main.c @@ -60,9 +60,9 @@ int main(void) openCellular_init(); /* Call board init functions */ Board_initGeneral(); - Board_initSPI(); Board_initGPIO(); Board_initI2C(); + Board_initSPI(); Board_initUSB(Board_USBDEVICE); Board_initUART(); ethernet_start(); diff --git a/firmware/ec/src/subsystem/sys/sys.c b/firmware/ec/src/subsystem/sys/sys.c index 174412fa25..8a2381ad9f 100644 --- a/firmware/ec/src/subsystem/sys/sys.c +++ b/firmware/ec/src/subsystem/sys/sys.c @@ -8,17 +8,17 @@ */ #include "common/inc/global/Framework.h" -#include -#include #include "helpers/memory.h" -#include "inc/subsystem/sys/sys.h" +#include "inc/common/bigbrother.h" +#include "inc/common/global_header.h" #include "inc/common/post.h" #include "inc/devices/eeprom.h" #include "inc/subsystem/gpp/gpp.h" /* For resetting AP */ -#include "inc/common/bigbrother.h" -#include "inc/common/global_header.h" +#include "inc/subsystem/sys/sys.h" #include "inc/utils/ocmp_util.h" #include "src/filesystem/fs_wrapper.h" +#include +#include #include #include #include @@ -27,9 +27,9 @@ #include #include +#define FRAME_SIZE 64 #define OCFS_TASK_PRIORITY 5 #define OCFS_TASK_STACK_SIZE 4096 -#define FRAME_SIZE 64 Task_Struct ocFSTask; Char ocFSTaskStack[OCFS_TASK_STACK_SIZE];