#include "../include/beeos.h"
#include "../include/bctype.h"
#include "../include/bbit.h"
#include "../include/bstring.h"
#include "../include/bmalloc.h"
#include "../include/exec.h"
#include "../include/sci.h"
#include "../include/ect.h"
#include <stdarg.h>
#include "../include/bprintf.h"
#include "../include/asm/vectors.h"
#include "../include/asm/ports.h"
Include dependency graph for main.c:

Go to the source code of this file.
Functions | |
| void | lbdrv_chg (void) |
| void | misc (void) |
| void | btnscan_chk (void) |
| int | _start (void) |
Variables | |
| bool | toggle_scan_lk |
| uchar | gbl_scani |
| uchar | map_leds [8] |
| uchar | map_btns [8] |
|
|
Definition at line 60 of file main.c. References ASM_CLI, ASM_SEI, ASM_SWI, COPCTL, DDRA, DDRB, DDRE, DDRH, DDRJ, DDRK, DDRM, DDRP, DDRS, DDRT, lk_bputs, lk_putchar, PERH, PERJ, PERM, PERP, PERS, PERT, PIEH, PIEJ, PIEP, PORTA, PORTB, PORTE, PORTK, PPSH, PPSJ, PPSM, PPSP, PPSS, PPST, PTH, PTJ, PTM, PTP, PTS, PTT, RDRH, RDRIV, RDRJ, RDRM, RDRP, RDRS, RDRT, RTICTL, ushort, WOMM, and WOMS.
00070 { /* _start(): BeeOS cold-start execution entry point. */
00071 #ifndef HOSTED_BUILD
00072 ASM_SEI;
00073 RTICTL = 0x00;
00074 COPCTL = 0x00;
00075 _sp = (void *)0x3FFF;
00076 RDRIV = 0xFF;
00077 DDRA = 0x00; PORTA = 0x00;
00078 DDRB = 0x00; PORTB = 0x00;
00079 DDRE = 0x00; PORTE = 0x00;
00080 DDRK = 0x00; PORTK = 0x00;
00081 RDRT = 0xFF; PERT = 0xFF; PPST = 0xFF; DDRT = 0x00; PTT = 0x00;
00082 RDRS = 0xFF; PERS = 0x00; PPSS = 0xFF; WOMS = 0xFF; DDRS = 0x00; PTS = 0x00;
00083 RDRM = 0xFF; PERM = 0xFF; PPSM = 0xFF; WOMM = 0xFF; DDRM = 0x00; PTM = 0x00;
00084 PIEP = 0X00; RDRP = 0xFF; PERP = 0xFF; PPSP = 0xFF; DDRP = 0xFF; PTP = 0x01;
00085 PIEH = 0X00; RDRH = 0xFF; PERH = 0xFF; PPSH = 0xFF; DDRH = 0xFF; PTH = 0x00;
00086 PIEJ = 0X00; RDRJ = 0xFF; PERJ = 0xFF; PPSJ = 0xFF; DDRJ = 0x00; PTJ = 0x00;
00087 sci0_init(960);
00088 #endif
00089 lk_bputs = false;
00090 lk_putchar = false;
00091 bmallocinit();
00092 execprep();
00093 addtask(lbdrv_chg, (char) 1, (ushort) TOUSHORT(TCNT_H), 500);
00094 addtask(btnscan_chk, (char) 2, (ushort) TOUSHORT(TCNT_H) + MSEC2TCNT(10), 500);
00095 addtask(misc, (char) 3, (ushort) TOUSHORT(TCNT_H) + MSEC2TCNT(20), 500);
00096 /* bprintf(10, "main(): exec() %04x.\r\n", (sshort)(_start));*/
00097 ect_init();
00098 ASM_CLI;
00099 ASM_SWI; /* Run isr_exec. */
00100 while(1 == 1); /* Necessary, otherwise compiler will ignore noreturn. */
00101 /*@-compdef@*/ /* The @sets clause does not support globals (for addTask).*/
00102 #ifdef HOSTED_BUILD /* splint detects that on return, not all the fields in */
00103 return 0; /* tasks are necessarily defined, because of addTask's */
00104 #else /* modifies list. */
00105 /* return;*/
00106 #endif
00107 /*@=compdef@*/
00108 }
|
|
|
Definition at line 152 of file main.c. References ASM_MOVW_MM, BIT6, bitncheck(), bmemset(), bprintf(), bsleep(), gbl_scani, map_btns, PORTA, PTT, sshort, toggle_scan_lk, and uchar.
00153 {
00154 uchar row_bit, ptt_bit, i;
00155 uchar ptt, scani, *row;
00156 uchar btni;
00157
00158 bmemset((char *)map_btns, '\0', sizeof(uchar) * 8);
00159 while (1 == 1) {
00160 while (true == toggle_scan_lk);
00161 ASM_MOVW_MM(PTT, ptt);
00162 ASM_MOVW_MM(gbl_scani, scani);
00163 toggle_scan_lk = true;
00164 row = &(map_btns[scani]);
00165
00166 if (*row != ptt) {
00167 /*bprintf(20, "scani: %i, row: %'08B, ptt: %'08B, PTT: %'08B.\r\n", (sshort) scani, (sshort) *row, (sshort) ptt, (sshort) PTT);*/
00168 for (i = 0; i < 8; i++) {
00169 row_bit = bitncheck(row, i);
00170 ptt_bit = bitncheck((uchar *)&(ptt), i);
00171 if (row_bit != ptt_bit) {
00172 btni = 8*scani + i;
00173 if (row_bit < ptt_bit)
00174 bprintf(0, "Key pressed: %02x.\r\n", (sshort) btni);
00175 else bprintf(0, "Key released: %02x.\r\n", (sshort) btni);
00176 }
00177 }
00178 /*ASM_NOP;
00179 __asm__ __volatile__ (
00180 "ldaa %0\
00181 \n\tldx %1\
00182 \n\tstaa 0,X" : "=m" (*row) : "m" (ptt) : "%ccr", "%a", "%x");
00183 *row = ptt;
00184 __asm__ __volatile__ ("movb %1, %0" : "=m" (*row) : "m" (ptt));
00185 ASM_NOP;*/
00186 *row = ptt;
00187 /*bprintf(20, "scani: %i, row: %'08B, ptt: %'08B.\r\n", (sshort) scani, (sshort) *row, (sshort) ptt);*/
00188 }
00189 PORTA ^= BIT6;
00190
00191 bsleep(50);
00192 }
00193
00194 return;
00195 }
|
Here is the call graph for this function:

|
|
Definition at line 119 of file main.c. References __asm__(), BIT5, bsleep(), gbl_scani, map_leds, PORTA, PTH, PTP, and toggle_scan_lk.
00120 {
00121 while (1 == 1) {
00122 while (true != toggle_scan_lk);
00126 __asm__ __volatile__ ("inc %0" : "=m" (gbl_scani));
00127 if (7 < gbl_scani) gbl_scani = 0;
00128 PTP = 0x1 << gbl_scani;
00129 PTH = 0xFF & ~map_leds[gbl_scani];
00130 toggle_scan_lk = false;
00131
00132 PORTA ^= BIT5;
00133 bsleep(3);
00134 }
00135
00136 return;
00137 }
|
Here is the call graph for this function:

|
|
Definition at line 197 of file main.c. References BIT7, bsleep(), and PORTA.
|
Here is the call graph for this function:

|
|
Definition at line 45 of file main.c. Referenced by btnscan_chk(), and lbdrv_chg(). |
|
|
Definition at line 47 of file main.c. Referenced by btnscan_chk(). |
|
|
Definition at line 46 of file main.c. Referenced by lbdrv_chg(). |
|
|
Definition at line 44 of file main.c. Referenced by btnscan_chk(), and lbdrv_chg(). |
1.3.6-20040222