Ignore:
Timestamp:
Jan 23, 2025, 4:10:33 PM (4 months ago)
Author:
Zed
Message:

NetX can be compiled and initialized.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • ctrl/firmware/Main/CubeMX/Core/Src/app_threadx.c

    r66 r69  
    3434#include "gsm_rx_thread.h"
    3535#include "fan_thread.h"
     36#include "eth_thread.h"
    3637
    3738/* USER CODE END Includes */
     
    4950#define GSM_RX_THREAD_STACK_SIZE_BYTES          (1024U)
    5051#define FAN_THREAD_STACK_SIZE_BYTES                     (512U)
     52#define ETH_THREAD_STACK_SIZE_BYTES                     (2048U)
    5153
    5254/* USER CODE END PD */
     
    6062/* USER CODE BEGIN PV */
    6163
    62 TX_THREAD scan_keys_thread_ptr;
    63 TX_THREAD gsm_thread_ptr;
    64 TX_THREAD gsm_rx_thread_ptr;
    65 TX_THREAD fan_thread_ptr;
     64TX_THREAD scan_keys_thread;
     65TX_THREAD gsm_thread;
     66TX_THREAD gsm_rx_thread;
     67TX_THREAD fan_thread;
     68TX_THREAD eth_thread;
    6669
    6770/* USER CODE END PV */
     
    8790  VOID *gsm_rx_thread_pointer;
    8891  VOID *fan_thread_pointer;
     92  VOID *eth_thread_pointer;
    8993
    9094  /* USER CODE END App_ThreadX_MEM_POOL */
     
    97101
    98102  char* scan_keys_thread_name = "Scan Keys Thread";
    99   ret = tx_thread_create(&scan_keys_thread_ptr, scan_keys_thread_name, scanKeysThread, 0x0001, keys_thread_pointer, KEYS_THREAD_STACK_SIZE_BYTES, TX_MAX_PRIORITIES-1, TX_MAX_PRIORITIES-1, TX_NO_TIME_SLICE, TX_AUTO_START);
     103  ret = tx_thread_create(&scan_keys_thread, scan_keys_thread_name, scanKeysThread, 0x0001, keys_thread_pointer, KEYS_THREAD_STACK_SIZE_BYTES, TX_MAX_PRIORITIES-1, TX_MAX_PRIORITIES-1, TX_NO_TIME_SLICE, TX_AUTO_START);
    100104  if (ret != TX_SUCCESS) { printf("Cannot create %s!\n", scan_keys_thread_name); return ret; }
    101105
     
    106110
    107111  char* gsm_thread_name = "GSM Thread";
    108   ret = tx_thread_create(&gsm_thread_ptr, gsm_thread_name, gsmThread, 0x0001,   gsm_thread_pointer, GSM_THREAD_STACK_SIZE_BYTES, TX_MAX_PRIORITIES-1, TX_MAX_PRIORITIES-1, TX_NO_TIME_SLICE, TX_AUTO_START);
     112  ret = tx_thread_create(&gsm_thread, gsm_thread_name, gsmThread, 0x0001,       gsm_thread_pointer, GSM_THREAD_STACK_SIZE_BYTES, TX_MAX_PRIORITIES-1, TX_MAX_PRIORITIES-1, TX_NO_TIME_SLICE, TX_AUTO_START);
    109113  if (ret != TX_SUCCESS) { printf("Cannot create %s!\n", gsm_thread_name); return ret; }
    110114
     
    114118
    115119  char* gsm_rx_thread_name = "GSM RX Thread";
    116   ret = tx_thread_create(&gsm_rx_thread_ptr, gsm_rx_thread_name, gsmRxThread, 0x0001, gsm_rx_thread_pointer, GSM_RX_THREAD_STACK_SIZE_BYTES, TX_MAX_PRIORITIES-1, TX_MAX_PRIORITIES-1, TX_NO_TIME_SLICE, TX_AUTO_START);
     120  ret = tx_thread_create(&gsm_rx_thread, gsm_rx_thread_name, gsmRxThread, 0x0001, gsm_rx_thread_pointer, GSM_RX_THREAD_STACK_SIZE_BYTES, TX_MAX_PRIORITIES-1, TX_MAX_PRIORITIES-1, TX_NO_TIME_SLICE, TX_AUTO_START);
    117121  if (ret != TX_SUCCESS) { printf("Cannot create %s!\n", gsm_rx_thread_name); return ret; }
    118122
     
    122126
    123127  char* fan_thread_name = "FAN Thread";
    124   ret = tx_thread_create(&fan_thread_ptr, fan_thread_name, fanThread, 0x0001, fan_thread_pointer, FAN_THREAD_STACK_SIZE_BYTES, TX_MAX_PRIORITIES-1, TX_MAX_PRIORITIES-1, TX_NO_TIME_SLICE, TX_AUTO_START);
     128  ret = tx_thread_create(&fan_thread, fan_thread_name, fanThread, 0x0001, fan_thread_pointer, FAN_THREAD_STACK_SIZE_BYTES, TX_MAX_PRIORITIES-1, TX_MAX_PRIORITIES-1, TX_NO_TIME_SLICE, TX_AUTO_START);
     129  if (ret != TX_SUCCESS) { printf("Cannot create %s!\n", fan_thread_name); return ret; }
     130
     131  // Allocate the stack for ethernet thread
     132  ret = tx_byte_allocate(byte_pool, &eth_thread_pointer, ETH_THREAD_STACK_SIZE_BYTES, TX_NO_WAIT);
     133  if (ret != TX_SUCCESS) { printf("Cannot allocate bytes of memory!\n"); return ret; }
     134
     135  char* eth_thread_name = "ETH Thread";
     136  ret = tx_thread_create(&eth_thread, eth_thread_name, ethThread, 0x0001, eth_thread_pointer, ETH_THREAD_STACK_SIZE_BYTES, TX_MAX_PRIORITIES-1, TX_MAX_PRIORITIES-1, TX_NO_TIME_SLICE, TX_AUTO_START);
    125137  if (ret != TX_SUCCESS) { printf("Cannot create %s!\n", fan_thread_name); return ret; }
    126138
Note: See TracChangeset for help on using the changeset viewer.