xref: /netbsd-src/usr.bin/scmdctl/scmdctl.h (revision bf53d4416703565e0d45b6919cbfae62d21a4872)
1 /*	$NetBSD: scmdctl.h,v 1.1 2021/12/07 17:39:55 brad Exp $	*/
2 
3 /*
4  * Copyright (c) 2021 Brad Spencer <brad@anduin.eldar.org>
5  *
6  * Permission to use, copy, modify, and distribute this software for any
7  * purpose with or without fee is hereby granted, provided that the above
8  * copyright notice and this permission notice appear in all copies.
9  *
10  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17  */
18 
19 #ifndef _SCMDCTL_H_
20 #define _SCMDCTL_H_
21 
22 #define SCMD_IDENTIFY 1
23 #define SCMD_DIAG 2
24 #define SCMD_MOTOR 3
25 #define SCMD_SUBMOTORGET 3000
26 #define SCMD_SUBMOTORSET 3001
27 #define SCMD_SUBMOTORINVERT 3002
28 #define SCMD_SUBMOTORBRIDGE 3003
29 #define SCMD_SUBMOTORDISABLE 3004
30 #define SCMD_SUBMOTORENABLE 3005
31 #define SCMD_READ 4
32 #define SCMD_WRITE 5
33 #define SCMD_RESTART 6
34 #define SCMD_ENUMERATE 7
35 #define SCMD_UPDATERATE 8
36 #define SCMD_SUBURGET 8000
37 #define SCMD_SUBURSET 8001
38 #define SCMD_SUBURFORCE 8002
39 #define SCMD_EBUS 9
40 #define SCMD_SUBEBUSGET 9000
41 #define SCMD_SUBEBUSSET 9001
42 #define SCMD_LOCK 10
43 #define SCMD_SUBLOCKGET 10000
44 #define SCMD_SUBLOCKLOCK 10001
45 #define SCMD_SUBLOCKUNLOCK 10002
46 #define SCMD_SPIREADONE 11
47 
48 #define SCMD_ENABLE 100
49 #define SCMD_DISABLE 101
50 
51 #define SCMD_ANY_MODULE 0xff
52 #define SCMD_ANY_MOTOR 'C'
53 #define SCMD_NO_MOTOR 0xff00
54 
55 #define SCMD_LOCAL_USER_LOCK 12000
56 #define SCMD_LOCAL_MASTER_LOCK 12001
57 #define SCMD_GLOBAL_USER_LOCK 12002
58 #define SCMD_GLOBAL_MASTER_LOCK 12003
59 #define SCMD_LOCK_LOCKED 0x00
60 #define SCMD_LOCK_UNLOCK 0x01
61 
62 #define UART_IS_PURE_UART 0
63 #define UART_IS_SPI_USERLAND 1
64 
65 struct scmdcmd {
66 	const char	*cmd;
67 	const int	id;
68 	const char	*helpargs;
69 };
70 
71 #endif
72