00001
00020
00021
00022
00023
00024 #include "co_int.h"
00025 #include "co_bool.h"
00026
00027 #include "co_list.h"
00028 #include "tx_swdesc.h"
00029 #include "ke_event.h"
00030 #include "co_utils.h"
00031
00032
00033
00034
00035
00036 #if !NX_FULLY_HOSTED
00038 struct txdesc txdesc_array0[RW_USER_MAX * NX_TXDESC_CNT0];
00040 struct txdesc txdesc_array1[RW_USER_MAX * NX_TXDESC_CNT1];
00042 struct txdesc txdesc_array2[RW_USER_MAX * NX_TXDESC_CNT2];
00044 struct txdesc txdesc_array3[RW_USER_MAX * NX_TXDESC_CNT3];
00045 #if (NX_BEACONING)
00047 struct txdesc txdesc_array4[NX_TXDESC_CNT4];
00048 #endif
00049
00051 const struct txdesc * const txdesc_array_per_q[NX_TXQ_CNT] =
00052 {
00053 txdesc_array0,
00054 txdesc_array1,
00055 txdesc_array2,
00056 txdesc_array3,
00057 #if (NX_BEACONING)
00058 txdesc_array4,
00059 #endif
00060 };
00061
00063 struct txdesc *txdesc_array[NX_TXQ_CNT][RW_USER_MAX];
00064
00066 const struct tx_hw_desc * const tx_hw_desc[NX_TXQ_CNT] =
00067 {
00068 tx_hw_desc0,
00069 tx_hw_desc1,
00070 tx_hw_desc2,
00071 tx_hw_desc3,
00072 #if (NX_BEACONING)
00073 tx_hw_desc4,
00074 #endif
00075 };
00076 #endif
00077
00078 const int nx_txdesc_cnt[] =
00079 {
00080 NX_TXDESC_CNT0,
00081 NX_TXDESC_CNT1,
00082 NX_TXDESC_CNT2,
00083 NX_TXDESC_CNT3,
00084 #if (NX_BEACONING)
00085 NX_TXDESC_CNT4,
00086 #endif
00087 };
00088
00089 const int nx_txuser_cnt[] =
00090 {
00091 RW_USER_MAX,
00092 RW_USER_MAX,
00093 RW_USER_MAX,
00094 RW_USER_MAX,
00095 #if (NX_BEACONING)
00096 1,
00097 #endif
00098 };
00099
00100
00101
00102
00103
00104 void tx_txdesc_init(void)
00105 {
00106 #if !NX_FULLY_HOSTED
00107
00108 for (int i = 0; i < NX_TXQ_CNT; i++)
00109 {
00110 for (int j = 0; j < nx_txuser_cnt[i]; j++)
00111 {
00112 txdesc_array[i][j] = (struct txdesc *)&txdesc_array_per_q[i][j * nx_txdesc_cnt[i]];
00113
00114 memset((void *)txdesc_array[i][j], 0, nx_txdesc_cnt[i] * sizeof(struct txdesc));
00115 for (int k = 0; k < nx_txdesc_cnt[i]; k++)
00116 {
00117 struct txdesc *txdesc = &txdesc_array[i][j][k];
00118 struct lmacdesc *desc = &txdesc->lmac;
00119 struct tx_hw_desc *hw_desc = (struct tx_hw_desc *)&tx_hw_desc[i][j * nx_txdesc_cnt[i] + k];
00120
00121
00122 desc->hw_desc = hw_desc;
00123
00124
00125 hw_desc->dma_desc.src = CPU2HW(&hw_desc->cfm);
00126 hw_desc->dma_desc.length = sizeof_b(hw_desc->cfm);
00127 }
00128 }
00129 }
00130 #endif
00131 }
00132
00134