Shad Ansari | 2f7f9be | 2017-06-07 13:34:53 -0700 | [diff] [blame^] | 1 | #include <bcmolt_tr_ud_driver.h> |
| 2 | #include <bcm_dev_log.h> |
| 3 | #include <bcmolt_dev_ctrl.h> |
| 4 | #include <bcmolt_tr_mux.h> |
| 5 | #include <bcmos_system.h> |
| 6 | #include <bcmolt_user_utils.h> |
| 7 | #include <bcmolt_host_api.h> |
| 8 | #include <bcmolt_fld.h> |
| 9 | #include <bcmtr_pcie.h> |
| 10 | |
| 11 | extern struct proc_dir_entry *bcmolt_dir; |
| 12 | |
| 13 | bcmos_errno bcmtr_init(void) |
| 14 | { |
| 15 | return BCM_ERR_OK; |
| 16 | } |
| 17 | |
| 18 | #ifdef ENABLE_LOG |
| 19 | #define DEV_LOG_SIZE1 1<<11 |
| 20 | #define DEV_LOG_SIZE2 1<<13 |
| 21 | #define DEV_LOG_QUEUE_SIZE 1000 |
| 22 | |
| 23 | static bcmos_errno dev_ctrl_logger_init_cb(void) |
| 24 | { |
| 25 | bcmos_errno rc; |
| 26 | static uint8_t logger_buf1[DEV_LOG_SIZE1]; |
| 27 | static uint8_t logger_buf2[DEV_LOG_SIZE2]; |
| 28 | void *addresses[DEV_LOG_MAX_FILES] = {logger_buf1, logger_buf2}; |
| 29 | uint32_t sizes[DEV_LOG_MAX_FILES] = {sizeof(logger_buf1), sizeof(logger_buf2)}; |
| 30 | uint32_t flags[DEV_LOG_MAX_FILES] = {BCM_DEV_LOG_FILE_FLAG_STOP_WHEN_FULL, BCM_DEV_LOG_FILE_FLAG_WRAP_AROUND}; |
| 31 | |
| 32 | rc = bcm_dev_log_init_default_logger(addresses, sizes, flags, BCM_SIZEOFARRAY(addresses), 0x4000, TASK_PRIORITY_DEV_LOG, DEV_LOG_QUEUE_SIZE); |
| 33 | BCMOS_TRACE_CHECK_RETURN(rc, rc, "bcm_dev_log_initialize_dev_logger_default()\n"); |
| 34 | |
| 35 | /* For now just map BCMOS_TRACE_XX to dev_log. Later on dev_control |
| 36 | * can define its own log ids |
| 37 | */ |
| 38 | //rc = bcm_dev_log_os_trace_init(); |
| 39 | //BUG_ON(rc); |
| 40 | |
| 41 | return rc; |
| 42 | } |
| 43 | #endif |
| 44 | |
| 45 | |
| 46 | |
| 47 | int main(int argc, char *argv[]) |
| 48 | { |
| 49 | bcmos_errno rc; |
| 50 | bcmolt_host_init_params params = |
| 51 | { |
| 52 | #ifdef ENABLE_LOG |
| 53 | .logger_init_cb = dev_ctrl_logger_init_cb, |
| 54 | #endif |
| 55 | .run_dev_ctrl = BCMOS_TRUE |
| 56 | }; |
| 57 | |
| 58 | rc = bcmolt_host_init(¶ms); |
| 59 | BUG_ON(rc); |
| 60 | |
| 61 | bcmos_trace_level_set(BCMOS_TRACE_LEVEL_DEBUG); |
| 62 | |
| 63 | rc = bcmtr_ud_init(); /* Never returns - runs accept loop */ |
| 64 | BUG_ON(rc); |
| 65 | |
| 66 | while (BCMOS_TRUE) |
| 67 | { |
| 68 | bcmos_usleep(5*1000*1000); |
| 69 | bcmos_printf("Waiting\n"); |
| 70 | } |
| 71 | } |
| 72 | |