- Timestamp:
- Feb 4, 2016, 11:11:09 PM (7 years ago)
- Location:
- uKadecot/trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
uKadecot/trunk/src/ukadecot/arduino.c
r108 r155 58 58 * モジュールストップ機能の設定(S12AD) 59 59 */ 60 sil_wrh_mem( (uint16_t *)SYSTEM_PRCR_ADDR, (uint16_t)0xA502); /* 書込み許可 */61 sil_wrw_mem( (uint32_t *)SYSTEM_MSTPCRA_ADDR,62 sil_rew_mem( (uint32_t *)SYSTEM_MSTPCRA_ADDR) & ~SYSTEM_MSTPCRA_MSTPA17_BIT);63 sil_wrh_mem( (uint16_t *)SYSTEM_PRCR_ADDR, (uint16_t)0xA500); /* 書込み禁止 */60 sil_wrh_mem(SYSTEM_PRCR_ADDR, (uint16_t)0xA502); /* 書込み許可 */ 61 sil_wrw_mem(SYSTEM_MSTPCRA_ADDR, 62 sil_rew_mem(SYSTEM_MSTPCRA_ADDR) & ~SYSTEM_MSTPCRA_MSTPA17_BIT); 63 sil_wrh_mem(SYSTEM_PRCR_ADDR, (uint16_t)0xA500); /* 書込み禁止 */ 64 64 65 65 /* 12bitADC初期化 */ 66 sil_wrh_mem( (uint16_t *)S12AD_ADEXICR_ADDR, 0x0000); /* 温度センサ出力、内部基準電圧非選択 */67 sil_wrh_mem( (uint16_t *)S12AD_ADANS0_ADDR, 0x00FF); /* 変換ポートAN000〜AN007選択、AN008〜AN015非選択 */68 sil_wrh_mem( (uint16_t *)S12AD_ADANS1_ADDR, 0x0000); /* 変換ポートAN016〜AN020非選択 */66 sil_wrh_mem(S12AD_ADEXICR_ADDR, 0x0000); /* 温度センサ出力、内部基準電圧非選択 */ 67 sil_wrh_mem(S12AD_ADANS0_ADDR, 0x00FF); /* 変換ポートAN000〜AN007選択、AN008〜AN015非選択 */ 68 sil_wrh_mem(S12AD_ADANS1_ADDR, 0x0000); /* 変換ポートAN016〜AN020非選択 */ 69 69 70 70 /* PWM出力(490Hz) */ … … 157 157 158 158 /* 書き込みプロテクトレジスタの設定 PFSWEビットへの書き込みを許可 */ 159 sil_wrb_mem( (uint8_t *)MPC_PWPR_ADDR, 0x00);159 sil_wrb_mem(MPC_PWPR_ADDR, 0x00); 160 160 /* 書き込みプロテクトレジスタの設定 PxxFSレジスタへの書き込みを許可 */ 161 sil_wrb_mem( (uint8_t *)MPC_PWPR_ADDR, 0x40);161 sil_wrb_mem(MPC_PWPR_ADDR, 0x40); 162 162 163 163 switch(pin){ … … 166 166 if(gpio){ 167 167 /* P21端子機能制御レジスタ P21とする */ 168 sil_wrb_mem( (uint8_t *)MPC_P21PFS_ADDR, 0x00);168 sil_wrb_mem(MPC_P21PFS_ADDR, 0x00); 169 169 } 170 170 else{ 171 171 /* P21端子機能制御レジスタ TIOCA3とする */ 172 sil_wrb_mem( (uint8_t *)MPC_P21PFS_ADDR, 0x03);172 sil_wrb_mem(MPC_P21PFS_ADDR, 0x03); 173 173 } 174 174 result = E_OK; … … 178 178 if(gpio){ 179 179 /* P20端子機能制御レジスタ P20とする */ 180 sil_wrb_mem( (uint8_t *)MPC_P20PFS_ADDR, 0x00);180 sil_wrb_mem(MPC_P20PFS_ADDR, 0x00); 181 181 } 182 182 else{ 183 183 /* P20端子機能制御レジスタ TIOCB3とする */ 184 sil_wrb_mem( (uint8_t *)MPC_P20PFS_ADDR, 0x03);184 sil_wrb_mem(MPC_P20PFS_ADDR, 0x03); 185 185 } 186 186 result = E_OK; … … 190 190 if(gpio){ 191 191 /* P22端子機能制御レジスタ P22とする */ 192 sil_wrb_mem( (uint8_t *)MPC_P22PFS_ADDR, 0x00);192 sil_wrb_mem(MPC_P22PFS_ADDR, 0x00); 193 193 } 194 194 else{ 195 195 /* P22端子機能制御レジスタ TIOCC3とする */ 196 sil_wrb_mem( (uint8_t *)MPC_P22PFS_ADDR, 0x03);196 sil_wrb_mem(MPC_P22PFS_ADDR, 0x03); 197 197 } 198 198 result = E_OK; … … 202 202 if(gpio){ 203 203 /* P23端子機能制御レジスタ P23とする */ 204 sil_wrb_mem( (uint8_t *)MPC_P23PFS_ADDR, 0x00);204 sil_wrb_mem(MPC_P23PFS_ADDR, 0x00); 205 205 } 206 206 else{ 207 207 /* P23端子機能制御レジスタ TIOCD3とする */ 208 sil_wrb_mem( (uint8_t *)MPC_P23PFS_ADDR, 0x03);208 sil_wrb_mem(MPC_P23PFS_ADDR, 0x03); 209 209 } 210 210 result = E_OK; … … 214 214 if(gpio){ 215 215 /* P24端子機能制御レジスタ P24とする */ 216 sil_wrb_mem( (uint8_t *)MPC_P24PFS_ADDR, 0x00);216 sil_wrb_mem(MPC_P24PFS_ADDR, 0x00); 217 217 } 218 218 else{ 219 219 /* P24端子機能制御レジスタ TIOCB4とする */ 220 sil_wrb_mem( (uint8_t *)MPC_P24PFS_ADDR, 0x03);220 sil_wrb_mem(MPC_P24PFS_ADDR, 0x03); 221 221 } 222 222 result = E_OK; … … 226 226 if(gpio){ 227 227 /* P25端子機能制御レジスタ P25とする */ 228 sil_wrb_mem( (uint8_t *)MPC_P25PFS_ADDR, 0x00);228 sil_wrb_mem(MPC_P25PFS_ADDR, 0x00); 229 229 } 230 230 else{ 231 231 /* P25端子機能制御レジスタ TIOCA4とする */ 232 sil_wrb_mem( (uint8_t *)MPC_P25PFS_ADDR, 0x03);232 sil_wrb_mem(MPC_P25PFS_ADDR, 0x03); 233 233 } 234 234 result = E_OK; … … 238 238 if(gpio){ 239 239 /* P32端子機能制御レジスタ P32とする */ 240 sil_wrb_mem( (uint8_t *)MPC_P32PFS_ADDR, 0x00);240 sil_wrb_mem(MPC_P32PFS_ADDR, 0x00); 241 241 } 242 242 else{ 243 243 /* P32端子機能制御レジスタ TIOCC0とする */ 244 sil_wrb_mem( (uint8_t *)MPC_P32PFS_ADDR, 0x03);244 sil_wrb_mem(MPC_P32PFS_ADDR, 0x03); 245 245 } 246 246 result = E_OK; … … 250 250 if(gpio){ 251 251 /* P33端子機能制御レジスタ P33とする */ 252 sil_wrb_mem( (uint8_t *)MPC_P33PFS_ADDR, 0x00);252 sil_wrb_mem(MPC_P33PFS_ADDR, 0x00); 253 253 } 254 254 else{ 255 255 /* P33端子機能制御レジスタ TIOCD0とする */ 256 sil_wrb_mem( (uint8_t *)MPC_P33PFS_ADDR, 0x03);256 sil_wrb_mem(MPC_P33PFS_ADDR, 0x03); 257 257 } 258 258 result = E_OK; … … 261 261 262 262 /* 書き込みプロテクトレジスタの設定 書き込みを禁止 */ 263 sil_wrb_mem( (uint8_t *)MPC_PWPR_ADDR, 0x80);263 sil_wrb_mem(MPC_PWPR_ADDR, 0x80); 264 264 265 265 /* 機能ポートに設定 */ … … 314 314 } 315 315 316 static ER change_pin_mode(arduino_pin_mode_t mode, volatile uint8_t *pdr, int bit)317 { 318 volatile uint8_t *pcr = pdr + (PORT0_PCR_ADDR - PORT0_PDR_ADDR);316 static ER change_pin_mode(arduino_pin_mode_t mode, volatile __evenaccess uint8_t *pdr, int bit) 317 { 318 volatile __evenaccess uint8_t *pcr = pdr + (PORT0_PCR_ADDR - PORT0_PDR_ADDR); 319 319 320 320 switch(mode){ … … 388 388 } 389 389 390 static ER write_gpio(arduino_digital_value_t value, volatile uint8_t *podr, int bit)390 static ER write_gpio(arduino_digital_value_t value, volatile __evenaccess uint8_t *podr, int bit) 391 391 { 392 392 switch(value){ … … 452 452 } 453 453 454 static ER read_gpio(volatile uint8_t *pidr, int bit, arduino_digital_value_t *result)454 static ER read_gpio(volatile __evenaccess uint8_t *pidr, int bit, arduino_digital_value_t *result) 455 455 { 456 456 if ((sil_reb_mem(pidr) & bit) != 0) { … … 523 523 switch(pin){ 524 524 case 14: 525 /* *value = sil_reh_mem( (uint16_t *)S12AD_ADDR0_ADDR); */525 /* *value = sil_reh_mem(S12AD_ADDR0_ADDR); */ 526 526 *value = 1023 - (arduino_ad_avelage[0] / (arduino_ad_table_count * 4/*12bit→10bit*/)); 527 527 return E_OK; 528 528 case 15: 529 /* *value = sil_reh_mem( (uint16_t *)S12AD_ADDR1_ADDR); */529 /* *value = sil_reh_mem(S12AD_ADDR1_ADDR); */ 530 530 *value = 1023 - (arduino_ad_avelage[1] / (arduino_ad_table_count * 4/*12bit→10bit*/)); 531 531 return E_OK; 532 532 case 16: 533 /* *value = sil_reh_mem( (uint16_t *)S12AD_ADDR2_ADDR); */533 /* *value = sil_reh_mem(S12AD_ADDR2_ADDR); */ 534 534 *value = 1023 - (arduino_ad_avelage[2] / (arduino_ad_table_count * 4/*12bit→10bit*/)); 535 535 return E_OK; 536 536 case 17: 537 /* *value = sil_reh_mem( (uint16_t *)S12AD_ADDR3_ADDR); */537 /* *value = sil_reh_mem(S12AD_ADDR3_ADDR); */ 538 538 *value = 1023 - (arduino_ad_avelage[3] / (arduino_ad_table_count * 4/*12bit→10bit*/)); 539 539 return E_OK; 540 540 case 18: 541 /* *value = sil_reh_mem( (uint16_t *)S12AD_ADDR4_ADDR); */541 /* *value = sil_reh_mem(S12AD_ADDR4_ADDR); */ 542 542 *value = 1023 - (arduino_ad_avelage[4] / (arduino_ad_table_count * 4/*12bit→10bit*/)); 543 543 return E_OK; 544 544 case 19: 545 /* *value = sil_reh_mem( (uint16_t *)S12AD_ADDR5_ADDR); */545 /* *value = sil_reh_mem(S12AD_ADDR5_ADDR); */ 546 546 *value = 1023 - (arduino_ad_avelage[5] / (arduino_ad_table_count * 4/*12bit→10bit*/)); 547 547 return E_OK; 548 548 case 20: 549 /* *value = sil_reh_mem( (uint16_t *)S12AD_ADDR6_ADDR); */549 /* *value = sil_reh_mem(S12AD_ADDR6_ADDR); */ 550 550 *value = 1023 - (arduino_ad_avelage[6] / (arduino_ad_table_count * 4/*12bit→10bit*/)); 551 551 return E_OK; 552 552 case 21: 553 /* *value = sil_reh_mem( (uint16_t *)S12AD_ADDR7_ADDR); */553 /* *value = sil_reh_mem(S12AD_ADDR7_ADDR); */ 554 554 *value = 1023 - (arduino_ad_avelage[7] / (arduino_ad_table_count * 4/*12bit→10bit*/)); 555 555 return E_OK; … … 605 605 void arduino_tick() 606 606 { 607 static volatile uint16_t *const regs[8] = {607 static volatile __evenaccess uint16_t *const regs[8] = { 608 608 S12AD_ADDR0_ADDR, 609 609 S12AD_ADDR1_ADDR, … … 619 619 620 620 /* ADCの変換結果取得 */ 621 if((sil_reb_mem( (uint8_t *)S12AD_ADCSR_ADDR) & S12AD_ADCSR_ADST_BIT) == 0){621 if((sil_reb_mem(S12AD_ADCSR_ADDR) & S12AD_ADCSR_ADST_BIT) == 0){ 622 622 for (i = 0; i < 8; i++){ 623 623 arduino_ad_avelage[i] -= arduino_ad_table[i][arduino_ad_pos]; … … 633 633 634 634 /* 変換開始(シングルスキャンモード) */ 635 sil_wrb_mem( (uint8_t *)S12AD_ADCSR_ADDR, S12AD_ADCSR_ADST_BIT);636 } 637 } 635 sil_wrb_mem(S12AD_ADCSR_ADDR, S12AD_ADCSR_ADST_BIT); 636 } 637 } -
uKadecot/trunk/uip/apps/webserver/http-strings
r101 r155 8 8 http_content_type "content-type: " 9 9 http_texthtml "text/html" 10 http_location " location: "10 http_location "Location: " 11 11 http_host "host: " 12 12 http_crnl "\r\n" … … 21 21 http_header_101 "HTTP/1.1 101 Switching Protocols\r\n" 22 22 http_header_200 "HTTP/1.1 200 OK\r\nServer: uIP/1.0 http://www.toppers.jp/\r\nConnection: close\r\n" 23 http_header_301 "HTTP/1.1 301 Moved Permanently\r\nServer: uIP/1.0 http://www.toppers.jp/\r\nConnection: close\r\n" 23 24 http_header_404 "HTTP/1.1 404 Not found\r\nServer: uIP/1.0 http://www.toppers.jp/\r\nConnection: close\r\n" 24 25 http_content_encoding_gzip "Content-Encoding: gzip\r\n" -
uKadecot/trunk/uip/apps/webserver/http-strings.c
r108 r155 27 27 {0x74, 0x65, 0x78, 0x74, 0x2f, 0x68, 0x74, 0x6d, 0x6c, }; 28 28 const char http_location[11] = 29 /* " location: " */30 {0x 6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x3a, 0x20, };29 /* "Location: " */ 30 {0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x3a, 0x20, }; 31 31 const char http_host[7] = 32 32 /* "host: " */ … … 65 65 /* "HTTP/1.1 200 OK\r\nServer: uIP/1.0 http://www.toppers.jp/\r\nConnection: close\r\n" */ 66 66 {0x48, 0x54, 0x54, 0x50, 0x2f, 0x31, 0x2e, 0x31, 0x20, 0x32, 0x30, 0x30, 0x20, 0x4f, 0x4b, 0xd, 0xa, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x3a, 0x20, 0x75, 0x49, 0x50, 0x2f, 0x31, 0x2e, 0x30, 0x20, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x74, 0x6f, 0x70, 0x70, 0x65, 0x72, 0x73, 0x2e, 0x6a, 0x70, 0x2f, 0xd, 0xa, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x3a, 0x20, 0x63, 0x6c, 0x6f, 0x73, 0x65, 0xd, 0xa, }; 67 const char http_header_301[92] = 68 /* "HTTP/1.1 301 Moved Permanently\r\nServer: uIP/1.0 http://www.toppers.jp/\r\nConnection: close\r\n" */ 69 {0x48, 0x54, 0x54, 0x50, 0x2f, 0x31, 0x2e, 0x31, 0x20, 0x33, 0x30, 0x31, 0x20, 0x4d, 0x6f, 0x76, 0x65, 0x64, 0x20, 0x50, 0x65, 0x72, 0x6d, 0x61, 0x6e, 0x65, 0x6e, 0x74, 0x6c, 0x79, 0xd, 0xa, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x3a, 0x20, 0x75, 0x49, 0x50, 0x2f, 0x31, 0x2e, 0x30, 0x20, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x77, 0x77, 0x77, 0x2e, 0x74, 0x6f, 0x70, 0x70, 0x65, 0x72, 0x73, 0x2e, 0x6a, 0x70, 0x2f, 0xd, 0xa, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x3a, 0x20, 0x63, 0x6c, 0x6f, 0x73, 0x65, 0xd, 0xa, }; 67 70 const char http_header_404[84] = 68 71 /* "HTTP/1.1 404 Not found\r\nServer: uIP/1.0 http://www.toppers.jp/\r\nConnection: close\r\n" */ -
uKadecot/trunk/uip/apps/webserver/http-strings.h
r108 r155 21 21 extern const char http_header_101[35]; 22 22 extern const char http_header_200[77]; 23 extern const char http_header_301[92]; 23 24 extern const char http_header_404[84]; 24 25 extern const char http_content_encoding_gzip[25]; -
uKadecot/trunk/uip/apps/webserver/httpd-fs.c
r154 r155 40 40 #include "mmc_rspi.h" 41 41 #include <string.h> 42 #include "http-strings.h" 43 44 #ifndef _MSC_VER 45 #ifndef strcat_s 46 #define strcat_s(dst, dsz, src) strcat(dst, src) 47 #endif 48 #endif 42 49 43 50 //#define FILE_DUMP … … 114 121 /*-----------------------------------------------------------------------------------*/ 115 122 int 116 httpd_fs_open(int drv, c onst char *name, struct httpd_fs_file *file)123 httpd_fs_open(int drv, char *name, int len, struct httpd_fs_file *file) 117 124 { 118 125 FRESULT res; 119 FATFS *fs = (FATFS *)file->fs; 126 FATFS *fs = (FATFS *)&file->fs; 127 FILINFO fno; 128 DIR dir; 120 129 121 130 file->pos = 0; … … 123 132 file->drv = drv; 124 133 file->name = name; 134 file->redirect = 0; 125 135 memset(fs, 0, sizeof(FATFS)); 126 136 … … 143 153 } 144 154 145 if((res = pf_open(fs, name)) != FR_OK){ 146 printf("pf_open(%d:%s) => %d\n", drv, name, res); 147 return 0; 155 if ((res = pf_open(fs, name)) != FR_OK) { 156 dir.fs = fs; 157 if ((res = pf_opendir(&dir, name)) != FR_OK) { 158 printf("pf_opendir(%d:%s) => %d\n", drv, name, res); 159 return 0; 160 } 161 162 if ((res = pf_readdir(&dir, &fno)) != FR_OK) { 163 printf("pf_readdir(%d:%s) => %d\n", drv, name, res); 164 return 0; 165 } 166 167 if (len != 0/*fno.fattrib & AM_DIR*/) { 168 strcat_s(name, len, http_index_html); 169 res = pf_open(fs, name); 170 file->redirect = res == FR_OK; 171 } 172 else 173 res = FR_NO_FILE; 174 175 if (res != FR_OK) { 176 printf("pf_open(%d:%s) => %d %x\n", drv, name, res, fno.fattrib); 177 return 0; 178 } 148 179 } 149 180 … … 160 191 FRESULT ret; 161 192 UINT rlen; 162 FATFS *fs = (FATFS *) file->fs;193 FATFS *fs = (FATFS *)&file->fs; 163 194 164 195 if((ret = pf_lseek(fs, file->pos)) != FR_OK){ -
uKadecot/trunk/uip/apps/webserver/httpd-fs.h
r154 r155 43 43 int drv; 44 44 const char *name; 45 void *fs; 45 int redirect; 46 char fs[64 + 512/*sizeof(FATFS)*/]; 46 47 }; 47 48 48 49 /* file must be allocated by caller and will be filled in 49 50 by the function. */ 50 int httpd_fs_open(int drv, c onst char *name, struct httpd_fs_file *file);51 int httpd_fs_open(int drv, char *name, int len, struct httpd_fs_file *file); 51 52 int httpd_fs_read(struct httpd_fs_file *file, void *dst, int len); 52 53 -
uKadecot/trunk/uip/apps/webserver/httpd.c
r154 r155 203 203 } 204 204 205 if (s->file.redirect) { 206 len = strlen(http_location); 207 memcpy(pos, http_location, len); pos += len; 208 if (s->drv == 1) { 209 len = 2; 210 memcpy(pos, "/~", len); pos += len; 211 } 212 len = strlen(s->filename); 213 memcpy(pos, s->filename, len); pos += len; 214 len = 2; 215 memcpy(pos, "\r\n", len); pos += len; 216 } 217 205 218 ptr = strrchr(s->message.request_url, ISO_period); 206 219 if (ptr == NULL) { … … 248 261 PT_BEGIN(&s->outputpt); 249 262 250 s->file.fs = ((char *)&s[1]) - 64 - 512; 251 252 if (!httpd_fs_open(s->drv, s->filename, &s->file)) { 263 if (!httpd_fs_open(s->drv, s->filename, sizeof(s->filename), &s->file)) { 253 264 s->drv = 0; 254 httpd_fs_open(s->drv, http_404_html, &s->file);255 strcpy_s(s->message.request_url, sizeof(s->message.request_url), http_404_html);265 strcpy_s(s->filename, sizeof(s->filename), http_404_html); 266 httpd_fs_open(s->drv, s->filename, sizeof(s->filename), &s->file); 256 267 PT_WAIT_THREAD(&s->outputpt, 257 268 send_headers(s, … … 261 272 PT_WAIT_THREAD(&s->outputpt, 262 273 send_headers(s, 263 http_header_200));274 s->file.redirect ? http_header_301 : http_header_200)); 264 275 PT_WAIT_THREAD(&s->outputpt, send_file(s)); 265 276 } … … 381 392 size_t done; 382 393 const char *data; 394 char *ptr; 395 383 396 PSOCK_BEGIN(&s->sin); 384 397 … … 407 420 /* ""か"/"なら"index.html"に変更 */ 408 421 if ((s->message.request_url[0] == '\0') || ((s->message.request_url[0] == '/') && (s->message.request_url[1] == '\0'))) { 409 s trncpy_s(s->message.request_url, sizeof(s->message.request_url), http_index_html, sizeof(s->message.request_url));410 s ->filename = s->message.request_url;422 s->drv = 0; 423 strcpy_s(s->filename, sizeof(s->filename), http_index_html); 411 424 } 412 425 /* "/~/"ならSDカードから読み込み */ 413 426 else if ((s->message.request_url[0] == '/') && (s->message.request_url[1] == '~') && (s->message.request_url[2] == '/')) { 414 427 s->drv = 1; 415 s ->filename = &s->message.request_url[2];428 strcpy_s(s->filename, sizeof(s->filename), &s->message.request_url[2]); 416 429 } 417 430 else { 418 431 s->drv = 0; 419 s->filename = s->message.request_url; 420 } 432 strcpy_s(s->filename, sizeof(s->filename), s->message.request_url); 433 } 434 435 ptr = strrchr(s->filename, '?'); 436 if (ptr != NULL) 437 ptr[0] = '\0'; 421 438 422 439 /* httpd_log_file(uip_conn->ripaddr, s->message.request_url);*/ … … 426 443 s->state = STATE_WS_OUTPUT; 427 444 445 s->close_req = 0; 428 446 websocket_init(&s->websocket, uip_getid((struct uip_conn *)((intptr_t)s - offsetof(struct uip_conn, appstate)))); 429 447 for (;;) { -
uKadecot/trunk/uip/apps/webserver/httpd.h
r154 r155 47 47 char inputbuf[50]; 48 48 char state; 49 int drv; 50 char *filename; 51 int len; 52 struct httpd_fs_file file; 53 int parse_pos; 54 int parse_len; 55 struct http_parser parser; 56 struct http_parser_url handle; 57 struct message message; 58 struct websocket websocket; 59 int close_req; 49 union{ 50 struct{ 51 int parse_pos; 52 int parse_len; 53 struct http_parser parser; 54 struct http_parser_url handle; 55 struct message message; 56 }; 57 struct{ 58 char _dummy1[340]; 59 int drv; 60 char filename[256]; 61 int len; 62 struct httpd_fs_file file; 63 }; 64 struct{ 65 char _dummy2[340]; 66 struct websocket websocket; 67 int close_req; 68 }; 69 }; 60 70 }; 61 71 #define get_context(p) (struct httpd_state *)((intptr_t)p - (intptr_t)&((struct httpd_state *)0)->parser)
Note:
See TracChangeset
for help on using the changeset viewer.